/* ═══════════════════════════════════════════
   EMIF Contact Form — Styles front-end
   ═══════════════════════════════════════════ */

:root {
    --emif-navy:   #1a3a5c;
    --emif-blue:   #2563a8;
    --emif-accent: #e85d26;
    --emif-light:  #f0f5fb;
    --emif-border: #ccd8e8;
    --emif-text:   #1c2b3a;
    --emif-muted:  #6b82a0;
    --emif-white:  #ffffff;
    --emif-radius: 12px;
    --emif-shadow: 0 4px 24px rgba(26,58,92,.12);
    --emif-trans:  all .28s cubic-bezier(.4,0,.2,1);
}

/* ── CONTENEUR ── */
.emif-cf-wrap {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--emif-text);
}

/* ── BARRE DE PROGRESSION ── */
.emif-progress {
    height: 5px;
    background: var(--emif-border);
    border-radius: 99px;
    margin-bottom: 32px;
    overflow: hidden;
}
.emif-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--emif-navy), var(--emif-accent));
    border-radius: 99px;
    transition: width .45s cubic-bezier(.4,0,.2,1);
    width: 25%;
}

/* ── ÉTAPES ── */
.emif-step {
    display: none;
    background: var(--emif-white);
    border: 1px solid var(--emif-border);
    border-radius: var(--emif-radius);
    padding: 32px;
    box-shadow: var(--emif-shadow);
    animation: emifFadeIn .3s ease;
}
.emif-step.emif-active { display: block; }

@keyframes emifFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── EN-TÊTE ÉTAPE ── */
.emif-step-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.emif-step-num {
    width: 36px;
    height: 36px;
    background: var(--emif-navy);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9em;
    flex-shrink: 0;
}
.emif-step-header h2 {
    margin: 0;
    font-size: 1.3em;
    font-weight: 700;
    color: var(--emif-navy);
}
.emif-step-desc {
    color: var(--emif-muted);
    margin: -8px 0 24px;
    font-size: .95em;
    line-height: 1.6;
}

/* ── GRILLE DE CHOIX ── */
.emif-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}
.emif-choice-grid-4 {
    grid-template-columns: 1fr 1fr;
}
@media (max-width: 520px) {
    .emif-choice-grid,
    .emif-choice-grid-4 { grid-template-columns: 1fr; }
}

.emif-choice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 16px;
    background: var(--emif-light);
    border: 2px solid var(--emif-border);
    border-radius: var(--emif-radius);
    cursor: pointer;
    transition: var(--emif-trans);
    text-align: center;
    font-family: inherit;
}
.emif-choice-btn:hover {
    border-color: var(--emif-navy);
    background: #e6eef8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26,58,92,.14);
}
.emif-choice-icon  { font-size: 2em; line-height: 1; }
.emif-choice-label { font-size: .95em; font-weight: 600; color: var(--emif-navy); }

/* ── FORMULAIRE ── */
.emif-form { width: 100%; }
.emif-field { display: flex; flex-direction: column; gap: 5px; }

.emif-field label {
    font-size: .875em;
    font-weight: 600;
    color: var(--emif-navy);
}
.req { color: var(--emif-accent); }

.emif-field input[type="text"],
.emif-field input[type="email"],
.emif-field input[type="tel"] {
    padding: 10px 14px;
    border: 1.5px solid var(--emif-border);
    border-radius: 8px;
    font-size: .95em;
    font-family: inherit;
    color: var(--emif-text);
    background: var(--emif-white);
    transition: var(--emif-trans);
    outline: none;
    box-sizing: border-box;
    width: 100%;
}
.emif-field input:focus {
    border-color: var(--emif-blue);
    box-shadow: 0 0 0 3px rgba(37,99,168,.12);
}
.emif-field input.emif-invalid {
    border-color: var(--emif-accent);
    box-shadow: 0 0 0 3px rgba(232,93,38,.1);
}

.emif-field-group {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
    min-width: 0;
}
.emif-field-group-2 { grid-template-columns: 1fr 1fr; }
.emif-field-group-3 { grid-template-columns: minmax(0,1fr) minmax(0,2fr) minmax(0,1fr); }
.emif-field-grow    { grid-column: span 1; }

/* Empêcher les enfants de grille de déborder */
.emif-field-group > * { min-width: 0; }

@media (max-width: 540px) {
    .emif-field-group-2,
    .emif-field-group-3 { grid-template-columns: 1fr; }
}

/* Dernier champ seul avant actions */
.emif-form > .emif-field { margin-bottom: 14px; }

.emif-fieldset {
    border: 1.5px solid var(--emif-border);
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 14px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}
.emif-fieldset legend {
    font-size: .85em;
    font-weight: 700;
    color: var(--emif-navy);
    padding: 0 8px;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.emif-fieldset .emif-field { margin-bottom: 12px; }
.emif-fieldset .emif-field:last-child { margin-bottom: 0; }

/* ── ACTIONS ── */
.emif-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    gap: 12px;
}

.emif-btn-submit {
    background: linear-gradient(135deg, var(--emif-navy), var(--emif-blue));
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 28px;
    font-size: .95em;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--emif-trans);
    letter-spacing: .02em;
    margin-left: auto;
}
.emif-btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(26,58,92,.28);
}
.emif-btn-submit:active { transform: translateY(0); }
.emif-btn-submit:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

.emif-btn-back {
    background: none;
    border: 1.5px solid var(--emif-border);
    border-radius: 8px;
    padding: 10px 18px;
    font-size: .9em;
    color: var(--emif-muted);
    cursor: pointer;
    font-family: inherit;
    transition: var(--emif-trans);
}
.emif-btn-back:hover {
    border-color: var(--emif-navy);
    color: var(--emif-navy);
}

/* ── CONFIRMATION ── */
.emif-confirm-wrap {
    text-align: center;
    padding: 16px 0 8px;
}
.emif-confirm-icon {
    font-size: 4em;
    margin-bottom: 16px;
    animation: emifBounce .5s ease;
}
@keyframes emifBounce {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.emif-confirm-wrap h2 {
    color: var(--emif-navy);
    font-size: 1.5em;
    margin-bottom: 10px;
}
.emif-confirm-wrap p {
    color: var(--emif-muted);
    line-height: 1.6;
    margin-bottom: 28px;
}
.emif-btn-restart {
    background: var(--emif-light);
    border: 1.5px solid var(--emif-border);
    border-radius: 8px;
    padding: 10px 24px;
    font-size: .9em;
    color: var(--emif-navy);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: var(--emif-trans);
}
.emif-btn-restart:hover {
    background: var(--emif-navy);
    color: #fff;
    border-color: var(--emif-navy);
}

/* ── LOADER ── */
.emif-loader {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.85);
    border-radius: var(--emif-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    backdrop-filter: blur(4px);
    z-index: 10;
}
.emif-loader p { color: var(--emif-navy); font-weight: 600; margin: 0; }
.emif-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid var(--emif-border);
    border-top-color: var(--emif-navy);
    border-radius: 50%;
    animation: emifSpin .7s linear infinite;
}
@keyframes emifSpin { to { transform: rotate(360deg); } }

/* ── VÉRIFICATION CODE CLIENT ── */
.emif-verify-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .85em;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 7px;
    margin: -4px 0 12px;
    transition: all .25s;
    line-height: 1.3;
}
.emif-verify-status[data-state="loading"] {
    background: #f0f5fb;
    color: var(--emif-muted);
    border: 1px solid var(--emif-border);
}
.emif-verify-status[data-state="ok"] {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}
.emif-verify-status[data-state="error"] {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}
.emif-verify-spin {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid var(--emif-border);
    border-top-color: var(--emif-blue);
    border-radius: 50%;
    animation: emifSpin .65s linear infinite;
    flex-shrink: 0;
}

/* Champ valide */
.emif-field input.emif-valid {
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(52,211,153,.12);
}

/* ── MESSAGE D'ERREUR ── */
.emif-error-msg {
    background: #fef2ee;
    border: 1px solid #f8c4b0;
    color: #b83810;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: .9em;
    margin-top: 14px;
    display: none;
}
.emif-error-msg.emif-visible { display: block; }
