/* ==========================================================================
   Formulaires Contact Form 7 – style commun (pages Contact et Demande de devis)
   Chargé seulement sur les pages qui ont la classe body.ds-form-skin (voir contact-page.php).
   Les !important servent à passer devant les règles générales de style.css
   (marges de 20px, coins à 30px, couleurs…).
   ========================================================================== */

body.ds-form-skin {
    --dsf-accent: #D0187D;
    --dsf-accent-dark: #8B104E;
    --dsf-ink: #141414;
    --dsf-muted: #5C5C5C;
    --dsf-field: #DADADA;
    --dsf-line: #EDEDED;
    --dsf-error: #C62828;
    --dsf-title: 'Poppins', sans-serif;
    --dsf-text: 'Montserrat', sans-serif;
}

/* --- Grille : deux champs par ligne, message et bouton sur toute la largeur -- */
body.ds-form-skin .wpcf7-form > .form-group {
    margin: 0 0 16px;
}
body.ds-form-skin .wpcf7-form > p,
body.ds-form-skin .wpcf7-form > .form-group > p {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 0 0 16px;
    position: relative;
}
body.ds-form-skin .wpcf7-form > p:last-of-type {
    margin-bottom: 0;
}
body.ds-form-skin .wpcf7-form p > br {
    display: none;
}
body.ds-form-skin .wpcf7-form-control-wrap {
    display: block;
    position: relative;
    min-width: 0;
    width: auto !important;
    margin: 0 !important;
}
body.ds-form-skin .wpcf7-form-control-wrap[data-name="message"],
body.ds-form-skin .wpcf7-form-control-wrap:has(textarea) {
    grid-column: 1 / -1;
}

/* --- Champs ------------------------------------------------------------------ */
body.ds-form-skin .wpcf7-form input[type="text"],
body.ds-form-skin .wpcf7-form input[type="email"],
body.ds-form-skin .wpcf7-form input[type="tel"],
body.ds-form-skin .wpcf7-form input[type="number"],
body.ds-form-skin .wpcf7-form select,
body.ds-form-skin .wpcf7-form textarea {
    width: 100%;
    height: 52px;
    margin: 0 !important;
    border: 1.5px solid var(--dsf-field);
    border-radius: 14px !important;
    padding: 0 16px;
    font-family: var(--dsf-text);
    font-size: 15px;
    color: var(--dsf-ink);
    background-color: #FFFFFF;
    box-shadow: none;
    outline: none;
    transition: border-color .15s ease;
}
body.ds-form-skin .wpcf7-form textarea {
    height: auto;
    min-height: 170px;
    padding: 14px 16px;
    line-height: 1.6;
    resize: vertical;
}
/* Liste déroulante : flèche maison, texte à gauche */
body.ds-form-skin .wpcf7-form select {
    -webkit-appearance: none;
    appearance: none;
    text-align: left;
    padding: 0 48px 0 16px !important;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23D0187D' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}
body.ds-form-skin .wpcf7-form select option {
    padding-right: 0 !important;
}
body.ds-form-skin .wpcf7-form input::placeholder,
body.ds-form-skin .wpcf7-form textarea::placeholder {
    color: #8A8A8A;
    opacity: 1;
}
body.ds-form-skin .wpcf7-form input:hover,
body.ds-form-skin .wpcf7-form select:hover,
body.ds-form-skin .wpcf7-form textarea:hover {
    border-color: #BDBDBD;
}
body.ds-form-skin .wpcf7-form input:focus,
body.ds-form-skin .wpcf7-form select:focus,
body.ds-form-skin .wpcf7-form textarea:focus {
    outline: 2px solid var(--dsf-accent);
    outline-offset: 1px;
    border-color: var(--dsf-accent) !important;
}
body.ds-form-skin .wpcf7-form .wpcf7-not-valid {
    border-color: var(--dsf-error) !important;
}

/* --- Bouton « Envoyer » : pilule magenta avec flèche --------------------------- */
body.ds-form-skin .wpcf7-form .wpcf7-submit {
    grid-column: 1 / -1;
    justify-self: end;
    width: auto;
    height: 56px;
    margin: 8px 0 0 !important;
    padding: 0 58px 0 30px;
    border: 0;
    border-radius: 999px !important;
    background: var(--dsf-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='M13 6l6 6-6 6'/%3E%3C/svg%3E") no-repeat right 28px center;
    color: #FFFFFF;
    font-family: var(--dsf-title);
    font-weight: 600;
    font-size: 16px;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: none;
    cursor: pointer;
    transition: background-color .2s ease;
}
body.ds-form-skin .wpcf7-form .wpcf7-submit:hover {
    background-color: var(--dsf-accent-dark);
}
body.ds-form-skin .wpcf7-form .wpcf7-submit:focus-visible {
    outline: 2px solid var(--dsf-accent);
    outline-offset: 3px;
}
body.ds-form-skin .wpcf7-form .wpcf7-submit:disabled {
    opacity: .5;
    cursor: wait;
}
body.ds-form-skin .wpcf7-form .wpcf7-spinner {
    position: absolute;
    right: 230px;
    bottom: 16px;
    margin: 0;
}

/* --- Messages ---------------------------------------------------------------- */
body.ds-form-skin .wpcf7-not-valid-tip {
    color: var(--dsf-error);
    font-size: 13px;
    margin: 4px 0 0;
    padding-left: 4px;
}
body.ds-form-skin .wpcf7 form .wpcf7-response-output {
    margin: 24px 0 0;
    padding: 12px 16px;
    border-radius: 14px;
    border-width: 1.5px;
    font-size: 14px;
}

/* --- Mobile ------------------------------------------------------------------ */
@media (max-width: 767px) {
    body.ds-form-skin .wpcf7-form > p,
    body.ds-form-skin .wpcf7-form > .form-group > p {
        grid-template-columns: 1fr;
    }
    body.ds-form-skin .wpcf7-form input[type="text"],
    body.ds-form-skin .wpcf7-form input[type="email"],
    body.ds-form-skin .wpcf7-form input[type="tel"],
    body.ds-form-skin .wpcf7-form select,
    body.ds-form-skin .wpcf7-form textarea {
        font-size: 16px; /* évite le zoom automatique sur iPhone */
    }
    body.ds-form-skin .wpcf7-form .wpcf7-submit {
        justify-self: stretch;
        height: 54px;
    }
    body.ds-form-skin .wpcf7-form .wpcf7-spinner {
        right: 50%;
        bottom: -36px;
        transform: translateX(50%);
    }
}


/* ==========================================================================
   Page Demande de devis : le formulaire dans une carte blanche, comme sur la page Contact
   ========================================================================== */
body.ds-devis-page .wpcf7 {
    background: #FFFFFF;
    border: 1px solid var(--dsf-line);
    border-radius: 28px;
    padding: 40px;
    box-shadow: 0 2px 0 rgba(20, 20, 20, .02), 0 18px 40px rgba(20, 20, 20, .06);
}
@media (max-width: 767px) {
    body.ds-devis-page .wpcf7 {
        padding: 22px 18px;
        border-radius: 24px;
    }
}
