@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@400;500;600;700;800&display=swap');

:root {
  --rose: #f2753b;
  --rose-dark: #d85f28;
  --sauge: #1db8b8;
  --sauge-dark: #16938f;
  --creme: #fdfaf6;
  --creme-2: #f4ece2;
  --texte: #3f3f3f;
  --texte-clair: #756a61;
  --blanc: #ffffff;
  --erreur: #c0504d;
  --succes: #16938f;
  --radius: 10px;
  --ombre: 0 4px 18px rgba(60, 40, 20, 0.08);
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: "Raleway", "Segoe UI", Optima, Candara, "Helvetica Neue", Arial, sans-serif;
  background: var(--creme);
  color: var(--texte);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--rose); }

.top-bar-accent {
  background: var(--sauge);
  height: 6px;
  width: 100%;
}
.top-bar {
  background: var(--blanc);
  border-bottom: 1px solid var(--creme-2);
  padding: 14px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  text-align: center;
}
.top-bar img.brand-logo {
  height: 54px;
  width: auto;
  margin-bottom: 4px;
}
.top-bar h1 { font-size: 1.05rem; margin: 0; color: var(--texte); font-weight: 600; letter-spacing: 0.01em; }
.top-bar p { margin: 0; color: var(--rose); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

.wrap { max-width: 720px; margin: 0 auto; padding: 24px 16px 80px; }

.card {
  background: var(--blanc);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 28px 24px;
}
@media (max-width: 480px) { .card { padding: 20px 16px; border-radius: 10px; } }

.progress-outer {
  background: var(--creme-2);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-inner {
  background: linear-gradient(90deg, var(--rose), var(--sauge));
  height: 100%;
  transition: width 0.3s ease;
}
.progress-label { font-size: 0.82rem; color: var(--texte-clair); margin-bottom: 22px; text-align: right; }

.step { display: none; }
.step.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.step h2 { font-size: 1.15rem; color: var(--rose-dark); margin: 0 0 6px; }
.step .step-desc { color: var(--texte-clair); font-size: 0.9rem; margin: 0 0 20px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--texte-clair); font-size: 0.8rem; display: block; margin-top: 4px; }

input[type="text"], input[type="email"], input[type="tel"], input[type="date"],
input[type="number"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid #e4d9cb;
  border-radius: 9px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--creme);
  color: var(--texte);
  transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rose); background: var(--blanc); }
textarea { min-height: 90px; resize: vertical; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }

.radio-group { display: flex; gap: 12px; }
.radio-pill { flex: 1; position: relative; }
.radio-pill input { position: absolute; opacity: 0; }
.radio-pill label {
  display: block; text-align: center; padding: 11px;
  border: 1.5px solid #e4d9cb; border-radius: 9px; cursor: pointer;
  font-weight: 500; color: var(--texte-clair); transition: all 0.15s ease;
}
.radio-pill input:checked + label { background: var(--rose); border-color: var(--rose); color: #fff; }

.conditional { margin-top: 12px; padding-left: 14px; border-left: 3px solid var(--creme-2); display: none; }
.conditional.visible { display: block; }

.file-drop {
  border: 1.5px dashed #d9c8b4; border-radius: 10px; padding: 16px; text-align: center;
  background: var(--creme); cursor: pointer; font-size: 0.88rem; color: var(--texte-clair);
}
.file-drop.has-file { border-color: var(--sauge); background: #f1f6ef; color: var(--sauge); font-weight: 600; }
.file-drop input { display: none; }
.file-status { font-size: 0.8rem; margin-top: 6px; color: var(--texte-clair); }

/* En-tête permanent : dates de la formation, discrètes et non modifiables. */
.formation-dates {
  margin: 6px 0 0; color: var(--texte-clair); font-size: 0.9rem; font-weight: 500;
}
.time-hint {
  text-align: center; color: var(--texte-clair); font-size: 0.85rem; margin: 0 0 18px;
}
.dates-rappel {
  background: var(--creme); border-radius: 10px; padding: 14px; margin: 18px 0;
}
.dates-rappel .dates-titre { margin: 0; font-weight: 700; color: var(--sauge-dark); }
.dates-rappel .dates-valeur { margin: 4px 0 0; color: var(--texte-clair); }
.saving-indicator.ok { color: var(--succes); font-weight: 600; }

/* ---------------------------------------------------------------------
   Mobile : le public remplit ce dossier majoritairement au téléphone.
   Une seule colonne, aucun défilement horizontal, des cibles tactiles d'au
   moins 44 px, et le bouton principal accessible sans remonter la page.
   --------------------------------------------------------------------- */
html, body { max-width: 100%; overflow-x: hidden; }
img, iframe { max-width: 100%; }

@media (max-width: 620px) {
  /* 16px minimum sur les champs : en dessous, iOS zoome tout seul à la mise
     au point et l'utilisatrice se retrouve avec un défilement horizontal. */
  input, select, textarea, button { font-size: 16px; }

  input, select { min-height: 44px; }
  .radio-pill label { min-height: 44px; display: flex; align-items: center; justify-content: center; }
  .file-drop { padding: 20px 16px; min-height: 60px; }
  .fichiers-recap .fichier-remplacer { min-height: 44px; padding: 0 4px; }
  .email-unlock-link, .save-exit-link { min-height: 44px; }

  .row2 { grid-template-columns: 1fr; }

  /* Le bouton principal reste à portée de pouce, sans masquer le contenu. */
  .nav-buttons {
    position: sticky; bottom: 0; z-index: 5;
    background: var(--blanc);
    padding: 12px 0 10px;
    margin-top: 20px;
    box-shadow: 0 -8px 16px -12px rgba(60, 40, 20, 0.35);
  }
  .nav-buttons button { padding: 14px 18px; min-height: 48px; }
}

.fichiers-recap { list-style: none; margin: 8px 0 0; padding: 0; }
.fichiers-recap li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; margin-bottom: 8px; border-radius: 10px;
  background: #f1f6ef; border: 1.5px solid transparent; font-size: 0.85rem; color: var(--sauge-dark);
}
.fichiers-recap li.missing { background: #fbeceb; color: var(--erreur); border-color: #f0d3d1; }
.fichiers-recap .fichier-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.fichiers-recap .fichier-remplacer {
  background: none; border: none; color: inherit; font-weight: 600; font-size: 0.8rem;
  text-decoration: underline; cursor: pointer; padding: 0; flex-shrink: 0;
}

.checkbox-line {
  display: flex; gap: 10px; align-items: flex-start; background: var(--creme);
  border-radius: 10px; padding: 14px; border: 1.5px solid #e4d9cb;
}
.checkbox-line input { margin-top: 3px; }

.engagement-box {
  background: var(--creme); border-radius: 10px; padding: 16px; font-size: 0.86rem;
  color: var(--texte-clair); margin-bottom: 16px; max-height: 260px; overflow-y: auto;
}
.engagement-box p { margin: 0 0 10px; }

.nav-buttons { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }

button {
  font-family: inherit; font-size: 1rem; border: none; border-radius: 999px;
  padding: 13px 26px; cursor: pointer; font-weight: 600;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
button:active { transform: scale(0.98); }
.btn-primary { background: var(--rose); color: #fff; }
.btn-primary:hover { background: var(--rose-dark); }
.btn-secondary { background: transparent; color: var(--texte-clair); border: 1.5px solid #e4d9cb; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.error-msg { color: var(--erreur); font-size: 0.82rem; margin-top: 4px; display: none; }
.error-msg.visible { display: block; }

.gate { text-align: center; }
.gate .field { text-align: left; }

.status-banner {
  background: #f1f6ef; border: 1px solid var(--sauge); color: #4a6b46;
  border-radius: 10px; padding: 12px 16px; font-size: 0.88rem; margin-bottom: 18px; display: none;
}
.status-banner.visible { display: block; }
.status-banner.hint {
  background: #fbeee0;
  border-color: var(--rose);
  color: var(--rose-dark);
}

input#gateEmail[readonly] {
  background: var(--creme-2);
  color: var(--texte-clair);
  cursor: not-allowed;
}
.email-unlock-link {
  display: block;
  background: none;
  border: none;
  padding: 6px 0 0;
  margin: 0;
  font-size: 0.8rem;
  color: var(--texte-clair);
  text-decoration: underline;
  cursor: pointer;
}
.email-unlock-link:hover { color: var(--rose-dark); }

.saving-indicator { font-size: 0.8rem; color: var(--texte-clair); text-align: center; margin-top: 10px; min-height: 16px; }

.success-screen { text-align: center; padding: 20px 0; }
.success-screen .icon { font-size: 3rem; margin-bottom: 12px; }
.success-screen h2 { color: var(--sauge); }

/* Dashboard */
.dash-header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.dash-header input[type="search"] { padding: 10px 14px; border: 1.5px solid #e4d9cb; border-radius: 999px; min-width: 220px; }

.stat-pills { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.pill { background: var(--blanc); border: 1px solid var(--creme-2); border-radius: 999px; padding: 8px 16px; font-size: 0.85rem; box-shadow: var(--ombre); }
.pill b { color: var(--rose-dark); }

.reg-table { width: 100%; border-collapse: collapse; background: var(--blanc); border-radius: var(--radius); overflow: hidden; box-shadow: var(--ombre); }
.reg-table th, .reg-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--creme-2); font-size: 0.88rem; }
.reg-table th { background: var(--creme-2); color: var(--texte); font-weight: 600; }
.reg-table tr:hover td { background: #fdfaf6; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.badge.termine { background: #e0f5f4; color: var(--succes); }
.badge.encours { background: #fbeee0; color: var(--rose-dark); }

.link-btn { background: none; border: none; color: var(--rose-dark); text-decoration: underline; padding: 0; font-size: 0.85rem; font-weight: 600; }

.reg-cards { display: none; flex-direction: column; gap: 12px; }
@media (max-width: 760px) { .reg-table { display: none; } .reg-cards { display: flex; } }

.reg-card { background: var(--blanc); border-radius: 12px; padding: 16px; box-shadow: var(--ombre); }
.reg-card .rc-name { font-weight: 700; margin-bottom: 4px; }
.reg-card .rc-meta { font-size: 0.83rem; color: var(--texte-clair); margin-bottom: 8px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(58, 51, 46, 0.5); display: none;
  align-items: flex-start; justify-content: center; padding: 30px 14px; overflow-y: auto; z-index: 50;
}
.modal-backdrop.visible { display: flex; }
.modal { background: var(--blanc); border-radius: var(--radius); max-width: 560px; width: 100%; padding: 26px; position: relative; }
.modal h3 { margin-top: 0; color: var(--rose-dark); }
.modal .close-btn { position: absolute; top: 14px; right: 14px; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--texte-clair); padding: 4px 8px; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; font-size: 0.87rem; margin-bottom: 16px; }
@media (max-width: 480px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-grid .dt-label { color: var(--texte-clair); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; }

.files-list { display: flex; flex-wrap: wrap; gap: 8px; }
.files-list button { background: var(--creme); border: 1px solid #e4d9cb; color: var(--texte); font-size: 0.82rem; padding: 8px 14px; }

.gate-overlay { position: fixed; inset: 0; background: var(--creme); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.gate-card { background: var(--blanc); border-radius: var(--radius); box-shadow: var(--ombre); padding: 32px 26px; max-width: 380px; width: 100%; text-align: center; }

.refresh-note { text-align: center; color: var(--texte-clair); font-size: 0.8rem; margin-top: 20px; }

.save-exit-link {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--texte-clair);
  text-decoration: underline;
  background: none;
  border: none;
  padding: 6px;
}
.save-exit-link:hover {
  color: var(--rose-dark);
}
