/**
 * Halo — Style du formulaire de demande d'information (Gravity Forms id 1)
 * =============================================================================
 * Scope : #gform_wrapper_1 — s'applique partout où le form 1 est rendu
 *   - page d'accueil (widget eael-gravity-form)
 *   - page Plans des unités (template-plans-unites.php)
 *
 * Le wrapper porte la frame visuelle (fond blanc + bordure + padding genereux)
 * pour que le formulaire ait le même rendu indépendamment du contexte
 * Elementor / template qui l'enveloppe.
 *
 * Les variables --halo-* sont déclarées dans plans-unites.css (:root) ;
 * fallback en dur ici pour les pages où plans-unites.css n'est pas chargé.
 * =============================================================================
 */

/* ---------------------------------------------------------------------------
 * 0. Fallback variables (au cas où plans-unites.css n'est pas chargé)
 * ------------------------------------------------------------------------- */
#gform_wrapper_1 {
    --halo-form-white:       #FFFFFF;
    --halo-form-accent:      #1E314F;
    --halo-form-secondary:   #84A09B;
    --halo-form-olive:       #899B43;
    --halo-form-text:        #7A7A7A;
    --halo-form-border:      #E2E2E2;
    --halo-form-border-frame:#878787;
    --halo-form-urbanist:    "Urbanist", "Helvetica Neue", Arial, sans-serif;
    --halo-form-p:           14px;
}

/* ---------------------------------------------------------------------------
 * 1. Cadre visuel : conteneur blanc avec bordure + padding généreux
 *    Meme cadre pour le formulaire (#gform_wrapper_1) ET la confirmation
 *    post-submit (#gform_confirmation_wrapper_1) — la frame doit rester
 *    visuellement coherente apres l'envoi.
 * ------------------------------------------------------------------------- */
#gform_wrapper_1,
#gform_confirmation_wrapper_1 {
    background: var(--halo-form-white);
    border: 1px solid var(--halo-form-border-frame);
    padding: clamp(36px, 5vw, 64px) clamp(28px, 5vw, 56px);
    margin: 0 auto;
    max-width: 1040px;
    box-sizing: border-box;
}

#gform_confirmation_wrapper_1 {
    --halo-form-white:       #FFFFFF;
    --halo-form-accent:      #1E314F;
    --halo-form-secondary:   #84A09B;
    --halo-form-olive:       #899B43;
    --halo-form-text:        #7A7A7A;
    --halo-form-border:      #E2E2E2;
    --halo-form-border-frame:#878787;
    --halo-form-urbanist:    "Urbanist", "Helvetica Neue", Arial, sans-serif;
    --halo-form-p:           14px;
}

#gform_wrapper_1 *,
#gform_wrapper_1 *::before,
#gform_wrapper_1 *::after,
#gform_confirmation_wrapper_1 *,
#gform_confirmation_wrapper_1 *::before,
#gform_confirmation_wrapper_1 *::after {
    box-sizing: border-box;
}

/* ---------------------------------------------------------------------------
 * 2. Grille de champs : 3 colonnes — ligne 1 (Prénom|Nom|Courriel),
 *    ligne 2 (Tél|Budget|Unité), ligne 3 (Date occupation),
 *    ligne 4 (Message pleine largeur), ligne 5 (Newsletter pleine largeur).
 *    !important pour neutraliser Elementor Pro qui peut injecter ses propres
 *    flex/grid sur le wrapper.
 * ------------------------------------------------------------------------- */
#gform_wrapper_1 #gform_fields_1,
#gform_wrapper_1 .gform_fields,
#gform_wrapper_1 .gform_body .gform_fields {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 16px 20px !important;
    align-items: start;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Chaque champ reste en bloc (pas écrasé par flex Elementor) */
#gform_wrapper_1 #gform_fields_1 > .gfield,
#gform_wrapper_1 .gform_fields > .gfield {
    display: block !important;
    width: auto !important;
    min-width: 0;
    margin: 0;
    padding: 0;
}

/* Champs pleine largeur */
#gform_wrapper_1 .gfield.gfield--width-full,
#gform_wrapper_1 .gfield--type-textarea,
#gform_wrapper_1 .gfield--type-consent,
#gform_wrapper_1 .gfield--type-checkbox,
#gform_wrapper_1 .gfield--type-html {
    grid-column: 1 / -1 !important;
}

#gform_wrapper_1 .gfield.gfield--width-two-thirds {
    grid-column: span 2;
}

/* Captcha invisible : sort visuellement de la grille */
#gform_wrapper_1 .gfield--type-captcha {
    grid-column: 1 / -1 !important;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Légende GF "* indique les champs requis" */
#gform_wrapper_1 .gform_required_legend {
    display: none;
}

#gform_wrapper_1 .gform_heading {
    margin: 0;
    padding: 0;
}

/* ---------------------------------------------------------------------------
 * 2.bis  Bannière d'erreurs (top du formulaire) + messages d'erreur inline
 *        Style harmonisé avec le cadre du formulaire — bordure marine,
 *        accent rouge brique discret, typo Urbanist.
 * ------------------------------------------------------------------------- */
#gform_wrapper_1 .gform_validation_errors {
    grid-column: 1 / -1;
    margin: 0 0 clamp(18px, 2vw, 24px);
    padding: 18px 22px;
    background: #FFF5F5;
    border: 1px solid #B94A48;
    border-left: 4px solid #B94A48;
    border-radius: 0;
    font-family: var(--halo-form-urbanist);
    color: #B94A48;
}

#gform_wrapper_1 .gform_validation_errors .gform_submission_error,
#gform_wrapper_1 .gform_validation_errors h2 {
    margin: 0;
    padding: 0;
    font-family: var(--halo-form-urbanist);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: #B94A48;
    text-transform: none;
    letter-spacing: 0;
    background: transparent;
    border: 0;
}

#gform_wrapper_1 .gform_validation_errors ol,
#gform_wrapper_1 .gform_validation_errors ul {
    margin: 10px 0 0 18px;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    color: #B94A48;
    line-height: 1.6;
}

#gform_wrapper_1 .gform_validation_errors a {
    color: #B94A48;
    text-decoration: underline;
}

/* Champ en erreur : bordure rouge */
#gform_wrapper_1 .gfield_error input[type="text"],
#gform_wrapper_1 .gfield_error input[type="email"],
#gform_wrapper_1 .gfield_error input[type="tel"],
#gform_wrapper_1 .gfield_error input[type="number"],
#gform_wrapper_1 .gfield_error select,
#gform_wrapper_1 .gfield_error textarea {
    border-color: #B94A48 !important;
    background: #FFF5F5 !important;
}

/* Message d'erreur sous chaque champ */
#gform_wrapper_1 .gfield_validation_message,
#gform_wrapper_1 .validation_message {
    margin-top: 6px;
    padding: 0;
    background: transparent;
    border: 0;
    color: #B94A48;
    font-family: var(--halo-form-urbanist);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.4;
}

/* Indicateur * dans les placeholders : meme couleur que le texte
   (rendu via placeholder, donc deja anime par le browser). */
#gform_wrapper_1 .gfield_required {
    color: #B94A48;
    font-weight: 600;
    margin-left: 2px;
}

/* ---------------------------------------------------------------------------
 * 3. Inputs / textarea / select
 * ------------------------------------------------------------------------- */
#gform_wrapper_1 input[type="text"],
#gform_wrapper_1 input[type="email"],
#gform_wrapper_1 input[type="tel"],
#gform_wrapper_1 input[type="number"],
#gform_wrapper_1 select,
#gform_wrapper_1 textarea {
    font-family: var(--halo-form-urbanist) !important;
    font-size: var(--halo-form-p) !important;
    font-weight: 400 !important;
    border: 1px solid var(--halo-form-border) !important;
    padding: 14px 16px !important;
    background: var(--halo-form-white) !important;
    color: var(--halo-form-accent) !important;
    border-radius: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: border-color 0.18s ease;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none !important;
    line-height: 1.4 !important;
}

#gform_wrapper_1 input:focus,
#gform_wrapper_1 textarea:focus,
#gform_wrapper_1 select:focus {
    outline: none !important;
    border-color: var(--halo-form-secondary) !important;
}

#gform_wrapper_1 textarea {
    min-height: 120px !important;
    resize: vertical;
}

/* Champ Unité pré-rempli par JS (page Plans des unités) */
#gform_wrapper_1 .gfield.is-prefilled input {
    border-color: var(--halo-form-olive) !important;
    background: #FAFCF5 !important;
}

/* ---------------------------------------------------------------------------
 * 4. Labels : visuellement masqués (sr-only) — design "placeholder only"
 *    Évite les désalignements quand un label long wrap sur 2 lignes.
 * ------------------------------------------------------------------------- */
#gform_wrapper_1 .gfield_label {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#gform_wrapper_1 #gform_fields_1 > .gfield,
#gform_wrapper_1 .gform_fields > .gfield {
    margin: 0;
    padding: 0;
}

#gform_wrapper_1 .ginput_container {
    margin-top: 0;
}

/* Checkbox / consentement : labels restent visibles */
#gform_wrapper_1 .gfield--type-consent .gfield_label,
#gform_wrapper_1 .gfield--type-checkbox .gfield_label {
    position: static !important;
    width: auto;
    height: auto;
    padding: initial;
    margin: 0 0 6px;
    overflow: visible;
    clip: auto;
    white-space: normal;
    font-family: var(--halo-form-urbanist);
    font-size: 13px;
    font-weight: 500;
    color: var(--halo-form-text);
}

#gform_wrapper_1 .gfield_checkbox label,
#gform_wrapper_1 .gfield_consent_label {
    font-family: var(--halo-form-urbanist);
    font-size: 14px;
    font-weight: 400;
    color: var(--halo-form-text);
    line-height: 1.5;
}

/* Placeholder bien visible */
#gform_wrapper_1 input::placeholder,
#gform_wrapper_1 textarea::placeholder {
    color: var(--halo-form-text);
    opacity: 1;
    font-weight: 400;
}

/* ---------------------------------------------------------------------------
 * 5. Date picker (champ 13) — deux selects côte à côte + lien retour
 * ------------------------------------------------------------------------- */
#gform_wrapper_1 .halo-dp {
    margin-top: 8px;
}

#gform_wrapper_1 .halo-dp__row {
    display: flex;
    gap: 10px;
}

#gform_wrapper_1 .halo-dp select {
    flex: 1;
    min-width: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%231E314F'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px !important;
    cursor: pointer;
}

#gform_wrapper_1 .halo-dp__back {
    display: inline-block;
    margin-top: 10px;
    padding: 0;
    background: none;
    border: 0;
    color: var(--halo-form-secondary);
    font-family: var(--halo-form-urbanist);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
}

#gform_wrapper_1 .halo-dp__back:hover {
    color: var(--halo-form-accent);
}

/* Quand le picker est actif, on cache le select natif GF mais sans le
   retirer du DOM (pour qu'il soit toujours soumis avec le formulaire). */
#gform_wrapper_1 select.halo-dp__hidden-native {
    display: none !important;
}

/* ---------------------------------------------------------------------------
 * 6. Footer : bouton ENVOYER collé en bas-droite du cadre
 * ------------------------------------------------------------------------- */
#gform_wrapper_1 .gform_footer {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    margin: clamp(20px, 2.5vw, 30px) calc(-1 * clamp(28px, 5vw, 56px)) calc(-1 * clamp(36px, 5vw, 64px)) 0;
    padding: 0;
}

#gform_wrapper_1 .gform_footer input[type="submit"],
#gform_wrapper_1 .gform_footer button[type="submit"],
#gform_wrapper_1 button.gform_button,
#gform_wrapper_1 .halo-gf-submit {
    background: var(--halo-form-accent) !important;
    color: #fff !important;
    font-family: var(--halo-form-urbanist) !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    letter-spacing: 1.4px !important;
    text-transform: uppercase !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 22px 38px !important;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
    box-shadow: none !important;
    width: auto !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center;
    gap: 12px;
    margin: 0;
    align-self: flex-end;
}

#gform_wrapper_1 .gform_footer input[type="submit"]:hover,
#gform_wrapper_1 button.gform_button:hover,
#gform_wrapper_1 .halo-gf-submit:hover {
    background: #2A4166 !important;
}

#gform_wrapper_1 .gform_footer input[type="submit"]::after {
    content: " \2192";
    margin-left: 10px;
}

#gform_wrapper_1 .halo-gf-submit .halo-btn__arrow {
    transition: transform 0.2s ease;
    font-size: 1.2em;
    line-height: 1;
}

#gform_wrapper_1 .halo-gf-submit:hover .halo-btn__arrow {
    transform: translateX(4px);
}

/* ---------------------------------------------------------------------------
 * 6.bis  Message de confirmation post-submit
 *        Apparait dans #gform_confirmation_wrapper_1 a la place du formulaire.
 *        Garde la meme frame + centre le contenu + bouton retour accueil.
 * ------------------------------------------------------------------------- */
#gform_wrapper_1 .gform_confirmation_message,
#gform_confirmation_wrapper_1 .gform_confirmation_message,
#gform_confirmation_wrapper_1 [class*="gform_confirmation_message"] {
    font-family: var(--halo-form-urbanist);
    font-size: 16px;
    color: var(--halo-form-accent);
    text-align: center;
}

.halo-form-confirm {
    font-family: var(--halo-form-urbanist, "Urbanist", "Helvetica Neue", Arial, sans-serif);
    color: var(--halo-form-accent, #1E314F);
    text-align: center;
    line-height: 1.55;
    padding: clamp(20px, 3vw, 40px) 0;
}

.halo-form-confirm p {
    margin: 0 0 1em;
    font-size: 15px;
}

.halo-form-confirm__title {
    font-size: clamp(18px, 2vw, 22px) !important;
    font-weight: 600;
    color: var(--halo-form-accent, #1E314F);
    margin-bottom: 1.2em !important;
}

.halo-form-confirm__phone {
    color: var(--halo-form-accent, #1E314F);
    font-weight: 600;
    text-decoration: underline;
}

.halo-form-confirm__phone:hover {
    color: var(--halo-form-secondary, #84A09B);
}

.halo-form-confirm__sig {
    font-style: italic;
    color: var(--halo-form-text, #7A7A7A);
    margin-bottom: 1.8em !important;
}

.halo-form-confirm__cta {
    margin: 0 !important;
}

.halo-form-confirm__btn {
    display: inline-block;
    background: var(--halo-form-accent, #1E314F);
    color: #fff !important;
    text-decoration: none !important;
    padding: 14px 32px;
    font-family: var(--halo-form-urbanist, "Urbanist", sans-serif);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    border: 1.5px solid var(--halo-form-accent, #1E314F);
    border-radius: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
    line-height: 1;
}

.halo-form-confirm__btn:hover,
.halo-form-confirm__btn:focus-visible {
    background: #2A4166;
    border-color: #2A4166;
    color: #fff !important;
}

/* ---------------------------------------------------------------------------
 * 7. Newsletter consent (injectée en JS sous le textarea)
 * ------------------------------------------------------------------------- */
#gform_wrapper_1 .halo-newsletter-consent-cell {
    grid-column: 1 / -1 !important;
    list-style: none;
    margin: 0;
    padding: clamp(14px, 1.5vw, 20px) 0 0;
    display: block;
}

#gform_wrapper_1 .halo-newsletter-consent {
    display: inline-flex;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
    user-select: none;
    max-width: 100%;
}

#gform_wrapper_1 .halo-newsletter-consent__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

#gform_wrapper_1 .halo-newsletter-consent__box {
    width: 18px;
    height: 18px;
    border: 1px solid var(--halo-form-accent);
    background: var(--halo-form-white);
    flex-shrink: 0;
    margin-top: 3px;
    position: relative;
    transition: background 0.18s ease;
}

#gform_wrapper_1 .halo-newsletter-consent__input:checked + .halo-newsletter-consent__box {
    background: var(--halo-form-accent);
}

#gform_wrapper_1 .halo-newsletter-consent__input:checked + .halo-newsletter-consent__box::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 6px;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

#gform_wrapper_1 .halo-newsletter-consent__input:focus-visible + .halo-newsletter-consent__box {
    outline: 2px solid var(--halo-form-olive);
    outline-offset: 3px;
}

#gform_wrapper_1 .halo-newsletter-consent__text {
    display: flex;
    flex-direction: column;
    font-family: var(--halo-form-urbanist);
    font-size: 13px;
    color: var(--halo-form-text);
    line-height: 1.5;
}

#gform_wrapper_1 .halo-newsletter-consent__text strong {
    color: var(--halo-form-accent);
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 3px;
    letter-spacing: 0.1px;
}

/* ---------------------------------------------------------------------------
 * 8. Responsive
 * ------------------------------------------------------------------------- */
@media (max-width: 720px) {
    #gform_wrapper_1 #gform_fields_1,
    #gform_wrapper_1 .gform_fields {
        grid-template-columns: 1fr !important;
    }

    #gform_wrapper_1 .gfield.gfield--width-two-thirds {
        grid-column: span 1;
    }

    #gform_wrapper_1 .halo-newsletter-consent {
        max-width: 100%;
    }

    #gform_wrapper_1 .halo-gf-submit,
    #gform_wrapper_1 .gform_footer input[type="submit"] {
        align-self: stretch;
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    #gform_wrapper_1 .gform_footer {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    #gform_wrapper_1 .gform_footer input[type="submit"],
    #gform_wrapper_1 .gform_button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}
