/**
 * Responsive Styles - Cyrus Agency Theme
 */

/* ========================================
   Base - Prévenir le défilement horizontal
======================================== */

html,
body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    position: relative;
}

body.menu-open {
    overflow: hidden;
}

#page,
.site {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

img,
video,
iframe,
embed,
object {
    max-width: 100%;
    height: auto;
}

/* ========================================
   Desktop - Ajustements header
======================================== */

@media (min-width: 1200px) and (max-width: 1400px) {
    .site-branding {
        max-width: 250px;
    }

    .site-title {
        font-size: 1rem;
    }

    .site-description {
        font-size: 0.65rem;
    }
}

/* ========================================
   Tablet (max-width: 1024px)
======================================== */

@media (max-width: 1024px) {
    .container {
        padding: 0 2rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
}

/* ========================================
   Mobile (max-width: 768px)
======================================== */

@media (max-width: 768px) {

    /* Forcer le blocage du défilement horizontal sur mobile */
    html,
    body,
    #page,
    .site {
        overflow-x: hidden !important;
        max-width: 100vw !important;
        width: 100% !important;
        position: relative;
    }

    * {
        max-width: 100%;
    }

    .container,
    .site-header,
    .header-container,
    .header-inner,
    .main-navigation,
    .nav-menu {
        max-width: 100vw;
        box-sizing: border-box;
    }

    /* Navigation Mobile - FORCER L'AFFICHAGE */
    .menu-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 1001 !important;
    }

    /* Masquer le menu desktop par défaut */
    .main-navigation .nav-menu {
        display: none;
    }

    /* Afficher le menu quand actif */
    .main-navigation.active .nav-menu {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Overlay pour le menu mobile */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 998;
    }

    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Menu mobile - Panel coulissant */
    .main-navigation {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        width: 85% !important;
        max-width: 320px !important;
        height: 100vh !important;
        background-color: var(--color-white) !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 999 !important;
        overflow-y: auto !important;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1) !important;
        padding-top: 80px !important;
        display: block !important;
    }

    .main-navigation.active {
        left: 0 !important;
    }

    .nav-menu {
        flex-direction: column;
        padding: 1rem 0;
        gap: 0;
        margin: 0;
        width: 100%;
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid var(--color-light);
        margin: 0;
    }

    .nav-menu li:first-child {
        border-top: 1px solid var(--color-light);
    }

    .nav-menu a {
        padding: 1rem 2rem;
        display: block;
        width: 100%;
        font-size: 1rem;
        font-weight: 500;
        transition: var(--transition);
    }

    .nav-menu a:hover {
        background-color: var(--color-light);
        color: var(--color-primary);
        padding-left: 2.5rem;
    }

    /* Empêcher le scroll du body quand le menu est ouvert */
    body.menu-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
        height: 100%;
    }

    .header-cta {
        display: none;
    }

    /* Hero */
    .hero-section {
        min-height: 500px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    /* Sections */
    section {
        padding: 3rem 0;
    }

    .section-title h2 {
        font-size: 2rem;
    }

    .section-title p {
        font-size: 1rem;
    }

    /* Grids */
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    /* Page Header */
    .page-header h1,
    .archive-header h1 {
        font-size: 2rem;
    }

    .page-description {
        font-size: 1rem;
    }

    /* Footer */
    .footer-widgets-inner {
        grid-template-columns: 1fr !important; /* 1 colonne sur mobile */
        gap: 2.5rem !important;
        text-align: left !important;
    }
    
    .footer-widget-area {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .footer-widget-area h3 {
        font-size: 1.25rem !important;
        margin-bottom: 1rem !important;
    }
    
    .footer-widget-area p,
    .footer-widget-area ul {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }

    .footer-bottom-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-menu {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* CTA Section */
    .cta-content h2 {
        font-size: 1.75rem;
    }

    .cta-content p {
        font-size: 1rem;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .cta-buttons .btn {
        width: 100%;
    }

    /* Service Card */
    .service-card-link {
        width: 100%;
    }

    /* Filters */
    .filter-buttons {
        gap: 0.5rem;
    }

    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }

    /* Project Content */
    .project-content-inner {
        flex-direction: column;
    }

    .project-sidebar {
        width: 100%;
    }

    /* About Page */
    .about-stats {
        padding: 3rem 0;
    }

    .histoire-content {
        flex-direction: column;
    }

    .process-steps {
        grid-template-columns: 1fr;
    }

    /* Testimonials Slider Responsive */
    .testimonials-slider {
        padding: 0 50px;
    }

    .testimonials-slider .splide__arrow {
        width: 40px;
        height: 40px;
    }

    .testimonials-slider .splide__arrow svg {
        width: 16px;
        height: 16px;
    }

    .testimonial-author {
        flex-direction: column;
        text-align: center;
    }

    .author-info {
        text-align: center;
    }

    /* Partners */
    .partners-logos {
        gap: 2rem;
    }

    .partner-logo img {
        max-height: 40px;
    }
}

/* ========================================
   Small Mobile (max-width: 480px)
======================================== */

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    /* Testimonials Slider Mobile */
    .testimonials-slider {
        padding: 0 40px;
    }

    .testimonials-slider .splide__arrow {
        width: 36px;
        height: 36px;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section-title h2 {
        font-size: 1.75rem;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }

    .btn-large {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }

    .service-card-icon {
        width: 60px;
        height: 60px;
    }

    .service-card-title {
        font-size: 1.25rem;
    }

    .portfolio-title {
        font-size: 1.25rem;
    }

    .cta-content h2 {
        font-size: 1.5rem;
    }

    .page-header h1,
    .archive-header h1 {
        font-size: 1.75rem;
    }

    /* Single Service Responsive */
    .service-banner {
        min-height: 400px;
        padding: 3rem 0;
    }

    .service-banner-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 1.5rem;
    }

    .service-banner-title {
        font-size: 2.25rem;
    }

    .service-banner-excerpt {
        font-size: 1.125rem;
        margin-bottom: 1.5rem;
    }

    .service-banner-meta {
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .service-meta-item {
        padding: 1rem 1.5rem;
        min-width: 120px;
    }

    .service-meta-item .meta-value {
        font-size: 1.25rem;
    }

    .service-meta-item .meta-value.price {
        font-size: 1.5rem;
    }

    .service-header {
        padding: 3rem 0;
    }

    .service-header-content {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }

    .service-icon {
        width: 100px;
        height: 100px;
    }

    .service-header-text h1 {
        font-size: 2rem;
    }

    .service-excerpt {
        font-size: 1.125rem;
    }

    .service-meta {
        justify-content: center;
        gap: 1.5rem;
    }

    /* Service Cards Responsive */
    .service-card-image {
        height: 200px;
    }

    .service-card-content {
        padding: 1.25rem;
    }

    .service-card-title {
        font-size: 1.25rem;
    }

    .service-description,
    .service-benefits,
    .service-technologies,
    .service-process,
    .service-projects {
        padding: 3rem 0;
    }

    .service-content {
        font-size: 1rem;
    }

    .benefits-grid {
        grid-template-columns: 1fr;
    }

    .technologies-grid {
        gap: 1rem;
    }

    .tech-item {
        min-width: 100px;
        padding: 1rem;
    }

    .process-timeline::before {
        left: 20px;
    }

    .step-number {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }

    .process-step {
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .service-cta {
        padding: 3rem 0;
    }

    .service-cta .cta-content h2 {
        font-size: 2rem;
    }

    .service-cta .cta-content p {
        font-size: 1.125rem;
    }
}

/* ========================================
   Print Styles
======================================== */

@media print {

    .site-header,
    .menu-toggle,
    .header-cta,
    .hero-buttons,
    .filter-buttons,
    .cta-section,
    .site-footer {
        display: none;
    }

    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }

    .card {
        border: 1px solid #ddd !important;
    }
}

/* ========================================
   High Resolution Displays
======================================== */

@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    /* Optimisations pour les écrans haute résolution */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* ========================================
   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;
    }
}

/* ========================================
   Bootstrap Carousel Responsive
======================================== */

/* Tablette (2 témoignages) */
@media (min-width: 769px) and (max-width: 991px) {
    #testimonials-carousel .carousel-inner {
        padding: 1rem 2rem;
    }
    
    #testimonials-carousel .col-lg-4 {
        display: none; /* Masquer le 3ème sur tablette */
    }
    
    #testimonials-carousel .col-md-6:nth-child(3) {
        display: none; /* Masquer le 3ème témoignage */
    }
}

/* Mobile (1 témoignage) */
@media (max-width: 768px) {
    #testimonials-carousel .carousel-inner {
        padding: 1rem 0.5rem;
    }
    
    #testimonials-carousel .carousel-item .row {
        margin: 0;
    }
    
    #testimonials-carousel .carousel-item .col-12 {
        padding: 0 0.5rem;
    }
    
    #testimonials-carousel .col-md-6:nth-child(n+2) {
        display: none; /* Masquer 2ème et 3ème sur mobile */
    }
    
    #testimonials-carousel .carousel-control-prev,
    #testimonials-carousel .carousel-control-next {
        width: 35px;
        height: 35px;
    }
    
    #testimonials-carousel .carousel-control-prev {
        left: -10px;
    }
    
    #testimonials-carousel .carousel-control-next {
        right: -10px;
    }
    
    #testimonials-carousel .carousel-indicators {
        margin-bottom: -1rem;
    }
    
    #testimonials-carousel .carousel-indicators button {
        width: 8px;
        height: 8px;
        margin: 0 4px;
    }
}

/* ========================================
   Dark Mode (optional)
======================================== */

@media (prefers-color-scheme: dark) {
    /* Laissé vide pour l'instant, à implémenter si nécessaire */
}