/* =====================================================
   INDIE PORTAL - SITE HEADER
   Netflix-inspired dark navigation
   ===================================================== */

/*
 * Global header height token.
 *
 * IMPORTANT: This must live on :root so other templates (single game, dashboard,
 * sticky navigators, etc.) can reliably account for the fixed header without
 * guessing DOM structure.
 */
:root {
    --ip-header-height: 64px;
    --ip-admin-bar-height: 0px;
}

/* Hide theme's default header when our header is active */
body.ip-has-custom-header #masthead,
body.ip-has-custom-header .site-header,
body.ip-has-custom-header header.entry-header,
body.ip-has-custom-header .elementor-location-header,
body.ip-has-custom-header .site-branding,
body.ip-has-custom-header .ast-primary-header,
body.ip-has-custom-header #site-header,
body.ip-has-custom-header .starter-header,
body.ip-has-custom-header > header:not(.ip-site-header) {
    display: none !important;
}

/* Also try to hide common theme header patterns */
.ip-site-header ~ .site-header,
.ip-site-header ~ #masthead,
.ip-site-header ~ header:not(.ip-site-header) {
    display: none !important;
}

/* CSS Variables */
.ip-site-header {
    --ip-header-bg: rgba(13, 13, 13, 0.95);
    --ip-header-bg-solid: #0d0d0d;
    --ip-header-border: rgba(255, 255, 255, 0.08);
    --ip-header-text: rgba(255, 255, 255, 0.85);
    --ip-header-text-muted: rgba(255, 255, 255, 0.5);
    --ip-header-accent: var(--ip-primary);
    --ip-header-accent-hover: #d64ff2;
}

/* Header Container */
.ip-site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999; /* Below WP admin bar dropdowns (99999) but above page content */
    background: var(--ip-header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--ip-header-border);
    transition: background 0.3s ease;
}

/* Account for WordPress Admin Bar */
.admin-bar .ip-site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar .ip-site-header {
        top: 46px;
    }
}

.ip-site-header.scrolled {
    background: var(--ip-header-bg-solid);
}

.ip-header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: var(--ip-header-height);
}

/* Header Spacer */
.ip-header-spacer {
    height: var(--ip-header-height);
}

/* Logo */
.ip-header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.ip-logo-icon {
    font-size: 1.5rem;
}

.ip-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.ip-logo-accent {
    color: var(--ip-header-accent);
}

/* Main Navigation */
.ip-header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ip-nav-link {
    position: relative;
    padding: 8px 16px;
    color: var(--ip-header-text-muted);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

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

.ip-nav-link.active {
    color: #fff;
}

.ip-nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--ip-header-accent);
    border-radius: 1px;
}

/* Search */
.ip-header-search {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    max-width: 400px;
}

.ip-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--ip-header-border);
    border-radius: 8px;
    color: var(--ip-header-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.ip-search-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Search Overlay */
.ip-search-overlay {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--ip-header-bg-solid);
    border-bottom: 1px solid var(--ip-header-border);
    padding: 20px 24px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.ip-search-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ip-search-container {
    max-width: 700px;
    margin: 0 auto;
}

.ip-search-form {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--ip-header-border);
    border-radius: 12px;
    padding: 12px 20px;
}

.ip-search-form:focus-within {
    border-color: var(--ip-header-accent);
    box-shadow: 0 0 0 3px rgba(200, 42, 239, 0.15);
}

.ip-search-icon {
    color: var(--ip-header-text-muted);
    flex-shrink: 0;
}

.ip-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 1.125rem;
    color: #fff;
}

.ip-search-input::placeholder {
    color: var(--ip-header-text-muted);
}

.ip-search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: var(--ip-header-text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.ip-search-close:hover {
    color: #fff;
}

.ip-search-suggestions {
    margin-top: 16px;
}

.ip-search-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ip-hint-label {
    font-size: 0.8125rem;
    color: var(--ip-header-text-muted);
}

.ip-search-hint a {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    color: var(--ip-header-text);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: background 0.2s;
}

.ip-search-hint a:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Header Actions */
.ip-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Header Buttons */
.ip-header-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.ip-submit-btn {
    background: var(--ip-header-accent);
    color: #fff;
}

.ip-submit-btn:hover {
    background: var(--ip-header-accent-hover);
}

.ip-submit-btn.active {
    background: var(--ip-header-accent-hover);
}

/* Roulette Button */
.ip-roulette-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--ip-header-text);
    cursor: pointer;
}

.ip-roulette-btn:hover {
    background: rgba(200, 42, 239, 0.15);
    border-color: rgba(200, 42, 239, 0.3);
    color: #fff;
}

.ip-roulette-btn:active {
    transform: scale(0.97);
}

.ip-roulette-btn svg {
    flex-shrink: 0;
}

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

.ip-login-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.ip-register-btn {
    background: #fff;
    color: #0d0d0d;
}

.ip-register-btn:hover {
    background: rgba(255, 255, 255, 0.9);
}

/* Icon Button */
.ip-header-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--ip-header-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.ip-header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.ip-notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    border-radius: 9px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Notifications Dropdown */
.ip-notifications {
    position: relative;
}

.ip-notifications-trigger {
    position: relative;
}

.ip-notifications-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: -8px;
    width: 340px;
    max-height: 480px;
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        0 20px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: all 0.2s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ip-notifications.open .ip-notifications-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.ip-notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ip-notifications-header h3 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}

.ip-mark-all-read {
    background: none;
    border: none;
    color: var(--ip-header-accent);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.ip-mark-all-read:hover {
    background: rgba(200, 42, 239, 0.15);
}

.ip-notifications-list {
    flex: 1;
    overflow-y: auto;
    max-height: 360px;
    padding: 6px 0;
}

.ip-notifications-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    color: var(--ip-header-text-muted);
}

.ip-notifications-empty svg {
    opacity: 0.25;
    margin-bottom: 12px;
}

.ip-notifications-empty p {
    margin: 0 0 4px 0;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
}

.ip-notifications-empty span {
    font-size: 0.75rem;
}

.ip-notification-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    margin: 0 6px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--ip-header-text);
    transition: background 0.15s ease;
    position: relative;
}

.ip-notification-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.ip-notification-item.unread {
    background: rgba(200, 42, 239, 0.08);
}

.ip-notification-item.unread:hover {
    background: rgba(200, 42, 239, 0.12);
}

.ip-notification-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 8px;
    color: var(--ip-header-text-muted);
}

.ip-notification-icon svg {
    width: 18px;
    height: 18px;
}

.ip-notification-icon-new_follower { color: #60a5fa; }
.ip-notification-icon-new_review { color: #fbbf24; }
.ip-notification-icon-review_vote { color: #34d399; }
.ip-notification-icon-game_approved { color: #34d399; }
.ip-notification-icon-game_rejected { color: #f87171; }
.ip-notification-icon-review_approved { color: #34d399; }
.ip-notification-icon-new_reply { color: #a78bfa; }
.ip-notification-icon-followed_company_new_game { color: var(--ip-header-accent); }

.ip-notification-content {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.ip-notification-message {
    margin: 0 0 2px 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.85);
}

.ip-notification-time {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.4);
}

.ip-notification-unread-dot {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    background: var(--ip-header-accent);
    border-radius: 50%;
    margin-top: 8px;
    box-shadow: 0 0 8px rgba(200, 42, 239, 0.5);
}

.ip-notifications-footer {
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

.ip-notifications-footer a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

.ip-notifications-footer a:hover {
    color: var(--ip-header-accent);
}

/* User Menu */
.ip-user-menu {
    position: relative;
}

.ip-user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    padding-right: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--ip-header-border);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.ip-user-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ip-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Support emoji avatars (span elements) in header */
.ip-user-avatar.ip-profile-picture--default,
span.ip-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
}

.ip-user-chevron {
    color: var(--ip-header-text-muted);
    transition: transform 0.2s;
}

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

/* User Dropdown */
.ip-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--ip-header-bg-solid);
    border: 1px solid var(--ip-header-border);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

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

.ip-dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.ip-dropdown-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Support emoji avatars (span elements) in dropdown */
.ip-dropdown-avatar.ip-profile-picture--default,
span.ip-dropdown-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
}

.ip-dropdown-user-details {
    overflow: hidden;
}

.ip-dropdown-username {
    display: block;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ip-dropdown-email {
    display: block;
    font-size: 0.8125rem;
    color: var(--ip-header-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ip-dropdown-divider {
    height: 1px;
    background: var(--ip-header-border);
    margin: 4px 0;
}

.ip-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--ip-header-text);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: background 0.2s;
}

.ip-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ip-dropdown-item svg {
    color: var(--ip-header-text-muted);
}

.ip-dropdown-logout {
    color: #ef4444;
}

.ip-dropdown-logout svg {
    color: #ef4444;
}

/* Mobile Toggle */
.ip-mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.ip-hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 22px;
}

.ip-hamburger span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    transition: all 0.3s ease;
}

.ip-mobile-toggle.active .ip-hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.ip-mobile-toggle.active .ip-hamburger span:nth-child(2) {
    opacity: 0;
}

.ip-mobile-toggle.active .ip-hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu */
.ip-mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--ip-header-bg-solid);
    border-bottom: 1px solid var(--ip-header-border);
    max-height: calc(100vh - var(--ip-header-height));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ip-mobile-menu.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: ip-mobile-menu-in 0.25s ease;
}

@keyframes ip-mobile-menu-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Backdrop for mobile menu */
.ip-mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--ip-header-height);
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ip-mobile-menu.active + .ip-mobile-backdrop,
.ip-mobile-backdrop.active {
    display: block;
    opacity: 1;
}

.ip-mobile-nav {
    padding: 12px 16px 24px;
}

.ip-mobile-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    color: var(--ip-header-text);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 10px;
    transition: background 0.15s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.ip-mobile-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ip-mobile-link:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.08);
}

.ip-mobile-link.active {
    background: rgba(200, 42, 239, 0.1);
    color: var(--ip-header-accent);
}

.ip-mobile-link svg {
    color: var(--ip-header-text-muted);
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.ip-mobile-link.active svg {
    color: var(--ip-header-accent);
}

.ip-mobile-divider {
    height: 1px;
    background: var(--ip-header-border);
    margin: 8px 18px;
}

/* Section labels in mobile menu */
.ip-mobile-section-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ip-header-text-muted);
    padding: 16px 18px 8px;
    margin-top: 8px;
}

.ip-mobile-submit {
    background: rgba(200, 42, 239, 0.12);
    color: var(--ip-header-accent);
    border: 1px solid rgba(200, 42, 239, 0.25);
}

.ip-mobile-submit svg {
    color: var(--ip-header-accent);
}

.ip-mobile-roulette {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.ip-mobile-roulette:hover {
    background: rgba(200, 42, 239, 0.1);
}

.ip-mobile-register {
    background: var(--ip-header-accent);
    color: #fff;
    font-weight: 600;
    margin-top: 8px;
}

.ip-mobile-register:hover {
    background: var(--ip-header-accent-hover);
}

.ip-mobile-logout {
    color: rgba(239, 68, 68, 0.9);
}

.ip-mobile-logout svg {
    color: rgba(239, 68, 68, 0.9);
}

.ip-mobile-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* User info section in mobile menu */
.ip-mobile-user {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.ip-mobile-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.ip-mobile-user-info {
    flex: 1;
    min-width: 0;
}

.ip-mobile-user-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--ip-header-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ip-mobile-user-email {
    font-size: 13px;
    color: var(--ip-header-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .ip-header-inner {
        gap: 24px;
    }
    
    .ip-header-nav {
        gap: 4px;
    }
    
    .ip-nav-link {
        padding: 8px 12px;
        font-size: 0.875rem;
    }
}

@media (max-width: 900px) {
    .ip-header-nav {
        display: none;
    }
    
    .ip-header-search {
        flex: 1;
        justify-content: flex-end;
    }
    
    .ip-btn-label {
        display: none;
    }
    
    .ip-submit-btn {
        padding: 8px 12px;
    }
    
    .ip-mobile-toggle {
        display: flex;
    }
}

@media (max-width: 640px) {
    .ip-header-inner {
        padding: 0 16px;
        gap: 12px;
    }
    
    .ip-logo-text {
        display: none;
    }
    
    .ip-logo-icon {
        font-size: 1.75rem;
    }
    
    .ip-header-actions {
        gap: 8px;
    }
    
    .ip-login-btn,
    .ip-register-btn {
        display: none;
    }
    
    .ip-search-overlay {
        padding: 16px;
    }
    
    .ip-search-form {
        padding: 10px 16px;
    }
    
    .ip-search-input {
        font-size: 1rem;
    }
    
    /* Notifications dropdown mobile */
    .ip-notifications-dropdown {
        position: fixed;
        top: calc(var(--ip-header-height) + 8px);
        left: 16px;
        right: 16px;
        width: auto;
        max-height: calc(100vh - var(--ip-header-height) - 32px);
    }
    
    .admin-bar .ip-notifications-dropdown {
        top: calc(var(--ip-header-height) + 46px + 8px);
    }
}
