/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, rgba(11, 15, 25, 0.97), rgba(17, 24, 39, 0.95), rgba(20, 16, 35, 0.97));
    border-bottom: 1px solid rgba(79, 143, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(16px);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    max-width: 100%;
    padding: 0 40px;
    position: relative;
}

.header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.header__logo img {
    height: auto;
    width: 200px;
}

/* ===== MENU WRAPPER (nav + auth) ===== */
.header__menu {
    display: contents;
}

.header__nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
}

.header__nav a {
    padding: 8px 18px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-muted);
    position: relative;
}

.header__nav a:hover,
.header__nav a.active {
    color: var(--primary);
    background: rgba(79, 143, 255, 0.08);
}

.header__nav a.active {
    font-weight: 600;
}

/* ===== AUTH BUTTONS ===== */
.header__auth {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    margin-right: 16px;
}

.header__auth-btn {
    padding: 8px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    white-space: nowrap;
}

.header__auth-btn--login {
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: transparent;
}

.header__auth-btn--login:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.header__auth-btn--register {
    color: var(--white);
    background: linear-gradient(135deg, var(--primary), var(--purple));
}

.header__auth-btn--register:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79, 143, 255, 0.3);
}

/* ===== USER MENU ===== */
.header__user-menu {
    position: relative;
}

.header__user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.header__user-btn:hover {
    border-color: rgba(79, 143, 255, 0.3);
    background: rgba(79, 143, 255, 0.06);
}

.header__user-btn .fa-circle-user {
    font-size: 1.2rem;
    color: var(--primary);
}

.header__user-chevron {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.header__user-menu.open .header__user-chevron {
    transform: rotate(180deg);
}

/* Dropdown */
.header__user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 100;
}

.header__user-menu.open .header__user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header__user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
}

.header__user-dropdown-item:hover {
    background: rgba(79, 143, 255, 0.08);
    color: var(--text);
}

.header__user-dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
}

.header__user-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

.header__user-dropdown-item--danger {
    color: #f87171;
}

.header__user-dropdown-item--danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Light theme */
[data-theme="light"] .header__user-dropdown {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* ===== BURGER BUTTON ===== */
.header__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px;
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    position: relative;
    z-index: 10;
}

.header__burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
    transform-origin: center;
}

/* Burger -> X animation */
.header__burger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.header__burger.active span:nth-child(2) {
    opacity: 0;
}

.header__burger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ===== HEADER SCROLLED STATE ===== */
.header {
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.header .container {
    transition: height 0.35s ease;
}

.header__logo img {
    transition: width 0.35s ease;
}

.header--scrolled {
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom-color: rgba(79, 143, 255, 0.15);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.header--scrolled .container {
    height: 60px;
}

.header--scrolled .header__logo img {
    width: 160px;
}

[data-theme="light"] .header--scrolled {
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
    .header .container {
        height: 70px;
    }

    .header__logo img {
        width: 160px;
    }

    .header__burger {
        display: flex;
    }

    .header__menu {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(11, 15, 25, 0.98));
        border-bottom: 1px solid rgba(79, 143, 255, 0.1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
        flex-direction: column;
        gap: 0;
        padding: 0;
        backdrop-filter: blur(16px);
    }

    .header__menu.open {
        display: flex;
    }

    .header__nav {
        position: static;
        transform: none;
        flex-direction: column;
        width: 100%;
        gap: 0;
        padding: 16px 20px;
    }

    .header__nav a {
        width: 100%;
        padding: 14px 16px;
        border-radius: 8px;
        font-size: 1rem;
    }

    .header__auth {
        width: 100%;
        padding: 16px 20px;
        border-top: 1px solid var(--border);
        gap: 10px;
    }

    .header__auth {
        margin-right: 0;
    }

    .theme-toggle {
        margin-left: auto;
        margin-right: 4px;
    }

    .header__auth-btn {
        flex: 1;
        text-align: center;
        padding: 12px 16px;
    }

    /* User menu mobile */
    .header__user-menu {
        width: 100%;
    }

    .header__user-btn {
        width: 100%;
        justify-content: center;
    }

    .header__user-dropdown {
        position: static;
        transform: none;
        box-shadow: none;
        border: 1px solid var(--border);
        margin-top: 8px;
        opacity: 0;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        padding: 0;
        transition: opacity 0.2s ease, max-height 0.3s ease, padding 0.2s ease, visibility 0.2s ease;
    }

    .header__user-menu.open .header__user-dropdown {
        opacity: 1;
        visibility: visible;
        max-height: 300px;
        padding: 8px;
    }
}
