/*
 * ==========================================================================
 * UI/UX Visual Enhancements - جمعية الإمام محمد بن سعود الخيرية
 * Version: 1.0.0
 * ملاحظة: هذا الملف يضيف تحسينات بصرية فقط ولا يغير أي منطق
 * ==========================================================================
 */

/* ==========================================================================
   1. CSS Variables - ألوان الهوية الرسمية
   ========================================================================== */

:root {
    /* Primary Colors - الألوان الأساسية */
    --mscs-primary-dark: #02877A;      /* Pantone P128-15C */
    --mscs-primary: #32BCAD;           /* Pantone P127-5C */
    --mscs-neutral: #C2B59B;           /* Pantone P13-4C */

    /* Primary Scale */
    --mscs-primary-50: #e6f7f5;
    --mscs-primary-100: #b3e8e3;
    --mscs-primary-200: #80d9d1;
    --mscs-primary-300: #4dcabf;
    --mscs-primary-400: #32BCAD;
    --mscs-primary-500: #1aa89a;
    --mscs-primary-600: #02877A;
    --mscs-primary-700: #026b62;
    --mscs-primary-800: #024f49;
    --mscs-primary-900: #013330;

    /* Soft Shadows - ظلال ناعمة */
    --shadow-soft-sm: 0 2px 8px -2px rgba(2, 135, 122, 0.06), 0 1px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-soft-md: 0 4px 16px -4px rgba(2, 135, 122, 0.08), 0 2px 8px -2px rgba(0, 0, 0, 0.04);
    --shadow-soft-lg: 0 8px 24px -6px rgba(2, 135, 122, 0.10), 0 4px 12px -4px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 16px 40px -10px rgba(2, 135, 122, 0.15), 0 8px 20px -8px rgba(0, 0, 0, 0.08);

    /* Transitions */
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-normal: 250ms;
    --duration-slow: 350ms;
}

/* ==========================================================================
   2. Page Load Animation - انتقال تحميل الصفحة
   ========================================================================== */

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body {
    animation: pageEnter 0.4s ease-out forwards;
    overflow-x: hidden; /* SAFE RESPONSIVE FIX: Prevent horizontal scroll */
}

/* ==========================================================================
   3. Cards Enhancement - تحسين الكروت (3D Soft Depth)
   ========================================================================== */

.stat-card,
.news-card,
.service-card,
.initiative-card {
    box-shadow: var(--shadow-soft-md);
    transition: transform var(--duration-normal) var(--transition-smooth),
                box-shadow var(--duration-normal) var(--transition-smooth);
    transform: perspective(1000px) translateZ(0);
}

.stat-card:hover,
.news-card:hover,
.service-card:hover,
.initiative-card:hover {
    transform: perspective(1000px) translateZ(8px) translateY(-6px);
    box-shadow: var(--shadow-hover);
}

/* كروت المبادرات */
.bg-white.border-2 {
    transition: transform var(--duration-normal) var(--transition-smooth),
                box-shadow var(--duration-normal) var(--transition-smooth),
                border-color var(--duration-normal) var(--transition-smooth);
}

.bg-white.border-2:hover {
    border-color: var(--mscs-primary-400);
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

/* ==========================================================================
   4. Buttons Enhancement - تحسين الأزرار
   ========================================================================== */

.btn,
a[class*="bg-dga-primary-600"],
button[class*="bg-dga-primary-600"] {
    position: relative;
    overflow: hidden;
    transition: transform 150ms var(--transition-smooth),
                box-shadow 150ms var(--transition-smooth),
                background-color 150ms var(--transition-smooth);
    box-shadow: 0 2px 6px -1px rgba(2, 135, 122, 0.20);
}

.btn:hover,
a[class*="bg-dga-primary-600"]:hover,
button[class*="bg-dga-primary-600"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px -2px rgba(2, 135, 122, 0.25);
}

.btn:active,
a[class*="bg-dga-primary-600"]:active,
button[class*="bg-dga-primary-600"]:active {
    transform: translateY(0);
}

/* ==========================================================================
   5. Form Fields Enhancement - تحسين الحقول
   ========================================================================== */

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="password"],
textarea,
select {
    transition: border-color 150ms var(--transition-smooth),
                box-shadow 150ms var(--transition-smooth);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--mscs-primary-400) !important;
    box-shadow: 0 0 0 4px rgba(50, 188, 173, 0.12);
}

/* ==========================================================================
   6. Navigation Enhancement - تحسين التنقل
   ========================================================================== */

header {
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.95) !important;
}

.dropdown-menu {
    box-shadow: var(--shadow-soft-lg);
    animation: dropdownEnter 0.2s ease-out forwards;
}

@keyframes dropdownEnter {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-menu a:hover {
    background-color: var(--mscs-primary-50);
    padding-right: 1.5rem;
}

/* ==========================================================================
   7. Scroll to Top Enhancement - زر العودة للأعلى
   ========================================================================== */

.scroll-to-top {
    background: linear-gradient(135deg, var(--mscs-primary-600) 0%, var(--mscs-primary-500) 100%);
    box-shadow: var(--shadow-soft-lg);
    transition: transform var(--duration-normal) var(--transition-smooth),
                box-shadow var(--duration-normal) var(--transition-smooth);
}

.scroll-to-top:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--shadow-hover);
}

/* ==========================================================================
   8. Status UI - حالات الطلب
   ========================================================================== */

.status-received,
.status-pending {
    background-color: var(--mscs-primary-50);
    color: var(--mscs-primary-700);
    border: 1px solid var(--mscs-primary-200);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
}

.status-completed,
.status-approved {
    background-color: #ECFDF5;
    color: #047857;
    border: 1px solid #6EE7B7;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
}

.status-review,
.status-processing {
    background-color: #FFF7ED;
    color: #C2410C;
    border: 1px solid #FDBA74;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
}

/* ==========================================================================
   9. Mobile Enhancements - تحسينات الجوال
   ========================================================================== */

@media (max-width: 768px) {
    .btn,
    button,
    a[class*="bg-dga-primary"] {
        min-height: 48px;
        touch-action: manipulation; /* SAFE RESPONSIVE FIX: Prevent double-tap zoom */
    }

    .stat-card:hover,
    .news-card:hover {
        transform: none;
    }
}

/* ==========================================================================
   10. Focus States - حالات التركيز (Accessibility)
   ========================================================================== */

*:focus-visible {
    outline: 2px solid var(--mscs-primary-400);
    outline-offset: 3px;
}

/* ==========================================================================
   11. Reduced Motion Support - دعم تقليل الحركة
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   12. Initiative Cards - بطاقات المبادرات (توحيد المظهر)
   ========================================================================== */

/* Grid Container للمبادرات */
.grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-3.xl\:grid-cols-3.gap-6 {
    display: grid;
    gap: 1.5rem;
}

/* توحيد جميع بطاقات المبادرات */
.grid > .bg-white.border-2.border-\[\#E5E7EB\] {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: #ffffff;
    border: 2px solid #E5E7EB;
    box-shadow: var(--shadow-soft-md);
    transition: all 0.3s var(--transition-smooth);
}

.grid > .bg-white.border-2.border-\[\#E5E7EB\]:hover {
    border-color: var(--mscs-primary-400);
    box-shadow: var(--shadow-hover);
    transform: translateY(-6px);
}

/* توحيد منطقة الصورة */
.grid > .bg-white.border-2 > .relative.w-full.h-40,
.grid > .bg-white.border-2 .relative.w-full.h-40 {
    width: 100%;
    height: 160px;
    min-height: 160px;
    max-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E0D1B6 0%, #C2B59B 100%);
    position: relative;
    overflow: hidden;
}

/* توحيد الصور داخل البطاقات */
.grid > .bg-white.border-2 > .relative.w-full.h-40 img,
.grid > .bg-white.border-2 .relative.w-full.h-40 img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 1rem;
}

/* توحيد أيقونة الزاوية */
.grid > .bg-white.border-2 .absolute.top-3.right-3 {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* توحيد منطقة المحتوى */
.grid > .bg-white.border-2 > .p-6,
.grid > .bg-white.border-2 .p-6.flex-1.flex.flex-col {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* توحيد العناوين */
.grid > .bg-white.border-2 h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #161616;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

/* توحيد الوصف */
.grid > .bg-white.border-2 .text-md-regular {
    font-size: 0.95rem;
    color: #6B7280;
    margin-bottom: 1rem;
    flex: 1;
    line-height: 1.6;
}

/* توحيد التاجات */
.grid > .bg-white.border-2 .flex.flex-wrap.gap-2 {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.grid > .bg-white.border-2 .dga-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background-color: #F3F4F6;
    color: #6B7280;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
}

/* توحيد منطقة الأزرار */
.grid > .bg-white.border-2 .flex.gap-2.mt-auto {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

/* زر Primary */
.grid > .bg-white.border-2 .flex.gap-2 a.flex-1 {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    background-color: var(--mscs-primary-600);
    color: white;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    min-height: 42px;
}

.grid > .bg-white.border-2 .flex.gap-2 a.flex-1:hover {
    background-color: var(--mscs-primary-700);
    transform: translateY(-1px);
}

/* زر Secondary */
.grid > .bg-white.border-2 .flex.gap-2 a.border-2 {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    background-color: transparent;
    color: #6B7280;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    min-height: 42px;
}

.grid > .bg-white.border-2 .flex.gap-2 a.border-2:hover {
    border-color: var(--mscs-primary-400);
    color: var(--mscs-primary-600);
    background-color: var(--mscs-primary-50);
}

/* ==========================================================================
   13. Tag System - Colorful Variants
   ========================================================================== */

.dga-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

/* Primary Tag - Teal */
.dga-tag-primary {
    background: linear-gradient(135deg, #e6f7f5 0%, #b3e8e3 100%);
    color: #02887A;
    border-color: #80d9d1;
}

.dga-tag-primary:hover {
    background: linear-gradient(135deg, #b3e8e3 0%, #80d9d1 100%);
    border-color: #4dcabf;
    transform: translateY(-1px);
}

/* Success Tag - Green */
.dga-tag-success {
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    color: #047857;
    border-color: #6EE7B7;
}

.dga-tag-success:hover {
    background: linear-gradient(135deg, #D1FAE5 0%, #A7F3D0 100%);
    border-color: #34D399;
    transform: translateY(-1px);
}

/* Warning Tag - Orange */
.dga-tag-warning {
    background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
    color: #C2410C;
    border-color: #FDBA74;
}

.dga-tag-warning:hover {
    background: linear-gradient(135deg, #FFEDD5 0%, #FED7AA 100%);
    border-color: #FB923C;
    transform: translateY(-1px);
}

/* Sand Tag - Beige */
.dga-tag-sand {
    background: linear-gradient(135deg, #F5F0E8 0%, #E0D1B6 100%);
    color: #8B7355;
    border-color: #D4C4A8;
}

.dga-tag-sand:hover {
    background: linear-gradient(135deg, #E0D1B6 0%, #C2B59B 100%);
    border-color: #B8A788;
    transform: translateY(-1px);
}

/* Info Tag - Blue */
.dga-tag-info {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    color: #1E40AF;
    border-color: #93C5FD;
}

.dga-tag-info:hover {
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    border-color: #60A5FA;
    transform: translateY(-1px);
}

/* Gray Tag - Default */
.dga-tag-gray {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    color: #4B5563;
    border-color: #E5E7EB;
}

.dga-tag-gray:hover {
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
    border-color: #D1D5DB;
    transform: translateY(-1px);
}

/* Tag Icon Styling */
.dga-tag svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ==========================================================================
   14. Statistics Cards - Advanced Effects
   ========================================================================== */

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        transparent,
        rgba(50, 188, 173, 0.05),
        transparent 30%
    );
    animation: rotate 8s linear infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

.stat-card:hover::before {
    animation-duration: 4s;
}

/* Number scale on hover */
.stat-card:hover h3 {
    transform: scale(1.1);
}

/* ==========================================================================
   15. Hero Section Animations
   ========================================================================== */

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fade-in 0.8s ease-out forwards;
}

.animate-slide-up {
    animation: slide-up 0.8s ease-out forwards;
    opacity: 0;
}

/* ==========================================================================
   13. Micro-interactions - تفاعلات دقيقة
   ========================================================================== */

/* Button press effect */
button:active,
.btn:active,
a[class*="bg-"]:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
}

/* Link underline animation */
a:not([class*="bg-"]):not(.no-underline):hover {
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    transition: text-decoration-thickness 0.2s ease, text-underline-offset 0.2s ease;
}

/* Card subtle lift on hover */
.hover\:shadow-xl:hover,
.hover\:shadow-lg:hover,
.hover\:shadow-hover:hover {
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Icon bounce on hover */
.group:hover svg,
.hover\:scale-110:hover {
    animation: icon-bounce 0.6s ease;
}

@keyframes icon-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Number scale on hover for stats */
.stat-card:hover h3 {
    transform: scale(1.05);
    transition: transform 0.3s ease;
}

/* Tag subtle pulse on hover */
.dga-tag:hover {
    animation: tag-pulse 0.4s ease;
}

@keyframes tag-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* Image zoom on hover */
.group:hover img {
    transform: scale(1.05);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth image transitions */
img {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s ease;
}

/* Focus ring enhancement */
*:focus-visible {
    outline: 2px solid #32BCAD;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Smooth color transitions */
* {
    transition-property: color, background-color, border-color;
    transition-duration: 0.2s;
    transition-timing-function: ease;
}

/* Don't animate transform for all elements (only specific ones) */
*:not(img):not(svg):not(.stat-card):not(.dga-tag) {
    transition-property: color, background-color, border-color, opacity;
}

/* ==========================================================================
   14. Responsive Typography - خطوط متجاوبة
   ========================================================================== */

/* Fluid typography using clamp() */
.display-xl {
    font-size: clamp(2.25rem, 4vw + 1rem, 3.75rem) !important;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.display-lg {
    font-size: clamp(2rem, 3.5vw + 0.5rem, 3rem) !important;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.display-md {
    font-size: clamp(1.75rem, 3vw + 0.5rem, 2.25rem) !important;
    line-height: 1.3;
}

.display-sm {
    font-size: clamp(1.5rem, 2.5vw + 0.5rem, 1.875rem) !important;
    line-height: 1.3;
}

/* Body text responsive */
body {
    font-size: clamp(0.875rem, 1vw + 0.5rem, 1rem);
    line-height: 1.6;
}

/* Headings responsive scaling */
h1 {
    font-size: clamp(2rem, 3.5vw + 1rem, 3rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(1.75rem, 3vw + 0.5rem, 2.25rem);
    line-height: 1.3;
}

h3 {
    font-size: clamp(1.5rem, 2.5vw + 0.5rem, 1.875rem);
    line-height: 1.3;
}

h4 {
    font-size: clamp(1.25rem, 2vw + 0.5rem, 1.5rem);
    line-height: 1.4;
}

/* Improve readability on mobile */
@media (max-width: 768px) {
    body {
        line-height: 1.7;
        font-size: 16px;
    }

    h1, h2, h3, h4, h5, h6 {
        word-break: break-word;
        hyphens: auto;
    }

    /* Responsive typography */
    .display-md {
        font-size: 1.75rem !important; /* 28px instead of 36px */
        line-height: 2.25rem !important;
    }

    .display-lg {
        font-size: 2rem !important; /* 32px instead of 48px */
        line-height: 2.5rem !important;
    }

    .text-xl {
        font-size: 1.125rem !important; /* 18px instead of 20px */
        line-height: 1.75rem !important;
    }

    .text-2xl {
        font-size: 1.5rem !important; /* 24px instead of 30px */
        line-height: 2rem !important;
    }

    /* Improve spacing on mobile */
    .py-16 {
        padding-top: 2rem !important; /* 32px instead of 64px */
        padding-bottom: 2rem !important;
    }

    .mb-12 {
        margin-bottom: 2rem !important; /* 32px instead of 48px */
    }

    /* Form improvements */
    .form-input {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }

    /* Button improvements */
    button, .btn {
        min-height: 44px; /* Better touch target */
        padding: 0.75rem 1.5rem;
    }

    /* Grid improvements */
    .grid {
        gap: 1rem !important; /* Smaller gaps on mobile */
    }

    /* Card padding */
    .rounded-2xl {
        padding: 1rem !important;
    }

    /* Table responsive */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    /* Image responsive */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Logo responsive */
    .h-16 {
        height: 3rem !important; /* 48px instead of 64px */
    }

    /* Sidebar improvements */
    aside {
        margin-bottom: 2rem;
    }

    /* Radio cards on mobile */
    .radio-card {
        padding: 0.75rem !important;
        min-height: 44px; /* Better touch target */
    }

    .radio-card input[type="radio"] {
        min-width: 20px;
        min-height: 20px;
    }

    /* Select and input improvements */
    select, textarea, input[type="text"], input[type="tel"], input[type="email"], input[type="number"], input[type="date"] {
        font-size: 16px !important; /* Prevents zoom on iOS */
        min-height: 44px; /* Better touch target */
    }

    /* Better spacing for form sections */
    .space-y-6 > * + * {
        margin-top: 1.25rem !important;
    }

    .space-y-8 > * + * {
        margin-top: 1.5rem !important;
    }

    /* Mobile menu improvements */
    .mobile-menu {
        position: relative;
        z-index: 50;
        background-color: white !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .mobile-menu.active {
        border-top: 2px solid #E5E7EB;
        max-height: 2000px !important;
        overflow: visible !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
    
    /* DISABLED - causing issues */ .mobile-menu-disabled:not(.active) {
        max-height: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
    }

    /* Mobile menu button improvements */
    button[onclick="toggleMobileMenu()"] {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Ensure mobile menu items are touch-friendly */
    .mobile-menu nav a,
    .mobile-menu nav button {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem;
    }
}

/* Optimize for large screens */
@media (min-width: 1920px) {
    .max-w-\\[1440px\\] {
        max-width: 1600px !important;
    }
}

/* ==========================================================================
   15. Partners Carousel Indicators - مؤشرات شركاء النجاح
   ========================================================================== */

#partnersIndicators {
    user-select: none;
}

#partnersIndicators button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #D1D5DB;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

#partnersIndicators button:hover {
    background-color: #9CA3AF;
    transform: scale(1.2);
}

#partnersIndicators button.active {
    background-color: #32BCAD;
    width: 32px;
    border-radius: 5px;
    transform: scale(1);
}

#partnersIndicators button:focus {
    outline: 2px solid #32BCAD;
    outline-offset: 2px;
}

/* ==========================================================================
   16. Print Styles - طباعة
   ========================================================================== */

@media print {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* ==========================================================================
   SAFE RESPONSIVE FIX: Hero Background Image Mobile Optimization
   ========================================================================== */

/* Base - Desktop: Keep center position (no change from original) */
.hero-bg {
    background-position: center center !important;
}

/* Mobile Portrait: Focus on upper area for better subject framing */
@media (max-width: 768px) {
    .hero-bg {
        background-position: center 35% !important;
        background-size: cover !important;
    }
}

/* Small Mobile: Extra focus on top area */
@media (max-width: 480px) {
    .hero-bg {
        background-position: center 30% !important;
    }
}

/* ==========================================================================
   SAFE ACCESSIBILITY FIX: Mobile Menu Visual Enhancements
   ========================================================================== */

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

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #02877A;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* Enhanced Focus Indicators for Mobile Menu */
.mobile-menu button:focus-visible,
.mobile-menu a:focus-visible {
    outline: 3px solid #02877A;
    outline-offset: 2px;
    background-color: rgba(2, 135, 122, 0.1);
    position: relative;
    z-index: 1;
}

/* Focus indicator for menu toggle button */
button[aria-label=فتح/إغلاق القائمة]:focus-visible {
    outline: 3px solid #02877A;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(2, 135, 122, 0.2);
}

/* High contrast focus for better visibility */
@media (prefers-contrast: high) {
    .mobile-menu button:focus-visible,
    .mobile-menu a:focus-visible {
        outline-width: 4px;
        outline-color: #000;
        background-color: #FFFF00;
        color: #000;
    }
}

/* Keyboard-only focus (not mouse click) */
.mobile-menu button:focus:not(:focus-visible),
.mobile-menu a:focus:not(:focus-visible) {
    outline: none;
}

/* Active dropdown visual state */
.mobile-dropdown-menu.active {
    border-left: 4px solid #02877A;
}

/* Menu item hover and focus states */
.mobile-dropdown-menu a {
    transition: all 0.2s ease;
}

.mobile-dropdown-menu a:hover,
.mobile-dropdown-menu a:focus {
    background-color: rgba(2, 135, 122, 0.1);
    padding-right: 20px;
}

/* ARIA Live Region positioning */
#a11y-live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   17. COMPREHENSIVE RESPONSIVE FIXES - إصلاحات شاملة للتوافق
   Added: 2026-01-22
   ========================================================================== */

/* ===== Responsive Images Fix ===== */
img {
    max-width: 100%;
    height: auto;
}

img[width],
img[height] {
    max-width: 100%;
    height: auto;
}

/* Initiative card images */
#initiatives img,
.initiative-card img,
.grid img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* ===== Small Mobile (< 480px) ===== */
@media (max-width: 479.98px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Single column grid */
    .grid {
        grid-template-columns: 1fr !important;
    }

    /* Smaller card min-height */
    #initiatives .grid > a {
        min-height: auto;
    }

    /* Full width buttons */
    .flex.gap-2 {
        flex-direction: column;
    }

    .flex.gap-2 > * {
        width: 100%;
    }

    /* Smaller text */
    .text-4xl { font-size: 1.75rem !important; }
    .text-3xl { font-size: 1.5rem !important; }
    .text-2xl { font-size: 1.25rem !important; }
}

/* ===== Tablet Portrait (768px - 991px) ===== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .grid.lg\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .grid.lg\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ===== Tablet Landscape (992px - 1199px) ===== */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .grid.xl\:grid-cols-4 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ===== Responsive Spacing ===== */
@media (max-width: 767.98px) {
    .py-20 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
    .py-16 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .px-8 { padding-left: 1rem !important; padding-right: 1rem !important; }
    .gap-8 { gap: 1.5rem !important; }
    .gap-6 { gap: 1rem !important; }
    .mb-16 { margin-bottom: 2rem !important; }
    .mb-12 { margin-bottom: 1.5rem !important; }
}

/* ===== Fix Horizontal Overflow ===== */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

.container,
section,
main {
    max-width: 100%;
    overflow-x: hidden;
}

/* ===== Responsive Tables ===== */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    min-width: 100%;
}

@media (max-width: 767.98px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* ===== Cards Equal Height Fix ===== */
.grid > .bg-white {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.grid > .bg-white > .p-6:last-child,
.grid > .bg-white > div:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.grid > .bg-white .mt-auto {
    margin-top: auto !important;
}

/* ===== Touch Device Optimizations ===== */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .stat-card:hover,
    .news-card:hover,
    .service-card:hover,
    .initiative-card:hover {
        transform: none;
    }

    /* Larger touch targets */
    a, button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ===== Safe Area for Notched Devices ===== */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

/* ===== Landscape Mobile Fix ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-bg {
        min-height: 100vh;
    }

    .py-20 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
}

/* ==========================================================================
   18. INITIATIVE & SERVICE IMAGES RESPONSIVE FIX
   ========================================================================== */

/* Override fixed image sizes on mobile */
@media (max-width: 767.98px) {
    #initiatives .grid > a img,
    #services .grid > a img {
        width: 80px !important;
        height: 80px !important;
        max-width: 80px !important;
        max-height: 80px !important;
    }

    /* Smaller image area on mobile */
    #initiatives .grid > a > div:first-child,
    #services .grid > a > div:first-child {
        height: 140px !important;
        min-height: 140px !important;
    }
}

@media (max-width: 479.98px) {
    #initiatives .grid > a img,
    #services .grid > a img {
        width: 64px !important;
        height: 64px !important;
        max-width: 64px !important;
        max-height: 64px !important;
    }

    #initiatives .grid > a > div:first-child,
    #services .grid > a > div:first-child {
        height: 120px !important;
        min-height: 120px !important;
    }
}

/* ==========================================================================
   19. SEARCH BOX OVERFLOW FIX
   ========================================================================== */

/* Prevent search box from causing horizontal scroll */
#searchBox {
    max-width: 100% !important;
    overflow: hidden;
}

@media (max-width: 768px) {
    #searchBox {
        position: fixed !important;
        left: 1rem !important;
        right: 1rem !important;
        width: auto !important;
        max-width: calc(100vw - 2rem) !important;
        transform: none !important;
        z-index: 9999;
    }

    #searchBox input {
        width: 100% !important;
        font-size: 16px !important; /* Prevent iOS zoom */
    }
}

/* Extra safety for all fixed/absolute positioned elements */
[style*="position: absolute"],
[style*="position: fixed"],
.absolute,
.fixed {
    max-width: 100vw;
}

/* Mobile Menu Button Touch Fix */
#mobileMenuBtn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    position: relative;
    z-index: 9999;
}

/* Initiatives Carousel - Hide Scrollbar */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
