/**
 * JavaESPORTS - Navigation Styles
 * Clean rewrite matching 3rd image ideal state
 * Pure CSS - No framework dependencies
 */

/* ====================
   CSS RESET FOR NAV
   ==================== */

.topbar,
.topbar *,
.topbar *::before,
.topbar *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ====================
   MAIN NAVIGATION BAR
   ==================== */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    /* Ensure topbar stays on top during scroll */
    will-change: transform;
    transform: translateZ(0);
}

.topbar__inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem);
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* ====================
   LOGO
   ==================== */

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    transition: transform 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.logo:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.logo__badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.logo__text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ====================
   DESKTOP NAVIGATION
   ==================== */

.nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    max-width: 800px;
}

/* Hide social section on desktop */
.nav__social-section {
    display: none;
}

.nav__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: all 0.2s ease;
    stroke-width: 2.5;
    opacity: 0.85;
}

.nav__text {
    flex: 1;
}

.nav__link:hover {
    background: rgba(139, 92, 246, 0.15);
    color: #fff;
}

.nav__link:hover .nav__icon {
    transform: scale(1.1);
    opacity: 1;
}

.nav__link--active {
    background: rgba(139, 92, 246, 0.2);
    color: #fff;
    font-weight: 600;
}

.nav__link--active .nav__icon {
    opacity: 1;
    transform: scale(1.05);
}

.nav__link--active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #8b5cf6, transparent);
    border-radius: 2px;
}

/* ====================
   RIGHT CONTROLS
   ==================== */

.topbar__controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* ====================
   LANGUAGE SELECTOR
   ==================== */

.lang-selector {
    position: relative;
}

.lang-selector__button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-selector__button:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
}

    .lang-selector__flag {
        width: 28px;
        height: 20px;
        object-fit: cover;
        border-radius: 4px;
        display: inline-block;
        vertical-align: middle;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
        border: 1.5px solid rgba(255, 255, 255, 0.15);
    }

.lang-selector__code {
    font-size: 0.8125rem;
    letter-spacing: 0.5px;
}

.lang-selector__arrow {
    transition: transform 0.2s ease;
}

.lang-selector__button[aria-expanded="true"] .lang-selector__arrow {
    transform: rotate(180deg);
}

.lang-selector__dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 160px;
    background: rgba(30, 27, 75, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 10000;
    /* Ensure dropdown stays above everything */
    transform: translateY(-8px) translateZ(0);
}

.lang-selector__dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-selector__option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-selector__option:hover {
    background: rgba(139, 92, 246, 0.15);
    color: #fff;
}

.lang-selector__option--active {
    background: rgba(139, 92, 246, 0.2);
    color: #fff;
    font-weight: 600;
}

.lang-selector__option-flag {
    width: 28px;
    height: 18px;
    object-fit: cover;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lang-selector__option-name {
    flex: 1;
}

.lang-selector__check {
    color: #8b5cf6;
    font-weight: 700;
}

/* ====================
   THEME TOGGLE
   ==================== */

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    color: #fff;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.98);
}

.theme-toggle__icon {
    line-height: 1;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-toggle__icon {
    transform: rotate(20deg);
}

/* ====================
   MOBILE MENU TOGGLE
   ==================== */

.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-toggle__line {
    width: 100%;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-toggle.is-active .mobile-toggle__line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.mobile-toggle.is-active .mobile-toggle__line:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.is-active .mobile-toggle__line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ====================
   MOBILE OVERLAY
   ==================== */

.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9998;
}

.mobile-menu-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ====================
   LIGHT MODE STYLES
   ==================== */

[data-theme="light"] .topbar {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 50%, #e8ebff 100%);
    border-bottom-color: rgba(139, 92, 246, 0.15);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
}

[data-theme="light"] .logo {
    color: #1e1b4b;
}

[data-theme="light"] .nav__link {
    color: rgba(30, 27, 75, 0.8);
}

[data-theme="light"] .nav__link:hover {
    background: rgba(139, 92, 246, 0.1);
    color: #1e1b4b;
}

[data-theme="light"] .nav__link--active {
    background: rgba(139, 92, 246, 0.15);
    color: #1e1b4b;
}

[data-theme="light"] .lang-selector__button,
[data-theme="light"] .theme-toggle {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.2);
    color: #1e1b4b;
}

[data-theme="light"] .lang-selector__button:hover,
[data-theme="light"] .theme-toggle:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

[data-theme="light"] .lang-selector__dropdown {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15);
}

[data-theme="light"] .lang-selector__option {
    color: rgba(30, 27, 75, 0.8);
}

[data-theme="light"] .lang-selector__option:hover {
    background: rgba(139, 92, 246, 0.1);
    color: #1e1b4b;
}

[data-theme="light"] .lang-selector__option--active {
    background: rgba(139, 92, 246, 0.15);
    color: #1e1b4b;
}

[data-theme="light"] .mobile-toggle__line {
    background: #1e1b4b;
}

[data-theme="light"] .lang-selector__flag,
[data-theme="light"] .lang-selector__option-flag {
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow: 0 1px 3px rgba(139, 92, 246, 0.15);
}

/* Light mode mobile menu - PREMIUM DESIGN */
@media (max-width: 1023px) {
    [data-theme="light"] .nav {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        border-right: 1px solid rgba(139, 92, 246, 0.2);
        box-shadow: 4px 0 24px rgba(139, 92, 246, 0.15), 
                    8px 0 48px rgba(139, 92, 246, 0.1);
    }
    
    [data-theme="light"] .nav__link {
        color: rgba(30, 27, 75, 0.9);
    }
    
    [data-theme="light"] .nav__link::before {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(124, 58, 237, 0.12));
    }
    
    [data-theme="light"] .nav__link:hover {
        background: rgba(139, 92, 246, 0.12);
        color: #1e1b4b;
    }
    
    [data-theme="light"] .nav__link--active {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.15));
        color: #1e1b4b;
        border-left-color: #7c3aed;
        box-shadow: 0 4px 16px rgba(139, 92, 246, 0.15),
                    inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    
    [data-theme="light"] .nav__link--active::before {
        background: #7c3aed;
        box-shadow: 0 0 8px rgba(124, 58, 237, 0.6);
    }
    
    [data-theme="light"] .nav__link:active {
        background: rgba(139, 92, 246, 0.25);
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
    }
    
    [data-theme="light"] .mobile-menu-overlay {
        background: rgba(30, 27, 75, 0.3);
        backdrop-filter: blur(8px) saturate(120%);
        -webkit-backdrop-filter: blur(8px) saturate(120%);
    }
}

/* ====================
   RESPONSIVE DESIGN
   World-class responsive navigation following international standards
   Breakpoints: Mobile < 1024px | Desktop >= 1024px
   ==================== */

/* Desktop and Laptop - Navigation always visible, NO hamburger menu */
@media (min-width: 1024px) {
    .mobile-toggle {
        display: none !important;
    }
    
    .nav {
        display: flex !important;
        position: static !important;
        flex-direction: row !important;
        transform: none !important;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    .mobile-menu-overlay {
        display: none !important;
    }
}

/* Tablet - Optimize spacing */
@media (min-width: 768px) and (max-width: 1023px) {
    .topbar__inner {
        gap: 1rem;
    }
    
    .nav__link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .logo__text {
        font-size: 1.125rem;
    }
}

/* Mobile and Tablet - Hamburger menu (< 1024px) - PREMIUM DESIGN */
@media (max-width: 1023px) {
    /* Show hamburger menu button */
    .mobile-toggle {
        display: flex;
        position: relative;
        z-index: 10001;
    }
    
    /* Hide navigation by default, show on toggle - Rayhona CRM style slide-in */
    .nav {
        position: fixed;
        top: 0 !important;
        left: 0;
        width: min(85vw, 380px);
        height: 100vh;
        height: 100dvh;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 60px 0 0 0 !important;
        margin: 0 !important;
        /* Ochiqroq gradient - Dark purple to lighter purple */
        background: linear-gradient(165deg, 
            rgba(76, 29, 149, 0.95) 0%, 
            rgba(88, 28, 135, 0.95) 30%,
            rgba(67, 56, 202, 0.92) 70%,
            rgba(79, 70, 229, 0.90) 100%);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overflow-x: hidden;
        z-index: 10000;
        box-shadow: 4px 0 32px rgba(0, 0, 0, 0.4), 
                    8px 0 64px rgba(139, 92, 246, 0.3),
                    inset -1px 0 0 rgba(167, 139, 250, 0.15);
        border-right: 1px solid rgba(167, 139, 250, 0.35);
        border-top-right-radius: 20px;
        border-bottom-right-radius: 20px;
        
        /* IMPORTANT: Hidden by default */
        visibility: hidden;
        pointer-events: none;
        opacity: 0;
        
        /* Smooth scrolling with momentum */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scroll-behavior: smooth;
        
        /* Menyu pastgacha tushishi uchun */
        min-height: 100vh;
        min-height: 100dvh;
    }
    
    /* Show navigation when menu is open - Rayhona CRM style entrance */
    .nav.is-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
        opacity: 1;
    }
    
    /* Animation for menu items - handled by mobile-navigation-premium.css */
    
    /* Mobile navigation links - Premium full width design */
    .nav__link {
        width: 100%;
        padding: 1.125rem 1.5rem;
        font-size: 1.0625rem;
        font-weight: 500;
        border-radius: 0;
        min-height: 56px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
        position: relative;
        overflow: hidden;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        margin: 0;
        border-bottom: 1px solid rgba(139, 92, 246, 0.1);
    }
    
    .nav__link:first-child {
        border-top: 1px solid rgba(139, 92, 246, 0.1);
    }
    
    /* Premium hover effect with gradient */
    .nav__link::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(124, 58, 237, 0.15));
        opacity: 0;
        transition: opacity 0.3s ease;
        z-index: -1;
    }
    
    .nav__link:hover::before {
        opacity: 1;
    }
    
    /* Premium touch feedback with scale and glow */
    .nav__link:active {
        background: rgba(139, 92, 246, 0.25);
        transform: scale(0.97);
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    }
    
    /* Active link - Premium highlighting */
    .nav__link--active {
        background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(124, 58, 237, 0.25));
        color: #fff;
        font-weight: 600;
        border-left: 4px solid #8b5cf6;
        padding-left: calc(1.5rem - 4px);
        box-shadow: 0 4px 16px rgba(139, 92, 246, 0.2),
                    inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    
    .nav__link--active::after {
        display: none;
    }
    
    /* Add subtle icon/indicator for active state */
    .nav__link--active::before {
        content: '';
        position: absolute;
        right: 1.5rem;
        width: 6px;
        height: 6px;
        background: #8b5cf6;
        border-radius: 50%;
        box-shadow: 0 0 8px rgba(139, 92, 246, 0.6);
        animation: pulse 2s infinite;
    }
    
    @keyframes pulse {
        0%, 100% {
            opacity: 1;
            transform: scale(1);
        }
        50% {
            opacity: 0.7;
            transform: scale(1.2);
        }
    }
}

/* Mobile specific - Smaller screens - PREMIUM MOBILE DESIGN */
@media (max-width: 767px) {
    .topbar__inner {
        height: 64px;
        padding: 0 1.25rem;
    }
    
    .logo__badge {
        width: 40px;
        height: 40px;
        font-size: 0.9375rem;
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
    }
    
    .logo__text {
        font-size: 1.1875rem;
        font-weight: 800;
    }
    
    .topbar__controls {
        gap: 0.875rem;
    }
    
    .lang-selector__button {
        padding: 0.625rem 0.875rem;
        min-width: 56px;
        min-height: 48px;
        border-radius: 12px;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        gap: 0.625rem;
    }
    
    .lang-selector__button:active {
        transform: scale(0.95);
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    }
    
    /* Show language code on mobile for clarity */
    .lang-selector__code {
        font-size: 0.875rem;
        font-weight: 700;
        letter-spacing: 0.5px;
    }
    
    .theme-toggle {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    
    .theme-toggle:active {
        transform: scale(0.95) rotate(20deg);
        box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    }
    
    .mobile-toggle {
        min-width: 48px;
        min-height: 48px;
        border-radius: 12px;
        transition: all 0.3s ease;
    }
    
    .mobile-toggle:active {
        background: rgba(139, 92, 246, 0.15);
    }
    
    .nav {
        top: 0;
        width: min(80vw, 320px);
        padding-top: 60px;
    }
    
    .nav::before,
    .nav::after {
        width: min(80vw, 320px);
    }
    
    /* Premium mobile overlay with blur */
    .mobile-menu-overlay {
        backdrop-filter: blur(8px) saturate(120%);
        -webkit-backdrop-filter: blur(8px) saturate(120%);
        background: linear-gradient(135deg, 
            rgba(30, 27, 75, 0.5) 0%,
            rgba(49, 46, 129, 0.45) 100%);
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .logo__text {
        display: none;
    }
    
    .topbar__inner {
        padding: 0 0.75rem;
    }
}

/* Touch device optimizations */
@media (pointer: coarse) {
    .nav__link,
    .lang-selector__button,
    .theme-toggle,
    .mobile-toggle,
    .lang-selector__option {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .nav,
    .nav__link,
    .logo,
    .theme-toggle,
    .lang-selector__dropdown,
    .mobile-menu-overlay {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ====================
   UTILITIES
   ==================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ====================
   NOSCRIPT FALLBACK
   ==================== */

/* Hide all noscript content when JavaScript is enabled */
noscript {
    display: none !important;
}

/* The noscript tag will automatically show its content when JavaScript is disabled */

/* ====================
   PRINT STYLES
   ==================== */

@media print {
    .topbar {
        position: static;
        box-shadow: none;
        border-bottom: 1px solid #ccc;
    }
    
    .mobile-toggle,
    .theme-toggle,
    .lang-selector {
        display: none;
    }
}

