/*
  Theme Name: Conciergerie Nantaise - Responsive Styles Professional Edition
  Author: Conciergerie Nantaise
  Description: Styles responsives optimisés pour une expérience mobile-first moderne.
  Version: 2.0
*/

/* ===================================
   MOBILE FIRST - Styles de base - NAVIGATION CORRIGÉE
   =================================== */

/* Header mobile - Logo réduit */
.main-header .container {
    padding: 0 var(--spacing-sm);
}

.main-header .logo img {
    height: 40px;
    max-width: 160px;
    object-fit: contain;
}

.header-actions .btn-primary {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Cache la navigation desktop sur mobile */
.main-nav {
    display: none;
}

/* Affiche le menu toggle sur mobile */
.menu-toggle {
    display: flex;
}

/* Menu mobile overlay - slide depuis la droite */
.main-nav.active {
    display: flex; /* Changé en flex pour le footer en bas */
    flex-direction: column; /* Colonne pour avoir le footer en bas */
    position: fixed;
    top: 0;
    right: 0;
    width: min(85%, 400px);
    height: 100vh;
    background: linear-gradient(135deg, var(--white-color) 0%, var(--light-color) 100%);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.2);
    z-index: 1003; /* AU-DESSUS du logo (1002) et de l'overlay (999) */
    overflow-y: auto;
    animation: slideInRight 0.3s ease-out;
    pointer-events: auto; /* Toujours cliquable */
}

/* Liste du menu mobile */
.main-nav.active .nav-list {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-xxxl) var(--spacing-xl) var(--spacing-xl);
    gap: 0;
    flex: 1; /* Prend l'espace disponible */
    pointer-events: auto; /* Tous les liens cliquables */
}

/* Header du menu mobile */
.main-nav.active::before {
    content: 'Menu';
    display: block;
    padding: var(--spacing-xl) var(--spacing-xl) var(--spacing-md);
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: var(--font-weight-bold);
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, var(--white-color) 0%, var(--light-color) 100%);
    z-index: 10;
}

/* Items du menu mobile */
.main-nav.active .nav-item {
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    opacity: 0;
    animation: slideInRight 0.3s ease-out forwards;
    pointer-events: auto; /* Tous les items cliquables */
}

/* Animation décalée pour chaque item */
.main-nav.active .nav-item:nth-child(1) { animation-delay: 0.05s; }
.main-nav.active .nav-item:nth-child(2) { animation-delay: 0.1s; }
.main-nav.active .nav-item:nth-child(3) { animation-delay: 0.15s; }
.main-nav.active .nav-item:nth-child(4) { animation-delay: 0.2s; }
.main-nav.active .nav-item:nth-child(5) { animation-delay: 0.25s; }
.main-nav.active .nav-item:nth-child(6) { animation-delay: 0.3s; }

.main-nav.active .nav-item:last-child {
    border-bottom: none;
}

/* Liens du menu mobile */
.main-nav.active .nav-link {
    padding: var(--spacing-md) var(--spacing-sm);
    font-size: 1.1rem;
    color: var(--heading-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all var(--transition-base);
    pointer-events: auto; /* Force la cliquabilité */
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.main-nav.active .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(29, 78, 216, 0.05);
    padding-left: var(--spacing-md);
}

.main-nav.active .nav-link::after {
    display: none;
}

.main-nav.active .nav-link.active {
    color: var(--primary-color);
    background-color: rgba(29, 78, 216, 0.1);
    font-weight: var(--font-weight-bold);
}

/* Dropdown mobile amélioré */
.main-nav.active .nav-item.dropdown {
    border-bottom: none;
}

.main-nav.active .nav-item.dropdown > .nav-link {
    cursor: pointer;
}

.main-nav.active .nav-item.dropdown > .nav-link i {
    transition: transform var(--transition-base);
    color: var(--primary-color);
}

.main-nav.active .nav-item.dropdown.open > .nav-link i {
    transform: rotate(180deg);
}

.main-nav.active .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0;
    background-color: var(--light-color);
    width: 100%;
    border-radius: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    pointer-events: auto; /* Cliquable */
}

.main-nav.active .nav-item.dropdown.open .dropdown-menu {
    max-height: 600px;
    opacity: 1;
    border-bottom: 1px solid var(--border-color);
}

.main-nav.active .dropdown-menu .dropdown-item {
    pointer-events: auto; /* Items cliquables */
}

.main-nav.active .dropdown-menu .dropdown-item a {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) calc(var(--spacing-md) + var(--spacing-sm));
    font-size: 1rem;
    color: var(--text-color);
    border-left: 3px solid transparent;
    transition: all var(--transition-base);
    pointer-events: auto; /* Liens cliquables */
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.main-nav.active .dropdown-menu .dropdown-item a:hover {
    background-color: var(--white-color);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    padding-left: calc(var(--spacing-md) + var(--spacing-md));
}

/* Overlay sombre */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999; /* DERRIÈRE le header (1000) et le menu (1003) */
    opacity: 0;
    transition: opacity var(--transition-base);
    backdrop-filter: blur(2px);
    pointer-events: none; /* Ne bloque pas les clics par défaut */
}

.nav-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto; /* Permet les clics uniquement quand actif */
}

/* Animation du bouton hamburger */
.menu-toggle i {
    transition: transform var(--transition-base);
}

.menu-toggle.active {
    background-color: var(--primary-color);
    color: var(--white-color);
    border-color: var(--primary-color);
}

.menu-toggle.active i {
    transform: rotate(90deg);
}

/* Footer du menu mobile - visible uniquement dans le menu actif */
.main-nav.active .mobile-menu-footer {
    display: block;
}

/* ===================================
   SMARTPHONES PAYSAGE (576px+) nav-list
   =================================== */
@media (min-width: 576px) {
    .container {
        padding: 0 var(--spacing-lg);
    }

    .main-header .logo img {
        height: 48px;
        max-width: 200px;
    }

    .header-actions .btn-primary {
        padding: 0.5rem 1.25rem;
        font-size: 0.9rem;
    }

    h1 { font-size: clamp(2.5rem, 5vw, 2.8rem); }
    h2 { font-size: clamp(2rem, 4vw, 2.2rem); }
    h3 { font-size: clamp(1.6rem, 3vw, 1.8rem); }

    .testimonials-slider {
        gap: var(--spacing-lg);
    }

    .process-step {
        padding: var(--spacing-xl);
    }

    .process-step .step-number {
        width: 52px;
        height: 52px;
        font-size: 1.375rem;
    }
    
    .main-nav.active {
        width: min(70%, 450px);
    }
    
    .main-nav.active .nav-link {
        font-size: 1.15rem;
        padding: var(--spacing-md);
    }
}

/* ===================================
   TABLETTES (768px+)
   =================================== */
@media (min-width: 768px) {
    /* Layout en colonnes */
    .section-about-intro .row,
    .section-why-choose-us .row {
        gap: var(--spacing-xl);
    }

    .section-contact-form .row {
        gap: var(--spacing-xl);
    }

    /* Grilles améliorées */
    .testimonials-slider {
        grid-template-columns: repeat(2, 1fr);
    }

    .section-values .values-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .section-team .team-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===================================
   TABLETTES LARGES (992px+)
   =================================== */
@media (min-width: 992px) {
    .container {
        padding: 0 var(--spacing-xl);
    }

    h1 { font-size: clamp(3rem, 5vw, 4rem); }
    h2 { font-size: clamp(2.5rem, 4vw, 3rem); }
    h3 { font-size: clamp(2rem, 3vw, 2.2rem); }

    /* Header plus imposant */
    .main-header .logo img {
        height: 65px;
        max-width: none;
    }

    .main-header .container {
        padding: 0 var(--spacing-xl);
    }

    .header-actions .btn-primary {
        padding: 0.625rem 1.5rem;
        font-size: 0.95rem;
    }

    /* Grilles optimisées */
    .section-values .values-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .section-team .team-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .testimonials-slider {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Process steps horizontal sur grand écran */
    .process-steps {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .process-step {
        flex: 1 1 calc(50% - var(--spacing-lg));
    }

    /* Contact form layout */
    .section-contact-form .contact-grid {
        display: grid;
        grid-template-columns: 1.5fr 1fr;
        gap: var(--spacing-xl);
    }
}

/* ===================================
   DESKTOP (1160px+) - Navigation horizontale
   =================================== */
@media (min-width: 1160px) {
    /* Cache le menu toggle et l'overlay sur desktop */
    .menu-toggle,
    .nav-overlay {
        display: none !important;
    }

    /* Affiche la navigation en mode desktop */
    .main-nav {
        display: block !important;
        position: static !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        box-shadow: none !important;
        animation: none !important;
        overflow: visible !important;
    }
    
    .main-nav::before {
        display: none !important;
    }

    /* Menu horizontal */
    .main-nav .nav-list {
        display: flex !important;
        flex-direction: row !important;
        padding: 0 !important;
        gap: var(--spacing-md) !important;
        align-items: center;
    }

    /* Réinitialise les styles mobile */
    .main-nav .nav-item {
        margin: 0 !important;
        border-bottom: none !important;
        animation: none !important;
        opacity: 1 !important;
    }

    .main-nav .nav-link {
        padding: 0.5rem 0 !important;
        font-size: 0.95rem !important;
        display: block !important;
        background-color: transparent !important;
    }

    .main-nav .nav-link::after {
        display: block !important;
    }

    .main-nav .nav-link:hover {
        padding-left: 0 !important;
    }

    /* Dropdown desktop */
    .main-nav .dropdown-menu {
        position: absolute !important;
        box-shadow: var(--shadow-lg) !important;
        border: 1px solid var(--border-color) !important;
        padding: var(--spacing-xs) 0 !important;
        background-color: var(--white-color) !important;
        width: auto !important;
        min-width: 240px !important;
        border-radius: var(--border-radius-lg) !important;
        max-height: none !important;
        overflow: visible !important;
        opacity: 0 !important;
        transform: translateY(-10px) !important;
        display: none !important;
    }

    .main-nav .nav-item.dropdown:hover .dropdown-menu {
        display: block !important;
        opacity: 1 !important;
        transform: translateY(0) !important;
    }

    .main-nav .nav-item.dropdown.open .dropdown-menu {
        display: none !important;
    }

    .main-nav .dropdown-menu .dropdown-item a {
        padding: var(--spacing-sm) var(--spacing-md) !important;
        font-size: 0.95rem !important;
        border-left: none !important;
    }

    .main-nav .dropdown-menu .dropdown-item a:hover {
        padding-left: calc(var(--spacing-md) + 0.5rem) !important;
    }
    
    /* Navigation plus espacée */
    .main-nav .nav-list {
        gap: var(--spacing-xl) !important;
    }
}

/* ===================================
   GRANDS ÉCRANS (1200px+)
   =================================== */
@media (min-width: 1200px) {
    .container {
        max-width: 1280px;
        padding: 0 var(--spacing-xxl);
    }

    /* Typographie grande */
    h1 { font-size: 4rem; }
    h2 { font-size: 3rem; }
    h3 { font-size: 2.2rem; }

    /* Navigation plus espacée */
    .main-nav .nav-list {
        gap: calc(var(--spacing-xl) + 0.5rem) !important;
    }
    
    .header-actions {
        gap: var(--spacing-lg);
    }

    /* Process steps 3 colonnes si 3+ items */
    .process-steps {
        flex-wrap: wrap;
    }

    .process-step {
        flex: 1 1 calc(33.333% - var(--spacing-lg));
    }
}

/* ===================================
   TRÈS GRANDS ÉCRANS (1440px+)
   =================================== */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    /* Augmente légèrement tous les espacements */
    section {
        padding: calc(var(--spacing-xxxl) + var(--spacing-lg)) 0;
    }
}

/* ===================================
   ÉCRANS ULTRA LARGES (1920px+)
   =================================== */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
}

/* ===================================
   PETITS MOBILES (< 375px)
   =================================== */
@media (max-width: 374px) {
    html {
        font-size: 15px;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    .main-header .logo img {
        height: 35px;
        max-width: 130px;
    }

    .header-actions .btn-primary {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.95rem;
    }

    .btn-lg {
        padding: 0.875rem 1.75rem;
        font-size: 1rem;
    }

    .main-nav.active {
        width: 90%;
    }

    .value-card,
    .team-member-card,
    .testimonial-card {
        padding: var(--spacing-md);
    }
}

/* ===================================
   ORIENTATION PAYSAGE SUR MOBILES
   =================================== */
@media (max-height: 600px) and (orientation: landscape) {
    .main-nav.active {
        padding: var(--spacing-md);
    }

    .main-nav.active .nav-link {
        padding: var(--spacing-sm);
    }

    section {
        padding: var(--spacing-xl) 0;
    }
}

/* ===================================
   ANIMATIONS - AJOUTÉE
   =================================== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================================
   MODE SOMBRE (si préférence système)
   =================================== */
@media (prefers-color-scheme: dark) {
    /* Cette section peut être développée pour un mode sombre complet */
    /* Pour l'instant, on garde le thème clair par défaut */
}

/* ===================================
   RÉDUCTION DES MOUVEMENTS
   =================================== */
@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;
    }

    .main-nav.active,
    .main-nav.active .nav-item {
        animation: none !important;
        opacity: 1;
    }
    
    .menu-toggle i,
    .nav-link i,
    .dropdown-menu {
        transition: none !important;
    }
}

/* ===================================
   HAUTE RÉSOLUTION (Retina)
   =================================== */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Optimisations pour écrans haute résolution */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .team-member-card img,
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===================================
   IMPRESSION
   =================================== */
@media print {
    /* Masque les éléments non essentiels */
    .main-nav,
    .menu-toggle,
    .btn,
    #back-to-top,
    .main-footer .social-links {
        display: none !important;
    }

    /* Optimise pour l'impression */
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    section {
        padding: 1rem 0;
        page-break-inside: avoid;
    }

    h1 {
        font-size: 20pt;
        page-break-after: avoid;
    }

    h2 {
        font-size: 16pt;
        page-break-after: avoid;
    }

    h3 {
        font-size: 14pt;
        page-break-after: avoid;
    }

    /* Affiche les URLs des liens */
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
    }

    /* Évite les coupures de page dans les cards */
    .value-card,
    .team-member-card,
    .testimonial-card,
    .process-step {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    /* Grilles en colonne simple pour impression */
    .values-grid,
    .team-grid,
    .testimonials-slider {
        display: block;
    }

    .value-card,
    .team-member-card,
    .testimonial-card {
        margin-bottom: 1rem;
    }
}
