/*
 * Hero Mobile Professional Layout - Simplified Responsive Approach
 * نهج مبسط وفعال للتجاوب على جميع الأجهزة
 */

/* ===== MOBILE RESPONSIVE (768px and below) ===== */
@media (max-width: 768px) {
    
    /* === Hero Section Container === */
    #home {
        padding-top: clamp(2.5rem, 6vh, 4rem) !important; /* تقليل لمنع التمرير */
        padding-bottom: clamp(0.3rem, 1.5vh, 0.75rem) !important; /* تقليل */
        padding-left: clamp(0.5rem, 2vw, 1rem) !important;
        padding-right: clamp(0.5rem, 2vw, 1rem) !important;
        min-height: 100vh !important; /* ملء كامل ارتفاع الشاشة */
        overflow: hidden !important; /* منع التمرير */
    }
    
    /* === Grid Layout - Keep Original Structure === */
    #home .grid {
        gap: 1rem !important; /* تقليل المسافة بين الأعمدة */
    }
    
    /* === LTR/RTL Support - Both centered === */
    [dir="ltr"] #home .grid > div:first-child {
        text-align: center !important;
    }
    
    [dir="rtl"] #home .grid > div:first-child {
        text-align: center !important;
    }
    
    /* === Left Content (Text Section) === */
    
    /* Badge - متجاوب تلقائي */
    #home .inline-flex.items-center.gap-3 {
        padding: clamp(0.4rem, 1.5vh, 0.6rem) clamp(0.75rem, 2vw, 1.25rem) !important;
        font-size: clamp(0.7rem, 2vw, 0.9rem) !important;
        gap: clamp(0.3rem, 1vw, 0.5rem) !important;
    }
    
    /* Main Title - متجاوب تلقائي */
    #home h1 {
        font-size: clamp(1.5rem, 5vw, 2.5rem) !important; /* تقليل لمنع التمرير */
        line-height: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* Description Text - سطرين فقط */
    #home p.text-lg {
        font-size: clamp(0.8rem, 2.8vw, 1rem) !important;
        line-height: 1.5 !important;
        width: 100% !important;
        max-width: none !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        text-align: center !important;
        display: block !important;
        height: clamp(3.2rem, 8vh, 4rem) !important; /* ارتفاع أكبر لإظهار النص كاملاً */
        overflow: hidden !important;
        margin: clamp(0.1rem, 0.5vh, 0.25rem) auto !important;
        padding: 0 clamp(0.5rem, 2vw, 1rem) !important;
    }
    
    /* === Buttons Section === */
    #home .flex.flex-col {
        gap: clamp(0.75rem, 2vh, 1.25rem) !important; /* متجاوب */
    }
    
    /* Primary Button */
    #home .flex.flex-col > a:first-child {
        padding: clamp(0.75rem, 2vh, 1rem) clamp(1.5rem, 3vw, 2.5rem) !important;
        font-size: clamp(0.9rem, 2.5vw, 1.1rem) !important;
    }
    
    /* Secondary Button */
    #home .flex.flex-col > a:last-child {
        padding: clamp(0.75rem, 2vh, 1rem) clamp(1.5rem, 3vw, 2.5rem) !important;
        font-size: clamp(0.9rem, 2.5vw, 1.1rem) !important;
    }
    
    /* === Statistics Section === */
    #home .flex.items-center.justify-center.gap-8 {
        gap: clamp(0.5rem, 2vw, 1.5rem) !important; /* متجاوب */
        padding-top: clamp(1rem, 2vh, 2rem) !important;
    }
    
    /* Stat Circles */
    #home .w-20.h-20 {
        width: clamp(3rem, 12vw, 5rem) !important;
        height: clamp(3rem, 12vw, 5rem) !important;
        margin-bottom: clamp(0.5rem, 1.5vh, 1rem) !important;
    }
    
    /* Stat Numbers */
    #home .w-20 .text-2xl {
        font-size: clamp(1.125rem, 3vw, 1.75rem) !important;
    }
    
    /* Stat Labels */
    #home .text-sm.text-white {
        font-size: clamp(0.65rem, 2vw, 0.95rem) !important;
    }
    
    /* === Right Visual Section === */
    
    /* Container Height - متجاوب تلقائي */
    #home .relative.h-\[600px\] {
        height: clamp(160px, 35vh, 280px) !important; /* تقليل */
    }
    
    /* Glowing Rings - متجاوب تلقائي */
    #home .w-\[500px\].h-\[500px\] {
        width: clamp(130px, 30vw, 220px) !important;
        height: clamp(130px, 30vw, 220px) !important;
    }
    
    #home .w-\[550px\].h-\[550px\] {
        width: clamp(150px, 32vw, 240px) !important;
        height: clamp(150px, 32vw, 240px) !important;
    }
    
    /* Main Image - متجاوب تلقائي */
    #home img[src="images/img3.png"] {
        width: clamp(110px, 25vw, 180px) !important; /* تقليل */
        height: auto !important;
    }
    
    /* Space Shuttle */
    #home img[src="images/img2.png"] {
        width: 80px !important; /* تصغير من 120px إلى 80px */
        top: -3rem !important;
        right: -2rem !important;
    }
    
    /* Floating Particles - تصغير */
    #home .w-4.h-4 {
        width: 0.75rem !important;
        height: 0.75rem !important;
    }
    
    #home .w-3.h-3 {
        width: 0.625rem !important;
        height: 0.625rem !important;
    }
    
    #home .w-2.h-2 {
        width: 0.5rem !important;
        height: 0.5rem !important;
    }
    
    /* === Status Badge === */
    #home .absolute.-bottom-6 {
        bottom: -1.5rem !important;
        padding: 0.625rem 1.5rem !important; /* تصغير طفيف */
    }
    
    #home .absolute.-bottom-6 .text-sm {
        font-size: 0.8rem !important;
    }
    
    /* === Background Planets - تصغير */
    #home .w-\[700px\].h-\[700px\] {
        width: 450px !important;
        height: 450px !important;
        bottom: -300px !important;
    }
    
    #home .w-\[500px\].h-\[500px\] {
        width: 320px !important;
        height: 320px !important;
        bottom: -180px !important;
    }
    
    /* === Background Effects - تقليل */
    #home .absolute.top-20.left-10 {
        width: 12rem !important; /* من w-64 إلى w-48 */
        height: 12rem !important;
        top: 3rem !important;
        left: 1.5rem !important;
    }
    
    #home .absolute.bottom-20.right-10 {
        width: 16rem !important; /* من w-80 إلى w-64 */
        height: 16rem !important;
        bottom: 3rem !important;
        right: 1.5rem !important;
    }
    
    #home .absolute.top-1\/2.left-1\/2 {
        width: 14rem !important; /* من w-72 إلى w-56 */
        height: 14rem !important;
    }
}

/* ===== SMALL MOBILE (640px and below) ===== */
@media (max-width: 640px) {
    
    /* Switch to single column layout with custom order */
    #home .grid {
        display: flex !important;
        flex-direction: column !important;
        gap: clamp(0.75rem, 2vh, 1.5rem) !important; /* متجاوب */
        text-align: center !important;
    }
    
    /* 1. IMAGE SECTION (First - Top) */
    #home .grid > div:last-child {
        order: 1 !important; /* الصورة أولاً في الأعلى */
        margin-bottom: clamp(0.5rem, 1.5vh, 1rem) !important;
    }
    
    /* 2. TEXT CONTENT (Second - Middle) */
    #home .grid > div:first-child {
        order: 2 !important; /* النصوص والأزرار في الوسط */
    }
    
    /* Move Statistics to Bottom (Outside Grid) */
    #home .flex.items-center.justify-center.gap-8 {
        order: 3 !important; /* الإحصائيات في الأسفل */
        position: relative !important;
        margin-top: clamp(0.3rem, 1vh, 0.75rem) !important; /* متجاوب */
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        gap: clamp(0.3rem, 1vw, 0.75rem) !important;
        padding: clamp(0.5rem, 1.5vh, 1rem) !important; /* متجاوب */
        background: rgba(255, 255, 255, 0.05) !important;
        backdrop-filter: blur(10px) !important;
        border-radius: 1rem !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
    
    /* --- Precise Vertical Spacing & Alignment Solution --- */
    #home .grid > div:first-child {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0 !important; /* Reset default gap to control spacing manually */
    }

    /* Adjust top margin for each element individually for perfect spacing */
    #home .grid > div:first-child > h1 {
        margin-top: 1rem; /* Space below badge */
    }

    #home .grid > div:first-child > p {
        margin-top: 1.5rem; /* Space below title */
    }

    #home .grid > div:first-child > .sm\:flex-row {
        margin-top: 2rem; /* Space below subtitle */
        width: 100%;
        max-width: 400px;
    }
    
    /* Further size reductions - مع تمدد كامل */
    #home h1 {
        font-size: 2.75rem !important; /* زيادة من 2rem إلى 2.75rem */
        width: 100% !important;
        max-width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        padding: 0 0.5rem !important;
    }
    
    /* Description text - تمدد كامل */
    #home p.text-lg {
        font-size: 1.1875rem !important; /* زيادة الحجم */
        line-height: 1.8 !important;
        width: 100% !important;
        max-width: none !important; /* إزالة أي تقييد */
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        padding: 0 1rem !important; /* إضافة padding متناسب */
        text-align: center !important;
        display: block !important;
        margin: 0.5rem auto !important; /* تقليل المسافة العمودية */
    }
    
    #home img[src="images/img3.png"] {
        width: 240px !important;
    }
    
    #home .relative.h-\[600px\] {
        height: 300px !important;
    }
    
    /* Statistics - Enhanced Single Row Design */
    #home .flex.items-center.justify-center.gap-8 {
        gap: 0.75rem !important;
        flex-wrap: nowrap !important; /* منع التفاف العناصر */
        justify-content: space-between !important;
        align-items: center !important;
        max-width: 350px !important;
        margin: 2rem auto 0 auto !important;
    }
    
    /* Individual Stat Item */
    #home .flex.flex-col.items-center {
        flex: 1 !important; /* توزيع متساوي */
        min-width: 0 !important; /* منع overflow */
        text-align: center !important;
    }
    
    #home .w-20.h-20 {
        width: 3.5rem !important;
        height: 3.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    #home .w-20 .text-2xl {
        font-size: 1.125rem !important; /* حجم مناسب للقراءة */
        font-weight: 800 !important;
    }
    
    /* Stat Labels - Better Typography */
    #home .text-sm.text-white {
        font-size: 0.75rem !important;
        line-height: 1.2 !important;
        white-space: nowrap !important; /* منع كسر النص */
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

/* ===== EXTRA SMALL MOBILE (480px and below) ===== */
@media (max-width: 480px) {
    
    #home {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    #home h1 {
        font-size: 2.25rem !important; /* زيادة من 1.75rem إلى 2.25rem */
        width: 100% !important;
        max-width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        padding: 0 0.5rem !important;
    }
    
    /* Description text - تمدد كامل */
    #home p.text-lg {
        font-size: 1.125rem !important; /* زيادة الحجم */
        line-height: 1.8 !important;
        width: 100% !important;
        max-width: none !important; /* إزالة أي تقييد */
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        padding: 0 0.75rem !important; /* padding أقل للشاشات الصغيرة */
        text-align: center !important;
        display: block !important;
        margin: 0.5rem auto !important; /* تقليل المسافة العمودية */
    }
    
    #home img[src="images/img3.png"] {
        width: 200px !important;
    }
    
    #home .relative.h-\[600px\] {
        height: 250px !important;
    }
    
    /* Buttons full width */
    #home .flex.flex-col {
        width: 100% !important;
    }
    
    #home .flex.flex-col > a {
        width: 100% !important;
        padding: 0.75rem 1.5rem !important;
    }
    
    /* Statistics - Compact Single Row for Small Screens */
    #home .flex.items-center.justify-center.gap-8 {
        max-width: 300px !important;
        gap: 0.5rem !important;
        padding: 0.75rem !important;
        margin: 1.5rem auto 0 auto !important;
    }
    
    #home .w-20.h-20 {
        width: 2.75rem !important;
        height: 2.75rem !important;
        margin-bottom: 0.375rem !important;
    }
    
    #home .w-20 .text-2xl {
        font-size: 1rem !important;
        font-weight: 700 !important;
    }
    
    #home .text-sm.text-white {
        font-size: 0.625rem !important;
        line-height: 1.1 !important;
    }
}

/* ===== MEDIUM MOBILE (600px and below) ===== */
@media (max-width: 600px) and (min-width: 481px) {
    #home {
        padding-top: 4rem !important;
        padding-bottom: 0.5rem !important;
        min-height: 100vh !important;
    }
    
    #home h1 {
        font-size: 2.25rem !important;
    }
    
    #home p.text-lg {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
        margin: 0.3rem auto !important;
    }
    
    #home .relative.h-\[600px\] {
        height: 260px !important;
    }
    
    #home img[src="images/img3.png"] {
        width: 180px !important;
    }
}

/* ===== EXTRA EXTRA SMALL (360px and below) ===== */
@media (max-width: 360px) {
    #home {
        padding-top: 3.5rem !important;
        padding-bottom: 0.5rem !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        min-height: 100vh !important;
    }
    
    #home h1 {
        font-size: 1.875rem !important; /* 30px */
        line-height: 1.1 !important;
    }
    
    #home p.text-lg {
        font-size: 0.875rem !important; /* 14px */
        line-height: 1.5 !important;
        margin: 0.2rem auto !important;
    }
    
    #home .relative.h-\[600px\] {
        height: 200px !important;
    }
    
    #home img[src="images/img3.png"] {
        width: 150px !important;
    }
    
    #home .w-\[500px\].h-\[500px\] {
        width: 180px !important;
        height: 180px !important;
    }
    
    #home .w-\[550px\].h-\[550px\] {
        width: 200px !important;
        height: 200px !important;
    }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-width: 768px) and (max-height: 500px) and (orientation: landscape) {
    
    #home {
        padding-top: 3rem !important;
        padding-bottom: 1rem !important;
        min-height: auto !important;
    }
    
    #home .grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 1.5rem !important;
        align-items: center !important;
    }
    
    #home .relative.h-\[600px\] {
        height: 200px !important;
    }
    
    #home h1 {
        font-size: 1.5rem !important;
    }
    
    #home .flex.items-center.justify-center.gap-8 {
        gap: 0.75rem !important;
    }
    
    #home .w-20.h-20 {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    #home * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== RTL/LTR SUPPORT ===== */
@media (max-width: 640px) {
    /* Center the main content block */
    #home .grid > div:first-child {
        text-align: center !important;
    }

    /* Make paragraph full width and align its internal text */
    #home .grid > div:first-child > p {
        width: 100% !important;
    }
    [dir="ltr"] #home .grid > div:first-child > p { text-align: center !important; }
    [dir="rtl"] #home .grid > div:first-child > p { text-align: center !important; }
    
    /* Both LTR & RTL - Centered alignment */
    [dir="ltr"] #home .grid > div:first-child,
    [dir="rtl"] #home .grid > div:first-child {
        text-align: center !important;
        align-items: center !important;
    }
    
    [dir="ltr"] #home h1,
    [dir="rtl"] #home h1 {
        text-align: center !important;
    }
    
    [dir="ltr"] #home .inline-flex.items-center.gap-3,
    [dir="rtl"] #home .inline-flex.items-center.gap-3 {
        justify-content: center !important;
    }
    
    [dir="ltr"] #home .flex.flex-col.sm\:flex-row,
    [dir="rtl"] #home .flex.flex-col.sm\:flex-row {
        justify-content: center !important;
    }
}
