:root {
    /* Base HSL Tokens */
    --bg-hsl: 240, 10%, 4%;
    --card-hsl: 240, 6%, 8%;
    --accent-hsl: 45, 100%, 50%;
    /* Vibrant Amber */

    --bg-color: hsl(var(--bg-hsl));
    --card-bg: hsla(var(--card-hsl), 0.7);
    --text-primary: #f8f9fa;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;

    /* Functional Palette */
    --accent-amber: hsl(var(--accent-hsl));
    --accent-glow: hsla(var(--accent-hsl), 0.5);
    --accent-dim: hsla(var(--accent-hsl), 0.15);

    --accent-color: var(--accent-amber);
    --accent-cyan: #00f2ff;
    --accent-green: #00ff88;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: hsla(var(--accent-hsl), 0.6);

    --success-color: #00ff88;
    --error-color: #ff3366;

    --radius: 4px;
    --shadow-luxe: 0 8px 28px 0 rgba(0, 0, 0, 0.65);
    --glass-bg: rgba(20, 20, 20, 0.7);
    --glass-border: rgba(255, 255, 255, 0.12);

    --field-bg: rgba(0, 0, 0, 0.75);
    /* Deep Obsidian for fields */

    --font-heading: 'Chakra Petch', sans-serif;
    --font-body: 'Exo 2', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Z-Index Hierarchy */
    --z-base: 1;
    --z-header: 100;
    --z-overlay: 300;
    --z-login: 1000;
}

/* --- Global Resets & Elements --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.9rem;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 3rem 1.5rem;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    isolation: isolate;
}


.hidden {
    display: none !important;
}

/* Main HUD Scanlines & CRT Effect */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.08) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.01), rgba(0, 255, 0, 0.005), rgba(0, 0, 255, 0.01));
    z-index: 10000;
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    opacity: 0.3;
}

/* Ambient Glow */
body::after {
    content: "";
    position: fixed;
    top: -10%;
    left: -10%;
    width: 40%;
    height: 40%;
    background: radial-gradient(circle, hsla(var(--accent-hsl), 0.08) 0%, transparent 70%);
    z-index: -2;
    pointer-events: none;
}

.app-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

/* --- Header Overhaul --- */
header {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
}

header h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 5px;
    color: var(--accent-amber);
    margin: 0;
    line-height: 1.1;
}

.matrix-text {
    font-family: var(--font-heading);
    text-shadow: 0 0 15px hsla(var(--accent-hsl), 0.4);
    letter-spacing: 3px;
}

header p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hero-message {
    margin-top: 1rem;
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-align: center;
    box-shadow: 0 0 14px rgba(0, 0, 0, 0.2);
    text-transform: none;
    letter-spacing: 0.6px;
}

.license-section .hero-message {
    color: var(--text-secondary);
}

.license-section .hero-message {
    text-align: left;
}

.license-section .copyright-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
}

.license-section .version-text {
    white-space: nowrap;
}


/* --- Login Overlay & Box --- */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, hsla(var(--bg-hsl), 0.8) 0%, hsla(var(--bg-hsl), 1) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-login);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    pointer-events: all;
    overflow: hidden;
}

.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

[data-auth="out"] .app-container {
    pointer-events: none;
    visibility: hidden;
}

[data-auth="out"] body {
    overflow: hidden;
}

[data-auth="out"] html {
    overflow: hidden;
}

[data-auth="out"] body {
    height: 100vh;
    width: 100vw;
    position: fixed;
}

[data-auth="out"] {
    overscroll-behavior: none;
    touch-action: none;
}

.login-box {
    background: var(--glass-bg);
    padding: 3.5rem;
    border: 1px solid var(--glass-border);
    border-top: 2px solid var(--accent-amber);
    box-shadow: var(--shadow-luxe), 0 0 40px hsla(var(--accent-hsl), 0.05);
    text-align: center;
    max-width: 440px;
    width: 90%;
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
}

.login-box::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, hsla(var(--accent-hsl), 0.1) 0%, transparent 70%);
    pointer-events: none;
    animation: pulseGlow 4s ease-in-out infinite;
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.login-logo {
    margin-bottom: 2rem;
}

.login-box h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #fff;
    letter-spacing: 5px;
    text-transform: uppercase;
}

.login-box h2 {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--accent-amber);
    letter-spacing: 3px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.login-box p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 2rem;
    font-family: var(--font-mono);
}

.login-input-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-input-stack input {
    width: 100%;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.login-input-stack input:focus {
    border-color: var(--accent-amber);
    background: rgba(0, 0, 0, 0.6);
    outline: none;
    box-shadow: 0 0 15px hsla(var(--accent-hsl), 0.1);
}

#btn-login {
    width: fit-content;
    min-width: 160px;
    margin: 1rem auto 0;
    background: var(--accent-amber);
    color: #000;
    border: none;
    padding: 0.8rem 2rem;
    font-weight: 700;
    letter-spacing: 2px;
    border-radius: var(--radius);
}

#btn-login:hover {
    background: #fff;
    box-shadow: 0 0 30px hsla(var(--accent-hsl), 0.4);
    transform: translateY(-2px);
}

/* Unified status styling */
.status-msg,
.save-status-msg {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    min-height: 1.2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    background: transparent;
    box-shadow: none;
    cursor: help;
    position: relative;
    top: -1px;
}

.tip-icon-right {
    position: absolute;
    top: 14px;
    right: 14px;
}

.parser-section,
.save-section,
.manager-section {
    position: relative;
}
.tip-icon:hover {
    color: var(--accent-amber);
    border-color: var(--accent-glow);
    background: rgba(255, 204, 0, 0.05);
}

.parser-section h2,
.save-section h3,
.manager-section h3 {
    margin-top: 0;
    margin-bottom: 0.6rem;
    line-height: 1.1;
}

.tip-icon::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    width: max-content;
    max-width: 320px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transform: translateX(-50%) translateY(4px);
    box-shadow: none;
    border: 1px solid rgba(160, 160, 160, 0.35);
    z-index: 50;
}

.tip-icon:hover::after,
.tip-icon:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.status-msg[data-has-text="true"]:not(.prominent),
.save-status-msg.success,
.save-status-msg.error,
.save-status-msg.info {
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.25);
}

.status-msg.error {
    color: var(--error-color);
    text-shadow: 0 0 10px rgba(255, 51, 102, 0.3);
}

.status-msg.success {
    color: var(--success-color);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.status-msg.info {
    color: #aaa;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.status-msg .status-text {
    position: relative;
    z-index: 2;
    display: inline-block;
    font: inherit;
    letter-spacing: inherit;
}


.status-msg.success.prominent {
    font-size: 1.2rem;
    padding: 1.5rem 2rem;
    background: rgba(0, 255, 136, 0.1);
    backdrop-filter: blur(10px);
    border: 3px solid var(--accent-green);
    border-radius: var(--radius);
    text-shadow: 0 0 30px rgba(0, 255, 136, 0.95);
    box-shadow: 0 0 60px rgba(0, 255, 136, 0.6), inset 0 0 40px rgba(0, 255, 136, 0.35);
    margin: 1.5rem 0 2.5rem 0;
    /* Adjusted for new position */
    text-align: center;
    font-weight: 800;
    letter-spacing: 2px;
    animation: slideInDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
}


.status-msg.error.prominent {
    font-size: 1.2rem;
    padding: 1.5rem 2rem;
    background: rgba(255, 51, 102, 0.1);
    backdrop-filter: blur(10px);
    border: 3px solid var(--error-color);
    border-radius: var(--radius);
    text-shadow: 0 0 20px rgba(255, 51, 102, 0.8);
    box-shadow: 0 0 40px rgba(255, 51, 102, 0.3), inset 0 0 30px rgba(255, 51, 102, 0.2);
    margin: 1.5rem 0 2.5rem 0;
    text-align: center;
    font-weight: 800;
    letter-spacing: 2px;
    animation: slideInDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
}

@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- Logout Button --- */
.logout-btn {
    position: absolute;
    top: 0.5rem;
    right: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    opacity: 1;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logout-btn:hover {
    color: var(--accent-amber);
    border-color: var(--accent-glow);
    background: rgba(255, 204, 0, 0.05);
    box-shadow: none;
    transform: none;
}

/* --- Main Layout & Components --- */
main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.input-group button {
    flex-shrink: 0;
}

input[type="url"],
input[type="text"],
select,
textarea {
    flex: 1;
    min-width: 150px;
    padding: 1rem 1.5rem;
    border: 1px solid var(--glass-border);
    background: var(--field-bg);
    color: #fff;
    font-size: 0.9rem;
    font-family: var(--font-mono);
    /* Technical feel */
    outline: none;
    border-radius: var(--radius);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-overflow: ellipsis;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

select {
    max-width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-amber);
    box-shadow: 0 0 0 3px hsla(var(--accent-hsl), 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.85);
}

button {
    padding: 0.8rem 1.8rem;
    background: var(--accent-amber);
    color: #000;
    border: 1px solid var(--accent-amber);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-heading);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    white-space: nowrap;
    border-radius: var(--radius);
    text-transform: uppercase;
    letter-spacing: 2px;
}

button:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 0 30px hsla(var(--accent-hsl), 0.5);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.settings {
    margin-bottom: 0.5rem;
}

/* --- Premium Toggle Switch --- */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
    padding: 0.5rem 0;
}

.toggle-switch input {
    display: none;
}

.slider {
    position: relative;
    width: 48px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    /* Industrial feel */
}

.slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

.toggle-switch input:checked+.slider {
    background: hsla(var(--accent-hsl), 0.15);
    border-color: var(--accent-amber);
    box-shadow: 0 0 15px hsla(var(--accent-hsl), 0.3);
}

.toggle-switch input:checked+.slider::before {
    background: var(--accent-amber);
    box-shadow: 0 0 10px var(--accent-amber);
    transform: translateX(24px);
}

.label-text {
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.toggle-switch:hover .slider {
    border-color: var(--accent-glow);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-primary);
    color: #fff;
    box-shadow: none;
}

.input-action-btn {
    padding: 0.8rem;
    min-width: 44px;
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-muted);
}

.input-action-btn:hover {
    color: var(--accent-amber);
    border-color: var(--accent-glow);
    background: rgba(255, 204, 0, 0.05);
    box-shadow: none;
}

/* --- Parser Section --- */
.parser-section {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-top: 2px solid var(--accent-amber);
    padding: 2.5rem;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: var(--shadow-luxe);
}

.parser-section .emergency-accordion {
    margin-top: 1.5rem;
    margin-bottom: 0;
    border-color: var(--glass-border);
    width: 100%;
}

.emergency-accordion .accordion-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}

#xmlPasteArea {
    width: 100%;
    min-height: 250px;
    resize: vertical;
}

/* --- Output Area --- */
.output-content {
    border-top: 1px solid var(--glass-border);
    padding-top: 2rem;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.output-header h2 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.url-list-scroll {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
}

.output-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 1.5rem;
}

.interactive-url-list {
    list-style: none;
}

.interactive-url-list li {
    padding: 0.1rem 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: background 0.2s ease;
}

.interactive-url-list li:hover {
    background: rgba(255, 255, 255, 0.02);
}

.url-item-text {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.delete-url-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    min-width: unset;
    font-size: 1.1rem;
    opacity: 0.5;
}

.delete-url-btn:hover {
    color: var(--error-color);
    background: transparent;
    box-shadow: none;
    transform: none;
    opacity: 1;
}

/* --- Footer --- */
footer {
    padding: 4rem 0 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

footer p {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* Matrix Digital Rain Animation */
.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -3;
    pointer-events: none;
    opacity: 0.12;
    transition: opacity 0.5s ease-in-out;
}

[data-loading="parser"] .matrix-bg {
    opacity: 0;
    z-index: -3;
}

[data-loading="parser"] .app-container {
    filter: none;
    opacity: 1;
    pointer-events: none;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

/* Matrix Overlay */
.matrix-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2001;
    /* Above canvas */
    pointer-events: all;
    background: rgba(0, 0, 0, 0.75);
    transition: opacity 0.3s ease;
}

.matrix-overlay.hidden {
    display: none;
    opacity: 0;
}

.overlay-content {
    text-align: center;
    padding: 1.5rem 2.5rem;
    background: rgba(0, 10, 0, 0.85);
    border: 1px solid var(--matrix-color);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.2), inset 0 0 10px rgba(0, 255, 65, 0.1);
    border-radius: 4px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.overlay-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--matrix-color);
    box-shadow: 0 0 10px var(--matrix-color);
    animation: scanline 2s linear infinite;
}

.matrix-loader-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    /* Slightly larger for visibility, but still small */
    font-weight: 600;
    color: var(--matrix-color);
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.8), 0 0 20px rgba(0, 255, 65, 0.4);
    letter-spacing: 3px;
    text-transform: uppercase;
}

@keyframes scanline {
    0% {
        top: 0;
        opacity: 0;
    }

    5% {
        opacity: 1;
    }

    95% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }
}

[data-loading="parser"] .app-container {
    filter: none;
    transition: filter 0.5s ease-in-out;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 5;
    pointer-events: none;
    transition: background 0.4s ease-in-out;
}

[data-loading="parser"] body::before {
    background: rgba(0, 0, 0, 0.55);
}

[data-loading="parser"] #statusMessage {
    display: none !important;
}

[data-loading="parser"] #fetchBtn {
    background: #0b0f0b;
    color: #5dff9a;
    border: 3px solid rgba(0, 255, 136, 0.9);
    box-shadow: 0 0 70px rgba(0, 255, 136, 1), 0 0 30px rgba(0, 255, 136, 0.9), inset 0 0 26px rgba(0, 255, 136, 0.55);
    text-shadow: 0 0 26px rgba(0, 255, 136, 1);
    position: relative;
    z-index: 20;
    animation: parseGlow 0.7s ease-in-out infinite;
}

@keyframes parseGlow {
    0%, 100% {
        box-shadow: 0 0 42px rgba(0, 255, 136, 0.75), 0 0 18px rgba(0, 255, 136, 0.6), inset 0 0 20px rgba(0, 255, 136, 0.4);
    }
    50% {
        box-shadow: 0 0 90px rgba(0, 255, 136, 1), 0 0 42px rgba(0, 255, 136, 0.95), inset 0 0 34px rgba(0, 255, 136, 0.7);
    }
}

.loader {
    width: 20px;
    height: 20px;
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.loader::before,
.loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent-green);
    animation: rotation 1s linear infinite;
}

.loader::after {
    width: 12px;
    height: 12px;
    top: 4px;
    left: 4px;
    border-top-color: var(--accent-cyan);
    animation: rotationReverse 0.8s linear infinite;
}

#fetchBtn[data-loading="true"] {
    animation: pulseGlow 1.5s ease-in-out infinite;
    background-color: rgba(0, 255, 0, 0.1);
}

/* --- Save Section --- */
.save-section {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: var(--shadow-luxe);
}

.save-section h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0;
    margin-bottom: 1rem;
}

.manager-section h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.save-section .empty-state {
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.save-section .status-msg {
    margin-top: 0.75rem;
}

.empty-state {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.empty-state strong {
    color: var(--accent-amber);
    text-shadow: 0 0 10px hsla(var(--accent-hsl), 0.4);
}

.sm-group {
    gap: 0.75rem;
}

/* --- Manager Section --- */
.manager-section {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow-luxe);
}

.manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}

#clientViewSelect {
    flex: 1;
}

.icon-btn {
    padding: 0.6rem;
    min-width: 40px;
    height: 40px;
    font-size: 1.2rem;
}

.edit-client-btn {
    padding: 0.4rem;
    min-width: 28px;
    height: 28px;
}

/* --- Client Details Card --- */
.client-details-card {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

.client-details-card::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at top right, hsla(var(--accent-hsl), 0.05), transparent 70%);
}

.details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.client-name-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.client-name-wrapper h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: #fff;
}

.badge {
    background: var(--accent-amber);
    color: #000;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

/* --- Sitemaps List --- */
.sitemaps-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sitemaps-list li {
    background: var(--field-bg);
    border: 1px solid var(--glass-border);
    padding: 1.5rem 2rem;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    /* Fixed: container for sitemap delete icon */
}

.sitemaps-list li:hover {
    border-color: var(--accent-amber);
    background: rgba(255, 255, 255, 0.02);
    transform: translateX(5px);
    box-shadow: 0 4px 25px hsla(var(--accent-hsl), 0.1);
}

.map-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.map-alias {
    font-weight: 600;
    font-family: var(--font-heading);
    color: var(--accent-amber);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.simple-edit-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 4px;
    width: auto;
    height: auto;
    opacity: 0.5;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.simple-edit-btn:hover {
    color: var(--accent-amber);
    opacity: 1;
    border-color: var(--accent-glow);
    background: rgba(255, 204, 0, 0.05);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.1);
}

.alias-input {
    background: var(--bg-darker);
    border: 1px solid var(--accent-color);
    color: var(--text-color);
    padding: 0.2rem 0.5rem;
    font-size: inherit;
    font-family: var(--font-heading);
    font-weight: 600;
    border-radius: 2px;
    outline: none;
    min-width: 200px;
}

.alias-input:focus {
    box-shadow: 0 0 0 2px rgba(0, 255, 65, 0.2);
}

.map-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.map-url {
    font-size: 1rem;
    /* Increased size for prominence */
    color: var(--accent-color);
    margin-top: 0.4rem;
    font-family: var(--font-mono);
    word-break: break-all;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

.link-count {
    color: var(--text-muted);
    font-size: 0.7rem;
    /* Match map-meta size */
}

.map-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-end;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
}

.map-info {
    flex: 1;
    padding-right: 2rem;
    /* Make room for delete button */
}

.map-inline-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
    align-items: center;
}



.action-btn {
    padding: 0.4rem;
    min-width: 32px;
    height: 32px;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
}

.delete-icon-btn {
    background: transparent;
    border: 1px solid rgba(255, 51, 102, 0.2);
    color: var(--error-color);
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.text-btn {
    min-width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    height: auto;
    background: var(--accent-color);
    color: #000;
    border: none;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.3);
}

.text-btn:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
    transform: translateY(-2px);
}


.client-card-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Specific Sitemap Action Buttons - Moved here to avoid overrides */
.view-btn {
    background: #66c2ff;
    /* Vibrant Sky Blue */
    border: none;
    color: #000;
    padding: 0.45rem 1.2rem;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    width: auto;
    height: auto;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.view-btn:hover {
    background: #99d6ff;
    /* Brilliant Blue */
    box-shadow: 0 0 20px rgba(102, 194, 255, 0.7);
    transform: translateY(-1px);
}

.sync-btn {
    background: var(--primary-color);
    border: none;
    color: #000;
    padding: 0.45rem 1.2rem;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    width: auto;
    height: auto;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sync-btn:hover {
    background: #00ff41;
    /* Pure vibrant green */
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.6);
    transform: translateY(-1px);
}

.delete-icon-btn.text-btn {
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background: transparent;
    border: 1px solid #ff4444;
    color: #ff4444;
    font-size: 0.9rem;
}

.delete-icon-btn.text-btn:hover {
    background: rgba(255, 68, 68, 0.1);
}

.delete-icon-btn:hover {
    background: var(--error-color);
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.4);
}

.view-btn {
    background: rgba(0, 150, 255, 0.1);
    border: 1px solid rgba(0, 150, 255, 0.3);
    color: #0096ff;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    background: #0096ff;
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 150, 255, 0.4);
}

/* --- Instruction Accordion --- */
.instruction-accordion {
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.instruction-accordion:hover {
    border-color: var(--accent-glow);
}

.instruction-accordion+.instruction-accordion {
    margin-top: 0.5rem;
}

.instruction-accordion summary {
    padding: 1.25rem 2rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
    background: transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-heading);
    text-transform: uppercase;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 2px;
}

.instruction-accordion[open] summary {
    color: var(--accent-amber);
    background: rgba(255, 204, 0, 0.05);
}

.instruction-accordion summary::after {
    content: '+';
    font-family: var(--font-mono);
    font-size: 1.2rem;
}

.instruction-accordion[open] summary::after {
    content: '-';
}

.accordion-content {
    padding: 2.5rem;
    border-top: 1px solid var(--border-color);
}

/* --- Custom Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: hsla(var(--bg-hsl), 0.9);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-overlay);
}

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--accent-amber);
    padding: 2.5rem;
    max-width: 480px;
    width: 90%;
    border-radius: var(--radius);
    box-shadow: 0 0 50px hsla(var(--accent-hsl), 0.2);
}

.modal-header h3 {
    font-family: var(--font-heading);
    color: var(--accent-amber);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
}

.modal-body p {
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-btn {
    padding: 0.8rem 1.5rem;
}

.modal-btn.confirm {
    background: var(--accent-amber);
    color: #000;
}

/* Matrix Digital Rain Animation and Keyframes */
@keyframes scanMove {
    0% {
        transform: translateY(-100vh);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes rotationReverse {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(-360deg);
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(0, 255, 0, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
        border-color: var(--accent-cyan);
    }
}

/* --- Base Entrance Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
        filter: blur(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.app-container>* {
    animation: fadeInUp 1s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.app-container>header {
    animation-delay: 0.1s;
}

.app-container>main {
    animation-delay: 0.3s;
}

.app-container>footer {
    animation-delay: 0.6s;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    body {
        padding: 1.5rem 1rem;
    }

    .input-group {
        flex-direction: column;
        align-items: stretch;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .logout-btn {
        top: 1.5rem;
    }

    .manager-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

.main-sync-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: -1rem;
    z-index: 10;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-text {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.sync-status.connected .status-dot {
    background: var(--success-color);
    box-shadow: 0 0 10px hsla(150, 100%, 50%, 0.5);
}

/* Integrated Save Section */
.save-section.integrated-save {
    margin-top: 0;
    padding-top: 3rem;
    border-top: 1px solid var(--glass-border);
}

.save-section.integrated-save h3 {
    font-size: 1rem;
    color: var(--primary-color);
}

.save-status-msg {
    display: none;
    /* Hidden by default */
}

/* Show when it has content (managed via script.js class toggle mostly, 
   but we can ensure display:block when type is added) */
.save-status-msg.success,
.save-status-msg.error,
.save-status-msg.info {
    display: block;
}

.save-status-msg.success {
    background: rgba(0, 255, 65, 0.1);
    color: var(--matrix-color);
    border-color: rgba(0, 255, 65, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.1);
}

.save-status-msg.error {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border-color: rgba(255, 68, 68, 0.3);
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.1);
}

.save-status-msg.info {
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
    border-color: rgba(255, 255, 255, 0.1);
}

.sync-status.connected .status-text {
    color: #fff;
}

/* Spin Animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spinning {
    animation: spin 1s linear infinite;
    pointer-events: none;
    opacity: 0.7;
}

/* Specific Sitemap Action Buttons - Standardized and Resized */
.view-btn,
.sync-btn,
.copy-urls-btn {
    background: var(--accent-amber) !important;
    border: 1px solid var(--accent-amber) !important;
    color: #000 !important;
    padding: 0.5rem 1.2rem !important;
    /* ~30% smaller */
    font-size: 0.65rem !important;
    /* ~30% smaller */
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    height: auto !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
}

.view-btn:hover,
.sync-btn:hover,
.copy-urls-btn:hover {
    background: #fff !important;
    color: #000 !important;
    border-color: #fff !important;
    box-shadow: 0 0 30px hsla(var(--accent-hsl), 0.5) !important;
    transform: translateY(-2px) !important;
}

/* Sync Button Animations & Feedback */
.sync-btn.syncing-pulse {
    animation: btn-pulse 1.5s infinite ease-in-out !important;
    background: rgba(0, 255, 65, 0.2) !important;
    border-color: var(--matrix-color) !important;
    color: var(--matrix-color) !important;
}

@keyframes btn-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 65, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 255, 65, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 65, 0);
    }
}

.sync-btn.success {
    background: #065f46 !important;
    color: #fff !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4) !important;
}

.sync-btn.error {
    background: #991b1b !important;
    color: #fff !important;
    border-color: #ef4444 !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4) !important;
}
.matrix-bg {
    overflow: hidden;
}
