/* =============================
   Header Styles
   ============================= */

header.header {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    height: 72px;
    background: rgba(12, 17, 28, 0.75);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.3s ease, border-color 0.3s ease, height 0.3s ease;
}

[data-theme="light"] header.header {
    background: rgba(248, 240, 230, 0.92);
    border-bottom: 1px solid rgba(205, 191, 172, 0.45);
}

.header-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-4);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="light"] .brand-logo {
    background: linear-gradient(135deg, #efe4d6, #e2d5c4);
    border-color: rgba(205, 191, 172, 0.45);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.brand-link:hover .brand-logo {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .brand-link:hover .brand-logo {
    box-shadow: 0 6px 16px rgba(168, 152, 80, 0.22);
    border-color: rgba(168, 152, 80, 0.35);
}

.brand-logo img {
    width: 24px;
    height: 24px;
    display: block;
    object-fit: contain;
}

.brand-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-text {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
    color: var(--color-text);
    line-height: 1.2;
}

.brand-tagline {
    margin: 0;
    font-size: 11px;
    color: var(--color-text-soft);
    font-weight: 500;
    opacity: 0.8;
}

#versionBadge {
    margin-left: var(--space-2);
    padding: 2px 8px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    border-radius: 99px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--color-accent-alt);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

[data-theme="light"] #versionBadge {
    background: rgba(7, 102, 120, 0.1);
    border-color: rgba(7, 102, 120, 0.2);
    color: var(--color-accent);
}

/* Actions & Nav */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-nav {
    display: flex;
    align-items: center;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 4px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    height: 36px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-soft);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .nav-link:hover,
[data-theme="light"] .nav-link:focus-visible {
    background: rgba(0, 0, 0, 0.04);
}

.header-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .header-divider {
    background: rgba(0, 0, 0, 0.1);
}

.header-tools {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Buttons in Header */
.header .btn {
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.header .btn .material-symbols-rounded {
    font-size: 18px;
    margin: 0;
}

/* Report Button */
.report-toggle {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--color-text-soft);
}

.report-toggle:hover,
.report-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--color-text);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .report-toggle {
    background: #f8f0e6;
    border-color: rgba(205, 191, 172, 0.5);
    color: var(--color-text-soft);
    box-shadow: 0 1px 2px rgba(47, 42, 33, 0.04);
}

[data-theme="light"] .report-toggle:hover,
[data-theme="light"] .report-toggle[aria-expanded="true"] {
    background: #e2d5c4;
    border-color: var(--color-accent);
    color: var(--color-accent);
    box-shadow: 0 4px 12px rgba(168, 152, 80, 0.18);
}

/* Theme Toggle */
.theme-toggle {
    width: 38px;
    padding: 0;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    color: var(--color-text-soft);
}

.theme-toggle .txt {
    display: none;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-warn);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--color-accent);
}

/* Mobile Menu Toggle */
.header-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .header-menu-toggle {
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .header-menu-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* Report Panel (Dropdown) */
.report-entry {
    position: relative;
}

.report-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    padding: 20px 22px 18px;
    background:
        radial-gradient(circle at 0 0, rgba(99, 102, 241, 0.18), transparent 60%),
        rgba(18, 24, 38, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 18px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform-origin: top right;
    animation: menuSlideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

[data-theme="light"] .report-panel {
    background:
        radial-gradient(circle at 0 0, rgba(168, 152, 80, 0.18), transparent 60%),
        rgba(248, 240, 230, 0.96);
    border-color: rgba(205, 191, 172, 0.55);
    box-shadow: 0 20px 40px -10px rgba(47, 42, 33, 0.12), 0 0 0 1px rgba(205, 191, 172, 0.12);
}

@keyframes menuSlideDown {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-8px);
    }

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

.report-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.report-heading-text {
    display: flex;
    gap: 12px;
}

.report-icon {
    font-size: 24px;
    color: var(--color-accent);
    background: rgba(99, 102, 241, 0.1);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.report-heading-text strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 2px;
}

.report-subtitle {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-soft);
}

.report-close {
    background: transparent;
    border: none;
    color: var(--color-text-soft);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.report-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text);
}

[data-theme="light"] .report-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.report-text {
    font-size: 13px;
    color: var(--color-text-soft);
    line-height: 1.5;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .report-text {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.report-highlights {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-highlights li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.report-highlights .material-symbols-rounded {
    font-size: 20px;
    color: var(--color-accent-alt);
    margin-top: 2px;
}

.report-highlights strong {
    display: block;
    font-size: 13px;
    color: var(--color-text);
    margin-bottom: 2px;
}

.report-highlights p {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-soft);
    line-height: 1.4;
}

.report-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.report-links .btn {
    width: 100%;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text);
}

.report-links .btn:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

[data-theme="light"] .report-links .btn {
    background: #e2d5c4;
    border-color: rgba(205, 191, 172, 0.6);
    color: var(--color-text);
}

[data-theme="light"] .report-links .btn:hover {
    background: var(--color-accent);
    color: #fff;
}

.report-note {
    font-size: 11px;
    color: var(--color-text-soft);
    text-align: center;
    margin: 0;
    opacity: 0.7;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .header-menu-toggle {
        display: flex;
    }

    .header-actions {
        position: fixed;
        top: 72px;
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        padding: 20px;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        display: none;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }

    .header-actions.is-open {
        display: flex;
        animation: slideDown 0.2s ease-out;
    }

    .header-nav {
        width: 100%;
    }

    .nav-list {
        flex-direction: column;
        width: 100%;
        gap: 4px;
    }

    .nav-link {
        width: 100%;
        justify-content: flex-start;
        height: 48px;
        background: var(--color-surface-alt);
        border-radius: 12px;
    }

    .header-divider {
        display: none;
    }

    .header-tools {
        flex-direction: column;
        gap: 12px;
    }

    .report-entry {
        width: 100%;
    }

    .report-toggle {
        width: 100%;
        justify-content: center;
        height: 48px;
    }

    .theme-toggle {
        width: 100%;
        height: 48px;
        border: 1px solid var(--color-border);
        border-radius: 12px;
    }

    .theme-toggle .txt {
        display: inline;
    }

    .report-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        border-radius: 0;
        transform: none;
        overflow-y: auto;
        padding-top: 80px;
        /* Space for close button or header */
    }

    .report-close {
        position: absolute;
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        background: var(--color-surface-alt);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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