/* ===== Responsive Design - Sheikh Ayoub Maghrebi ===== */

/* ===== Mobile First Approach ===== */

/* ===== Extra Small Devices (phones, 576px and down) ===== */
@media (max-width: 575.98px) {
    .container {
        padding: 0 1rem;
    }
    
    .hero-text h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-text h2 {
        font-size: 1.3rem;
    }
    
    .hero-text p {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .service-card {
        padding: 1.5rem;
    }
    
    .service-card h3 {
        font-size: 1.3rem;
    }
    
    .about-highlights {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .highlight-item {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }
    
    .highlight-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-item {
        padding: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .contact-form-section {
        padding: 1.5rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 280px;
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    .floating-whatsapp {
        bottom: 1rem;
        right: 1rem;
    }
    
    .floating-whatsapp a {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
    
    .floating-whatsapp .whatsapp-text {
        display: none;
    }
    
    .scroll-top-btn {
        bottom: 1rem;
        left: 1rem;
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .footer-links-bottom {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ===== Small Devices (landscape phones, 576px and up) ===== */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
    }
    
    .hero-text h2 {
        font-size: 1.5rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .about-highlights {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .contact-content {
        grid-template-columns: 1fr;
    }
    
    .hero-buttons {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn-primary,
    .btn-secondary {
        flex: 1;
        min-width: 200px;
    }
}

/* ===== Medium Devices (tablets, 768px and up) ===== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .container {
        padding: 0 2rem;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
    }
    
    .hero-text h1 {
        font-size: 3rem;
    }
    
    .hero-text h2 {
        font-size: 1.8rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .about-highlights {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .contact-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .hero-buttons {
        justify-content: center;
    }
}

/* ===== Large Devices (desktops, 992px and up) ===== */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }
    
    .hero-content {
        grid-template-columns: 1fr 1fr;
    }
    
    .hero-text h1 {
        font-size: 3.2rem;
    }
    
    .hero-text h2 {
        font-size: 1.9rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .about-highlights {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .contact-content {
        grid-template-columns: 1fr 1fr;
    }
}

/* ===== Extra Large Devices (large desktops, 1200px and up) ===== */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
    
    .hero-content {
        grid-template-columns: 1fr 1fr;
        gap: 4rem;
    }
    
    .hero-text h1 {
        font-size: 3.5rem;
    }
    
    .hero-text h2 {
        font-size: 2rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .about-highlights {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .contact-content {
        grid-template-columns: 1fr 1fr;
    }
}

/* ===== Ultra Wide Screens (1400px and up) ===== */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-text h1 {
        font-size: 4rem;
    }
    
    .hero-text h2 {
        font-size: 2.2rem;
    }
    
    .section-title {
        font-size: 3rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3rem;
    }
    
    .service-card {
        padding: 3rem 2rem;
    }
}

/* ===== Landscape Orientation ===== */
@media (orientation: landscape) and (max-height: 500px) {
    .hero {
        min-height: auto;
        padding: 2rem 0;
    }
    
    .hero-content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    
    .hero-text h1 {
        font-size: 2rem;
    }
    
    .hero-text h2 {
        font-size: 1.3rem;
    }
    
    .hero-text p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .hero-buttons {
        margin-bottom: 1rem;
    }
    
    .hero-stats {
        gap: 1rem;
    }
}

/* ===== High DPI Displays ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .service-icon,
    .highlight-icon,
    .stat-icon {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ===== Print Styles ===== */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    .header,
    .floating-whatsapp,
    .scroll-top-btn,
    .nav-actions,
    .hero-buttons,
    .contact-form-section,
    .social-links {
        display: none !important;
    }
    
    .hero {
        min-height: auto;
        padding: 1rem 0;
        background: white !important;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-text h1,
    .hero-text h2,
    .section-title {
        color: black !important;
    }
    
    .service-card,
    .highlight-item,
    .testimonial-card,
    .stat-item {
        break-inside: avoid;
        border: 1px solid #ddd !important;
        margin-bottom: 1rem;
    }
    
    .footer {
        background: white !important;
        color: black !important;
        border-top: 1px solid #ddd;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
    }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .floating-whatsapp {
        animation: none !important;
    }
    
    .hero-image img:hover {
        transform: none !important;
    }
    
    .service-card:hover,
    .highlight-item:hover,
    .testimonial-card:hover,
    .stat-item:hover {
        transform: none !important;
    }
}

/* ===== Dark Mode Support ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #e9ecef;
        --text-light: #adb5bd;
        --bg-color: #212529;
        --white: #343a40;
    }
    
    .header {
        background: linear-gradient(135deg, #343a40 0%, #495057 50%, #6c757d 100%);
    }
    
    .service-card,
    .highlight-item,
    .testimonial-card,
    .stat-item,
    .faq-item,
    .contact-form-section,
    .info-card {
        background: #495057;
        border-color: #6c757d;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        background: #495057;
        border-color: #6c757d;
        color: #e9ecef;
    }
}

/* ===== Focus Styles for Accessibility ===== */
@media (prefers-reduced-motion: no-preference) {
    .nav-link:focus,
    .btn-primary:focus,
    .btn-secondary:focus,
    .whatsapp-btn:focus,
    .social-link:focus,
    .contact-link:focus,
    .btn-submit:focus,
    .faq-question:focus,
    .dot:focus,
    .scroll-top-btn:focus {
        outline: 2px solid var(--accent-color);
        outline-offset: 2px;
    }
}

/* ===== Container Queries (Future Support) ===== */
@supports (container-type: inline-size) {
    .services-grid {
        container-type: inline-size;
    }
    
    @container (max-width: 400px) {
        .service-card {
            padding: 1rem;
        }
        
        .service-card h3 {
            font-size: 1.2rem;
        }
    }
}

/* ===== Hover Support Detection ===== */
@media (hover: hover) and (pointer: fine) {
    .service-card:hover {
        transform: translateY(-10px);
    }
    
    .highlight-item:hover {
        transform: translateY(-5px);
    }
    
    .stat-item:hover {
        transform: translateY(-5px);
    }
    
    .hero-image img:hover {
        transform: scale(1.05);
    }
}

@media (hover: none) and (pointer: coarse) {
    .service-card:active,
    .highlight-item:active,
    .stat-item:active {
        transform: scale(0.98);
    }
}

/* ===== Touch Device Optimizations ===== */
@media (pointer: coarse) {
    .nav-link,
    .btn-primary,
    .btn-secondary,
    .whatsapp-btn,
    .social-link,
    .contact-link,
    .btn-submit,
    .faq-question,
    .dot,
    .scroll-top-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .hamburger {
        padding: 1rem;
    }
    
    .hamburger span {
        width: 30px;
        height: 4px;
    }
}

/* ===== Specific Device Optimizations ===== */

/* iPhone SE and similar small phones */
@media (max-width: 375px) {
    .hero-text h1 {
        font-size: 1.8rem;
    }
    
    .hero-text h2 {
        font-size: 1.2rem;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .service-card {
        padding: 1rem;
    }
    
    .service-card h3 {
        font-size: 1.1rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* iPad and similar tablets */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .about-highlights {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* iPad and similar tablets - Landscape */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
    .hero-content {
        grid-template-columns: 1fr 1fr;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .about-highlights {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large Desktop Screens */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
    
    .hero-text h1 {
        font-size: 4.5rem;
    }
    
    .hero-text h2 {
        font-size: 2.5rem;
    }
    
    .section-title {
        font-size: 3.5rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4rem;
    }
    
    .service-card {
        padding: 4rem 3rem;
    }
    
    .service-card h3 {
        font-size: 2rem;
    }
    
    .service-card p {
        font-size: 1.2rem;
    }
}
