/* Universal Navigation CSS */
:root {
    --nav-bg: #0f172a;
    --nav-text: #ffffff;
    --nav-accent: #FF9900;
    --dropdown-bg: #1e293b;
    --nav-hover-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

header {
    background: var(--nav-bg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 10000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 10001;
}

.logo {
    color: var(--nav-text);
    font-size: 24px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--nav-accent);
}

.nav-menu {
    display: flex;
    gap: 5px;
    list-style: none;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-menu>li {
    position: relative;
}

.nav-menu>li>a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    color: var(--nav-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-menu>li>a:hover,
.nav-menu>li.active>a {
    background: var(--nav-hover-gradient);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.nav-menu>li>a i.fa-chevron-down {
    font-size: 10px;
    transition: transform 0.3s;
}

.nav-menu>li:hover>a i.fa-chevron-down {
    transform: rotate(180deg);
}

/* Dropdown Content */
.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--dropdown-bg);
    min-width: 240px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 12px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    margin-top: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-menu>li:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content a {
    display: block;
    padding: 14px 24px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.dropdown-content a:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    color: #818cf8;
    padding-left: 28px;
}

/* Badges */
.nav-badge {
    background: var(--nav-accent);
    color: #0F1111;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
    margin-left: 5px;
}

/* Nav Actions */
.nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.cart-button,
.theme-toggle,
.chatbot-button {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.cart-button:hover,
.theme-toggle:hover,
.chatbot-button:hover {
    background: var(--nav-hover-gradient);
    transform: scale(1.1);
}

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--nav-accent);
    color: #0F1111;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    font-weight: 700;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

.mobile-nav-overlay {
    display: none;
}

/* Nav element overflow fix for mobile menu */
header nav {
    overflow: visible !important;
}

/* Body overflow control when menu is open */
body.menu-open {
    overflow: hidden !important;
}

/* Responsive */
@media (max-width: 1200px) {
    .mobile-menu-btn {
        display: flex;
        z-index: 10002;
        position: relative;
        order: -1;
        /* Put hamburger first in nav-actions */
    }

    /* Hide nav element content on mobile (menu slides in separately) */
    header nav {
        display: none;
    }

    .nav-menu {
        position: fixed !important;
        top: 0 !important;
        right: -100%;
        width: 300px !important;
        height: 100vh !important;
        background: var(--nav-bg) !important;
        flex-direction: column !important;
        padding: 80px 0 20px !important;
        transition: right 0.3s ease !important;
        overflow-y: auto !important;
        z-index: 10001 !important;
        gap: 0 !important;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5) !important;
        align-items: stretch !important;
        display: flex !important;
    }

    .nav-menu.active {
        right: 0 !important;
        display: flex !important;
        visibility: visible !important;
    }

    .nav-menu>li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-menu>li>a {
        justify-content: space-between;
        padding: 15px 20px;
        border-radius: 0;
        width: 100%;
    }

    .nav-menu>li>a i:not(.fa-chevron-down) {
        width: 20px;
        text-align: center;
    }

    .dropdown-content {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: rgba(0, 0, 0, 0.2);
        box-shadow: none;
        border-radius: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        margin: 0;
    }

    .nav-menu>li.active .dropdown-content,
    .nav-menu>li:hover .dropdown-content {
        max-height: 1000px;
    }

    .mobile-nav-overlay.active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.7);
        z-index: 10000;
    }
}

/* Light Theme Overrides */
[data-theme="light"] header {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .logo {
    color: #1e293b;
}

[data-theme="light"] .nav-menu>li>a {
    color: #1e293b;
}

[data-theme="light"] .nav-menu>li>a:hover {
    color: white;
}

[data-theme="light"] .cart-button,
[data-theme="light"] .theme-toggle,
[data-theme="light"] .chatbot-button,
[data-theme="light"] .mobile-menu-btn {
    color: #1e293b;
}

[data-theme="light"] .dropdown-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .dropdown-content a {
    color: #1e293b;
}

[data-theme="light"] .dropdown-content a:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
}

@media (max-width: 1200px) {
    [data-theme="light"] .nav-menu {
        background: #ffffff;
    }

    [data-theme="light"] .nav-menu>li {
        border-bottom: 1px solid #e2e8f0;
    }

    [data-theme="light"] .dropdown-content {
        background: #f8fafc;
    }
}

/* Mobile Menu Animation */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Global Promo Banner */
.promo-banner {
    background: linear-gradient(90deg, #FF416C 0%, #FF4B2B 100%);
    color: white;
    padding: 10px 0;
    font-size: 0.9rem;
    position: relative;
    z-index: 1001;
}

.promo-banner .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.promo-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.promo-text strong {
    font-weight: 800;
    text-transform: uppercase;
    margin-left: 5px;
}

.promo-timer {
    opacity: 0.9;
    font-size: 0.8rem;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    padding-left: 10px;
    margin-left: 10px;
}

.promo-actions {
    display: flex;
    gap: 10px;
}

.promo-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
    transition: background 0.3s;
}

.promo-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.promo-btn.discord {
    background: #5865F2;
}

.promo-btn.discord:hover {
    background: #4752C4;
}

@media (max-width: 768px) {
    .promo-banner .container {
        justify-content: center;
        text-align: center;
    }

    .promo-timer {
        display: none;
    }
}

/* ===== CRITICAL MOBILE NAVIGATION FIXES ===== */

/* Mobile header layout - keep everything on one row */
@media (max-width: 768px) {
    .nav-container {
        flex-wrap: nowrap !important;
        padding: 10px 15px !important;
        gap: 10px;
    }

    .logo {
        font-size: 18px !important;
        flex-shrink: 0;
    }

    /* Hide nav element that contains menu button on mobile - control via nav-actions */
    header nav {
        flex-grow: 0;
        display: flex;
        align-items: center;
    }

    .mobile-menu-btn {
        font-size: 20px !important;
        padding: 6px !important;
    }

    .nav-actions {
        gap: 6px !important;
        flex-shrink: 0;
    }

    .cart-button,
    .theme-toggle,
    .chatbot-button {
        font-size: 16px !important;
        padding: 6px !important;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    .nav-container {
        padding: 8px 10px !important;
    }

    .logo {
        font-size: 16px !important;
    }

    .logo i {
        display: none;
        /* Hide icon on very small screens */
    }

    .nav-actions {
        gap: 4px !important;
    }

    .cart-button,
    .theme-toggle,
    .chatbot-button {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
    }
}

/* Mobile menu improvements - better contrast and readability */
@media (max-width: 1200px) {
    .nav-menu {
        background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%) !important;
    }

    .nav-menu>li>a {
        color: #ffffff !important;
        font-size: 16px !important;
        padding: 18px 24px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
    }

    .nav-menu>li>a:hover {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    }

    .nav-menu>li>a i:first-child {
        color: #818cf8;
        width: 24px;
        font-size: 16px;
    }

    /* Mobile dropdown styling */
    .dropdown-content a {
        padding: 14px 24px 14px 48px !important;
        color: rgba(255, 255, 255, 0.9) !important;
        background: rgba(0, 0, 0, 0.15) !important;
    }

    .dropdown-content a:hover {
        background: rgba(102, 126, 234, 0.2) !important;
        color: #a5b4fc !important;
    }

    /* Close button positioning */
    .nav-menu::before {
        content: '✕';
        position: absolute;
        top: 20px;
        right: 20px;
        font-size: 24px;
        color: #ffffff;
        cursor: pointer;
        opacity: 0.7;
        pointer-events: none;
    }
}

/* Footer mobile improvements */
@media (max-width: 768px) {
    footer {
        padding: 2rem 1rem !important;
    }

    footer .footer-content {
        flex-direction: column !important;
        gap: 2rem !important;
        text-align: center;
    }

    footer .footer-section {
        width: 100% !important;
        padding: 0 !important;
    }

    footer .footer-section h3 {
        font-size: 1.1rem !important;
        margin-bottom: 1rem !important;
    }

    footer .footer-section ul {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    footer .footer-section ul li a {
        display: inline-block;
        padding: 0.5rem 0;
        font-size: 0.95rem;
    }

    footer .social-links {
        justify-content: center !important;
        gap: 1.5rem !important;
    }

    footer .social-links a {
        width: 44px !important;
        height: 44px !important;
        font-size: 1.2rem !important;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.1);
        transition: all 0.3s ease;
    }

    footer .social-links a:hover {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        transform: scale(1.1);
    }

    footer .footer-bottom {
        padding-top: 1.5rem !important;
        margin-top: 1.5rem !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    footer .footer-bottom p {
        font-size: 0.85rem !important;
    }
}

/* Promo banner mobile improvements */
@media (max-width: 600px) {
    .promo-banner {
        padding: 8px 5px !important;
        font-size: 0.75rem !important;
    }

    .promo-content {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }

    .promo-text {
        font-size: 0.75rem;
    }

    .promo-actions {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }

    .promo-btn {
        padding: 4px 10px !important;
        font-size: 0.7rem !important;
    }
}

/* Touch-friendly targets */
@media (hover: none) and (pointer: coarse) {

    .nav-menu>li>a,
    .dropdown-content a,
    footer a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}