/* ===================================================================
   PhoneLigne - Formulaires pro (v3)
   Style commun à TOUS les champs (.champ) + mise en page des pages de formulaire.
   Charge après components.css : surcharge sans casser la structure existante.
   =================================================================== */

/* ---------- Champs ---------- */
.champ { margin-bottom: 18px; position: relative; }
.champ > label:first-child,
.champ__titre { display: block; margin: 0 0 7px; font-weight: 600; font-size: .88rem; color: var(--color-ink); }
.champ .requis { color: var(--color-alert); margin-left: 2px; }

.champ input[type="text"], .champ input[type="email"], .champ input[type="password"],
.champ input[type="tel"], .champ input[type="number"], .champ input[type="date"], .champ input[type="search"],
.champ select, .champ textarea {
    width: 100%; min-height: 50px; padding: 0 15px; border-radius: 14px;
    border: 1.5px solid var(--color-mist); background: var(--color-surface); color: var(--color-ink);
    font: 1rem/1.4 var(--font-principale); transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.champ textarea { padding: 13px 15px; min-height: 104px; resize: vertical; }
.champ select { appearance: none; padding-right: 42px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A93B0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; }
.champ input::placeholder, .champ textarea::placeholder { color: var(--color-muted); opacity: .75; }
.champ input:hover, .champ select:hover, .champ textarea:hover { border-color: #B7BFD8; }
.champ input:focus, .champ select:focus, .champ textarea:focus {
    outline: none; border-color: var(--color-signal); box-shadow: 0 0 0 4px rgba(42, 63, 122, .14);
}
.champ input:disabled { background: var(--color-paper); color: var(--color-muted); cursor: not-allowed; }

.champ--erreur input, .champ--erreur select, .champ--erreur textarea { border-color: var(--color-alert); background: rgba(178, 59, 46, .04); }
.champ--erreur input:focus, .champ--erreur textarea:focus, .champ--erreur select:focus { box-shadow: 0 0 0 4px rgba(178, 59, 46, .14); }
.champ--ok input:not([type="file"]), .champ--ok textarea { border-color: rgba(47, 125, 83, .6); }
.champ__erreur { display: flex; gap: 6px; align-items: flex-start; margin: 7px 0 0; font-size: .82rem; font-weight: 500; color: var(--color-alert); max-width: none; }
.champ__erreur::before { content: "!"; flex: none; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; background: var(--color-alert); color: #fff; font-size: .68rem; font-weight: 800; display: grid; place-items: center; }
.champ__aide { margin: 6px 0 0; font-size: .8rem; color: var(--color-muted); max-width: none; }
.champ__compteur { text-align: right; font-size: .74rem; color: var(--color-muted); margin-top: 4px; }
.champ__compteur--limite { color: var(--color-alert); font-weight: 700; }
.champ__apercu-prix { margin: 6px 0 0; font: 700 .9rem var(--font-donnees); color: var(--color-teal); }

/* ---------- Mot de passe : bascule œil ---------- */
.champ-mdp { position: relative; }
.champ-mdp input { padding-right: 52px !important; }
.champ-mdp__bascule { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; border-radius: 10px; color: var(--color-muted); cursor: pointer; display: grid; place-items: center; }
.champ-mdp__bascule:hover { background: var(--color-paper); color: var(--color-ink); }
.champ-mdp__bascule svg { width: 20px; height: 20px; }

/* ---------- Pages de formulaire ---------- */
.form-page { max-width: 560px; padding-block: 28px 56px; }
.form-page--large { max-width: 760px; }
.form-retour { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 14px; font-size: .9rem; font-weight: 600; }
.form-entete { text-align: center; margin: 8px 0 22px; }
.form-entete__icone { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; font-size: 1.7rem; background: linear-gradient(135deg, #16213F, #2A3F7A); box-shadow: 0 14px 28px -14px rgba(22,33,63,.9); }
.form-entete h1 { margin: 0 0 6px; font-size: clamp(1.45rem, 4.5vw, 1.85rem); letter-spacing: -.02em; }
.form-entete p { margin: 0 auto; max-width: 44ch; font-size: .94rem; }
.form-carte {
    background: var(--color-surface); border: 1px solid var(--color-mist); border-radius: 24px;
    padding: clamp(20px, 5vw, 32px); box-shadow: 0 1px 2px rgba(16,21,28,.04), 0 24px 48px -30px rgba(22,33,63,.45);
}
.form-carte .message { margin-top: 0; }
.form-bas { margin: 18px 0 0; text-align: center; font-size: .92rem; max-width: none; }
.form-info { display: flex; gap: 12px; padding: 14px 16px; margin: 0 0 22px; border-radius: 14px; background: rgba(20,107,101,.09); color: var(--color-ink); font-size: .87rem; line-height: 1.45; }
.form-info__icone { flex: none; font-size: 1.2rem; }
.form-info p { margin: 0; max-width: none; color: inherit; }

.form-section__titre { display: flex; align-items: center; gap: 12px; margin: 30px 0 16px; padding-top: 22px; border-top: 1px dashed var(--color-mist); font-size: 1.02rem; }
.form-carte > .form-section__titre:first-child, .form-progression + .form-section__titre { margin-top: 6px; padding-top: 0; border-top: 0; }
.form-section__titre span { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--color-signal); color: #fff; font-size: .82rem; font-weight: 800; }
.form-section__sous { margin: -8px 0 16px 40px; font-size: .84rem; max-width: none; }

.form-progression { margin: 0 0 22px; }
.form-progression__ligne { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 600; margin-bottom: 6px; }
.form-progression__barre { height: 8px; border-radius: 999px; background: var(--color-paper); overflow: hidden; }
.form-progression__barre span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #F0A537, #2F9E6A); transition: width .35s ease; }

.form-actions { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.btn--large { width: 100%; min-height: 54px; border-radius: 16px; font-size: 1.02rem; font-weight: 700; }
.btn.pl-envoi { position: relative; pointer-events: none; opacity: .85; }
.btn.pl-envoi::after { content: ""; display: inline-block; width: 16px; height: 16px; margin-left: 10px; vertical-align: -3px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: pl-tourne .7s linear infinite; }
@keyframes pl-tourne { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
    .form-actions--collant { position: sticky; bottom: 0; margin-inline: calc(-1 * clamp(20px, 5vw, 32px)); padding: 12px clamp(20px, 5vw, 32px) 14px; background: linear-gradient(180deg, transparent, var(--color-surface) 28%); z-index: 5; }
}

/* ---------- Cartes de choix (cases / boutons radio) ---------- */
.choix-grille { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .choix-grille--2 { grid-template-columns: repeat(2, 1fr); } .choix-grille--3 { grid-template-columns: repeat(3, 1fr); } }
.choix { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin: 0 !important; border-radius: 14px; border: 1.5px solid var(--color-mist); background: var(--color-surface); cursor: pointer; font-weight: 400 !important; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.choix:hover { border-color: #B7BFD8; }
.choix input { position: absolute; opacity: 0; pointer-events: none; }
.choix__coche { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--color-mist); display: grid; place-items: center; color: transparent; transition: all .15s ease; }
.choix--radio .choix__coche { border-radius: 50%; }
.choix__coche::after { content: "✓"; font-size: .8rem; font-weight: 800; }
.choix--radio .choix__coche::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.choix__corps { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choix__corps strong { font-size: .95rem; color: var(--color-ink); }
.choix__corps small { font-size: .8rem; color: var(--color-muted); }
.choix:has(input:checked) { border-color: var(--color-signal); background: rgba(42,63,122,.06); box-shadow: 0 0 0 3px rgba(42,63,122,.10); }
.choix:has(input:checked) .choix__coche { background: var(--color-signal); border-color: var(--color-signal); color: #fff; }
.choix:has(input:focus-visible) { outline: 3px solid #F0A537; outline-offset: 2px; }
.choix__icone { flex: none; font-size: 1.4rem; }
.champ--erreur .choix { border-color: rgba(178,59,46,.5); }

/* case unique (CGU) */
.choix-simple { display: flex; align-items: flex-start; gap: 12px; margin: 0 !important; font-weight: 400 !important; cursor: pointer; font-size: .92rem; line-height: 1.45; }
.choix-simple input { width: 20px !important; min-height: 0 !important; height: 20px; margin-top: 2px; accent-color: var(--color-signal); flex: none; }

/* ---------- Dépôt de fichiers / photos ---------- */
.depot { position: relative; }
.depot input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 2; padding: 0; min-height: 0; border: 0; }
.depot__zone { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; border: 2px dashed #B7BFD8; background: var(--color-paper); transition: border-color .15s ease, background .15s ease; }
.depot:hover .depot__zone, .depot--survol .depot__zone { border-color: var(--color-signal); background: rgba(42,63,122,.05); }
.depot__icone { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--color-surface); font-size: 1.4rem; box-shadow: var(--pl-ombre-douce); overflow: hidden; }
.depot__icone img { width: 100%; height: 100%; object-fit: cover; }
.depot__texte { min-width: 0; flex: 1; }
.depot__texte strong { display: block; font-size: .92rem; color: var(--color-ink); }
.depot__texte small { display: block; font-size: .78rem; color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.depot--rempli .depot__zone { border-style: solid; border-color: rgba(47,125,83,.55); background: rgba(47,125,83,.06); }
.depot__retirer { position: relative; z-index: 3; flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--color-surface); color: var(--color-alert); font-size: 1.2rem; cursor: pointer; box-shadow: var(--pl-ombre-douce); }
.depot--rempli .depot__apercu-grand { display: block; }
.depot__apercu-grand { display: none; width: 100%; max-height: 220px; object-fit: cover; border-radius: 14px; margin-bottom: 10px; border: 1px solid var(--color-mist); }
#apercu-photo-conteneur { display: none !important; }

/* ---------- Connexion : détails ---------- */
.form-ligne-oubli { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 18px; font-size: .86rem; }
.champ-ligne { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .champ-ligne { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Validation de commande (client) ---------- */
.cmd-layout { display: grid; gap: 22px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .cmd-layout { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); } .cmd-layout__resume { position: sticky; top: 90px; } }
.cmd-resume { background: var(--color-surface); border: 1px solid var(--color-mist); border-radius: 20px; padding: 20px; box-shadow: var(--pl-ombre-douce); }
.cmd-resume h2 { margin: 0 0 12px; font-size: 1.05rem; }
.cmd-resume__ligne { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--color-mist); font-size: .9rem; }
.cmd-resume__ligne span:first-child { min-width: 0; overflow-wrap: anywhere; }
.cmd-resume__total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 14px; font-weight: 700; }
.cmd-resume__total strong { font: 800 1.35rem var(--font-donnees); color: var(--color-ink); }
.cmd-rassurance { list-style: none; margin: 16px 0 0; padding: 14px; border-radius: 14px; background: var(--color-paper); display: grid; gap: 9px; font-size: .83rem; }
.cmd-rassurance li { display: flex; gap: 10px; align-items: flex-start; color: var(--color-ink); }
.cmd-rassurance li span:first-child { flex: none; }
.cmd-etapes { display: flex; justify-content: center; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; font-size: .8rem; font-weight: 600; color: var(--color-muted); flex-wrap: wrap; }
.cmd-etapes li { display: inline-flex; align-items: center; gap: 6px; }
.cmd-etapes li::before { content: attr(data-n); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--color-mist); color: var(--color-ink); font-size: .74rem; }
.cmd-etapes li.fait::before { content: "✓"; background: var(--color-success); color: #fff; }
.cmd-etapes li.actuel { color: var(--color-ink); }
.cmd-etapes li.actuel::before { background: var(--color-marigold); }
.cmd-etapes li + li::after { content: ""; }
[hidden] { display: none !important; }
.champ--revele { animation: pl-revele .25s ease; }
@keyframes pl-revele { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Commandes (fournisseur) : cartes enrichies ---------- */
.cmd-carte { position: relative; }
.cmd-carte[data-statut="recue"] { border-left: 4px solid #3B82F6; }
.cmd-carte[data-statut="prete"] { border-left: 4px solid var(--color-marigold); }
.cmd-carte[data-statut="livree"] { border-left: 4px solid #34B27B; }
.cmd-carte[data-statut="annulee"] { border-left: 4px solid #E5695A; opacity: .8; }
.cmd-carte__temps { font-size: .76rem; color: var(--color-muted); white-space: nowrap; }
.cmd-chip-msg { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--color-alert); color: #fff !important; font-size: .74rem; font-weight: 700; text-decoration: none !important; animation: pl-pop .6s ease; }
.cmd-progression { height: 6px; border-radius: 999px; background: var(--color-paper); overflow: hidden; margin-top: 8px; }
.cmd-progression span { display: block; height: 100%; background: linear-gradient(90deg, #F0A537, #2F9E6A); border-radius: 999px; }
.cmd-carte__rapide { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.cmd-rapide { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--color-mist); background: var(--color-surface); color: var(--color-ink) !important; text-decoration: none !important; font-size: 1rem; }
.cmd-rapide:hover { border-color: var(--color-marigold); transform: translateY(-1px); }
.cmd-filtres { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 4px 0 14px; }
.cmd-filtres input { flex: 1 1 220px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--color-mist); background: var(--color-surface); color: var(--color-ink); font: inherit; }
.cmd-filtres input:focus { outline: none; border-color: var(--color-signal); box-shadow: 0 0 0 4px rgba(42,63,122,.14); }

/* ---------- Pages d'inscription : succès ---------- */
.verif-etape { padding: 18px; border-radius: 18px; border: 2px solid #E67E22; background: rgba(230,126,34,.08); }
.verif-etape__code { display: block; margin: 12px 0; padding: 14px; border-radius: 12px; background: var(--color-surface); text-align: center; font: 800 1.2rem var(--font-donnees); letter-spacing: .12em; user-select: all; }

/* ---------- Indicateur de force du mot de passe ---------- */
.force-mdp { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; }
.force-mdp__barre { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.force-mdp__barre i { height: 6px; border-radius: 999px; background: var(--color-mist); transition: background .2s ease; }
.force-mdp__texte { font-size: .76rem; font-weight: 600; color: var(--color-muted); min-width: 110px; text-align: right; }
.force-mdp[data-niveau="1"] i:nth-child(-n+1) { background: #D2503F; }
.force-mdp[data-niveau="2"] i:nth-child(-n+2) { background: #E8892B; }
.force-mdp[data-niveau="3"] i:nth-child(-n+3) { background: #C9B037; }
.force-mdp[data-niveau="4"] i:nth-child(-n+4) { background: #2F9E6A; }

/* ---------- Carte d'accès fournisseur : Connexion / Inscription sur une même carte ---------- */
body:has(.form-page--acces) { background: radial-gradient(900px 460px at 50% -120px, rgba(42, 63, 122, .16), transparent 70%) no-repeat, var(--color-paper); }
[data-theme="dark"] body:has(.form-page--acces) { background: radial-gradient(900px 460px at 50% -120px, rgba(90, 120, 210, .18), transparent 70%) no-repeat, var(--color-paper); }
.form-page--acces { display: flex; flex-direction: column; align-items: center; max-width: none; padding-block: clamp(24px, 6vh, 56px) 56px; }
.acces-carte { width: 100%; max-width: 460px; background: var(--color-surface); border: 1px solid var(--color-mist); border-radius: 28px; padding: clamp(20px, 5vw, 32px); box-shadow: 0 1px 2px rgba(16, 21, 28, .05), 0 34px 70px -30px rgba(22, 33, 63, .55); }
.acces-carte--large { max-width: 760px; }
.acces-onglets { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 5px; margin-bottom: 26px; background: var(--color-paper); border-radius: 16px; }
.acces-onglet { display: block; text-align: center; padding: 11px 12px; border-radius: 12px; font-weight: 600; font-size: .95rem; color: var(--color-muted); text-decoration: none; transition: background .2s ease, color .2s ease, box-shadow .2s ease; }
.acces-onglet:hover { color: var(--color-ink); }
.acces-onglet--actif, .acces-onglet--actif:hover { background: var(--color-surface); color: var(--color-ink); box-shadow: 0 1px 3px rgba(16, 21, 28, .14), 0 8px 16px -10px rgba(22, 33, 63, .4); }
.acces-onglet:focus-visible { outline: 2px solid var(--color-signal); outline-offset: 2px; }
/* Le formulaire n'a plus sa propre carte : il vit dans la carte d'accès */
.acces-carte .form-carte { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
.acces-carte .form-entete { text-align: left; margin: 0 0 22px; }
.acces-carte .form-entete__icone { display: none; }
.acces-carte .form-entete h1 { font-size: clamp(1.4rem, 4.5vw, 1.7rem); }
.acces-carte .form-entete p { margin: 0; max-width: none; }
.acces-carte > .message { margin: 0 0 16px; }
