@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
    /* Fluid typography variables */
    --min-font: 14px;
    --max-font: 18px;
    --min-width: 320px;
    --max-width: 1200px;
    
    /* Colors */
    --primary-green: #5f9f49;
    --dark-green: #1a5632;
    --medium-green: #2d7a4c;
    --light-green: #a8e6cf;
    --accent-green: #4caf50;
    --bright-green: #8bc34a;
    --white: #ffffff;
    --dark-gray: #333333;
    --medium-gray: #555555;
    --light-gray: #f0f0f0;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* ============================================
   MOBILE RESPONSIVENESS FIXES - UPDATED
   ============================================ */

/* Base mobile fixes */
html, body {
    width: 100%;
    overflow-x: hidden;
    position: relative;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    touch-action: pan-y;
    max-width: 100vw;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--light-gray);
    overflow-x: hidden;
    color: var(--dark-gray);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    line-height: 1.5;
    font-size: 16px !important; /* Base font size for mobile */
}

html {
    height: -webkit-fill-available;
}

/* Fix all containers to prevent horizontal overflow */
.nav-container,
.main-content,
.footer-container,
.boxes-container,
.typing-container {
    max-width: 100vw;
    overflow-x: hidden;
    width: 100%;
}

/* ============================================
   PROFESSIONAL MOBILE HEADER - FIXED
   ============================================ */

/* Professional compact header */
header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08) !important;
    border-bottom: 1px solid rgba(95, 159, 73, 0.15) !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 70px !important;
}

/* iOS Safe Area Support */
@supports (padding-top: env(safe-area-inset-top)) {
    header {
        padding-top: env(safe-area-inset-top) !important;
        height: calc(70px + env(safe-area-inset-top)) !important;
    }
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px !important;
    position: relative;
    min-height: 70px !important;
    background: transparent !important;
}

/* Compact logo container for mobile */
.logo-container {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 10px;
    order: 1;
}

.logo-img {
    width: 42px !important;
    height: 42px !important;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(95, 159, 73, 0.1);
    flex-shrink: 0;
}

.logo-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.logo {
    font-size: 13px !important;
    font-weight: 600;
    color: #222;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    letter-spacing: -0.2px;
    display: block;
}

.logo span {
    color: var(--primary-green);
    font-weight: 700;
    font-size: 13px !important;
}

/* Compact navigation box - Hide on mobile, only show menu button */
.nav-box {
    display: none !important; /* Hide desktop nav on mobile */
}

/* Professional mobile menu button */
.mobile-menu-btn {
    display: flex !important;
    background: var(--primary-green);
    border: none;
    border-radius: 12px;
    width: 44px !important;
    height: 44px !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1002;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    order: 3;
    flex-shrink: 0;
    position: relative;
    margin-left: 0;
    box-shadow: 0 4px 12px rgba(95, 159, 73, 0.25);
    padding: 0;
}

.mobile-menu-btn i {
    font-size: 1.1rem !important;
    color: white;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    background: var(--medium-green);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(95, 159, 73, 0.35);
}

.mobile-menu-btn:active {
    transform: scale(0.95);
}

.mobile-menu-btn.active {
    background: var(--dark-green);
}

/* ============================================
   SUPERB MODERN MOBILE MENU DESIGN WITH ANIMATED GREEN BACKGROUND
   ============================================ */

/* Modern Mobile Menu Design */
@media (max-width: 767px) {
    .nav-box {
        display: none !important;
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh !important;
        background: linear-gradient(135deg, 
            rgba(26, 86, 50, 0.98),  /* --dark-green */
            rgba(45, 122, 76, 0.95), /* --medium-green */
            rgba(95, 159, 73, 0.92)  /* --primary-green */
        );
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 1001;
        padding: 100px 0 40px;
        box-shadow: -10px 0 50px rgba(0, 0, 0, 0.3);
        overflow-y: auto;
        overflow-x: hidden;
        border-left: 1px solid rgba(168, 230, 207, 0.3); /* --light-green */
        pointer-events: all !important;
        isolation: isolate;
    }
    
    /* Animated gradient background */
    .nav-box::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(
            45deg,
            rgba(26, 86, 50, 0.8),    /* --dark-green */
            rgba(45, 122, 76, 0.7),   /* --medium-green */
            rgba(95, 159, 73, 0.6),   /* --primary-green */
            rgba(76, 175, 80, 0.7),   /* --accent-green */
            rgba(139, 195, 74, 0.6),  /* --bright-green */
            rgba(168, 230, 207, 0.5)  /* --light-green */
        );
        background-size: 400% 400%;
        animation: gradientShift 12s ease infinite;
        -webkit-animation: gradientShift 12s ease infinite;
        z-index: -1;
        opacity: 0.9;
    }
    
    /* Floating particle effect */
    .nav-box::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-image: 
            radial-gradient(circle at 20% 30%, rgba(168, 230, 207, 0.2) 0%, transparent 50%),
            radial-gradient(circle at 80% 60%, rgba(76, 175, 80, 0.15) 0%, transparent 50%),
            radial-gradient(circle at 40% 80%, rgba(95, 159, 73, 0.1) 0%, transparent 50%),
            radial-gradient(circle at 60% 20%, rgba(139, 195, 74, 0.15) 0%, transparent 50%);
        background-size: 300% 300%;
        animation: particlesFloat 20s linear infinite;
        -webkit-animation: particlesFloat 20s linear infinite;
        z-index: -1;
        opacity: 0.6;
    }
    
    .nav-box.active {
        display: block !important;
        right: 0;
        z-index: 1001 !important;
    }
    
    /* Modern menu header */
    .nav-box::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 100px;
        background: linear-gradient(to bottom, 
            rgba(255, 255, 255, 0.1), 
            transparent);
        z-index: -1;
        pointer-events: none;
    }
    
    /* Menu title */
    .menu-title {
        position: absolute;
        top: 40px;
        left: 0;
        right: 0;
        text-align: center;
        color: white;
        font-size: 1.2rem;
        font-weight: 600;
        letter-spacing: 1px;
        text-transform: uppercase;
        padding: 0 25px;
        opacity: 0.9;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        z-index: 1;
    }
    
    .menu-title::after {
        content: '';
        display: block;
        width: 40px;
        height: 2px;
        background: rgba(255, 255, 255, 0.5);
        margin: 8px auto 0;
        border-radius: 2px;
    }
    
    nav ul {
        flex-direction: column;
        padding: 0 25px !important;
        gap: 8px;
        pointer-events: all !important;
        position: relative;
        z-index: 2;
    }
    
    nav li {
        width: 100%;
        margin: 0;
        position: relative;
    }
    
    /* Ultra-modern menu links */
    nav a {
        padding: 18px 24px !important;
        border-radius: 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        font-size: 16px !important;
        font-weight: 600;
        color: white;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        min-height: 56px !important;
        position: relative;
        overflow: hidden;
        pointer-events: all !important;
        letter-spacing: 0.3px;
    }
    
    /* Glow effect on hover */
    nav a::before {
        content: '';
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        background: linear-gradient(45deg, 
            rgba(168, 230, 207, 0.3),  /* --light-green */
            rgba(95, 159, 73, 0.3),    /* --primary-green */
            rgba(76, 175, 80, 0.3)     /* --accent-green */
        );
        border-radius: 18px;
        z-index: -1;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    /* Modern hover effect */
    nav a::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        width: 4px;
        height: 0;
        background: linear-gradient(to bottom, 
            var(--light-green), 
            var(--primary-green));
        border-radius: 0 2px 2px 0;
        transform: translateY(-50%);
        transition: height 0.3s ease;
        box-shadow: 0 0 10px rgba(168, 230, 207, 0.5);
    }
    
    nav a:hover::before,
    nav a.active::before {
        opacity: 1;
        animation: glowPulse 2s ease-in-out infinite;
        -webkit-animation: glowPulse 2s ease-in-out infinite;
    }
    
    nav a:hover::after,
    nav a.active::after {
        height: 40px;
    }
    
    nav a:hover {
        background: rgba(255, 255, 255, 0.15);
        transform: translateX(-10px);
        border-color: rgba(255, 255, 255, 0.3);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
        color: var(--light-green);
    }
    
    nav a.active {
        background: rgba(255, 255, 255, 0.2);
        border-color: var(--light-green);
        color: var(--light-green);
    }
    
    /* Menu icon styling */
    nav a i:first-child {
        margin-right: 12px;
        font-size: 1.1rem;
        width: 24px;
        text-align: center;
        opacity: 0.9;
    }
    
    /* Chevron styling */
    nav a i.fa-chevron-down {
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        font-size: 0.85rem !important;
        color: rgba(255, 255, 255, 0.8);
        margin-left: 8px;
    }
    
    .dropdown.active > a i.fa-chevron-down {
        transform: rotate(180deg);
        color: var(--light-green);
    }
    
    /* Remove dropdown content since we're using modals now */
    .dropdown-content {
        display: none !important;
    }
}

/* Mobile menu backdrop overlay - FIXED */
.mobile-menu-backdrop {
    display: none !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none !important;
}

/* Only show and enable backdrop when menu is active */
.mobile-menu-backdrop.active {
    display: block !important;
    opacity: 1;
    pointer-events: all !important;
}

/* ============================================
   CRITICAL FIX: CONTENT VISIBILITY
   ============================================ */

/* Adjust main content for fixed header - FIXED */
.main-content {
    max-width: 1200px;
    margin: 100px auto 50px !important; /* Increased top margin */
    padding: 0 clamp(15px, 3vw, 20px);
    text-align: center;
    position: relative;
    z-index: 1;
    opacity: 1 !important;
    visibility: visible !important;
}

@media (max-width: 767px) {
    .main-content {
        margin-top: 90px !important; /* Increased space for fixed header */
        padding-top: 15px !important;
        scroll-margin-top: 90px !important;
    }
    
    .typing-container {
        padding-top: 20px !important;
        margin-top: 10px !important;
        opacity: 1 !important;
        transform: none !important;
        animation: fadeIn 0.5s ease !important;
    }
    
    .welcome-text {
        margin-top: 15px !important;
        padding-top: 10px !important;
        position: relative;
        z-index: 1;
        transform: none !important;
        line-height: 1.2 !important;
    }
    
    .welcome-text span {
        display: inline-block;
        transform: none !important;
    }
}

/* ============================================
   DESKTOP NAVIGATION FIX - UPDATED
   ============================================ */

/* Show desktop navigation properly */
@media (min-width: 768px) {
    /* Reset header for desktop */
    header {
        position: relative !important;
        padding: 10px 0 !important;
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08) !important;
        height: auto !important;
    }
    
    .nav-container {
        padding: 10px 20px !important;
        min-height: 70px !important;
    }
    
    .logo-img {
        width: 60px !important;
        height: 60px !important;
    }
    
    .logo {
        font-size: 16px !important;
    }
    
    .nav-box {
        display: block !important; /* Force show on desktop */
        visibility: visible !important;
        opacity: 1 !important;
        position: static !important;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 40px;
        padding: 8px 20px !important;
        box-shadow: 0 5px 20px var(--shadow-color);
        animation: float 3s ease-in-out infinite;
        -webkit-animation: float 3s ease-in-out infinite;
        transition: all 0.3s ease;
        z-index: 1001;
        order: 2;
        flex-shrink: 0;
        overflow: visible !important;
        width: auto;
        height: auto;
        max-width: none;
    }

    /* Reset mobile menu styles */
    .nav-box::before,
    .nav-box::after,
    .menu-title,
    .menu-footer {
        display: none !important;
    }

    /* Fix nav positioning */
    nav {
        display: block !important;
    }

    nav ul {
        display: flex !important;
        flex-direction: row !important;
        gap: 15px;
        padding: 0 !important;
        margin: 0 !important;
        position: static !important;
        height: auto !important;
        overflow: visible !important;
        background: transparent !important;
    }

    nav li {
        width: auto !important;
        margin: 0 !important;
        position: relative !important;
    }

    nav a {
        background: transparent !important;
        backdrop-filter: none !important;
        border: none !important;
        color: var(--dark-gray) !important;
        padding: 8px 15px !important;
        font-size: 14px !important;
        font-weight: 600;
        min-height: auto !important;
        text-shadow: none !important;
        transform: none !important;
        border-radius: 20px !important;
        transition: all 0.3s ease !important;
    }

    nav a:hover {
        color: var(--primary-green) !important;
        background: rgba(95, 159, 73, 0.1) !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 5px 15px rgba(95, 159, 73, 0.2) !important;
    }

    nav a::after {
        content: '';
        position: absolute;
        width: 0;
        height: 2px;
        background: var(--primary-green);
        bottom: -5px;
        left: 0;
        transition: width 0.3s ease;
    }

    nav a:hover::after {
        width: 100%;
    }

    /* Hide mobile menu button on desktop */
    .mobile-menu-btn {
        display: none !important;
    }

    .mobile-menu-backdrop {
        display: none !important;
    }
    
    /* Reset main content margin for desktop */
    .main-content {
        margin: clamp(30px, 5vw, 50px) auto !important;
    }
}

/* Desktop (1024px and above) */
@media (min-width: 1024px) {
    .logo-img {
        width: 70px !important;
        height: 70px !important;
    }
    
    .logo {
        font-size: 18px !important;
    }
    
    nav ul li a {
        font-size: 15px !important;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
    100% {
        transform: translateY(0px);
    }
}

@-webkit-keyframes float {
    0% {
        -webkit-transform: translateY(0px);
        transform: translateY(0px);
    }
    50% {
        -webkit-transform: translateY(-5px);
        transform: translateY(-5px);
    }
    100% {
        -webkit-transform: translateY(0px);
        transform: translateY(0px);
    }
}

/* ============================================
   ENHANCED RTL ARABIC SUPPORT - UPDATED
   ============================================ */

/* RTL Base Styles */
body[dir="rtl"] {
    text-align: right;
    direction: rtl;
}

/* Logo and Header RTL */
body[dir="rtl"] .logo-container {
    flex-direction: row-reverse;
}

body[dir="rtl"] .logo-text {
    text-align: right;
    margin-left: 0;
    margin-right: 10px;
}

body[dir="rtl"] .logo {
    text-align: right;
}

/* Desktop Navigation RTL */
@media (min-width: 768px) {
    body[dir="rtl"] .nav-box ul {
        text-align: right;
        flex-direction: row;
    }
    
    body[dir="rtl"] nav a {
        text-align: right;
    }
    
    body[dir="rtl"] nav a::after {
        left: auto;
        right: 0;
    }
}

/* Mobile Menu RTL */
@media (max-width: 767px) {
    body[dir="rtl"] .nav-box {
        left: -100%;
        right: auto;
        border-left: none;
        border-right: 1px solid rgba(168, 230, 207, 0.3);
    }
    
    body[dir="rtl"] .nav-box.active {
        left: 0;
        right: auto;
    }
    
    body[dir="rtl"] nav a {
        text-align: right;
        flex-direction: row-reverse;
    }
    
    body[dir="rtl"] nav a::after {
        left: auto;
        right: 0;
        border-radius: 2px 0 0 2px;
    }
    
    body[dir="rtl"] nav a i.fa-chevron-down {
        margin-left: 0;
        margin-right: 8px;
    }
    
    body[dir="rtl"] nav a i:first-child {
        margin-right: 0;
        margin-left: 12px;
    }
}

/* Content RTL */
body[dir="rtl"] .main-text,
body[dir="rtl"] .mission-statement,
body[dir="rtl"] .box p,
body[dir="rtl"] .modal-content p,
body[dir="rtl"] .footer-box p,
body[dir="rtl"] .contact-info span {
    text-align: right;
}

/* Modal RTL */
body[dir="rtl"] .modal-tabs {
    flex-direction: row-reverse;
}

body[dir="rtl"] .close {
    float: left;
    right: auto;
    left: 15px;
}

body[dir="rtl"] .modal-tab {
    border-left: 3px solid transparent;
    border-right: none;
}

body[dir="rtl"] .modal-tab.active {
    border-left: 3px solid var(--light-green);
    border-right: none;
}

/* Buttons RTL */
body[dir="rtl"] .discover-btn,
body[dir="rtl"] .submit-btn {
    flex-direction: row-reverse;
}

body[dir="rtl"] .discover-btn i,
body[dir="rtl"] .submit-btn i {
    margin-left: 0;
    margin-right: 8px;
    transform: rotate(180deg);
}

body[dir="rtl"] .discover-btn:hover i,
body[dir="rtl"] .submit-btn:hover i {
    transform: translateX(-5px) rotate(180deg);
}

/* Form RTL */
body[dir="rtl"] .form-group label {
    text-align: right;
    display: block;
    width: 100%;
}

body[dir="rtl"] .floating-form-group label {
    right: auto;
    left: 12px;
}

body[dir="rtl"] .form-control {
    text-align: right;
}

body[dir="rtl"] .floating-form-group input:focus ~ label,
body[dir="rtl"] .floating-form-group input:not(:placeholder-shown) ~ label,
body[dir="rtl"] .floating-form-group textarea:focus ~ label,
body[dir="rtl"] .floating-form-group textarea:not(:placeholder-shown) ~ label {
    transform: translateY(-24px) translateX(-12px);
}

/* Contact Info RTL */
body[dir="rtl"] .contact-info {
    flex-direction: row-reverse;
    text-align: right;
}

body[dir="rtl"] .contact-info i {
    margin-right: 0;
    margin-left: 10px;
}

/* Social Links RTL - Keep natural order */
body[dir="rtl"] .social-links {
    direction: ltr;
}

/* Footer Links RTL */
body[dir="rtl"] .footer-box:nth-child(2) .contact-info i {
    margin-right: 0;
    margin-left: 10px;
}

body[dir="rtl"] .footer-box:nth-child(2) .contact-info span {
    text-align: right;
}

/* Ensure Arabic font stack */
body[dir="rtl"],
.arabic-font {
    font-family: 'Segoe UI', 'Noto Sans Arabic', Tahoma, Geneva, Verdana, sans-serif;
}

body[dir="rtl"] .logo,
body[dir="rtl"] h1,
body[dir="rtl"] h2,
body[dir="rtl"] h3 {
    font-family: 'Segoe UI', 'Noto Sans Arabic', Tahoma, Geneva, Verdana, sans-serif;
}

/* ============================================
   OPTIONS MODAL SYSTEM (REPLACES DROPDOWNS)
   ============================================ */

/* ============================================
   PROFESSIONAL OPTIONS MODAL SYSTEM (REPLACES DROPDOWNS)
   ============================================ */

.options-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1004;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
    -webkit-animation: fadeIn 0.3s ease;
}

.options-modal-content {
    background: rgba(26, 86, 50, 0.95); /* --dark-green with opacity */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 25px 30px;
    width: 90%;
    max-width: 450px; /* Smaller max-width */
    max-height: 70vh; /* Smaller height */
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(168, 230, 207, 0.2);
}

.options-modal h2 {
    color: var(--white);
    text-align: center;
    margin-bottom: 20px; /* Smaller margin */
    font-size: 1.4rem; /* Smaller font */
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* Smaller columns */
    gap: 15px; /* Smaller gap */
    margin-top: 15px; /* Smaller margin */
}

.option-card {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px; /* Smaller radius */
    padding: 20px 15px; /* Smaller padding */
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    min-height: 130px; /* Smaller height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.option-card:hover {
    transform: translateY(-5px) scale(1.03); /* Subtle hover */
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(168, 230, 207, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.option-card:active {
    transform: translateY(-2px) scale(1.01);
}

.option-icon {
    width: 50px; /* Smaller icon */
    height: 50px; /* Smaller icon */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px; /* Smaller margin */
    font-size: 1.4rem; /* Smaller font */
    color: var(--light-green);
    transition: all 0.3s ease;
}

.flag-icon {
    font-size: 1.8rem; /* Smaller flag */
    background: transparent;
}

.option-card:hover .option-icon {
    transform: scale(1.05); /* Subtle scale */
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
}

.option-card h3 {
    color: var(--white);
    margin-bottom: 6px; /* Smaller margin */
    font-size: 1.1rem; /* Smaller font */
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    line-height: 1.3;
}

.option-card p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem; /* Smaller font */
    line-height: 1.3;
    margin: 0;
    opacity: 0.9;
}

.options-close {
    position: absolute;
    top: 12px; /* Closer to edge */
    right: 15px; /* Closer to edge */
    color: rgba(255, 255, 255, 0.8);
    font-size: 24px; /* Smaller close button */
    font-weight: 300; /* Thinner */
    cursor: pointer;
    width: 36px; /* Smaller */
    height: 36px; /* Smaller */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
    background: rgba(0, 0, 0, 0.2);
}

.options-close:hover {
    color: var(--light-green);
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

/* RTL Support for Options Modal */
body[dir="rtl"] .options-close {
    right: auto;
    left: 15px;
}

body[dir="rtl"] .option-card h3,
body[dir="rtl"] .option-card p {
    text-align: center;
}

/* Animation for modal */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@-webkit-keyframes slideUp {
    from {
        opacity: 0;
        -webkit-transform: translateY(30px);
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

/* Mobile Responsive for Options Modal */
@media (max-width: 767px) {
    .options-modal-content {
        width: 85%;
        padding: 20px 15px;
        margin: 10px;
        border-radius: 14px;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .option-card {
        min-height: 110px;
        padding: 15px 12px;
        border-radius: 10px;
    }
    
    .option-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    
    .flag-icon {
        font-size: 1.6rem;
    }
    
    .options-modal h2 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .option-card h3 {
        font-size: 1rem;
    }
    
    .option-card p {
        font-size: 0.75rem;
    }
    
    .options-close {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    
    body[dir="rtl"] .options-close {
        right: auto;
        left: 10px;
    }
}

/* Small phones */
@media (max-width: 360px) {
    .options-modal-content {
        width: 90%;
        padding: 15px 12px;
    }
    
    .option-card {
        min-height: 100px;
        padding: 12px 10px;
    }
    
    .option-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
    
    .flag-icon {
        font-size: 1.4rem;
    }
    
    .options-modal h2 {
        font-size: 1.1rem;
    }
    
    .option-card h3 {
        font-size: 0.95rem;
    }
    
    .option-card p {
        font-size: 0.7rem;
    }
}

/* Desktop - Make it more compact */
@media (min-width: 768px) {
    .options-modal-content {
        max-width: 420px; /* Even smaller on desktop */
        padding: 22px 25px;
    }
    
    .options-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .option-card {
        min-height: 120px;
        padding: 18px 12px;
    }
    
    .option-card:hover {
        transform: translateY(-4px) scale(1.02);
    }
}

/* Tablet specific */
@media (min-width: 768px) and (max-width: 1023px) {
    .options-modal-content {
        max-width: 400px;
    }
    
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop hover effects - subtle and professional */
@media (min-width: 1024px) {
    .option-card {
        transition: all 0.3s ease;
    }
    
    .option-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, 
            rgba(168, 230, 207, 0.1), 
            rgba(95, 159, 73, 0.1));
        border-radius: 12px;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .option-card:hover::before {
        opacity: 1;
    }
    
    .option-card:hover {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    }
}

/* Fix for very small content */
.language-options-container {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 5px;
}

.language-options-container::-webkit-scrollbar {
    width: 6px;
}

.language-options-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.language-options-container::-webkit-scrollbar-thumb {
    background: rgba(168, 230, 207, 0.3);
    border-radius: 3px;
}

.language-options-container::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 230, 207, 0.5);
}

/* ============================================
   MOBILE RESPONSIVE TYPOGRAPHY - FIXED
   ============================================ */

/* Base responsive typography for mobile */
@media (max-width: 767px) {
    .logo {
        font-size: 13px !important;
        white-space: nowrap;
        line-height: 1.3;
        max-width: 100%;
        text-align: left;
        word-break: break-word;
        padding: 0;
        margin-right: 0;
    }
    
    .nav-container {
        padding: 12px 15px !important;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        min-height: 70px !important;
    }
    
    .logo-container {
        display: flex;
        align-items: center;
        flex: 1;
        min-width: 0;
        gap: 8px;
    }
    
    .logo img {
        width: 42px !important;
        height: 42px !important;
        margin-right: 8px;
    }
    
    .logo-text {
        flex: 1;
        overflow: hidden;
    }
    
    .logo span {
        display: inline;
    }
    
    .welcome-text {
        font-size: 2.2rem !important;
        line-height: 1.2;
        margin-bottom: 15px;
        padding: 0 5px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        position: relative;
        z-index: 1;
    }
    
    .academy-subtitle {
        font-size: 1.3rem !important;
        line-height: 1.3;
        padding: 15px 20px;
        text-align: center;
        max-width: 95%;
        word-break: break-word;
        white-space: normal;
        position: relative;
        z-index: 1;
    }
    
    .mission-statement {
        font-size: 1.1rem !important;
        padding: 20px 15px;
        line-height: 1.5;
        text-align: center;
        position: relative;
        z-index: 1;
    }
    
    .main-text p {
        font-size: 1rem !important;
        padding: 0 15px;
        line-height: 1.5;
        position: relative;
        z-index: 1;
    }
    
    /* Fix body text readability */
    body {
        font-size: 16px !important;
        line-height: 1.5 !important;
    }
    
    p, li, span {
        font-size: 1rem !important;
        line-height: 1.5 !important;
    }
}

/* Small phones (0-360px) */
@media (max-width: 360px) {
    .logo {
        font-size: 12px !important;
    }
    
    .logo-img {
        width: 38px !important;
        height: 38px !important;
    }
    
    .mobile-menu-btn {
        width: 40px !important;
        height: 40px !important;
    }
    
    .mobile-menu-btn i {
        font-size: 1rem !important;
    }
    
    .welcome-text {
        font-size: 1.8rem !important;
        margin-top: 10px !important;
    }
    
    .academy-subtitle {
        font-size: 1.1rem !important;
        padding: 12px 15px;
    }
    
    .boxes-container {
        padding: 0 10px;
    }
    
    .box {
        padding: 20px 15px !important;
        margin-bottom: 25px;
    }
    
    .box-image-container {
        height: 180px !important;
        min-height: 180px !important;
        max-height: 180px !important;
    }
    
    /* Adjust mobile menu for very small screens */
    .nav-box {
        width: 90%;
        max-width: 280px;
        padding: 90px 0 40px;
    }
    
    nav ul {
        padding: 0 20px !important;
    }
    
    nav a {
        padding: 16px 20px !important;
        font-size: 15px !important;
    }
    
    .menu-title {
        font-size: 1.1rem;
        top: 35px;
    }
}

/* Medium phones (361-480px) */
@media (min-width: 361px) and (max-width: 480px) {
    .logo {
        font-size: 13px !important;
    }
    
    .logo-img {
        width: 40px !important;
        height: 40px !important;
    }
    
    .welcome-text {
        font-size: 2rem !important;
    }
    
    .academy-subtitle {
        font-size: 1.2rem !important;
        padding: 15px 20px;
    }
    
    .box-image-container {
        height: 200px !important;
        min-height: 200px !important;
        max-height: 200px !important;
    }
}

/* Large phones (481-767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .logo {
        font-size: 14px !important;
    }
    
    .logo-img {
        width: 44px !important;
        height: 44px !important;
    }
    
    .welcome-text {
        font-size: 2.5rem !important;
    }
    
    .academy-subtitle {
        font-size: 1.4rem !important;
        padding: 18px 25px;
    }
    
    .box-image-container {
        height: 240px !important;
        min-height: 240px !important;
        max-height: 240px !important;
    }
}

/* ============================================
   TOUCH-FRIENDLY SIZES (Apple's guidelines)
   ============================================ */
@media (max-width: 767px) {
    /* Minimum touch target sizes */
    button,
    .discover-btn,
    .submit-btn,
    .social-link,
    .contact-info,
    nav ul li a,
    .option-card {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Ensure proper padding for touch */
    nav ul li a,
    .option-card,
    .discover-btn {
        padding: 12px 20px !important;
    }
    
    /* Input fields should be at least 44px */
    input,
    textarea,
    select {
        min-height: 44px !important;
        font-size: 16px !important; /* Prevents iOS zoom */
    }
    
    /* Buttons sizing */
    .discover-btn {
        padding: 12px 20px !important;
        font-size: 15px !important;
        min-height: 45px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        max-width: 100%;
    }
    
    .submit-btn {
        padding: 12px 20px !important;
        font-size: 15px !important;
        min-height: 45px;
    }
    
    /* Contact info sizing */
    .contact-info {
        padding: 12px !important;
        font-size: 0.95rem !important;
        min-height: 45px;
    }
    
    .contact-info i {
        font-size: 1.1rem !important;
        min-width: 35px;
    }
    
    /* Social links sizing */
    .social-link {
        width: 45px !important;
        height: 45px !important;
        min-height: 45px !important;
        min-width: 45px !important;
        font-size: 1.2rem !important;
    }
}

@media (max-width: 480px) {
    .nav-box {
        width: 85%;
    }
    
    nav a {
        padding: 16px 20px !important;
        font-size: 15px !important;
    }
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ============================================
   FIX HORIZONTAL SCROLLING
   ============================================ */
@media (max-width: 767px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative !important;
    }
    
    .nav-container,
    .main-content,
    .boxes-container,
    .footer-container {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    
    .box {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .main-content {
        padding: 0 15px !important;
        margin: 10px auto !important;
    }
    
    .boxes-container {
        padding: 0 10px !important;
    }
}

/* ============================================
   FIX IMAGE RESPONSIVENESS
   ============================================ */
@media (max-width: 767px) {
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    .box-main-image {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    
    .hero-logo img {
        width: 100px !important;
        max-width: 40vw !important;
        height: auto !important;
    }
}

/* Animated background */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(-45deg, var(--light-gray), #e0e0e0, var(--light-gray), #e0e0e0);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    -webkit-animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@-webkit-keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* About modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1003;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.3s;
    -webkit-animation: fadeIn 0.3s;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background: linear-gradient(135deg, var(--dark-green), var(--medium-green), var(--primary-green));
    margin: 15vh auto;
    padding: clamp(20px, 3vw, 30px);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    color: var(--white);
    animation: slideDown 0.4s;
    -webkit-animation: slideDown 0.4s;
    isolation: isolate;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@-webkit-keyframes slideDown {
    from {
        -webkit-transform: translateY(-50px);
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        -webkit-transform: translateY(0);
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: var(--white);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    color: var(--light-green);
}

.modal-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
}

.modal-tab {
    padding: clamp(8px, 1.5vw, 10px) clamp(15px, 2vw, 20px);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    color: var(--white);
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-size: clamp(14px, 1.5vw, 16px);
    min-height: 44px;
    display: flex;
    align-items: center;
}

.modal-tab.active {
    border-bottom: 3px solid var(--light-green);
    color: var(--light-green);
    font-weight: bold;
}

.modal-tab:hover {
    color: var(--light-green);
}

.tab-content {
    display: none;
    padding: 10px 0;
    animation: fadeIn 0.3s ease-out;
    -webkit-animation: fadeIn 0.3s ease-out;
    position: relative;
    z-index: 1;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    color: var(--white);
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    animation: none;
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
    position: static;
}

.tab-content p {
    line-height: 1.6;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-size: clamp(0.9rem, 2vw, 1rem);
    animation: none;
    position: static;
}

/* Hero Section with Logo and Title */
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: clamp(25px, 5vw, 50px);
    position: relative;
}

/* Logo above the title */
.hero-logo {
    margin-bottom: clamp(15px, 3vw, 25px);
    animation: fadeInDown 1s ease-out;
    -webkit-animation: fadeInDown 1s ease-out;
}

.hero-logo img {
    width: clamp(100px, 20vw, 180px);
    height: auto;
    object-fit: contain;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.hero-logo img:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@-webkit-keyframes fadeInDown {
    from {
        opacity: 0;
        -webkit-transform: translateY(-30px);
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

/* Enhanced Welcome Text */
.typing-container {
    display: inline-block;
    position: relative;
    margin-bottom: clamp(20px, 4vw, 40px);
    text-align: center;
    width: 100%;
    padding: 0 10px;
}

.welcome-text {
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 800;
    text-align: center;
    line-height: 1.1;
    margin-bottom: clamp(10px, 2vw, 15px);
    position: relative;
    display: block;
    width: 100%;
    letter-spacing: -0.5px;
}

.welcome-text span {
    background: linear-gradient(135deg, 
        var(--dark-green) 0%, 
        var(--medium-green) 25%, 
        var(--primary-green) 50%, 
        var(--bright-green) 75%, 
        var(--light-green) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
    -webkit-animation: gradientShift 8s ease infinite;
    position: relative;
    display: inline-block;
    padding: 0 5px;
}

.welcome-text span::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent);
    transform: skewX(-15deg);
    animation: textShine 6s ease-in-out infinite;
    -webkit-animation: textShine 6s ease-in-out infinite;
}

.academy-subtitle {
    font-size: clamp(1.3rem, 4vw, 2.2rem);
    color: var(--dark-gray);
    font-weight: 700;
    margin-bottom: clamp(30px, 5vw, 50px);
    position: relative;
    display: inline-block;
    padding: clamp(10px, 2vw, 15px) clamp(25px, 4vw, 40px);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 60px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    border: 3px solid rgba(95, 159, 73, 0.4);
    animation: subtitleFloat 6s ease-in-out infinite;
    -webkit-animation: subtitleFloat 6s ease-in-out infinite;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.3;
    max-width: 90%;
}

.mission-statement {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--medium-gray);
    max-width: min(900px, 95%);
    margin: 0 auto clamp(35px, 6vw, 60px);
    line-height: 1.7;
    padding: clamp(20px, 4vw, 35px);
    background: linear-gradient(135deg, 
        rgba(168, 230, 207, 0.15), 
        rgba(95, 159, 73, 0.15));
    border-radius: 25px;
    border-left: 6px solid var(--primary-green);
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

.mission-statement::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, 
        var(--light-green), 
        var(--primary-green), 
        var(--medium-green));
}

@keyframes textShine {
    0%, 100% {
        left: -100%;
    }
    50% {
        left: 100%;
    }
}

@-webkit-keyframes textShine {
    0%, 100% {
        left: -100%;
    }
    50% {
        left: 100%;
    }
}

@keyframes subtitleFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@-webkit-keyframes subtitleFloat {
    0%, 100% {
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
    50% {
        -webkit-transform: translateY(-10px);
        transform: translateY(-10px);
    }
}

/* Enhanced Brainy Academy text box */
.main-text {
    background: rgba(100, 100, 100, 0.9);
    padding: clamp(20px, 3vw, 30px);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: clamp(30px, 5vw, 50px);
    animation: fadeIn 1s ease-out;
    -webkit-animation: fadeIn 1s ease-out;
    position: relative;
    overflow: hidden;
    color: var(--white);
    border: none;
    z-index: 1;
    margin-left: auto;
    margin-right: auto;
    max-width: min(900px, 95%);
}

.main-text::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to bottom right,
            rgba(255, 255, 255, 0.1),
            rgba(255, 255, 255, 0.3),
            rgba(255, 255, 255, 0.1));
    transform: rotate(45deg);
    animation: shine 6s linear infinite;
    -webkit-animation: shine 6s linear infinite;
    z-index: -1;
}

.main-text::after {
    content: '';
    position: absolute;
    inset: 0;
    padding: 3px;
    border-radius: 20px;
    background: linear-gradient(135deg,
            rgba(200, 200, 200, 0.8),
            rgba(150, 150, 150, 0.6),
            rgba(200, 200, 200, 0.8));
    background-size: 200% 200%;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: borderGlow 4s ease infinite;
    -webkit-animation: borderGlow 4s ease infinite;
    z-index: -1;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

@-webkit-keyframes shine {
    0% {
        -webkit-transform: translateX(-100%) rotate(45deg);
        transform: translateX(-100%) rotate(45deg);
    }
    100% {
        -webkit-transform: translateX(100%) rotate(45deg);
        transform: translateX(100%) rotate(45deg);
    }
}

@keyframes borderGlow {
    0%, 100% {
        background-position: 0% 50%;
        opacity: 0.8;
    }
    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
}

@-webkit-keyframes borderGlow {
    0%, 100% {
        background-position: 0% 50%;
        opacity: 0.8;
    }
    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
}

.main-text p {
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    font-size: clamp(0.9rem, 2vw, 1rem);
    line-height: 1.6;
    margin-bottom: 15px;
}

.main-text p:last-child {
    margin-bottom: 0;
}

/* Boxes section */
.boxes-container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: clamp(20px, 3vw, 30px);
    margin-bottom: 50px;
}

.box {
    flex: 1;
    min-width: min(300px, 100%);
    padding: clamp(20px, 3vw, 30px);
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--shadow-color);
    color: var(--white);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 1s ease-out;
    -webkit-animation: fadeInUp 1s ease-out;
    border: none;
    background-clip: padding-box;
    isolation: isolate;
}

.box:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.brainy-kids {
    background: linear-gradient(135deg, var(--dark-green), var(--medium-green), var(--primary-green));
    background-size: 200% 200%;
    animation: gradientBG 8s ease infinite;
    -webkit-animation: gradientBG 8s ease infinite;
}

.brainy-robots {
    background: linear-gradient(135deg, var(--accent-green), var(--bright-green), var(--light-green));
    background-size: 200% 200%;
    animation: gradientBG 8s ease infinite reverse;
    -webkit-animation: gradientBG 8s ease infinite reverse;
}

.box h2 {
    font-size: clamp(1.3rem, 3vw, 2rem);
    margin-bottom: clamp(15px, 2vw, 20px);
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.box p {
    font-size: clamp(0.9rem, 2vw, 1rem);
    line-height: 1.6;
    margin-bottom: clamp(15px, 2vw, 20px);
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Enhanced Image Styling */
.box-image-container {
    width: 100%;
    height: auto;
    min-height: clamp(180px, 25vw, 280px);
    max-height: 300px;
    margin: 0 auto clamp(20px, 3vw, 30px);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.2),
        0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1), 
        rgba(255, 255, 255, 0.05));
    border: 2px solid rgba(255, 255, 255, 0.15);
    aspect-ratio: 16/9;
}

.box-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    filter: 
        brightness(1.05) 
        contrast(1.1)
        saturate(1.1);
    transform: scale(1.01);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0) 30%,
        rgba(0, 0, 0, 0.2) 100%
    );
    pointer-events: none;
    transition: all 0.5s ease;
}

.box:hover .box-image-container {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.3),
        0 10px 25px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.box:hover .box-main-image {
    transform: scale(1.08);
    filter: 
        brightness(1.1) 
        contrast(1.15)
        saturate(1.2);
}

.box:hover .image-overlay {
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(0, 0, 0, 0.1) 30%,
        rgba(0, 0, 0, 0.3) 100%
    );
}

/* Animated buttons */
.discover-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2vw, 12px) clamp(20px, 3vw, 30px);
    margin-top: clamp(15px, 2vw, 20px);
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    border: 2px solid var(--white);
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    overflow: hidden;
    transition: all 0.5s ease;
    z-index: 1;
    animation: pulse 2s infinite;
    -webkit-animation: pulse 2s infinite;
    font-size: clamp(14px, 1.5vw, 16px);
    min-height: 44px;
    min-width: 44px;
    width: fit-content;
    max-width: 90%;
    text-align: center;
}

.discover-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.discover-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: 0.5s;
    z-index: -1;
}

.discover-btn:hover::before {
    left: 100%;
}

.discover-btn i {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.discover-btn:hover i {
    transform: translateX(5px);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

@-webkit-keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* Enhanced Footer/Contact Section */
footer {
    background: linear-gradient(135deg, #0d3a1f, var(--dark-green), var(--medium-green));
    color: var(--white);
    padding: clamp(40px, 6vw, 80px) 0 clamp(20px, 3vw, 40px);
    margin-top: clamp(40px, 6vw, 80px);
    position: relative;
    overflow: hidden;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0 clamp(15px, 3vw, 20px);
    gap: clamp(20px, 3vw, 30px);
    position: relative;
    z-index: 1;
}

.footer-box {
    flex: 1;
    min-width: min(250px, 100%);
    background: rgba(255, 255, 255, 0.1);
    padding: clamp(20px, 3vw, 30px);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.5s ease;
    animation: fadeInUp 1s ease-out;
    -webkit-animation: fadeInUp 1s ease-out;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(168, 230, 207, 0.2);
}

.footer-box:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.15);
}

.footer-box h3 {
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    margin-bottom: clamp(15px, 2vw, 25px);
    color: var(--light-green);
    position: relative;
    display: inline-block;
}

.contact-info {
    display: flex;
    align-items: center;
    margin-bottom: clamp(12px, 2vw, 20px);
    padding: clamp(10px, 1.5vw, 15px);
    border-radius: 10px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    min-height: 44px;
    cursor: pointer;
}

.contact-info i {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    margin-right: clamp(10px, 2vw, 20px);
    color: var(--light-green);
    transition: all 0.3s ease;
    min-width: 30px;
    text-align: center;
}

.contact-info:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.contact-info:hover i {
    transform: scale(1.2);
    color: var(--white);
}

/* Social Media Links */
.social-links {
    display: flex;
    justify-content: center;
    gap: clamp(10px, 2vw, 20px);
    margin-top: clamp(20px, 3vw, 30px);
    flex-wrap: wrap;
}

.social-link {
    width: clamp(40px, 5vw, 50px);
    height: clamp(40px, 5vw, 50px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-height: 44px;
    min-width: 44px;
}

.social-link:hover {
    transform: translateY(-5px) scale(1.1);
    color: var(--white);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Contact Form */
.contact-form {
    margin-top: clamp(20px, 3vw, 30px);
}

.form-group {
    margin-bottom: clamp(15px, 2vw, 20px);
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--light-green);
    font-weight: 500;
    font-size: clamp(14px, 1.5vw, 16px);
}

.form-control {
    width: 100%;
    padding: clamp(10px, 2vw, 12px) clamp(12px, 2vw, 15px);
    border-radius: 8px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    font-size: 16px;
    transition: all 0.3s ease;
    border: 1px solid rgba(168, 230, 207, 0.3);
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--light-green);
    box-shadow: 0 0 0 2px rgba(168, 230, 207, 0.3);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.submit-btn {
    background: linear-gradient(45deg, var(--primary-green), var(--light-green));
    color: var(--white);
    border: none;
    padding: clamp(10px, 2vw, 12px) clamp(20px, 3vw, 30px);
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(95, 159, 73, 0.4);
    font-size: clamp(14px, 1.5vw, 16px);
    min-height: 44px;
    min-width: 44px;
    width: 100%;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(95, 159, 73, 0.6);
}

.submit-btn i {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.submit-btn:hover i {
    transform: translateX(5px);
}

/* Copyright */
.copyright {
    text-align: center;
    margin-top: clamp(25px, 4vw, 50px);
    padding-top: clamp(15px, 2vw, 20px);
    border-top: 1px solid rgba(168, 230, 207, 0.2);
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    position: relative;
    z-index: 1;
    padding: 0 clamp(15px, 3vw, 20px);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@-webkit-keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@-webkit-keyframes fadeInUp {
    from {
        opacity: 0;
        -webkit-transform: translateY(20px);
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

/* ============================================
   TABLET RESPONSIVE STYLES (768px to 1023px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Boxes Layout - Two columns on tablets */
    .boxes-container {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 25px;
        max-width: 750px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .box {
        flex: 0 0 calc(50% - 12.5px);
        min-width: auto;
        padding: 25px;
    }

    .box-image-container {
        min-height: 230px;
        max-height: 270px;
    }

    /* Footer - 2 columns */
    .footer-container {
        flex-wrap: wrap;
    }
    
    .footer-box {
        flex: 0 0 calc(50% - 15px);
        margin-bottom: 20px;
    }
}

/* ============================================
   LANDSCAPE MODE FOR PHONES
   ============================================ */
@media (max-height: 600px) and (orientation: landscape) {
    .nav-container {
        padding: 8px 15px;
        min-height: 60px;
    }

    .logo {
        font-size: 11px;
    }

    .logo-img {
        width: 45px;
        height: 45px;
    }

    .hero-section {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 15px;
        margin-bottom: 15px;
    }

    .hero-logo {
        margin-bottom: 0;
        flex: 0 0 auto;
    }

    .hero-logo img {
        width: 80px;
    }

    .typing-container {
        text-align: left;
        flex: 1;
        min-width: 0;
    }

    .welcome-text {
        font-size: 1.8rem;
        text-align: left;
        margin-bottom: 5px;
        margin-top: 20px !important;
    }

    .academy-subtitle {
        font-size: 1.1rem;
        text-align: left;
        margin-bottom: 15px;
        display: inline-block;
        width: auto;
        padding: 10px 20px;
    }

    .main-content {
        padding: 15px;
    }

    .boxes-container {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px;
    }

    .box {
        flex: 0 0 calc(50% - 7.5px);
        padding: 20px;
        min-width: auto;
    }

    .box-image-container {
        min-height: 150px;
        max-height: 180px;
    }
}

/* ============================================
   FIX FOR IOS SAFARI
   ============================================ */
@supports (-webkit-touch-callout: none) {
    .box-image-container,
    .nav-box,
    .modal-content,
    .options-modal-content {
        -webkit-backface-visibility: hidden;
        -webkit-transform: translateZ(0);
    }

    .main-content,
    .modal-content,
    .options-modal-content {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Safe area insets for iOS */
    @media (max-width: 767px) {
        header {
            padding-top: env(safe-area-inset-top) !important;
            height: calc(70px + env(safe-area-inset-top)) !important;
        }
        
        .nav-container {
            padding-top: max(12px, env(safe-area-inset-top)) !important;
            min-height: calc(70px + env(safe-area-inset-top)) !important;
        }
        
        .nav-box {
            top: calc(70px + env(safe-area-inset-top)) !important;
        }
        
        .mobile-menu-backdrop {
            top: calc(70px + env(safe-area-inset-top)) !important;
        }
        
        .main-content {
            margin-top: calc(90px + env(safe-area-inset-top)) !important;
        }
        
        footer {
            padding-bottom: max(20px, env(safe-area-inset-bottom));
        }
    }
}

/* ============================================
   TOUCH FEEDBACK FOR MOBILE
   ============================================ */
.touch-active {
    background: rgba(95, 159, 73, 0.2);
    transform: translateX(-3px) scale(0.98);
    transition: transform 0.1s ease;
}

/* ============================================
   ADDITIONAL FIXES FOR MOBILE VIEWPORT
   ============================================ */

/* Fix for iOS viewport */
@supports (-webkit-touch-callout: none) {
    html {
        height: -webkit-fill-available;
    }
    
    body {
        min-height: -webkit-fill-available;
    }
}

/* Improve mobile scrolling for anchor links */
@media (max-width: 767px) {
    html {
        scroll-behavior: smooth;
    }
    
    #services-section,
    #contact-section {
        scroll-margin-top: 90px;
        scroll-padding-top: 90px;
    }
}

/* Prevent zooming on mobile inputs */
@media (max-width: 767px) {
    input, textarea, select {
        font-size: 16px !important;
    }
}

/* Performance optimizations for mobile */
@media (max-width: 767px) {
    .bg-animation {
        animation-duration: 20s;
        -webkit-animation-duration: 20s;
    }

    /* Simplify heavy animations on mobile */
    .box::before,
    .box::after,
    .footer-box::before,
    .footer-box::after,
    .main-text::before,
    .main-text::after {
        display: none;
    }

    /* Remove hover effects on touch devices */
    @media (hover: none) and (pointer: coarse) {
        .box:hover {
            transform: none;
        }

        .box-image-container:hover {
            transform: none;
        }

        .discover-btn:hover {
            transform: none;
            animation: none;
            -webkit-animation: none;
        }

        .footer-box:hover {
            transform: none;
        }

        .contact-info:hover {
            transform: none;
        }

        .social-link:hover {
            transform: none;
        }

        .submit-btn:hover {
            transform: none;
        }

        /* Active state for touch */
        .discover-btn:active,
        .submit-btn:active,
        .contact-info:active,
        .social-link:active,
        .option-card:active {
            transform: scale(0.96);
            opacity: 0.9;
        }
    }
}

/* ============================================
   FIX BOX DIMENSIONS FOR MOBILE
   ============================================ */
@media (max-width: 767px) {
    .boxes-container {
        flex-direction: column;
        gap: 25px;
        padding: 0 10px;
        margin-bottom: 40px;
    }

    .box {
        min-width: 100% !important;
        padding: 25px 20px !important;
        margin-bottom: 0;
        width: 100% !important;
    }

    .box h2 {
        font-size: 1.4rem !important;
        margin-bottom: 15px;
        line-height: 1.3;
    }

    .box p {
        font-size: 1rem !important;
        line-height: 1.5;
        margin-bottom: 12px;
    }

    /* Fix box dimensions */
    .box-image-container {
        height: 220px !important;
        min-height: 220px !important;
        max-height: 220px !important;
        margin-bottom: 15px;
        border-radius: 15px;
        aspect-ratio: 16/9;
    }
}

/* ============================================
   FIX FOOTER FOR MOBILE
   ============================================ */
@media (max-width: 767px) {
    .footer-container {
        flex-direction: column;
        gap: 20px;
        padding: 0 15px;
    }

    .footer-box {
        min-width: 100%;
        padding: 20px 15px;
        margin-bottom: 0;
    }

    .footer-box h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }

    /* Contact Info */
    .contact-info {
        flex-direction: row;
        align-items: center;
        padding: 12px;
        min-height: 44px;
        margin-bottom: 10px;
    }

    .contact-info i {
        font-size: 1.2rem;
        min-width: 35px;
    }

    .contact-info:active {
        transform: translateX(3px);
        background: rgba(255, 255, 255, 0.15);
    }

    /* Social Links */
    .social-links {
        gap: 12px;
        margin-top: 20px;
        justify-content: center;
    }

    .social-link {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
        min-height: 45px;
        min-width: 45px;
    }

    .social-link:active {
        transform: scale(0.95);
    }

    /* Contact Form */
    .contact-form {
        margin-top: 20px;
    }

    .form-control {
        padding: 12px;
        font-size: 16px;
        min-height: 44px;
        margin-bottom: 12px;
    }

    .form-control:focus {
        font-size: 16px;
    }

    .submit-btn {
        padding: 12px 20px;
        font-size: 14px;
        width: 100%;
        min-height: 44px;
        margin-top: 10px;
    }

    .submit-btn:active {
        transform: scale(0.98);
    }

    /* Copyright */
    .copyright {
        margin-top: 25px;
        padding-top: 20px;
        font-size: 0.8rem;
        padding: 0 15px;
        line-height: 1.5;
    }
}

/* ============================================
   FIX MOBILE MODAL ADJUSTMENTS
   ============================================ */
@media (max-width: 767px) {
    .modal-content {
        margin: 10vh auto;
        width: 95%;
        padding: 20px;
    }
}

/* ============================================
   FINAL MOBILE OPTIMIZATIONS
   ============================================ */

/* Ensure all content fits within screen on mobile */
@media (max-width: 767px) {
    .main-content {
        padding: 0 15px !important;
        margin: 10px auto !important;
    }
    
    .boxes-container {
        padding: 0 10px !important;
    }
    
    .box {
        margin: 0 0 20px 0 !important;
        padding: 15px !important;
    }
    
    /* Ensure text doesn't overflow */
    .logo,
    .welcome-text,
    .academy-subtitle,
    .mission-statement,
    .box h2,
    .box p,
    .option-card h3,
    .option-card p {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
}

/* ============================================
   CRITICAL FIX: BACKDROP BLOCKING INTERACTIONS
   ============================================ */

/* Ensure backdrop is properly hidden when menu is closed */
.mobile-menu-backdrop:not(.active) {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Ensure main content is clickable when menu is closed */
body:not(.menu-open) .main-content,
body:not(.menu-open) .boxes-container,
body:not(.menu-open) .footer-container,
body:not(.menu-open) .box,
body:not(.menu-open) .discover-btn {
    pointer-events: all !important;
}

/* Fix for mobile menu state */
body.menu-open {
    overflow: hidden;
    height: 100vh;
}

body:not(.menu-open) {
    overflow: auto;
}

/* ============================================
   FINAL FIXES FOR CONTENT VISIBILITY
   ============================================ */

/* Ensure ALL content is visible */
@media (max-width: 767px) {
    /* Main content visibility */
    .main-content {
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* Welcome text specific fix */
    .typing-container {
        opacity: 1 !important;
        transform: none !important;
        animation: fadeIn 0.5s ease !important;
    }
    
    .welcome-text {
        margin-top: 25px !important;
        padding-top: 15px !important;
        position: relative;
        z-index: 1;
        transform: none !important;
    }
    
    /* Prevent any overlap */
    * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Fix body height */
    body {
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
        overflow-x: hidden !important;
        position: relative !important;
    }
    
    /* Main content clear visibility */
    .main-content > * {
        animation: fadeIn 0.5s ease-out !important;
        -webkit-animation: fadeIn 0.5s ease-out !important;
    }
}

/* Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 767px) {
        .nav-box,
        .options-modal-content {
            -webkit-overflow-scrolling: touch !important;
        }
        
        body.menu-open {
            position: fixed;
            width: 100%;
            height: 100%;
        }
    }
}

/* Smooth fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@-webkit-keyframes fadeIn {
    from {
        opacity: 0;
        -webkit-transform: translateY(10px);
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

/* Additional animations from mobile menu */
@keyframes particlesFloat {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 300% 300%;
    }
}

@-webkit-keyframes particlesFloat {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 300% 300%;
    }
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
}

@-webkit-keyframes glowPulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
}


/* ============================================
   BRAINY MAGAZINE SECTION - MODERN DESIGN
   ============================================ */

   .magazine-section {
    max-width: 1200px;
    margin: 70px auto 50px;
    padding: 0 clamp(15px, 3vw, 20px);
    position: relative;
    z-index: 1;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

.section-header h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: var(--dark-gray);
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.section-header h2 span {
    color: var(--primary-green);
    position: relative;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(to right, var(--dark-green), var(--primary-green));
    border-radius: 2px;
}

.section-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--medium-gray);
    max-width: 600px;
    margin: 25px auto 0;
    line-height: 1.6;
}

/* Magazine Container */
.magazine-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(95, 159, 73, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.magazine-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--dark-green), var(--medium-green), var(--primary-green));
    z-index: 1;
}

/* Latest Edition Badge */
.magazine-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--dark-green), var(--primary-green));
    color: white;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
    box-shadow: 0 5px 15px rgba(95, 159, 73, 0.3);
    animation: badgePulse 2s ease-in-out infinite;
}

.magazine-badge i {
    font-size: 0.8rem;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@-webkit-keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Magazine Content Layout */
.magazine-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

/* Magazine Cover */
.magazine-cover-container {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    perspective: 1000px;
}

.magazine-cover-container:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
}

.cover-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--dark-green);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--primary-green);
}

.magazine-cover {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.magazine-cover-container:hover .magazine-cover {
    transform: scale(1.05);
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.3));
    pointer-events: none;
}

/* Magazine Details */
.magazine-details {
    padding: 20px 0;
}

.edition-date {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--medium-gray);
    font-size: 0.95rem;
}

.edition-date i {
    color: var(--primary-green);
    font-size: 1.1rem;
}

.edition-date strong {
    color: var(--dark-gray);
    font-weight: 700;
}

.magazine-details h3 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: var(--dark-gray);
    margin-bottom: 20px;
    line-height: 1.3;
    font-weight: 700;
}

.magazine-description {
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.6;
    color: var(--medium-gray);
    margin-bottom: 30px;
    padding: 15px;
    background: rgba(95, 159, 73, 0.05);
    border-radius: 12px;
    border-left: 4px solid var(--primary-green);
}

/* Magazine Action Buttons */
.magazine-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 40px;
}

.magazine-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 44px;
    min-width: 44px;
    position: relative;
    overflow: hidden;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    flex: 1;
    min-width: 200px;
    max-width: 100%;
}

.magazine-btn i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.magazine-btn:hover i {
    transform: translateX(5px);
}

.read-now-btn {
    background: linear-gradient(135deg, var(--dark-green), var(--primary-green));
    color: white;
    box-shadow: 0 10px 25px rgba(95, 159, 73, 0.3);
}

.read-now-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(95, 159, 73, 0.4);
    background: linear-gradient(135deg, var(--medium-green), var(--primary-green));
}

.download-btn {
    background: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    box-shadow: 0 5px 15px rgba(95, 159, 73, 0.1);
}

.download-btn:hover {
    background: var(--primary-green);
    color: white;
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(95, 159, 73, 0.3);
}

/* Archive Section */
.archive-section {
    margin-top: 50px;
    border-top: 1px solid rgba(95, 159, 73, 0.2);
    padding-top: 30px;
}

.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(95, 159, 73, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(95, 159, 73, 0.1);
}

.archive-header:hover {
    background: rgba(95, 159, 73, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.archive-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.archive-title i {
    color: var(--primary-green);
    font-size: 1.2rem;
}

.archive-title h4 {
    color: var(--dark-gray);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.archive-chevron {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.archive-header.active .archive-chevron {
    transform: rotate(180deg);
}

.archive-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0 0 12px 12px;
    margin-top: -10px;
    position: relative;
    z-index: 0;
}

.archive-content.expanded {
    max-height: 300px;
}

.empty-archive {
    padding: 40px 20px;
    text-align: center;
    color: var(--medium-gray);
}

.empty-icon {
    font-size: 3rem;
    color: rgba(95, 159, 73, 0.3);
    margin-bottom: 20px;
    animation: floatIcon 3s ease-in-out infinite;
}

.empty-archive p {
    font-size: 1.1rem;
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.6;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@-webkit-keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ============================================
   RESPONSIVE DESIGN FOR MAGAZINE SECTION
   ============================================ */

/* Tablet Styles */
@media (max-width: 1023px) {
    .magazine-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .magazine-container {
        padding: 30px;
    }
    
    .magazine-actions {
        flex-direction: column;
    }
    
    .magazine-btn {
        width: 100%;
        min-width: auto;
    }
}

/* Mobile Styles */
@media (max-width: 767px) {
    .magazine-section {
        margin: 40px auto 30px;
        padding: 0 15px;
    }
    
    .section-header {
        margin-bottom: 30px;
    }
    
    .section-header h2 {
        font-size: 1.8rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
        padding: 0 10px;
    }
    
    .magazine-container {
        padding: 25px 20px;
        border-radius: 20px;
    }
    
    .magazine-badge {
        position: relative;
        top: 0;
        right: 0;
        margin-bottom: 20px;
        display: inline-flex;
    }
    
    .magazine-content {
        gap: 25px;
    }
    
    .magazine-details h3 {
        font-size: 1.4rem;
    }
    
    .magazine-description {
        font-size: 1rem;
        padding: 12px;
    }
    
    .magazine-actions {
        gap: 15px;
        margin-top: 30px;
    }
    
    .magazine-btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    .archive-section {
        margin-top: 40px;
    }
    
    .archive-title h4 {
        font-size: 1.1rem;
    }
    
    .empty-archive {
        padding: 30px 15px;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .magazine-section {
        margin: 30px auto 20px;
    }
    
    .magazine-container {
        padding: 20px 15px;
    }
    
    .magazine-details h3 {
        font-size: 1.3rem;
    }
    
    .magazine-description {
        font-size: 0.95rem;
    }
    
    .magazine-btn {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
}

/* ============================================
   ANIMATIONS & INTERACTIONS
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.magazine-section {
    animation: fadeInUp 0.6s ease-out;
}

/* ============================================
   RTL SUPPORT FOR MAGAZINE SECTION
   ============================================ */

body[dir="rtl"] .magazine-section {
    text-align: right;
}

body[dir="rtl"] .section-header h2::after {
    left: auto;
    right: 50%;
    transform: translateX(50%);
}

body[dir="rtl"] .edition-date {
    flex-direction: row-reverse;
}

body[dir="rtl"] .magazine-btn i {
    margin-right: 0;
    margin-left: 8px;
    transition: transform 0.3s ease;
}

body[dir="rtl"] .magazine-btn:hover i {
    transform: translateX(-5px);
}

body[dir="rtl"] .magazine-badge {
    right: auto;
    left: 20px;
}

body[dir="rtl"] .cover-badge {
    left: auto;
    right: 15px;
}

body[dir="rtl"] .archive-title {
    flex-direction: row-reverse;
}

body[dir="rtl"] .magazine-actions {
    direction: ltr;
}

/* ============================================
   HOVER EFFECTS FOR TOUCH DEVICES
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    .magazine-btn:active {
        transform: scale(0.98);
    }
    
    .magazine-cover-container:active {
        transform: scale(0.98);
    }
    
    .archive-header:active {
        transform: scale(0.98);
    }
}






/* Admin Section Styles */
.admin-section {
    animation: fadeInUp 0.5s ease;
}

#existingMagazines {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.magazine-item {
    background: var(--light-gray);
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.magazine-item.latest {
    border-color: var(--primary-green);
    background: rgba(95, 159, 73, 0.1);
}

.magazine-cover-small {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.magazine-actions-small {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.magazine-btn-small {
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    flex: 1;
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.edit-btn {
    background: #ffc107;
    color: #333;
}

/* Responsive Admin */
@media (max-width: 767px) {
    .admin-section {
        padding: 20px 15px;
        margin: 30px 15px;
    }
    
    #existingMagazines {
        grid-template-columns: 1fr;
    }
}













/* ============================================
   MAGAZINE ARCHIVE - YEAR/MONTH ORGANIZATION
   ============================================ */

/* Year Navigation */
.year-navigation {
    position: relative;
    margin: 30px 0 20px;
    padding: 0 40px;
}

.year-buttons-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-green) rgba(95, 159, 73, 0.1);
    padding: 15px 5px;
    margin: 0 -5px;
    scroll-padding: 0 20px;
}

.year-buttons-scroll::-webkit-scrollbar {
    height: 6px;
}

.year-buttons-scroll::-webkit-scrollbar-track {
    background: rgba(95, 159, 73, 0.1);
    border-radius: 3px;
}

.year-buttons-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 3px;
}

.year-button {
    background: rgba(95, 159, 73, 0.1);
    border: 2px solid transparent;
    color: var(--dark-gray);
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 100px;
    text-align: center;
}

.year-button:hover {
    background: rgba(95, 159, 73, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(95, 159, 73, 0.2);
}

.year-button.active {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
    box-shadow: 0 5px 20px rgba(95, 159, 73, 0.3);
    transform: translateY(-2px);
}

.year-button.active:hover {
    background: var(--medium-green);
    border-color: var(--medium-green);
}

/* Scroll Arrows */
.scroll-arrows {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
}

.scroll-arrow {
    background: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: var(--dark-gray);
    font-size: 1rem;
}

.scroll-arrow:hover {
    background: var(--primary-green);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(95, 159, 73, 0.3);
}

.scroll-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Month Navigation */
.month-navigation {
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease;
}

.month-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
}

.month-button {
    background: rgba(95, 159, 73, 0.08);
    border: 2px solid transparent;
    color: var(--dark-gray);
    padding: 15px 10px;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.month-button:hover {
    background: rgba(95, 159, 73, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(95, 73, 159, 0.1);
}

.month-button.active {
    background: linear-gradient(135deg, var(--primary-green), var(--medium-green));
    color: white;
    border-color: var(--primary-green);
    box-shadow: 0 5px 20px rgba(95, 159, 73, 0.3);
    transform: translateY(-3px);
}

.month-button.active:hover {
    background: linear-gradient(135deg, var(--medium-green), var(--dark-green));
}

.month-button.has-magazines::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--primary-green);
    border-radius: 50%;
    animation: pulseDot 2s infinite;
}

/* Archive Grid */
.archive-grid-container {
    margin-top: 30px;
    animation: fadeInUp 0.6s ease;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

.archive-item {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid rgba(95, 159, 73, 0.1);
}

.archive-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(95, 159, 73, 0.3);
}

.archive-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.archive-item:hover .archive-cover {
    transform: scale(1.05);
}

.archive-details {
    padding: 20px;
    position: relative;
}

.archive-date {
    position: absolute;
    top: -15px;
    left: 20px;
    background: var(--primary-green);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(95, 159, 73, 0.3);
}

.archive-details h4 {
    color: var(--dark-gray);
    font-size: 1.2rem;
    margin: 15px 0 10px;
    line-height: 1.4;
}

.archive-description {
    color: var(--medium-gray);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.archive-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.archive-btn {
    flex: 1;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
}

.read-btn {
    background: var(--primary-green);
    color: white;
}

.read-btn:hover {
    background: var(--medium-green);
    transform: translateY(-2px);
}

.download-btn-archive {
    background: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
}

.download-btn-archive:hover {
    background: var(--primary-green);
    color: white;
    transform: translateY(-2px);
}

/* Empty States */
.no-magazines-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: var(--medium-gray);
}

.no-magazines-message i {
    font-size: 3rem;
    color: rgba(95, 159, 73, 0.3);
    margin-bottom: 20px;
    display: block;
}

/* Animations */
@keyframes pulseDot {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .month-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .archive-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .year-navigation {
        padding: 0 30px;
    }
    
    .year-button {
        padding: 10px 20px;
        font-size: 1rem;
        min-width: 85px;
    }
    
    .scroll-arrows {
        display: none; /* Hide arrows on mobile */
    }
    
    .year-buttons-scroll {
        padding: 10px 0;
        margin: 0;
    }
    
    .month-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .month-button {
        padding: 12px 8px;
        font-size: 0.9rem;
    }
    
    .archive-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .year-navigation {
        padding: 0 10px;
    }
    
    .year-button {
        padding: 8px 15px;
        font-size: 0.9rem;
        min-width: 70px;
    }
    
    .month-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .month-button {
        padding: 10px 5px;
        font-size: 0.85rem;
    }
    
    .archive-cover {
        height: 160px;
    }
    
    .archive-details {
        padding: 15px;
    }
    
    .archive-details h4 {
        font-size: 1.1rem;
    }
    
    .archive-actions {
        flex-direction: column;
    }
}

/* RTL Support */
body[dir="rtl"] .year-buttons-scroll {
    direction: ltr; /* Keep LTR for scrolling */
}

body[dir="rtl"] .scroll-arrow i {
    transform: rotate(180deg);
}

body[dir="rtl"] .archive-date {
    left: auto;
    right: 20px;
}

body[dir="rtl"] .month-button.has-magazines::after {
    right: auto;
    left: 8px;
}

body[dir="rtl"] .archive-btn {
    flex-direction: row-reverse;
}

body[dir="rtl"] .archive-btn i {
    margin: 0 0 0 5px;
}




/* ============================================
   MAGAZINE ARCHIVE - YEAR/MONTH ORGANIZATION
   ============================================ */

/* Year Navigation */
.year-navigation {
    position: relative;
    margin: 30px 0 20px;
    padding: 0 40px;
}

.year-buttons-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-green) rgba(95, 159, 73, 0.1);
    padding: 15px 5px;
    margin: 0 -5px;
    scroll-padding: 0 20px;
}

.year-buttons-scroll::-webkit-scrollbar {
    height: 6px;
}

.year-buttons-scroll::-webkit-scrollbar-track {
    background: rgba(95, 159, 73, 0.1);
    border-radius: 3px;
}

.year-buttons-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 3px;
}

.year-button {
    background: rgba(95, 159, 73, 0.1);
    border: 2px solid transparent;
    color: var(--dark-gray);
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 100px;
    text-align: center;
}

.year-button:hover {
    background: rgba(95, 159, 73, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(95, 159, 73, 0.2);
}

.year-button.active {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
    box-shadow: 0 5px 20px rgba(95, 159, 73, 0.3);
    transform: translateY(-2px);
}

.year-button.active:hover {
    background: var(--medium-green);
    border-color: var(--medium-green);
}

/* Scroll Arrows */
.scroll-arrows {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
}

.scroll-arrow {
    background: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: var(--dark-gray);
    font-size: 1rem;
}

.scroll-arrow:hover {
    background: var(--primary-green);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(95, 159, 73, 0.3);
}

.scroll-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Month Navigation */
.month-navigation {
    margin-bottom: 30px;
    animation: fadeIn 0.5s ease;
}

.month-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
}

.month-button {
    background: rgba(95, 159, 73, 0.08);
    border: 2px solid transparent;
    color: var(--dark-gray);
    padding: 15px 10px;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.month-button:hover {
    background: rgba(95, 159, 73, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(95, 73, 159, 0.1);
}

.month-button.active {
    background: linear-gradient(135deg, var(--primary-green), var(--medium-green));
    color: white;
    border-color: var(--primary-green);
    box-shadow: 0 5px 20px rgba(95, 159, 73, 0.3);
    transform: translateY(-3px);
}

.month-button.active:hover {
    background: linear-gradient(135deg, var(--medium-green), var(--dark-green));
}

.month-button.has-magazines::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--primary-green);
    border-radius: 50%;
    animation: pulseDot 2s infinite;
}

/* Archive Grid */
.archive-grid-container {
    margin-top: 30px;
    animation: fadeInUp 0.6s ease;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

.archive-item {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid rgba(95, 159, 73, 0.1);
}

.archive-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(95, 159, 73, 0.3);
}

.archive-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.archive-item:hover .archive-cover {
    transform: scale(1.05);
}

.archive-details {
    padding: 20px;
    position: relative;
}

.archive-date {
    position: absolute;
    top: -15px;
    left: 20px;
    background: var(--primary-green);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(95, 159, 73, 0.3);
}

.archive-details h4 {
    color: var(--dark-gray);
    font-size: 1.2rem;
    margin: 15px 0 10px;
    line-height: 1.4;
}

.archive-description {
    color: var(--medium-gray);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.archive-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.archive-btn {
    flex: 1;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
}

.read-btn {
    background: var(--primary-green);
    color: white;
}

.read-btn:hover {
    background: var(--medium-green);
    transform: translateY(-2px);
}

.download-btn-archive {
    background: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
}

.download-btn-archive:hover {
    background: var(--primary-green);
    color: white;
    transform: translateY(-2px);
}

/* Empty States */
.no-magazines-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: var(--medium-gray);
}

.no-magazines-message i {
    font-size: 3rem;
    color: rgba(95, 159, 73, 0.3);
    margin-bottom: 20px;
    display: block;
}

.empty-hint {
    font-size: 0.9rem;
    color: var(--medium-gray);
    opacity: 0.8;
    margin-top: 10px;
}

.no-years-message {
    text-align: center;
    padding: 20px;
    color: var(--medium-gray);
    font-style: italic;
}

.year-button-placeholder {
    text-align: center;
    padding: 20px;
    color: var(--medium-gray);
    width: 100%;
    font-style: italic;
}

/* Animations */
@keyframes pulseDot {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .month-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .archive-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .year-navigation {
        padding: 0 30px;
    }
    
    .year-button {
        padding: 10px 20px;
        font-size: 1rem;
        min-width: 85px;
    }
    
    .scroll-arrows {
        display: none; /* Hide arrows on mobile */
    }
    
    .year-buttons-scroll {
        padding: 10px 0;
        margin: 0;
    }
    
    .month-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .month-button {
        padding: 12px 8px;
        font-size: 0.9rem;
    }
    
    .archive-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .year-navigation {
        padding: 0 10px;
    }
    
    .year-button {
        padding: 8px 15px;
        font-size: 0.9rem;
        min-width: 70px;
    }
    
    .month-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .month-button {
        padding: 10px 5px;
        font-size: 0.85rem;
    }
    
    .archive-cover {
        height: 160px;
    }
    
    .archive-details {
        padding: 15px;
    }
    
    .archive-details h4 {
        font-size: 1.1rem;
    }
    
    .archive-actions {
        flex-direction: column;
    }
}

/* RTL Support */
body[dir="rtl"] .year-buttons-scroll {
    direction: ltr; /* Keep LTR for scrolling */
}

body[dir="rtl"] .scroll-arrow i {
    transform: rotate(180deg);
}

body[dir="rtl"] .archive-date {
    left: auto;
    right: 20px;
}

body[dir="rtl"] .month-button.has-magazines::after {
    right: auto;
    left: 8px;
}

body[dir="rtl"] .archive-btn {
    flex-direction: row-reverse;
}

body[dir="rtl"] .archive-btn i {
    margin: 0 0 0 5px;
}

