/* =============================================================================
   Calculatrice publique — mobile d'abord, sobre, prévue pour l'iframe.
   Règle importante : aucune unité « vh » ni min-height sur html/body, sinon la
   hauteur mesurée pour l'iframe dépendrait de l'iframe elle-même (boucle).
   ============================================================================= */
:root {
    --primaire: #17405a;
    --primaire-fonce: #0f2c40;
    --accent: #d9791a;
    --accent-clair: #ffb35c;
    --fond: #f3f5f7;
    --carte: #ffffff;
    --texte: #1d2733;
    --discret: #5d6b79;
    --bordure: #d5dce3;
    --erreur: #b3261e;
    --rayon: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--texte);
    background: var(--fond);
}
html.embed body { background: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(217, 121, 26, .6); outline-offset: 2px; }

.calc { max-width: 860px; margin: 0 auto; padding: 16px; }
html.embed .calc { padding: 0 0 8px; }

.calc-entete { margin-bottom: 16px; }
.calc-entete h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 4px; color: var(--primaire-fonce); }
.calc-entete p { margin: 0; color: var(--discret); }
html.embed .calc-entete { display: none; }   /* le site parent a déjà son propre titre */

/* --- Étapes ---------------------------------------------------------------------- */
.etape {
    background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
    padding: 16px; margin-bottom: 16px;
}
.etape h2 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; margin: 0 0 14px; }
.num {
    display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none;
    background: var(--primaire); color: #fff; font-size: .9rem; font-weight: 700;
}
.aide { color: var(--discret); font-size: .9rem; margin: 0 0 12px; }

/* --- Cartes de choix (mode, modèles) ----------------------------------------------- */
.choix-mode, .grille-modeles { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) {
    .choix-mode { grid-template-columns: 1fr 1fr; }
    .grille-modeles { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}
.carte-choix { display: block; position: relative; cursor: pointer; }
.carte-choix input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.carte-corps {
    display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 14px 16px;
    border: 2px solid var(--bordure); border-radius: 10px; background: #fff;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.carte-corps strong { font-size: 1.05rem; }
.carte-corps span { color: var(--discret); font-size: .92rem; }
.carte-choix:hover .carte-corps { border-color: #a9b7c4; }
.carte-choix input:checked + .carte-corps { border-color: var(--accent); background: #fff8f0; box-shadow: 0 0 0 3px rgba(217, 121, 26, .15); }
.carte-choix input:focus-visible + .carte-corps { outline: 3px solid rgba(217, 121, 26, .6); outline-offset: 2px; }
.carte-choix.indisponible { cursor: not-allowed; opacity: .55; }
.modele-surface { color: var(--primaire) !important; font-weight: 700; font-size: 1.15rem !important; }
.modele-prix { font-size: .85rem !important; }

/* --- Champs -------------------------------------------------------------------------- */
.rang { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .rang { grid-template-columns: 1fr 1fr; } }
.champ { margin-bottom: 14px; }
.champ label { display: block; font-weight: 600; margin-bottom: 4px; }
.champ label small { font-weight: 400; color: var(--discret); }
.requis { font-weight: 400; color: var(--discret); font-size: .85rem; }
.champ input[type=text], .champ input[type=email], .champ input[type=tel], .champ textarea {
    width: 100%; padding: 11px 12px; border: 1px solid #b9c4cf; border-radius: 8px; font: inherit; background: #fff; color: var(--texte);
}
.champ textarea { resize: vertical; min-height: 96px; }
.champ-case { display: flex; gap: 10px; align-items: flex-start; }
.champ-case input { margin-top: 5px; width: 18px; height: 18px; flex: none; }
.champ-case label { font-weight: 400; margin: 0; }
.stepper { display: flex; max-width: 180px; }
.stepper button {
    width: 46px; border: 1px solid #b9c4cf; background: #f3f5f7; font-size: 1.3rem; cursor: pointer; color: var(--primaire);
}
.stepper button:first-child { border-radius: 8px 0 0 8px; }
.stepper button:last-child { border-radius: 0 8px 8px 0; }
.stepper input { text-align: center; border-radius: 0 !important; border-left: 0 !important; border-right: 0 !important; min-width: 0; }
.msg-erreur, .msg-champ { color: var(--erreur); font-size: .9rem; margin: 6px 0 0; }
.msg-erreur { font-weight: 600; }
.msg-champ:empty { display: none; }
.piege { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- Options ---------------------------------------------------------------------------- */
.categorie { border: 1px solid var(--bordure); border-radius: 10px; padding: 8px 14px 6px; margin: 0 0 14px; min-width: 0; }
.categorie legend { font-weight: 700; padding: 0 6px; }
.categorie .aide { margin: 0 0 4px; }
.badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px; background: #fdebd3; color: #8a4a06; font-size: .75rem; font-weight: 600; vertical-align: middle; }
.option { border-top: 1px solid #edf0f3; padding: 2px 0; }
.option:first-of-type { border-top: 0; }
.option > label { display: grid; grid-template-columns: 24px 1fr; column-gap: 10px; align-items: start; padding: 10px 0; cursor: pointer; }
.option input[type=checkbox], .option input[type=radio] { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.option-nom { font-weight: 500; }
.option-prix { grid-column: 2; color: var(--discret); font-size: .88rem; }
.option-aucune .option-nom { color: var(--discret); font-weight: 400; }
.qte { display: flex; align-items: center; gap: 10px; padding: 0 0 10px 34px; }
.qte label { font-size: .9rem; color: var(--discret); }
.qte input { width: 84px; padding: 8px 10px; border: 1px solid #b9c4cf; border-radius: 8px; font: inherit; text-align: center; }

/* --- Bandeau résultat ------------------------------------------------------------------- */
.resultat-zone { margin: 0 -16px 16px; }
html.embed .resultat-zone { margin: 0 0 16px; }
.resultat {
    position: sticky; bottom: 0; z-index: 10;
    background: var(--primaire-fonce); color: #fff; padding: 14px 16px 12px;
    box-shadow: 0 -4px 16px rgba(15, 44, 64, .25);
}
@media (min-width: 900px) { .resultat { border-radius: var(--rayon); } .resultat-zone { margin-left: 0; margin-right: 0; } }
/* En iframe, « sticky » ne peut pas fonctionner : le décalage est calculé par iframe-resize.js */
html.embed .resultat { position: relative; bottom: auto; transform: translateY(var(--dy, 0px)); border-radius: var(--rayon); will-change: transform; }
.resultat-principal { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.resultat-label { font-size: .9rem; color: #c3d3df; }
.resultat-fourchette { font-size: 1.5rem; line-height: 1.2; color: var(--accent-clair); font-variant-numeric: tabular-nums; }
.resultat-suffixe { font-weight: 700; }
.resultat-ttc { margin: 2px 0 8px; color: #dbe6ee; font-size: .92rem; }
.resultat-meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 18px; font-size: .9rem; color: #dbe6ee; }
.resultat-ajustement { margin: 8px 0 0; padding: 8px 10px; background: rgba(255, 255, 255, .1); border-radius: 8px; font-size: .88rem; }
.resultat-detail { margin-top: 8px; font-size: .88rem; }
.resultat-detail summary { cursor: pointer; color: var(--accent-clair); padding: 4px 0; }
.detail-table { overflow-x: auto; max-height: 420px; }
.detail-table table { border-collapse: collapse; width: 100%; }
.detail-table th, .detail-table td { text-align: left; padding: 5px 6px; vertical-align: top; border-bottom: 1px solid rgba(255, 255, 255, .15); }
.detail-table th { font-weight: 600; color: #c3d3df; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.detail-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.detail-table tr.total td { font-weight: 700; }

/* --- CTA / confirmation ------------------------------------------------------------------- */
.cta { margin-bottom: 16px; text-align: center; }
.mentions { color: var(--discret); font-size: .82rem; margin: 12px 0 0; text-align: left; }
.btn {
    display: inline-block; padding: 12px 22px; border: 0; border-radius: 8px; font: inherit; font-weight: 700; cursor: pointer;
    background: var(--primaire); color: #fff; text-decoration: none;
}
.btn:hover { background: var(--primaire-fonce); }
.btn-primaire { background: var(--accent); color: #fff; }
.btn-primaire:hover { background: #bf6813; }
.btn-grand { width: 100%; font-size: 1.05rem; padding: 14px 22px; }
@media (min-width: 620px) { .btn-grand { width: auto; min-width: 280px; } }
.btn:disabled { opacity: .6; cursor: wait; }
.confirmation { background: #e8f5ee; border: 1px solid #b7dfc8; border-radius: var(--rayon); padding: 22px 18px; color: #14573a; }
.confirmation h2 { margin: 0 0 8px; font-size: 1.25rem; }
.confirmation p { margin: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
