/**
 * Styles pour le formulaire de demande de devis
 */

/* Conteneur principal - éviter les conflits de z-index et overflow mobile */
.mafdevis-layout-wrapper {
    width: 100%;
    max-width: 100%;     /* Bloque tout débordement horizontal */
    overflow-x: hidden;  /* Empêche le scroll horizontal sur mobile */
    position: relative;
    z-index: 1;
}

/* Container principal du formulaire */
.mafdevis-success-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Container pour le titre et l'intro */
.mafdevis-form-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px 20px;
}

/* Container pour les deux colonnes (indépendant) */
.mafdevis-middle-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 30px;
}

/* Structure en deux colonnes */
.mafdevis-two-columns {
    display: flex;
    gap: 50px;
    align-items: flex-start;
    margin-bottom: 30px;
}

.mafdevis-left-column {
    flex: 0 0 45%;
    max-width: 45%;
}

.mafdevis-right-column {
    flex: 0 0 55%;
    max-width: 55%;
}

/* En-tête (Haut) */
.mafdevis-header-container {
    width: 100%;
    margin-bottom: 20px;
    overflow: hidden;
}

.mafdevis-header-container img {
    width: 100%;
    height: auto;          /* Hauteur naturelle = aucune coupure */
    max-height: none;      /* Suppression du plafond qui coupait "Aluminium" */
    object-fit: contain;   /* Image entière affichée sans recadrage */
    display: block;
}

/* Pied de page (Bas) - même style que le header */
.mafdevis-footer-container {
    width: 100%;
    margin-top: 60px;
    padding: 40px 0;
    overflow: hidden;
}

.mafdevis-footer-container img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    display: block;
    min-height: 300px;
}

/* Middle container adjustments */
.mafdevis-middle-container {
    margin-top: 30px;
}

/* Titre Premium */
.mafdevis-form-container .h1 {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 27px;
    text-transform: uppercase;
    color: #333;
    letter-spacing: -0.5px;
    margin-bottom: 30px;
    position: relative;
    padding-bottom: 15px;
}

.mafdevis-form-container .h1:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background-color: #25B848;
    border-radius: 2px;
}

/* Colonne de gauche : Image visuelle */
.mafdevis-visual-image {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mafdevis-visual-image img {
    width: 100%;
    height: auto;
    display: block;
    min-height: 500px;
    object-fit: cover;
}

/* ===== IMAGE VISUELLE GAUCHE ===== */

.mafdevis-visual-image {
    text-align: left;
    display: block;
}

.mafdevis-visual-image img {
    width: 100%;
    height: auto;
    display: block;
    min-height: 400px;
    object-fit: cover;
}

/* Image placeholder si pas de bannière */
.mafdevis-placeholder-image {
    background: linear-gradient(135deg, #25B848 0%, #1e9639 100%);
    border-radius: 8px;
    padding: 60px 40px;
    text-align: center;
    color: white;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.placeholder-content {
    max-width: 300px;
}

.placeholder-content .material-icons {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.9;
}

.placeholder-content h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 15px;
    color: white;
}

.placeholder-content p {
    font-size: 16px;
    margin: 0;
    opacity: 0.9;
}

/* Introduction du formulaire */
.form-intro {
    background-color: #f8f9fa;
    padding: 22px;
    border-left: 4px solid #25B848;
    margin-bottom: 35px;
    border-radius: 4px;
}

.form-intro p {
    margin: 0;
    font-size: 16px;
    color: #555;
}

/* Formulaire dans la colonne de droite */
.devis-form {
    background-color: #fff;
    padding: 35px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: none;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Groupes de champs */
.form-fields .form-group {
    margin-bottom: 28px;
}

.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

.form-label.required .required-star {
    color: #dc3545;
    margin-left: 3px;
}

/* Champs du formulaire */
.devis-form .form-control {
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 15px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.devis-form .form-control:focus {
    border-color: #25B848;
    box-shadow: 0 0 0 0.2rem rgba(37, 184, 72, 0.15);
    outline: none;
}

.devis-form textarea.form-control {
    resize: vertical;
    min-height: 150px;
}

/* Texte d'aide */
.form-text {
    font-size: 13px;
    color: #6c757d;
    margin-top: 5px;
}

/* Messages d'erreur */
.alert-danger ul {
    list-style: none;
    padding-left: 0;
}

.alert-danger li {
    padding: 5px 0;
}

.alert-danger li:before {
    content: "⚠ ";
    margin-right: 5px;
}

#file-error {
    font-size: 14px;
    font-weight: 500;
}

/* Bouton de soumission */
.form-footer {
    margin-top: 35px;
    text-align: left;
    padding: 0;
}

.devis-form .btn-primary {
    background-color: #25B848;
    border-color: #25B848;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 16px 45px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.devis-form .btn-primary:hover {
    background-color: #1e9639;
    border-color: #1e9639;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 184, 72, 0.3);
}

.devis-form .btn-primary:active {
    transform: translateY(0);
}

.devis-form .btn-primary .material-icons {
    font-size: 20px;
}

/* Info obligatoire */
.form-info {
    text-align: left;
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
    margin-top: 20px;
}

.form-info .required-star {
    color: #dc3545;
}

/* Page de succès */
.success-message {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    margin-bottom: 20px;
}

.success-icon .material-icons {
    font-size: 80px;
    color: #25B848;
}

.success-title {
    color: #25B848;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
}

.success-text {
    margin: 30px auto;
    max-width: 600px;
}

.success-text .lead {
    font-size: 18px;
    font-weight: 500;
    color: #333;
    margin-bottom: 15px;
}

.success-text p {
    font-size: 16px;
    color: #666;
}

.success-actions {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.success-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.success-actions .material-icons {
    font-size: 20px;
}

.success-info {
    max-width: 600px;
    margin: 30px auto;
}

.success-info .alert-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.success-info .material-icons {
    font-size: 24px;
}

/* Responsive */
@media (max-width: 991px) {

    /* Passage en mode empilé */
    .mafdevis-two-columns {
        flex-direction: column;
        gap: 30px;
    }

    .mafdevis-left-column,
    .mafdevis-right-column {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .mafdevis-left-column .mafdevis-visual-image img,
    .mafdevis-placeholder-image {
        min-height: 250px;
    }

    .mafdevis-placeholder-image {
        padding: 40px 20px;
    }

    .placeholder-content .material-icons {
        font-size: 48px;
        margin-bottom: 15px;
    }

    .placeholder-content h3 {
        font-size: 24px;
        margin-bottom: 10px;
    }

    .placeholder-content p {
        font-size: 14px;
    }
}

@media (max-width: 768px) {

    .mafdevis-form-container,
    .mafdevis-success-container {
        padding: 10px;
    }

    .devis-form {
        padding: 25px;
    }

    .form-intro {
        padding: 15px;
    }

    .form-intro p {
        font-size: 14px;
    }

    .devis-form .btn-primary {
        width: 100%;
        padding: 14px 25px;
        font-size: 15px;
        justify-content: center;
    }

    .mafdevis-footer-container {
        margin-top: 50px;
        padding: 30px 0;
    }

    .mafdevis-footer-container img {
        min-height: 220px;
    }

    .success-title {
        font-size: 24px;
    }

    .success-icon .material-icons {
        font-size: 60px;
    }

    .success-actions {
        flex-direction: column;
    }

    .success-actions .btn {
        width: 100%;
    }

    .success-actions .ml-3 {
        margin-left: 0 !important;
    }
}

@media (max-width: 576px) {
    .devis-form {
        padding: 15px;
    }

    .form-fields .form-group {
        margin-bottom: 20px;
    }

    .devis-form .form-control {
        padding: 10px 12px;
        font-size: 14px;
    }

    .success-text .lead {
        font-size: 16px;
    }
}

/* Champ Cloudflare - wrapper clip pour bloquer le débordement */
.cf-turnstile-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden;     /* Coupe ce qui dépasse après le scale */
    box-sizing: border-box;
}

.cf-turnstile {
    display: block;
    transform-origin: left top;
}

/* Bouton responsive */
.devis-form .btn-primary {
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
}

/* Tablette */
@media (max-width: 768px) {
    .devis-form .btn-primary {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    /* Scale Cloudflare : le wrapper overflow:hidden clip ce qui dépasse */
    .cf-turnstile {
        transform: scale(0.9);
        transform-origin: left top;
    }
    .cf-turnstile-wrapper {
        height: 68px; /* 76px × 0.9 = 68px pour éviter l'espace vide dessous */
    }
}

/* Mobile */
@media (max-width: 480px) {
    .cf-turnstile {
        transform: scale(0.78);
        transform-origin: left top;
    }
    .cf-turnstile-wrapper {
        height: 59px; /* 76px × 0.78 ≈ 59px */
        margin-bottom: 8px;
    }
    
    .devis-form .btn-primary {
        padding: 12px 15px;
        font-size: 14px;
        white-space: normal;  /* Autorise le retour à la ligne si texte long */
        text-align: center;
    }
}
.devis-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

.devis-form.loading .btn-primary:after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}