﻿/* ============================================
   ALVI - Header v3 - Theme-aware
   Uses --header-* theme variables
   ============================================ */

.header {
    position: sticky; top: 0; z-index: var(--z-sticky);
    background: var(--header-bg);
    height: var(--header-height);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--header-shadow);
    transition: background .3s var(--ease), box-shadow .3s var(--ease);
}
.header-inner {
    max-width: var(--max-width); margin: 0 auto;
    padding: 0 var(--space-6);
    display: flex; align-items: center; justify-content: space-between;
    height: 100%;
}

/* ── Brand ── */
.header-brand {
    display: flex; align-items: center; gap: var(--space-3);
    text-decoration: none !important;
}
.header-brand .logo {
    height: 34px; transition: opacity var(--transition);
    filter: brightness(0) invert(1);
}
[data-theme="modern"] .header-brand .logo { filter: none; }
.header-brand:hover .logo { opacity: .8; }
.logo-divider {
    width: 1px; height: 28px;
    background: var(--header-border);
}
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-text .logo-title {
    font-family: var(--font-display);
    font-size: var(--text-lg); font-weight: 800;
    color: var(--header-logo-text);
    letter-spacing: -0.01em;
}
.logo-text .logo-subtitle {
    font-size: 10px; font-weight: 600;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--header-nav-text);
}

/* ── Nav links ── */
.header-nav { display: flex; align-items: center; gap: var(--space-1); }
.nav-link {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm); font-weight: 600;
    color: var(--header-nav-text);
    transition: all .2s var(--ease);
    text-decoration: none !important;
    position: relative; white-space: nowrap;
}
.nav-link:hover {
    color: var(--header-nav-hover);
    background: var(--header-nav-active-bg);
}
.nav-link.active {
    color: var(--header-nav-active-text);
    background: var(--header-nav-active-bg);
}
.nav-link .nav-icon { font-size: 16px; flex-shrink: 0; }
.nav-link .nav-badge {
    position: absolute; top: -2px; right: -4px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: var(--radius-full);
    font-size: 10px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand); color: var(--white); line-height: 1;
}

/* ── User / Avatar ── */
.header-user {
    display: flex; align-items: center; gap: var(--space-3);
    margin-left: var(--space-4);
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: var(--radius-full);
    background: var(--gold); color: var(--gray-900);
    font-weight: 800; font-size: var(--text-xs);
    display: flex; align-items: center; justify-content: center;
    text-transform: uppercase;
    transition: transform .2s var(--ease);
}
.user-dropdown-trigger:hover .user-avatar { transform: scale(1.05); }
.user-name {
    font-size: var(--text-sm); font-weight: 600;
    color: var(--header-text);
    max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-role {
    display: block; font-size: 10px; font-weight: 500;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--header-nav-text);
}

/* ── Mobile toggle ── */
.mobile-toggle {
    display: none; background: none; border: none;
    color: var(--header-text); font-size: 24px;
    cursor: pointer; padding: var(--space-1);
}

/* ── Dropdown ── */
.user-dropdown { position: relative; }
.user-dropdown-trigger {
    background: none; border: none; cursor: pointer; padding: 0;
    display: flex; align-items: center; gap: var(--space-2);
}
.user-dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 8px);
    min-width: 200px; background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl); border: 1px solid var(--gray-100);
    padding: var(--space-1-5); z-index: var(--z-dropdown);
    animation: slideDown .15s var(--ease);
}
.dropdown-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm); font-weight: 500;
    color: var(--gray-700); cursor: pointer;
    transition: all var(--transition);
    background: none; border: none; width: 100%; text-align: left;
}
.dropdown-item:hover { background: var(--gray-50); color: var(--gray-900); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-bg); }
.dropdown-separator { height: 1px; background: var(--gray-100); margin: var(--space-1) 0; }

/* ── Menu backdrop ── */
.menu-backdrop { position: fixed; inset: 0; z-index: 98; background: transparent; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .mobile-toggle { display: flex; }
    .header-nav {
        display: none;
        position: fixed; inset: var(--header-height) 0 0 0;
        background: var(--header-bg);
        flex-direction: column;
        padding: var(--space-4) var(--space-5); gap: var(--space-1);
        overflow-y: auto; z-index: 99;
        border-top: 1px solid var(--header-border);
    }
    .header-nav.open { display: flex; animation: slideDown .2s var(--ease); }
    .nav-link {
        width: 100%; padding: var(--space-3) var(--space-4);
        font-size: var(--text-base);
    }
    .user-name { display: none; }
    .logo-text .logo-subtitle { display: none; }
}
