/* =================================================================
   FAST HOME PARE BRISE - CSS RESPONSIVE OPTIMISÉ
   Corrections pour mobile, tablette et demi-containers
   ================================================================= */

/* =================================================================
   BREAKPOINTS
   - Mobile: 0-576px
   - Mobile Large: 577-768px  
   - Tablette: 769-992px
   - Desktop petit: 993-1200px
   - Desktop: 1201px+
   ================================================================= */

/* =================================================================
   FIXES GÉNÉRAUX POUR TOUS LES ÉCRANS
   ================================================================= */

/* ⚠️ FIX CRITIQUE: Empêcher le débordement horizontal */
.fhpb-booking-app {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

.fhpb-booking-app .fhpb-card {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* S'assurer que toutes les sections ne débordent pas */
.fhpb-booking-app .fhpb-vitrage-selection-wrapper,
.fhpb-booking-app .fhpb-vitrage-layout-vertical,
.fhpb-booking-app .fhpb-quick-select-grid {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* Amélioration de la carte véhicule pour containers plus petits */
.fhpb-booking-app .fhpb-vehicle-card {
    min-width: 0 !important; /* Permet le shrink */
    max-width: 100% !important;
}

/* Forcer tous les éléments à rester dans leur container */
.fhpb-booking-app * {
    box-sizing: border-box !important;
}

/* Padding sécuritaire pour éviter le débordement */
.fhpb-booking-app .fhpb-card {
    padding-left: 16px !important;
    padding-right: 16px !important;
}

/* Grille boutons - s'assurer qu'elle ne déborde jamais */
.fhpb-booking-app .fhpb-buttons-column {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.fhpb-booking-app .fhpb-quick-select-grid {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

/* =================================================================
   NOUVEAU LAYOUT VERTICAL: Voiture en haut, boutons en bas
   ================================================================= */

/* Container principal vertical */
.fhpb-booking-app .fhpb-vitrage-layout-vertical {
    display: flex !important;
    flex-direction: column !important;
    gap: 30px !important;
    width: 100% !important;
}

/* Section voiture en haut - centrée */
.fhpb-booking-app .fhpb-car-section-top {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
}

.fhpb-booking-app .fhpb-car-view {
    max-width: 300px !important;
    width: 100% !important;
}

/* Section boutons en bas - grille */
.fhpb-booking-app .fhpb-buttons-section-bottom {
    width: 100% !important;
}

.fhpb-booking-app .fhpb-buttons-section-bottom .fhpb-quick-select-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
    width: 100% !important;
}

/* Icônes custodes en BLANC */
.fhpb-booking-app .fhpb-quick-select-btn[data-glass="custode-g"] .fhpb-btn-icon,
.fhpb-booking-app .fhpb-quick-select-btn[data-glass="custode-d"] .fhpb-btn-icon {
    color: #ffffff !important;
    font-size: 24px !important;
}

.fhpb-booking-app .fhpb-vehicle-brand {
    font-size: clamp(9px, 2vw, 11px) !important;
}

.fhpb-booking-app .fhpb-vehicle-model {
    font-size: clamp(16px, 4vw, 22px) !important;
    word-break: break-word !important;
}

.fhpb-booking-app .fhpb-vehicle-year {
    font-size: clamp(12px, 2.5vw, 14px) !important;
}

.fhpb-booking-app .fhpb-vehicle-plate {
    font-size: clamp(14px, 3vw, 16px) !important;
    padding: 6px 12px !important;
}

/* Voiture schématique responsive */
.fhpb-booking-app .fhpb-car-illustration {
    max-width: 100% !important;
    height: auto !important;
}

/* ===== ANCIEN SYSTÈME (commenté car layout vertical maintenant) =====
.fhpb-booking-app .fhpb-car-buttons-grid {
    display: grid !important;
    grid-template-columns: minmax(200px, 30fr) 70fr !important;
    gap: 20px !important;
    margin-bottom: 32px !important;
}
========= */

/* Bouton de confirmation - texte responsive */
.fhpb-booking-app .fhpb-btn-primary span {
    font-size: clamp(14px, 2.5vw, 16px) !important;
}

/* =================================================================
   TABLETTE ET PETIT DESKTOP (max-width: 1200px)
   ================================================================= */
@media (max-width: 1200px) {
    /* Réduction des paddings */
    .fhpb-booking-app .fhpb-card {
        padding: 20px !important;
    }
    
    /* ===== Ancien grid horizontal (commenté) =====
    .fhpb-booking-app .fhpb-car-buttons-grid {
        grid-template-columns: 35fr 65fr !important;
        gap: 16px !important;
    }
    ===== */
    
    /* Carte véhicule plus compacte */
    .fhpb-booking-app .fhpb-vehicle-card {
        padding: 14px !important;
    }
    
    .fhpb-booking-app .fhpb-vehicle-details {
        gap: 8px !important;
    }
    
    .fhpb-booking-app .fhpb-vehicle-detail {
        padding: 8px 10px !important;
    }
}

/* =================================================================
   TABLETTE (max-width: 992px)
   ================================================================= */
@media (max-width: 992px) {
    /* Grille VIN/Véhicule - toujours 2 colonnes mais plus compacte */
    .fhpb-booking-app .fhpb-vin-vehicle-grid {
        gap: 16px !important;
    }
    
    /* ===== Ancien grid (commenté) =====
    .fhpb-booking-app .fhpb-car-buttons-grid {
        grid-template-columns: 40fr 60fr !important;
    }
    ===== */
    
    /* Grille dommage/assurance en 1 colonne */
    .fhpb-booking-app .fhpb-damage-insurance-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    /* Grid adresse/postal/ville réduite mais encore en ligne */
    .fhpb-booking-app .fhpb-address-full-grid {
        grid-template-columns: 2fr 0.8fr 1.2fr !important;
        gap: 12px !important;
    }
    
    /* Réduction taille police */
    .fhpb-booking-app .fhpb-form-label {
        font-size: 13px !important;
    }
    
    .fhpb-booking-app .fhpb-form-input {
        font-size: 14px !important;
        padding: 10px 12px !important;
    }
}

/* =================================================================
   MOBILE LARGE (max-width: 768px)
   ================================================================= */
@media (max-width: 768px) {
    /* Container principal */
    .fhpb-booking-app {
        padding-bottom: 0 !important;
    }
    
    .fhpb-booking-app .fhpb-top-section {
        margin-bottom: 20px !important;
        padding: 0 20px !important;
    }

    .fhpb-booking-app .fhpb-logo-img {
        height: 35px !important;
        max-width: 200px !important;
    }

    .fhpb-booking-app .fhpb-main { 
        padding: 30px 20px !important;
    }

    .fhpb-booking-app .fhpb-header-inline,
    .fhpb-booking-app .fhpb-card-top-header {
        flex-direction: column !important;
        gap: 12px !important;
        text-align: center !important;
        padding: 15px 0 !important;
    }
    
    .fhpb-booking-app .fhpb-card { 
        padding: 24px 20px !important;
    }
    
    /* Grilles en 1 colonne */
    .fhpb-booking-app .fhpb-quick-select-grid, 
    .fhpb-booking-app .fhpb-damage-options, 
    .fhpb-booking-app .fhpb-form-grid-3 { 
        grid-template-columns: 1fr !important;
    }
    
    /* ⚠️ CORRECTION: Boutons vitrage en 3 colonnes sur mobile large (> 600px) */
    .fhpb-booking-app .fhpb-quick-select-grid,
    .fhpb-booking-app .fhpb-buttons-section-bottom .fhpb-quick-select-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    
    /* Voiture plus compacte sur mobile */
    .fhpb-booking-app .fhpb-car-view {
        max-width: 250px !important;
    }
    
    /* ⚠️ CORRECTION IMPORTANTE: Adresse en 1 colonne sur mobile */
    .fhpb-booking-app .fhpb-address-full-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .fhpb-booking-app .fhpb-date-grid { 
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .fhpb-booking-app .fhpb-time-grid { 
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Masquer les labels des étapes */
    .fhpb-booking-app .fhpb-steps { 
        display: none !important;
    }
    
    .fhpb-booking-app .fhpb-insurance-options, 
    .fhpb-booking-app .fhpb-btn-group { 
        flex-direction: column !important;
    }
    
    .fhpb-booking-app .fhpb-plate-field { 
        width: 160px !important;
        font-size: 26px !important;
    }
    
    /* Détails véhicule en 1 colonne */
    .fhpb-booking-app .fhpb-vehicle-details { 
        grid-template-columns: 1fr !important;
    }
    
    /* VIN plus compact */
    .fhpb-booking-app .fhpb-vin-value { 
        font-size: 14px !important;
        letter-spacing: 1px !important;
        word-break: break-all !important;
    }
    
    .fhpb-booking-app .fhpb-vin-header { 
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    /* Quick select en 2 colonnes */
    .fhpb-booking-app .fhpb-quick-select-grid { 
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        max-width: 100% !important;
    }
    
    /* Boutons de vitrage plus compacts sur mobile */
    .fhpb-booking-app .fhpb-quick-select-btn {
        padding: 10px 6px !important;
        min-height: 75px !important;
        font-size: 9px !important;
    }
    
    .fhpb-booking-app .fhpb-btn-icon {
        font-size: 16px !important;
        margin-bottom: 4px !important;
    }
    
    .fhpb-booking-app .fhpb-btn-title {
        font-size: 9px !important;
    }
    
    .fhpb-booking-app .fhpb-btn-desc {
        font-size: 7px !important;
    }

    /* Upload en 1 colonne */
    .fhpb-booking-app .fhpb-upload-grid {
        grid-template-columns: 1fr !important;
    }
    
    .fhpb-booking-app .fhpb-photos-grid {
        justify-content: center !important;
    }
    
    .fhpb-booking-app .fhpb-photo-upload-box {
        width: 100px !important;
        height: 100px !important;
    }
    
    /* Grille VIN/Véhicule en 1 colonne sur mobile */
    .fhpb-booking-app .fhpb-vin-vehicle-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    
    /* Section vitrage - padding réduit pour éviter débordement */
    .fhpb-booking-app .fhpb-vitrage-selection-wrapper {
        padding: 16px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Container de la section boutons */
    .fhpb-booking-app .fhpb-buttons-section-bottom {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Carte véhicule mieux présentée */
    .fhpb-booking-app .fhpb-vehicle-card {
        padding: 20px !important;
        margin-bottom: 20px !important;
    }
    
    .fhpb-booking-app .fhpb-vehicle-model {
        font-size: 20px !important;
    }
    
    .fhpb-booking-app .fhpb-vehicle-details {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    /* Bouton de confirmation plus compact */
    .fhpb-booking-app .fhpb-btn-primary {
        padding: 14px 20px !important;
        font-size: 15px !important;
    }
    
    .fhpb-booking-app .fhpb-btn-primary span {
        font-size: 15px !important;
    }
    
    /* Titres plus compacts */
    .fhpb-booking-app .fhpb-card-title {
        font-size: 22px !important;
    }
    
    .fhpb-booking-app .fhpb-section-title {
        font-size: 16px !important;
    }
}

/* =================================================================
   MOBILE (max-width: 576px)
   ================================================================= */
@media (max-width: 576px) {
    /* Paddings réduits */
    .fhpb-booking-app .fhpb-main {
        padding: 20px 15px !important;
    }
    
    .fhpb-booking-app .fhpb-card {
        padding: 20px 16px !important;
    }
    
    /* ⚠️ CORRECTION CRITIQUE: Boutons vitrage en 2 colonnes sur petits mobiles */
    .fhpb-booking-app .fhpb-quick-select-grid,
    .fhpb-booking-app .fhpb-buttons-section-bottom .fhpb-quick-select-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    /* Voiture encore plus petite sur mobile */
    .fhpb-booking-app .fhpb-car-view {
        max-width: 200px !important;
    }
    
    /* Gap réduit entre voiture et boutons */
    .fhpb-booking-app .fhpb-vitrage-layout-vertical {
        gap: 20px !important;
    }
    
    /* Titres encore plus compacts */
    .fhpb-booking-app .fhpb-card-title {
        font-size: 20px !important;
    }
    
    .fhpb-booking-app .fhpb-card-subtitle {
        font-size: 13px !important;
    }
    
    /* ⚠️ CORRECTION IMPORTANTE: Bouton "Confirmer le rendez-vous" plus court */
    .fhpb-booking-app .fhpb-btn-primary {
        padding: 12px 16px !important;
    }
    
    /* Texte du bouton raccourci sur mobile */
    .fhpb-booking-app .fhpb-btn-primary #confirmBtnText {
        font-size: 0 !important; /* Cache le texte original */
    }
    
    .fhpb-booking-app .fhpb-btn-primary #confirmBtnText::before {
        content: 'Confirmer le RDV' !important; /* Nouveau texte court */
        font-size: 14px !important;
        display: inline-block !important;
    }
    
    /* Carte véhicule très compacte */
    .fhpb-booking-app .fhpb-vehicle-card {
        padding: 16px !important;
    }
    
    .fhpb-booking-app .fhpb-vehicle-model {
        font-size: 18px !important;
    }
    
    .fhpb-booking-app .fhpb-vehicle-plate {
        font-size: 13px !important;
        padding: 6px 10px !important;
        letter-spacing: 1px !important;
    }
    
    /* Détails véhicule */
    .fhpb-booking-app .fhpb-vehicle-details {
        gap: 8px !important;
    }
    
    .fhpb-booking-app .fhpb-vehicle-detail {
        padding: 8px !important;
    }
    
    .fhpb-booking-app .fhpb-vehicle-detail-label {
        font-size: 8px !important;
    }
    
    .fhpb-booking-app .fhpb-vehicle-detail-value {
        font-size: 12px !important;
    }
    
    /* Formulaire plus compact */
    .fhpb-booking-app .fhpb-form-label {
        font-size: 12px !important;
        margin-bottom: 6px !important;
    }
    
    .fhpb-booking-app .fhpb-form-input {
        font-size: 14px !important;
        padding: 10px !important;
    }
    
    /* Grille de dates en 2 colonnes sur très petit mobile */
    .fhpb-booking-app .fhpb-date-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    /* Grille de temps en 2 colonnes */
    .fhpb-booking-app .fhpb-time-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    /* ⚠️ Boutons vitrage encore plus compacts */
    .fhpb-booking-app .fhpb-quick-select-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }
    
    .fhpb-booking-app .fhpb-quick-select-btn {
        padding: 8px 4px !important;
        min-height: 70px !important;
    }
    
    .fhpb-booking-app .fhpb-btn-icon {
        font-size: 14px !important;
    }
    
    .fhpb-booking-app .fhpb-btn-title {
        font-size: 8px !important;
        line-height: 1.1 !important;
    }
    
    .fhpb-booking-app .fhpb-btn-desc {
        font-size: 6.5px !important;
        line-height: 1 !important;
    }
    
    /* Boutons de groupe en colonne */
    .fhpb-booking-app .fhpb-btn-group {
        gap: 12px !important;
    }
    
    .fhpb-booking-app .fhpb-btn-group button {
        width: 100% !important;
    }
}

/* =================================================================
   MINI MOBILE (max-width: 380px)
   ================================================================= */
@media (max-width: 380px) {
    /* Plaque d'immatriculation plus petite */
    .fhpb-booking-app .fhpb-plate-field {
        width: 140px !important;
        font-size: 22px !important;
    }
    
    /* Carte véhicule minimale */
    .fhpb-booking-app .fhpb-vehicle-model {
        font-size: 16px !important;
    }
    
    .fhpb-booking-app .fhpb-vehicle-brand {
        font-size: 9px !important;
    }
    
    /* Titres encore plus petits */
    .fhpb-booking-app .fhpb-card-title {
        font-size: 18px !important;
    }
    
    /* Grille dates en 2 colonnes serrées */
    .fhpb-booking-app .fhpb-date-grid {
        gap: 6px !important;
    }
    
    /* Boutons vitrages plus petits */
    .fhpb-booking-app .fhpb-vitrage-btn {
        font-size: 11px !important;
        padding: 10px !important;
    }
}

/* =================================================================
   FIXES POUR DEMI-CONTAINER (dans une colonne de grid)
   ================================================================= */
@container (max-width: 800px) {
    /* ===== Ancien grid (commenté) =====
    .fhpb-booking-app .fhpb-car-buttons-grid {
        grid-template-columns: 1fr !important;
    }
    ===== */
    
    .fhpb-booking-app .fhpb-vin-vehicle-grid {
        grid-template-columns: 1fr !important;
    }
}

/* =================================================================
   AMÉLIORATION DE LA VOITURE SCHÉMATIQUE
   ================================================================= */

/* S'assurer que la voiture garde de bonnes proportions */
.fhpb-booking-app .fhpb-car-illustration {
    width: 100% !important;
    max-width: 280px !important;
    height: auto !important;
    margin: 0 auto !important;
    display: block !important;
}

@media (max-width: 1200px) {
    .fhpb-booking-app .fhpb-car-illustration {
        max-width: 220px !important;
    }
}

@media (max-width: 992px) {
    .fhpb-booking-app .fhpb-car-illustration {
        max-width: 200px !important;
    }
}

@media (max-width: 768px) {
    .fhpb-booking-app .fhpb-car-illustration {
        max-width: 250px !important;
        margin-bottom: 20px !important;
    }
}

/* =================================================================
   AMÉLIORATION DES BOUTONS DE SÉLECTION VITRAGE
   ================================================================= */

/* Boutons vitrages responsive */
.fhpb-booking-app .fhpb-vitrage-btn {
    font-size: clamp(11px, 2vw, 13px) !important;
    padding: clamp(10px, 2vw, 14px) !important;
}

.fhpb-booking-app .fhpb-vitrage-icon {
    font-size: clamp(18px, 3vw, 24px) !important;
}

/* =================================================================
   AMÉLIORATION PROGRESS BAR MOBILE
   ================================================================= */

@media (max-width: 768px) {
    .fhpb-booking-app .fhpb-progress-container {
        padding: 12px 0 !important;
    }
    
    .fhpb-booking-app .fhpb-progress-bar {
        height: 3px !important;
    }
    
    .fhpb-booking-app .fhpb-step-number {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }
}

/* =================================================================
   PRINT STYLES (bonus)
   ================================================================= */
@media print {
    .fhpb-booking-app .fhpb-btn-group,
    .fhpb-booking-app .fhpb-progress-container {
        display: none !important;
    }
    
    .fhpb-booking-app .fhpb-card {
        page-break-inside: avoid !important;
    }
}
