/* ═══════════════════════════════════════════════════════════════════════════
   ASSUGERIS — Wizard de devis : styles du formulaire multi-étapes (partagés).
   S'appuie sur les variables CSS (--burgundy, --gray-*, ...) définies dans
   index (inline) et dans assets/site.css — identiques dans les deux.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Carte du formulaire */
.form-card {
    background: #FFFFFF;
    border-radius: var(--radius-xl);
    padding: 36px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
    animation: fadeInUp 0.7s 0.2s ease forwards; opacity: 0;
    position: relative;
}
.form-card::before {
    content: '';
    position: absolute; top: -1px; left: 32px; right: 32px; height: 3px;
    background: linear-gradient(90deg, var(--burgundy), var(--burgundy-light));
    border-radius: 0 0 3px 3px;
}
.form-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem; color: var(--charcoal);
    margin-bottom: 2px;
}

/* État de succès */
.success-box {
    display: none; text-align: center; padding: 48px 24px;
}
.success-box.show { display: block; animation: fadeIn 0.5s ease; }
.success-icon {
    width: 60px; height: 60px; border-radius: 50%;
    background: var(--green-pale);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px; font-size: 1.8rem;
}
.success-box h3 { font-size: 1.25rem; margin-bottom: 8px; }
.success-box p { color: var(--gray-500); font-size: 0.88rem; line-height: 1.6; }

/* Spinner + fondus */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* Champ requis */
.req { color: var(--burgundy); margin-left: 2px; }

/* ═══════════ FORMULAIRE MULTI-ÉTAPES (universel : mobile + PC) ═══════════ */
#mobileFlow { display: flex; flex-direction: column; }

@media (max-width: 768px) {
    .form-card { padding: 20px 16px 28px; }
}

.mf-header {
    display: flex; align-items: center; gap: 10px;
    padding-bottom: 22px;
}
.mf-back-btn {
    width: 34px; height: 34px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-100); border-radius: 50%;
    font-size: 1rem; cursor: pointer; border: none;
    color: var(--charcoal); transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.mf-back-btn:active { background: var(--gray-200); }
.mf-prog-wrap {
    flex: 1; height: 5px; background: var(--gray-200);
    border-radius: 10px; overflow: hidden;
}
.mf-prog-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--burgundy), var(--burgundy-light));
    border-radius: 10px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.mf-counter {
    font-size: 0.68rem; font-weight: 600; color: var(--gray-400);
    flex-shrink: 0; min-width: 28px; text-align: right;
}

.mf-q { display: none; }
.mf-q.mf-active { display: block; }
.mf-q.mf-in-fwd { animation: mfInFwd 0.28s cubic-bezier(0.4, 0, 0.2, 1) both; }
.mf-q.mf-in-bwd { animation: mfInBwd 0.28s cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes mfInFwd { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: translateX(0); } }
@keyframes mfInBwd { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: translateX(0); } }

.mf-qlabel {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem; font-weight: 700; color: var(--charcoal);
    line-height: 1.3; margin-bottom: 6px;
}
.mf-qhint {
    font-size: 0.78rem; color: var(--gray-400);
    margin-bottom: 18px; line-height: 1.4;
}

.mf-inp {
    width: 100%; padding: 14px 16px;
    font-size: 1rem; font-family: 'Outfit', sans-serif;
    border: 2px solid var(--gray-200); border-radius: 14px;
    outline: none; background: var(--white); color: var(--charcoal);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none; display: block;
}
.mf-inp:focus { border-color: var(--burgundy); box-shadow: 0 0 0 4px rgba(123,45,59,0.08); }
.mf-inp.mf-err { border-color: #E53E3E; animation: mfShake 0.3s ease; }
@keyframes mfShake {
    0%, 100% { transform: translateX(0); }
    25%, 75% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
}

.mf-select {
    width: 100%; padding: 14px 44px 14px 16px;
    font-size: 1rem; font-family: 'Outfit', sans-serif;
    border: 2px solid var(--gray-200); border-radius: 14px;
    outline: none; background: var(--white); color: var(--charcoal);
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 16px center;
    transition: border-color 0.2s; display: block;
}
.mf-select:focus { border-color: var(--burgundy); }

.mf-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mf-tbtn {
    padding: 13px 10px; font-family: 'Outfit', sans-serif;
    font-size: 1rem; font-weight: 600;
    border: 2px solid var(--gray-200); border-radius: 12px;
    background: var(--white); color: var(--charcoal);
    cursor: pointer; transition: all 0.15s ease; text-align: center;
    -webkit-tap-highlight-color: transparent;
}
.mf-tbtn:active { transform: scale(0.96); }
.mf-tbtn.mf-on { border-color: var(--burgundy); background: var(--burgundy); color: white; }

/* Autocomplete code postal / ville (API geo.api.gouv.fr) */
.mf-postal-wrap { position: relative; }
.mf-postal-list {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
    background: var(--white); border: 1px solid var(--gray-200);
    border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    max-height: 260px; overflow-y: auto; padding: 4px;
}
.mf-postal-item {
    display: block; width: 100%; text-align: left;
    padding: 10px 12px; font-family: 'Outfit', sans-serif;
    font-size: 0.92rem; color: var(--charcoal);
    background: transparent; border: none; border-radius: 8px;
    cursor: pointer; transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
}
.mf-postal-item:hover, .mf-postal-item:focus { background: var(--gray-100); outline: none; }
.mf-postal-item + .mf-postal-item { border-top: 1px solid var(--gray-100); }
.mf-postal-cp { font-weight: 700; color: var(--burgundy); margin-right: 6px; }
.mf-postal-nom { color: var(--charcoal); }

/* Grouped-screen flow: several related fields per screen */
.mg-field { margin-bottom: 14px; }
.mg-field > label {
    display: block; font-size: 0.7rem; font-weight: 600;
    color: var(--gray-600); text-transform: uppercase;
    letter-spacing: 0.04em; margin-bottom: 6px;
}
.mg-field > label .req { color: var(--burgundy); margin-left: 2px; }
textarea.mf-inp { resize: vertical; min-height: 76px; }
.mg-lead-ok {
    background: var(--green-pale); color: var(--green);
    font-size: 0.78rem; font-weight: 600;
    padding: 9px 12px; border-radius: 8px; margin-bottom: 14px;
    border: 1px solid rgba(45,139,94,0.15);
}
.mg-restore {
    background: var(--burgundy-pale); color: var(--charcoal);
    font-size: 0.76rem; padding: 9px 12px; border-radius: 8px;
    margin-bottom: 14px; border: 1px solid rgba(123,45,59,0.12);
}
.mg-restore a { color: var(--burgundy); font-weight: 700; text-decoration: underline; cursor: pointer; }
.mg-trust {
    text-align: center; margin-top: 12px;
    font-size: 0.72rem; color: var(--gray-400);
}

.mf-next-btn {
    width: 100%; padding: 17px; margin-top: 18px;
    font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 700;
    background: var(--burgundy); color: white; border: none;
    border-radius: 14px; cursor: pointer; transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.mf-next-btn:active { transform: scale(0.98); background: var(--burgundy-dark); }
.mf-next-btn:disabled { opacity: 0.6; pointer-events: none; }
.mf-next-btn .mf-spin {
    display: none; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3); border-top-color: white;
    border-radius: 50%; animation: spin 0.6s linear infinite; flex-shrink: 0;
}
.mf-next-btn.mf-loading .mf-btxt { display: none; }
.mf-next-btn.mf-loading .mf-spin { display: block; }

/* Multi-field screens (2 questions grouped on one screen) */
.mf-multi-field { margin-bottom: 14px; }
.mf-multi-field label {
    display: block; font-size: 0.72rem; font-weight: 600; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px;
}

/* Choice grid (situation picker) */
.mf-choices { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.mf-choice {
    display: flex; align-items: center; gap: 12px;
    padding: 15px 16px; font-family: 'Outfit', sans-serif;
    font-size: 0.95rem; font-weight: 600;
    border: 2px solid var(--gray-200); border-radius: 14px;
    background: var(--white); color: var(--charcoal);
    cursor: pointer; transition: all 0.15s ease; text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.mf-choice:active { transform: scale(0.98); }
.mf-choice.mf-on { border-color: var(--burgundy); background: rgba(123,45,59,0.05); }
.mf-choice .mf-choice-ico { font-size: 1.2rem; flex-shrink: 0; }

/* Split decision screen (after lead capture) */
.mf-split-icon {
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--green-pale);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; margin-bottom: 14px;
}
.mf-split-sub { font-size: 0.85rem; color: var(--gray-500); line-height: 1.55; margin-bottom: 22px; }
.mf-split-btn-primary {
    width: 100%; padding: 17px; margin-bottom: 10px;
    font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 700;
    background: var(--burgundy); color: white; border: none;
    border-radius: 14px; cursor: pointer; transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.mf-split-btn-primary:active { transform: scale(0.98); background: var(--burgundy-dark); }
.mf-split-btn-secondary {
    width: 100%; padding: 15px;
    font-family: 'Outfit', sans-serif; font-size: 0.9rem; font-weight: 600;
    background: transparent; color: var(--gray-600); border: 1.5px solid var(--gray-200);
    border-radius: 14px; cursor: pointer; transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.mf-split-btn-secondary:active { background: var(--gray-100); }

/* Always-visible early-exit link during the optional deep-dive */
.mf-skip-exit {
    display: block; text-align: center; margin-top: 16px;
    font-size: 0.78rem; color: var(--gray-400);
    text-decoration: underline; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* PC : on met deux champs par ligne pour que les écrans courts
   remplissent bien la carte large — l'esprit mobile, adapté au grand écran. */
@media (min-width: 769px) {
    .mf-q.mf-active { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: start; }
    .mf-q .mg-field { min-width: 0; }
    .mf-q .mg-field.mg-wide,
    .mf-q .mf-qlabel, .mf-q .mf-qhint,
    .mf-q .mf-next-btn, .mf-q .mg-trust,
    .mf-q .mg-lead-ok, .mf-q .mg-restore { grid-column: 1 / -1; }
}
