/**
 * Header — Newtype v2 HUD bar
 * Sticky, full-width, dark + neon-green accent, no box-shadow (border only).
 */

header {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    /* Crisp CRT-style top line */
    box-shadow: 0 1px 0 rgba(46, 255, 126, 0.08);
}

.header-content {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Logo ── */
.header-left {
    display: contents; /* logo, nav, search all participate in the grid */
}

.logo a {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px 12px 0;
    border-right: 1px solid var(--border-color);
    white-space: nowrap;
}

.logo-mark {
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--neon);
    position: relative;
    transform: rotate(45deg);
    box-shadow: 0 0 10px var(--neon-glow);
    flex: 0 0 auto;
}

.logo-mark::before {
    content: '';
    position: absolute;
    inset: 4px;
    background: var(--neon);
    box-shadow: 0 0 6px var(--neon);
}

.logo-text {
    display: inline-block;
    font-family: var(--font-family-display);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.logo-text .logo-accent {
    color: var(--neon);
}

/* ── Search bar (center column) ── */
.nav-search-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.nav-search {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
    padding: 7px 14px;
    font-family: var(--font-family-mono);
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    width: 100%;
    max-width: 480px;
    background: rgba(46, 255, 126, 0.03);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
    transition: border-color 0.15s, background 0.15s;
    cursor: text;
}

.nav-search:focus-within {
    border-color: var(--neon);
    background: rgba(46, 255, 126, 0.05);
}

.nav-search .search-prefix {
    color: var(--neon);
    font-weight: 700;
    flex: 0 0 auto;
}

.nav-search input {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary);
    letter-spacing: 0.06em;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    min-width: 0;
}

.nav-search input::placeholder {
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-search .search-kbd {
    padding: 1px 6px;
    border: 1px solid var(--border-color);
    font-size: 10px;
    color: var(--text-tertiary);
    flex: 0 0 auto;
    font-family: inherit;
}

/* ── Authentication / pilot-id (right column) ── */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-section {
    display: flex;
    align-items: center;
}

.auth-loading {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    font-family: var(--font-family-mono);
}

.login-link {
    color: var(--neon);
    background: rgba(46, 255, 126, 0.06);
    padding: 7px 16px;
    text-decoration: none;
    font-weight: 600;
    font-family: var(--font-family-display);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid var(--border-color);
    clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
    transition: all 0.15s;
}

.login-link:hover {
    background: rgba(46, 255, 126, 0.12);
    border-color: var(--neon);
    box-shadow: 0 0 10px var(--neon-glow);
}

/* Pilot ID badge (logged-in user) */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pilot-online-dot {
    width: 7px;
    height: 7px;
    background: var(--neon);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--neon);
    animation: pilot-blink 2s infinite;
    flex: 0 0 auto;
}

@keyframes pilot-blink {
    0%, 60% { opacity: 1; }
    70%, 100% { opacity: 0.25; }
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--neon), var(--amber));
    clip-path: polygon(20% 0, 100% 0, 100% 80%, 80% 100%, 0 100%, 0 20%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    color: var(--bg-body);
    font-family: var(--font-family-display);
    object-fit: cover;
    border: none;
    border-radius: 0;
}

/* When avatar is an <img> override the clip-path approach */
img.user-avatar {
    clip-path: none;
    border-radius: 3px;
    border: 1px solid var(--border-color);
}

.user-name {
    font-family: var(--font-family-mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-primary);
    font-weight: 500;
}

.user-rank {
    font-family: var(--font-family-mono);
    font-size: 9px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    display: block;
}

.user-dropdown {
    position: relative;
}

.user-menu-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    font-family: var(--font-family-mono);
    font-size: 12px;
    transition: color 0.15s;
}

.user-menu-toggle:hover {
    color: var(--neon);
}

.user-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--bg-container);
    border: 1px solid var(--border-strong);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    min-width: 180px;
    z-index: 1000;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
}

.user-dropdown-content a {
    display: block;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-family: var(--font-family-display);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: background 0.12s, color 0.12s;
    border-left: 2px solid transparent;
}

.user-dropdown-content a:hover {
    background: rgba(46, 255, 126, 0.06);
    color: var(--neon);
    border-left-color: var(--neon);
}

.user-dropdown-content hr {
    margin: 4px 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

/* Notification bell */
.notification-container {
    position: relative;
}

.notification-bell {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    position: relative;
    transition: color 0.15s;
}

.notification-bell:hover {
    color: var(--neon);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--amber);
    color: var(--bg-body);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family-mono);
}

.notification-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--bg-container);
    border: 1px solid var(--border-strong);
    min-width: 300px;
    z-index: 1000;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}

.notification-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-family-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.notification-header h3 {
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-family: var(--font-family-mono);
    font-weight: 400;
    margin: 0;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-empty {
    padding: 20px 16px;
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: var(--font-family-mono);
    text-align: center;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: rgba(46, 255, 126, 0.06);
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 8px 14px;
    transition: all 0.15s;
    clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px));
}

.mobile-menu-btn:hover {
    background: rgba(46, 255, 126, 0.1);
    border-color: var(--neon);
}

.menu-text {
    color: var(--neon);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-family-display);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .header-content {
        gap: 14px;
    }
}

@media (max-width: 768px) {
    .header-content {
        grid-template-columns: auto 1fr auto;
        padding: 0 14px;
        gap: 10px;
    }

    .nav-search-wrap {
        grid-column: 2;
    }

    .main-navigation {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .user-name,
    .user-rank {
        display: none;
    }

    .pilot-online-dot {
        display: none;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 10px;
    }

    .logo a {
        padding-right: 12px;
    }

    .logo-text {
        font-size: 13px;
    }

    .nav-search {
        max-width: 100%;
    }
}
