/* Responsive Design - Enhanced Version */

/* Mobile First Approach */
@media (max-width: 640px) {
    /* إصلاح مشاكل التمرير على الموبايل */
    html, body {
        overflow-x: hidden !important;
        overscroll-behavior: none !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
    }
    
    /* منع التداخل مع touch events */
    * {
        touch-action: manipulation !important;
    }
    
    /* التأكد من عمل التمرير العادي */
    .swiper, .carousel {
        touch-action: pan-x !important;
    }
    
    /* Typography */
    .text-5xl { font-size: 2rem !important; }
    .text-4xl { font-size: 1.75rem !important; }
    .text-3xl { font-size: 1.5rem !important; }
    .text-2xl { font-size: 1.25rem !important; }
    .text-xl { font-size: 1.125rem !important; }
    .text-lg { font-size: 1rem !important; }
    
    /* Header/Navbar */
    .sticky-header {
        padding: 0.5rem 1rem !important;
        background: rgba(31, 41, 55, 0.95) !important;
        backdrop-filter: blur(10px) !important;
    }
    
    .sticky-header nav {
        display: none !important;
    }
    
    .sticky-header nav.active {
        display: flex !important;
        flex-direction: column !important;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        background: rgba(31, 41, 55, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        padding: 1rem !important;
        z-index: 1000 !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
    
    .sticky-header nav a {
        padding: 0.75rem 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        display: block !important;
        text-align: center !important;
    }
    
    /* Mobile Menu */
    .mobile-menu {
        transition: all 0.3s ease-in-out !important;
        transform: translateY(-10px) !important;
        opacity: 0 !important;
    }
    
    .mobile-menu:not(.hidden) {
        transform: translateY(0) !important;
        opacity: 1 !important;
    }
    
    .mobile-menu-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Hero Section */
    #hero {
        height: 100vh !important;
        padding: 1rem !important;
    }
    
    #hero .text-5xl,
    #hero .md\:text-7xl {
        font-size: 2.5rem !important;
        line-height: 1.2 !important;
    }
    
    #hero .text-3xl,
    #hero .md\:text-4xl {
        font-size: 1.5rem !important;
    }
    
    #hero .text-xl,
    #hero .md\:text-2xl {
        font-size: 1rem !important;
    }
    
    /* Buttons */
    .bg-brand-red {
        padding: 0.75rem 1.5rem !important;
        font-size: 1rem !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Grid Layouts */
    .grid-cols-1.md\:grid-cols-2,
    .grid-cols-1.md\:grid-cols-3,
    .grid-cols-1.lg\:grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Cards */
    .advantage-card,
    .service-card,
    .project-card,
    .testimonial-card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Sections */
    section {
        padding: 2rem 1rem !important;
    }
    
    footer {
        padding: 2rem 1rem !important;
    }
    
    footer .grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    
    /* Floating Elements */
    .whatsapp-float {
        bottom: 1rem !important;
        left: 1rem !important;
    }
    
    .whatsapp-float .w-14 {
        width: 3rem !important;
        height: 3rem !important;
    }
    
    .sticky-cta {
        bottom: 1rem !important;
        right: 1rem !important;
    }
    
    .sticky-cta button {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Utility Classes */
    .hidden.md\:flex {
        display: none !important;
    }
    
    .md\:hidden {
        display: block !important;
    }
    
    .flex-col.sm\:flex-row {
        flex-direction: column !important;
    }
    
    .space-x-8 {
        gap: 0 !important;
    }
    
    .space-x-4 {
        gap: 0.5rem !important;
    }
    
    .space-x-6 {
        gap: 0.75rem !important;
    }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
    .text-5xl { font-size: 3rem !important; }
    .text-4xl { font-size: 2.5rem !important; }
    .text-3xl { font-size: 2rem !important; }
    .text-2xl { font-size: 1.75rem !important; }
    .text-xl { font-size: 1.5rem !important; }
    
    .sticky-header nav {
        display: flex !important;
    }
    
    .grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    section {
        padding: 3rem 2rem !important;
    }
    
    #hero .text-5xl,
    #hero .md\:text-7xl {
        font-size: 4rem !important;
    }
    
    #hero .text-3xl,
    #hero .md\:text-4xl {
        font-size: 2rem !important;
    }
    
    .space-x-8 {
        gap: 1rem !important;
    }
    
    .space-x-4 {
        gap: 0.75rem !important;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .sticky-header nav {
        display: flex !important;
    }
    
    .grid-cols-1.lg\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    #hero .text-5xl,
    #hero .md\:text-7xl {
        font-size: 5rem !important;
    }
    
    #hero .text-3xl,
    #hero .md\:text-4xl {
        font-size: 2.5rem !important;
    }
    
    .space-x-8 {
        gap: 2rem !important;
    }
    
    .space-x-4 {
        gap: 1rem !important;
    }
    
    .space-x-6 {
        gap: 1.5rem !important;
    }
}

/* Landscape Mobile */
@media (max-width: 640px) and (orientation: landscape) {
    #hero {
        height: 100vh !important;
        padding: 0.5rem !important;
    }
    
    #hero .text-5xl,
    #hero .md\:text-7xl {
        font-size: 2rem !important;
    }
    
    #hero .text-3xl,
    #hero .md\:text-4xl {
        font-size: 1.25rem !important;
    }
    
    #hero .text-xl,
    #hero .md\:text-2xl {
        font-size: 0.875rem !important;
    }
    
    .sticky-header nav.active {
        max-height: 60vh !important;
        overflow-y: auto !important;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    .sticky-header,
    .whatsapp-float,
    .sticky-cta,
    .carousel-arrow,
    .carousel-dot {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    .advantage-card,
    .service-card,
    .project-card {
        page-break-inside: avoid;
    }
}

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

/* Focus Styles */
button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #DC2626;
    outline-offset: 2px;
}

/* Touch Targets */
@media (max-width: 640px) {
    button,
    a,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    .carousel-arrow {
        width: 48px !important;
        height: 48px !important;
    }
    
    .carousel-dot {
        width: 16px !important;
        height: 16px !important;
    }
    
    .mobile-menu-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .sticky-header nav.active a {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .bg-brand-red,
    .border-2 {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #DC2626;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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