/* Global Header Styles */
.global-header {
    background: #000000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000; /* Above all content including 3D window */
    width: 100%;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

/* Logo */
.header-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 45px;
    width: auto;
}

/* Home Icon Link */
.home-icon-link {
    color: white !important;
    font-size: 1.5rem !important;
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.home-icon-link:hover {
    color: #ffd700 !important;
}

.home-icon-link i {
    color: inherit;
    font-size: inherit;
}

/* DEV Badge */
.dev-badge {
    background: #ff0000;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: inline-block;
}

/* Navigation Menu */
.header-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

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

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.nav-link i {
    font-size: 0.7rem;
}

/* Dropdown Menu */
.has-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 250px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    list-style: none;
    margin: 5px 0 0 0;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 10001; /* Above 3D window and all other elements */
}

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

.dropdown-link {
    color: #2c3e50;
    text-decoration: none;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.dropdown-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dropdown-link i {
    font-size: 1rem;
    width: 20px;
}

/* Header Right Side (Login/Dashboard) */
.header-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Guest Menu */
.header-guest-menu {
    display: flex;
    gap: 10px;
}

.header-btn {
    padding: 10px 25px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-block;
}

.header-login-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
}

.header-login-btn:hover {
    background: white;
    color: #667eea;
}

.header-signup-btn {
    background: white;
    color: #667eea;
}

.header-signup-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* User Menu */
.header-user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.header-user-avatar {
    width: 45px;
    height: 45px;
    background: white;
    color: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.header-user-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.header-dropdown-content {
    position: absolute;
    top: 55px;
    right: 0;
    background: white;
    min-width: 200px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: none;
    overflow: hidden;
}

.header-dropdown-content.show {
    display: block;
}

.header-dropdown-content a {
    color: #2c3e50;
    text-decoration: none;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    font-weight: 500;
}

.header-dropdown-content a:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Subscription Badge in Header */
.nav-subscription-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}

.nav-subscription-badge.premium {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #764ba2;
    border: 1px solid #ffd700;
}

.nav-subscription-badge.admin {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border: 1px solid #ff6b6b;
}

/* Hide badge text on desktop, show only icon */
.nav-subscription-badge span {
    display: none;
}

/* User Navigation Items - Hidden on Desktop (shown only in mobile) */
.user-nav-item {
    display: none !important;
}

/* Hide user avatar and dropdown on all screen sizes */
.header-user-menu {
    display: none !important;
}

.header-user-avatar {
    display: none !important;
}

.header-user-dropdown {
    display: none !important;
}

/* Mobile User Greeting */
.mobile-user-greeting {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-greeting-text {
    color: #ffd700 !important;
    font-weight: 600;
    font-size: 1rem;
}

/* Desktop User Greeting */
.desktop-user-greeting {
    display: flex;
    align-items: center;
}

.desktop-greeting-text {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 15px;
}

/* Desktop User Greeting in Header Right */
.desktop-greeting-text-right {
    color: #ffd700;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0 10px;
    white-space: nowrap;
}

/* Home Link - Hidden by default, shown in mobile when logged in */
.header-home-link {
    display: none;
    color: white;
    font-size: 1.5rem;
    padding: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.header-home-link:hover {
    color: #ffd700;
}

/* Dashboard Link - Hidden now that we have it in the menu */
.header-dashboard-link {
    display: none !important;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: 2px solid #ffd700;
    border-radius: 8px;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px 12px;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .nav-menu {
        gap: 5px;
    }

    .nav-link {
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .dropdown-menu {
        min-width: 220px;
    }
}

@media (max-width: 768px) {
    .header-container {
        height: 60px;
        gap: 10px;
        position: relative;
    }

    .logo-img {
        height: 35px;
    }

    .header-nav {
        display: none;
        position: absolute;
        top: 70px;
        right: 0;
        width: 250px;
        max-width: 90vw;
        background: #000000;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        border-radius: 8px;
        z-index: 999;
    }

    .header-nav.active {
        display: block;
    }

    .nav-menu {
        flex-direction: column;
        padding: 10px 0;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        padding: 15px 20px;
    }

    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.1);
        display: none;
        margin: 0;
    }

    .has-dropdown.active .dropdown-menu {
        display: block;
    }

    .dropdown-link {
        color: white;
        padding: 12px 40px;
    }

    .dropdown-link:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .mobile-menu-toggle {
        display: block;
    }

    /* Show user nav items in mobile menu */
    .user-nav-item {
        display: block !important;
    }

    /* Hide desktop greeting on mobile */
    .desktop-user-greeting {
        display: none !important;
    }

    .desktop-greeting-text-right {
        display: none !important;
    }

    /* Show home link in mobile when logged in (JS controls visibility) */
    /* Display is controlled by JavaScript based on login status */

    .header-guest-menu {
        gap: 5px;
    }

    .header-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .nav-subscription-badge {
        display: none;
    }
}

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

    .logo-img {
        height: 30px;
    }

    .header-home-link {
        font-size: 1.2rem;
        padding: 5px;
    }

    .header-dashboard-link {
        padding: 4px 8px;
        font-size: 0.65rem;
    }

    /* Force hide entire user menu on mobile (avatar, dropdown, etc) */
    .header-user-menu,
    .header-user-menu *,
    .header-user-avatar,
    .header-user-dropdown,
    div.header-user-menu,
    div.header-user-dropdown {
        display: none !important;
        visibility: hidden !important;
    }

    /* Show only Premium badge (icon only) */
    #headerSubscriptionBadge,
    span#headerSubscriptionBadge,
    .nav-subscription-badge#headerSubscriptionBadge {
        display: inline-flex !important;
        visibility: visible !important;
        padding: 6px 10px !important;
        font-size: 1.1rem !important;
        min-width: auto !important;
        gap: 0 !important;
    }

    /* Hide badge text, show only icon */
    #headerSubscriptionBadge span,
    .nav-subscription-badge span,
    span#headerSubscriptionBadge span {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        font-size: 0 !important;
    }

    /* Show and size the icon properly */
    #headerSubscriptionBadge i,
    .nav-subscription-badge i,
    span#headerSubscriptionBadge i {
        display: inline-block !important;
        visibility: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 1.1rem !important;
    }

    .header-guest-menu {
        flex-direction: row;
        gap: 5px;
    }

    .header-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }

    .mobile-menu-toggle {
        padding: 6px 10px;
        font-size: 1.2rem;
    }
}
