/* EAFPS — Application forms + payment page
 *
 * Inherits the Salient look-and-feel: same fonts (Butler / Inter), same
 * border color (--nectar-extra-color-4), same accent (--nectar-accent-color).
 * Fallback values are provided after each var() in case Salient isn't loaded.
 */

.eafps-app-form,
.eafps-payment {
    --eafps-brand:          #0f3a5f;
    --eafps-text:           #2a2a2a;
    --eafps-text-muted:     #6b7480;
    --eafps-error-bg:       #fbe9e7;
    --eafps-error-border:   #d84315;
    --eafps-success-bg:     #e8f5e9;
    --eafps-success-border: #2e7d32;
    /* Figma DEV-2 token — local fallback if the global var isn't defined. */
    --Contour-champs:       #DCE4F5;

    color: var(--eafps-text);
    font-family: "Inter", inherit;
    box-sizing: border-box;
}
.eafps-app-form *,
.eafps-payment * {
    box-sizing: inherit;
}

/* ── Form container (100% width, no max) ─────────────────────────────── */

.eafps-app-form {
    width: 100%;
}

.eafps-app-form__intro {
    background: #f6f8fb;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 16px;
}

.eafps-app-form__error {
    padding: 14px 18px;
    margin-bottom: 24px;
    background: var(--eafps-error-bg);
    border-left: 4px solid var(--eafps-error-border);
    border-radius: 6px;
    color: #4a1e16;
}

/* ── Section heading (matches .wpcf7-form .heading from the theme) ──── */

.eafps-app-form__section {
    margin: 32px 0 16px;
    padding-bottom: 0;
    font-family: "Butler", serif;
    font-weight: 400;
    font-size: 30px;
    color: var(--eafps-brand);
}

/* ── 2-column responsive grid ────────────────────────────────────────── */

.eafps-app-form__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 24px;
}
.eafps-app-form__col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    flex: 1 1 calc(50% - 12px);
}
.eafps-app-form__col--12 {
    flex-basis: 100%;
}

/* Directors : 3 columns (one person per column) on desktop. DOM order is
   firstname1, firstname2, firstname3, lastname1, lastname2, lastname3 — so the
   first row holds the three first names and the second row the three last names. */
.eafps-app-form__grid--directors > .eafps-app-form__col {
    flex: 1 1 calc(33.333% - 16px);
}

@media ( max-width: 690px ) {
    .eafps-app-form {
        text-align: left;
    }
    .eafps-app-form__col {
        flex-basis: 100%;
    }

    /* Sponsors : on mobile, stack as fullname1 / email1 / fullname2 / email2
       (each sponsor grouped). DOM order is name1, name2, email1, email2 — kept
       for the desktop 2-column comparison — so we only reorder below the
       stacking breakpoint via flex `order`. */
    .eafps-app-form__grid--sponsors > :nth-child(1) { order: 1; } /* sponsor 1 — full name */
    .eafps-app-form__grid--sponsors > :nth-child(3) { order: 2; } /* sponsor 1 — email */
    .eafps-app-form__grid--sponsors > :nth-child(2) { order: 3; } /* sponsor 2 — full name */
    .eafps-app-form__grid--sponsors > :nth-child(4) { order: 4; } /* sponsor 2 — email */

    /* Directors : on mobile, stack grouped per person and in order
       (Director, then Co-director 1, then Co-director 2 — each first+last). DOM
       order is first1, first2, first3, last1, last2, last3 — kept for the desktop
       3-column layout — so we only regroup below the stacking breakpoint. */
    .eafps-app-form__grid--directors > .eafps-app-form__col { flex-basis: 100%; }
    .eafps-app-form__grid--directors > :nth-child(1) { order: 1; } /* Director — first name */
    .eafps-app-form__grid--directors > :nth-child(4) { order: 2; } /* Director — last name */
    .eafps-app-form__grid--directors > :nth-child(2) { order: 3; } /* Co-director 1 — first name */
    .eafps-app-form__grid--directors > :nth-child(5) { order: 4; } /* Co-director 1 — last name */
    .eafps-app-form__grid--directors > :nth-child(3) { order: 5; } /* Co-director 2 — first name */
    .eafps-app-form__grid--directors > :nth-child(6) { order: 6; } /* Co-director 2 — last name */
}

/* ── Labels ──────────────────────────────────────────────────────────── */
/* Note: input / radio / checkbox / required-asterisk chrome lives in
 * forms-global.css (auto-loaded on every frontend page via the
 * `eafps-styled-forms` body class) so it applies site-wide, not only to
 * .eafps-app-form. */

.eafps-app-form__label {
    font-family: "Butler", serif;
    font-weight: 300;
    font-size: 18px;
    color: var(--eafps-text);
}

/* ── Radio + checkbox groups : layout only (chrome is in forms-global.css) */

.eafps-app-form__radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 32px;
}
.eafps-app-form__radio {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: "Inter", sans-serif;
    font-weight: 300;
    font-size: 15px;
    color: var(--eafps-text);
    cursor: pointer;
}

.eafps-app-form__checkbox-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 24px;
}
@media ( max-width: 1000px ) {
    .eafps-app-form__checkbox-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media ( max-width: 690px ) {
    .eafps-app-form__checkbox-group {
        grid-template-columns: 1fr;
    }
}
.eafps-app-form__checkbox {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: "Inter", sans-serif;
    font-weight: 300;
    font-size: 15px;
    color: var(--eafps-text);
    cursor: pointer;
}

/* ── Informational note (e.g. auto-renewal terms) ────────────────────── */

.eafps-app-form__note {
    margin: 24px 0 0;
    font-size: 14px;
    line-height: 1.6;
    color: #6b7480;
}

/* ── Consent (privacy policy etc.) ──────────────────────────────────── */

.eafps-app-form__consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 24px 0 0;
    padding: 14px 18px;
    background: #f6f8fb;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.5;
}
.eafps-app-form__consent input {
    margin-top: 3px;
    accent-color: var(--nectar-accent-color, #2e6da8);
}

/* ── Submit button (matches Salient rounded buttons) ─────────────────── */

.eafps-app-form__submit-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 28px;
}
.eafps-app-form__submit {
    padding: 12px 32px;
    background: var(--nectar-accent-color, #2e6da8);
    color: #fff;
    border: none;
    border-radius: 9999px;
    font-family: "Inter", sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}
.eafps-app-form__submit:hover {
    background: var(--eafps-brand);
}
.eafps-app-form__submit:active {
    transform: translateY(1px);
}

/* ── Loading state for Stripe payment buttons ────────────────────────────
   Creating the Stripe Checkout session and redirecting can take a second or
   two ; show an inline spinner so the user knows the click registered and
   waits instead of clicking again. The `is-loading` class is added by
   application-wizard.js on the AJAX application/payment forms, and by an
   inline handler on the plain-POST membership renewal form
   (.eafps-renew-submit). */
.eafps-app-form__submit.is-loading,
.eafps-payment__submit.is-loading,
.eafps-renew-submit.is-loading {
    position: relative;
    color: transparent !important;   /* hide the label, the spinner takes over */
    pointer-events: none;            /* block double-clicks while we wait */
    cursor: progress;
}
.eafps-app-form__submit.is-loading::after,
.eafps-payment__submit.is-loading::after,
.eafps-renew-submit.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: eafps-btn-spin 0.6s linear infinite;
}
@keyframes eafps-btn-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .eafps-app-form__submit.is-loading::after,
    .eafps-payment__submit.is-loading::after,
    .eafps-renew-submit.is-loading::after {
        animation-duration: 1.5s;
    }
}

/* ── Processing overlay shown while the server handles the submission ───────
   Processing (validation, account creation, Stripe invoice, emails) takes
   ~10-20s. During that wait we cover ONLY the form with a white overlay (locks
   field editing) + spinner + message. Scoped to the form on purpose : the site
   menu / other links stay clickable, so a stuck/errored submission never traps
   the user. Injected / removed by application-wizard.js. The inner block is
   sticky so the message stays in view even on a long form. */
.eafps-app-form,
.eafps-payment {
    position: relative;
}
.eafps-form-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.94);
    border-radius: inherit;
    display: flex;
    align-items: flex-end;       /* contenu en bas du form = près du bouton submit, donc visible */
    justify-content: center;
}
.eafps-form-overlay__inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    padding: 24px 24px 32px;
    text-align: center;
}
.eafps-form-overlay__msg {
    font-family: "Inter", sans-serif;
    font-weight: 500;
    font-size: 15px;
    color: var(--eafps-text, #2a2a2a);
}
.eafps-form-overlay__spinner {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(0, 0, 0, 0.12);
    border-top-color: var(--nectar-accent-color, #2e6da8);
    border-radius: 50%;
    animation: eafps-btn-spin 0.7s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
    .eafps-form-overlay__spinner { animation-duration: 1.6s; }
}
/* "Continue to payment" CTA shown once processing succeeds. */
.eafps-form-overlay__btn {
    display: inline-block;
    padding: 12px 26px;
    background: var(--nectar-accent-color, #2e6da8);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: "Inter", sans-serif;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition: filter 0.15s ease;
}
.eafps-form-overlay__btn:hover { filter: brightness(0.92); }

/* ── Payment page ────────────────────────────────────────────────────── */

.eafps-payment {
    max-width: 520px;
    margin: 0 auto;
    padding: 32px 36px;
    background: #fff;
    border: 1px solid var(--nectar-extra-color-4, #E3E9F6);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(15, 58, 95, 0.07);
}

.eafps-payment__heading {
    margin: 0 0 22px;
    font-family: "Butler", serif;
    font-weight: 400;
    color: var(--eafps-brand);
    font-size: 28px;
}

.eafps-payment__line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 10px 0;
    font-size: 16px;
}
.eafps-payment__line--amount {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed var(--nectar-extra-color-4, #E3E9F6);
    font-size: 22px;
    font-weight: 700;
    color: var(--eafps-brand);
}
.eafps-payment__label {
    color: var(--eafps-text-muted);
}
.eafps-payment__value {
    text-align: right;
}

.eafps-payment__form {
    margin-top: 26px;
}
.eafps-payment__submit {
    display: block;
    width: 100%;
    padding: 14px 24px;
    background: var(--nectar-accent-color, #2e6da8);
    color: #fff;
    border: none;
    border-radius: 9999px;
    font-family: "Inter", sans-serif;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.eafps-payment__submit:hover {
    background: var(--eafps-brand);
}

/* Secondary "Pay by card instead" button : outlined, sits under the primary. */
.eafps-payment__submit--secondary {
    margin-top: 12px;
    background: transparent;
    color: var(--nectar-accent-color, #2e6da8);
    border: 1px solid var(--nectar-accent-color, #2e6da8);
}
.eafps-payment__submit--secondary:hover {
    background: var(--nectar-accent-color, #2e6da8);
    color: #fff;
}

.eafps-payment__note {
    margin: 14px 0 0;
    font-size: 12px;
    color: var(--eafps-text-muted);
    text-align: center;
}

.eafps-payment__recurring {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 0 0 18px;
    padding: 14px 16px;
    background: #f6f8fb;
    border: 1px solid var(--nectar-extra-color-4, #E3E9F6);
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.45;
    cursor: pointer;
}
.eafps-payment__recurring input {
    margin-top: 3px;
    accent-color: var(--nectar-accent-color, #2e6da8);
}

.eafps-payment-msg {
    max-width: 520px;
    margin: 0 auto;
    padding: 22px 26px;
    border-radius: 10px;
    border-left: 4px solid;
    font-size: 15px;
}
.eafps-payment-msg--success {
    background: var(--eafps-success-bg);
    border-color: var(--eafps-success-border);
    color: #1b4720;
}
.eafps-payment-msg--error,
.eafps-payment-msg--info {
    background: var(--eafps-error-bg);
    border-color: var(--eafps-error-border);
    color: #4a1e16;
}

/* ── Post-payment thank-you screen ─────────────────────────────────────
 * Mirrors the EBEC / Event / Certificate thank-you layout (hero navy panel
 * + image, with the message in an overlapping white card). Kept visually in
 * sync with .eafps-ebec-ty. */
.eafps-payment-ty {
    --eafps-ty-navy:        #272E47;
    --eafps-ty-text:        #4C4C4C;
    --eafps-ty-hero-pad-y:  60px;
    --eafps-ty-hero-pad-x:  100px;
    --eafps-ty-image-w:     440px;
    --eafps-ty-image-h:     420px;
    --eafps-ty-image-top:   60px;
    --eafps-ty-image-gap:   50px;

    position: relative;
    max-width: 1820px;
    margin: 0 auto;
    padding: 0 0 60px;
    font-family: "Inter", inherit;
    box-sizing: border-box;
}
.eafps-payment-ty * { box-sizing: inherit; }

.eafps-payment-ty__hero {
    position: relative;
    background: var(--eafps-ty-navy);
    border-radius: 15px;
    padding: var(--eafps-ty-hero-pad-y) var(--eafps-ty-hero-pad-x);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 40px;
    min-height: calc( var(--eafps-ty-image-top) + var(--eafps-ty-image-h) * 0.6 );
}

.eafps-payment-ty__title {
    color: #FFF;
    font-family: "Inter", sans-serif;
    font-size: 45px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    letter-spacing: -0.45px;
    text-transform: uppercase;
    margin: 0;
    max-width: calc( 100% - var(--eafps-ty-image-w) - var(--eafps-ty-image-gap) );
}

.eafps-payment-ty__image {
    position: absolute;
    top: var(--eafps-ty-image-top);
    right: var(--eafps-ty-hero-pad-x);
    width: var(--eafps-ty-image-w);
    height: var(--eafps-ty-image-h);
    background-color: lightgray;
    background-position: 50% 50%;
    background-size: cover;
    background-repeat: no-repeat;
    border-radius: 8px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.18);
}

.eafps-payment-ty__message {
    /* Reserve room on the right so the text never flows under the absolute
     * image (its left edge sits at right_pad + image_w from the container). */
    margin: 48px 0 0 var(--eafps-ty-hero-pad-x);
    margin-right: calc( var(--eafps-ty-hero-pad-x) + var(--eafps-ty-image-w) + var(--eafps-ty-image-gap) );
    color: var(--eafps-ty-text);
    font-family: "Inter", sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 300;
    line-height: 170%;
}
.eafps-payment-ty__message p { margin: 0 0 1em; }
.eafps-payment-ty__message p:last-child { margin-bottom: 0; }

@media ( max-width: 1300px ) {
    .eafps-payment-ty {
        --eafps-ty-hero-pad-x: 80px;
        --eafps-ty-image-w:    420px;
        --eafps-ty-image-h:    420px;
    }
    .eafps-payment-ty__title { font-size: 36px; }
}

@media ( max-width: 1000px ) {
    .eafps-payment-ty {
        padding: 0 16px 60px;
    }
    .eafps-payment-ty__hero {
        padding: 56px 28px;
        min-height: 0;
    }
    .eafps-payment-ty__title {
        font-size: 28px;
        max-width: 100%;
    }
    .eafps-payment-ty__image {
        position: static;
        width: 100%;
        height: 0;
        padding-bottom: 100%;
        margin-top: 28px;
        border-radius: 8px;
    }
    .eafps-payment-ty__message {
        margin: -32px 16px 0;
        padding: 28px 24px;
    }
}
