/* ============================================
   MOBILE NAVIGATION FIX - CORRECTED VERSION
   ============================================ */

/* Hide mobile menu button by default on desktop */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    padding: 5px;
    cursor: pointer;
    position: relative;
    z-index: 1001;
    background: transparent;
    border: none;
}

/* Hamburger lines default state */
.mobile-menu-btn span {
    display: block;
    width: 28px;
    height: 3px;
    background-color: #ffffff;
    border-radius: 3px;
    margin: 4px 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    transform-origin: center;
}

/* ============================================
   MOBILE RESPONSIVE (768px and below)
   ============================================ */
@media (max-width: 768px) {
    
    /* Show hamburger menu button */
    .mobile-menu-btn {
        display: flex;
    }
    
    /* Navigation links - hidden by default on mobile */
    .nav-links {
        position: fixed;
        top: 70px; /* Adjust based on navbar height */
        left: 0;
        right: 0;
        width: 100%;
        background: linear-gradient(135deg, #4da7e8 0%, #0273c6 100%);
        flex-direction: column;
        align-items: center;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                    padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 0;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        z-index: 999;
    }
    
    /* Active state - menu slides down */
    .nav-links.active {
        max-height: calc(100vh - 70px);
        padding: 20px 0;
        overflow-y: auto;
    }
    
    /* Navigation links styling */
    .nav-links a {
        display: block;
        width: 90%;
        padding: 12px 20px;
        margin: 5px 0;
        color: #ffffff !important;
        font-size: 16px;
        font-weight: 500;
        text-align: center;
        text-decoration: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        transition: background-color 0.3s ease;
    }
    
    .nav-links a:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .nav-links a:last-child {
        border-bottom: none;
    }
    
    /* Language toggle button */
    .language-toggle {
        width: 90%;
        margin: 10px auto;
        padding: 12px 20px;
        background: rgba(255, 255, 255, 0.2) !important;
        color: #ffffff !important;
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 25px;
        font-size: 14px;
        font-weight: 600;
        text-align: center;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .language-toggle:hover {
        background: rgba(255, 255, 255, 0.3) !important;
        transform: translateY(-1px);
    }
    
    /* AI Assistant button */
    .btn-ai {
        width: 90%;
        margin: 10px auto 15px;
        padding: 12px 20px;
        background: rgba(255, 255, 255, 0.2) !important;
        color: #ffffff !important;
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 25px;
        font-size: 14px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        cursor: pointer;
        transition: all 0.3s ease;
    }
    
    .btn-ai:hover {
        background: rgba(255, 255, 255, 0.3) !important;
        transform: translateY(-1px);
    }
    
    /* Hamburger animation to X */
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
        transform: scale(0);
    }
    
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* Ensure hamburger lines are always visible */
    .navbar .mobile-menu-btn span {
        background-color: #ffffff !important;
    }
    
    /* Fix navbar gradient on mobile */
    .navbar {
        background: linear-gradient(135deg, #4da7e8 0%, #0273c6 100%) !important;
    }
    
    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    /* Hero section adjustments */
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 20px;
    }
    
    .hero-title {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   SMALL MOBILE DEVICES (480px and below)
   ============================================ */
@media (max-width: 480px) {
    
    /* Smaller navbar on very small devices */
    .navbar {
        padding: 10px 0;
    }
    
    .nav-links {
        top: 60px;
    }
    
    .nav-links.active {
        max-height: calc(100vh - 60px);
    }
    
    .logo-image {
        height: 40px !important;
    }
    
    .nav-links a {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .language-toggle,
    .btn-ai {
        font-size: 13px;
        padding: 10px 15px;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
}

/* ============================================
   LANDSCAPE MOBILE (768px width in landscape)
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    
    .nav-links.active {
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    .nav-links a {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .language-toggle,
    .btn-ai {
        padding: 8px 15px;
        margin: 5px auto;
    }
}

/* ============================================
   TABLET PORTRAIT (768px to 1024px)
   ============================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    
    .nav-links {
        gap: 1rem;
    }
    
    .nav-links a {
        font-size: 14px;
    }
    
    .btn-ai {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .language-toggle {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* ============================================
   RTL SUPPORT FOR MOBILE NAVIGATION
   ============================================ */
[dir="rtl"] .mobile-menu-btn {
    margin-right: auto;
    margin-left: 0;
}

[dir="rtl"] .nav-links {
    text-align: right;
}

[dir="rtl"] .nav-links a {
    text-align: right;
}

@media (max-width: 768px) {
    [dir="rtl"] .nav-links {
        right: 0;
        left: 0;
    }
    
    [dir="rtl"] .nav-links.active {
        transform: translateX(0);
    }
    
    [dir="rtl"] .hero-content {
        text-align: right;
    }
    
    [dir="rtl"] .hero-buttons {
        flex-direction: column;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Focus styles for keyboard navigation */
.mobile-menu-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.nav-links a:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: -2px;
}

.language-toggle:focus-visible,
.btn-ai:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

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

/* ============================================
   SMOOTH SCROLL BEHAVIOR
   ============================================ */
html {
    scroll-behavior: smooth;
}

/* Adjust scroll padding for fixed navbar */
html {
    scroll-padding-top: 80px;
}

@media (max-width: 768px) {
    html {
        scroll-padding-top: 70px;
    }
}

@media (max-width: 480px) {
    html {
        scroll-padding-top: 60px;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Use hardware acceleration for animations */
.nav-links,
.mobile-menu-btn span {
    will-change: transform, opacity;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .nav-links,
    .mobile-menu-btn span {
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   DARK MODE SUPPORT (OPTIONAL)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* ============================================
   HIGH CONTRAST MODE SUPPORT
   ============================================ */
@media (prefers-contrast: high) {
    .mobile-menu-btn span {
        background-color: #ffffff !important;
        height: 4px;
    }
    
    .nav-links a {
        border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .navbar,
    .mobile-menu-btn {
        display: none !important;
    }
}
