﻿/* ==========================================================
   BASE ET STYLES GLOBAUX
   ========================================================== */

:root {
  --central-width: 900px; /* Fallback, actualisé par scripts/mise_en_forme.js */
}

*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;

  /* Pas d’ascenseur global: mise à l’échelle gérée en JS */
  overflow: hidden;

  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f9f9f9;
  color: #333;

  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  height: 100vh;
  height: 100dvh;

  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows:
    minmax(0, 15fr)   /* bannière */
    minmax(0, 70fr)   /* contenu */
    minmax(0, 15fr);  /* pied de page */
  row-gap: 0;
}

.hidden,
[hidden] { display: none !important; }

.required,
.obligatoire { color: #b42318; }

a {
  color: #007bff;
  text-decoration: underline;
}

/* Titres de page */
.page-title {
  text-align: center;
  display: block;     /* renforce le comportement bloc */
  width: 100%;        /* s’assure qu’il occupe toute la ligne */
  margin: 8px 0 12px; /* respiration au-dessus et en dessous */
  clear: both;        /* isole des éléments flottants s’il y en a */
}

/* ==========================================================
   STRUCTURE — BANNIÈRE
   ========================================================== */

#padak-banner {
  grid-area: 1 / 1;
  display: block;

  width: auto;
  height: 100%;
  min-width: 0;
  min-height: 0;

  object-fit: contain;
  object-position: center;

  border-bottom: 1px solid #ddd;

  max-width: 100%;
  justify-self: center;
}


/* ==========================================================
   STRUCTURE — ZONE CENTRALE ET PIED (largeur pilotée par --central-width)
   ========================================================== */

#form-container,
#response-viewport,
footer {
  grid-column: 1;
  width: min(100%, var(--central-width));
  height: 100%;
  min-width: 0;
  min-height: 0;
  position: relative;
  padding: 0;
  overflow: hidden;
  justify-self: center;
}

#form-container,
#response-viewport {
  grid-row: 2;
  background-color: #fff;
  border-radius: 0.6em;
}

footer { grid-row: 3; }


/* ==========================================================
   ENVELOPPES INTÉRIEURES (MISE À L’ÉCHELLE GÉRÉE EN JS)
   ========================================================== */

#form-fit,
#response-container,
#footer-fit {
  position: absolute;
  top: 0;
  left: 0;

  width: 100%;
  max-width: none;

  height: auto;
  min-height: 0;
  max-height: none;
  min-width: 0;

  margin: 0;
  overflow: visible;
  overflow-wrap: anywhere;

  /* transform: translate(...) scale(...) appliqué par JS */
  transform-origin: top left;
}

#form-fit {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  padding: 0.45em 0.6em;
  font-size: 16px;
  line-height: 1.2;
}

#footer-fit {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  padding: 0.45em 0.6em;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  color: #666;
}

#footer-fit > p { margin: 0; }
footer .marques,
footer .mentions-legales { font-style: italic; }


/* ==========================================================
   FORMULAIRE — TITRE, NOTE ET PROGRESSION
   ========================================================== */

#form-fit > h1,
#mandatory-note,
#progress {
  width: 100%;
  margin: 0;
  text-align: center;
}

#form-fit > h1 {
  font-size: 1.35em;
  line-height: 1.1;
  font-weight: 600;
  color: #222;
}

#mandatory-note { font-size: 0.8em; color: #555; }

#progress {
  padding: 0.35em 0.5em;
  font-size: 0.9em;
  font-weight: 600;
  background-color: #f2f2f2;
  border-radius: 0.4em;
}


/* ==========================================================
   FORMULAIRE — PAGES ET CONTENU
   ========================================================== */

form.page {
  display: none;
  flex-direction: column;
  gap: 0.55em;

  height: auto;
  min-width: 0;

  margin: 0;
  padding: 0.65em 0.75em;

  background: transparent; /* fond géré par le conteneur */
  box-shadow: none;
  border-radius: 0.6em;
}

form.page.active { display: flex; }

form.page > .content {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  flex: none; /* hauteur naturelle mesurée par JS */
  min-width: 0;
  overflow: visible;
}

.content > p,
.content > h4 { margin: 0; }
.content > h4 { font-size: 1em; font-weight: 600; }


/* ==========================================================
   FORMULAIRE — DISPOSITION DES CHAMPS (PAGES 1 & 2)
   ========================================================== */

#form1 > .content,
#form2 > .content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  align-items: center;
  align-content: start;
  gap: 0.35em 0.6em;
}

/* Cadre d’adresse (page 1) et groupes (page 2) sur toute la largeur */
#form1 > .content > fieldset,
#form2 > .content > .form-group,
#form2 > .content > fieldset { grid-column: 1 / -1; }

/* Supprimer les br d’espacement redondants */
.content > br,
fieldset > br { display: none; }


/* ==========================================================
   GROUPES, RADIOS ET LIGNES (CP / VILLE)
   ========================================================== */

#form-fit .form-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  align-items: center;
  gap: 0.3em 0.6em;
  min-width: 0;
  margin: 0;
}

#form-fit .form-group label { margin: 0; }

/* Question "Qui vous poursuit ?" superposée */
#form-fit #cadre-poursuivant { grid-template-columns: minmax(0, 1fr); }

/* Radios multi-lignes */
#form-fit .radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em 0.8em;
}
#form-fit .radio-group > label {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  margin: 0;
}

/* Cadres d’adresses compacts */
#cadre-identite-utilisateur,
#cadre-identite-poursuivant { margin: 0; }

/* Espacement entre lignes internes des fieldsets */
#form-fit fieldset > .form-group + .form-group,
#form-fit fieldset > .form-row { margin-top: 0.35em; }

/* Rangée CP/Ville en grille (sans min-width rigide) */
#form-fit .form-row {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr);
  gap: 0.6em;
}
#form-fit .form-row .col-1,
#form-fit .form-row .col-2 { min-width: 0; }
#form-fit .form-row label { display: block; margin-bottom: 0.2em; }


/* ==========================================================
   LABELS, CHAMPS ET FOCUS
   ========================================================== */

label {
  margin: 0;
  font-size: 0.9em;
  line-height: 1.2;
  font-weight: 600;
  cursor: pointer;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"],
input[type="number"],
input[type="file"],
select,
textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;

  margin: 0;
  padding: 0.3em 0.5em;

  font: inherit;
  line-height: 1.2;
  color: inherit;

  border: 1px solid #ccc;
  border-radius: 0.35em;
  background: #fff;
}

textarea { resize: none; overflow: hidden; }

input[type="radio"],
input[type="checkbox"] {
  width: 1em;
  height: 1em;
  margin: 0 0.25em 0 0;
  vertical-align: middle;
  flex-shrink: 0;
  accent-color: #007bff;
}

input[type="file"]::file-selector-button {
  font: inherit;
  margin-right: 0.5em;
  padding: 0.3em 0.5em;
}

/* Repère de focus clavier */
#form-fit input:focus-visible,
#form-fit select:focus-visible,
#form-fit textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid #007bff;
  outline-offset: 1px;
}

.info { font-size: 0.8em; color: #666; }


/* ==========================================================
   GROUPES / DATES / FIELDSETS
   ========================================================== */

fieldset {
  min-inline-size: 0;
  max-width: 100%;
  margin: 0;
  padding: 0.4em 0.6em;
  border: 1px solid #ddd;
  border-radius: 0.35em;
}

legend {
  max-width: 100%;
  padding: 0 0.25em;
  font-size: 1em;
}

fieldset > label {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  margin-right: 0.5em;
}

.date-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  align-items: center;
  gap: 0.3em 0.5em;
  margin-top: 0.4em;
}

/* Mois et année sur la même ligne (mode approx) */
#detteDate-approx {
  grid-template-columns:
    auto minmax(0, 1fr)
    auto minmax(0, 1fr);
}


/* ==========================================================
   PIÈCES JOINTES
   ========================================================== */

.file-list {
  margin: 0;
  padding: 0.4em 0.6em;
  list-style: none;

  border: 1px solid #ddd;
  border-radius: 0.35em;

  background-color: #fafafa;
  color: #444;
  font-size: 0.85em;

  max-height: none;
  overflow: visible;
}
.file-list li { overflow-wrap: anywhere; }
.file-list li + li { margin-top: 0.25em; }


/* ==========================================================
   BOUTONS
   ========================================================== */

.buttons {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.6em;
  padding-top: 0.5em;
  border-top: 1px solid #ddd;
}

button {
  min-width: 0;
  margin: 0;
  padding: 0.5em 0.7em;

  font: inherit;
  line-height: 1.2;
  white-space: normal;

  border: none;
  border-radius: 0.45em;

  background-color: #007bff;
  color: #fff;

  cursor: pointer;
}

.buttons button { flex: 1 1 0; }
button:hover:not(:disabled) { background-color: #0056b3; }
button:disabled { background-color: #999; cursor: not-allowed; }

.btn-annuler {
  display: inline-block;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  padding: 0.7em 1.5em;

  font-weight: 600;
  font-size: 1rem;
  text-align: center;

  border: none;
  border-radius: 0.45em;

  background-color: #007bff;
  color: #fff;

  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s ease;
}
.btn-annuler:hover,
.btn-annuler:focus { background-color: #0056b3; outline: none; }


/* ==========================================================
   ADAPTATION — ÉCRANS LARGES OU PAYSAGE PEU HAUT
   ========================================================== */

@media (min-width: 760px),
       (min-width: 480px) and (max-height: 550px) {
  #form1 > .content {
    grid-template-columns: repeat(2, minmax(0, 1fr) minmax(0, 1.4fr));
  }
}


/* ==========================================================
   ADAPTATION — ÉCRANS DE FAIBLE HAUTEUR
   ========================================================== */

@media (max-height: 550px) {
  #form-fit { gap: 0.25em; padding: 0.25em 0.5em; }
  #form-fit > h1 { font-size: 1.1em; }
  #progress { padding: 0.2em 0.4em; }
  form.page { gap: 0.4em; padding: 0.4em 0.5em; }
  .buttons { padding-top: 0.35em; }
}


/* ==========================================================
   PAGE FEU — DISPOSITION / TEXTES / BOUTONS / ADAPTATIONS
   ========================================================== */

.feu-container {
  display: flex;
  width: 100%;
  height: auto;
  min-height: 300px;
  gap: 1rem;
  box-sizing: border-box;
}

.feu-image-container {
  flex: 0 0 25%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.feu-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.feu-texte-container {
  flex: 1 1 75%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  text-align: center;
  padding: 0 1rem;
  box-sizing: border-box;
}

.texte-principal {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #333;
}

.texte-secondaire {
  font-size: 1rem;
  margin-bottom: 1.5rem;
  color: #555;
  max-width: 90%;
}

.buttons-rdv {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 400px;
}

.buttons-rdv button {
  flex: 1 1 45%;
  min-width: 100px;
  padding: 0.7em 1em;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5em;
  cursor: pointer;
  background-color: #007bff;
  color: #fff;
  transition: background-color 0.3s ease;
}

.buttons-rdv button:hover { background-color: #0056b3; }

@media (max-width: 600px) {
  .feu-container { flex-direction: column; min-height: auto; }
  .feu-image-container, .feu-texte-container { flex: none; width: 100%; }
  .buttons-rdv { max-width: 100%; }
}


/* ==========================================================
   CALENDRIER — EN-TÊTE / JOURS / CRÉNEAUX / CONFIRMATION
   ========================================================== */

.calendrier-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.calendrier-header button {
  border: none;
  background: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  padding: 0;
}
.calendrier-header button img { max-width: 100%; max-height: 100%; }

.mois-annee { font-weight: bold; font-size: 1.2rem; user-select: none; }

.calendrier-semaine {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1rem;
}

.jour-calendrier {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.5em;
  background: #fff;
  min-height: 150px;
  display: flex;
  flex-direction: column;
}

.jour-label {
  font-weight: 600;
  margin-bottom: 0.5em;
  text-align: center;
  user-select: none;
}

/* Liste des créneaux: centrée, largeur bornée */
.creneaux-liste {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.8rem 1rem;
  width: auto;
  max-width: 850px;
  margin: 0 auto;
  justify-items: center;
  justify-content: center;
}

.creneau-label {
  display: inline-block;
  padding: 8px 12px;

  border-radius: 10px;
  background-color: #e9f2ff;
  border: 2px solid #007bff;

  font-weight: 600;
  font-size: 1rem;

  cursor: pointer;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease,
    box-shadow 0.3s ease;

  min-width: 80px;
  text-align: center;
}

.creneau-label:hover,
.creneau-label:focus-visible {
  background-color: #a7cbff;
  border-color: #0056b3;
  color: #000;
  outline: none;
  box-shadow: 0 0 6px #0056b3bb;
}

input[name="rdv"] { display: none; }

.creneau-label.selected {
  background-color: #0047b3 !important;
  border-color: #002b80 !important;
  color: white !important;
  box-shadow: 0 0 12px 3px #002b80cc !important;
  font-weight: 700;
}

.creneaux input[type="radio"]:checked + label {
  background-color: #007bff;
  color: white;
  border-color: #0056b3;
}

/* Colonne calendrier centrée + bouton centré */
#calendrier-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#calendrier-content button#confirmer-rdv {
  display: inline-block;
  width: auto !important;  /* override des règles larges */
  max-width: 300px;
  margin: 1rem auto 0 auto;
  align-self: center;
}

/* Variante si un conteneur dédié est utilisé */
#confirmer-rdv-container {
  display: flex;
  justify-content: center;
}

button#confirmer-rdv:disabled {
  background-color: #aaa;
  cursor: default;
}

@media (max-width: 700px) {
  .calendrier-semaine { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .jour-calendrier { min-height: 120px; }
}
@media (max-width: 400px) {
  .calendrier-semaine { grid-template-columns: 1fr; }
}


/* ==========================================================
   LISTE / BOUTONS DES JOURS
   ========================================================== */

.jours-liste {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 1.2rem;
  max-width: 800px;
  margin: 0 auto;
  padding: 0.3rem 0;
}

.jour-btn {
  color: #000010;
  transition:
    background-color 0.25s ease,
    box-shadow 0.25s ease,
    color 0.25s ease;
}
.jour-btn:hover,
.jour-btn:focus {
  background-color: #007bff;
  box-shadow: 0 0 5px 3px #0056b399;
  color: white;
  outline: none;
}

.jour-label {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
  color: inherit;
  transition: color 0.25s ease;
}

.nb-creneaux { font-size: 0.87rem; color: inherit; }

@media (max-width: 600px) {
  .jours-liste { gap: 0.6rem; }
  .jour-btn   { min-width: 100px; }
}


/* ==========================================================
   RÉPONSE / CALENDRIER — DÉTAILS
   ========================================================== */

#response-container .feu-container { height: auto; min-height: 0; }
#response-container .feu-image    { height: auto; max-height: 180px; }

/* Éviter de tronquer les libellés des créneaux dans la réponse */
#response-container .creneau-label {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: visible;
  text-overflow: clip;
}


/* ==========================================================
   MENTIONS OBLIGATOIRES ET OPTIONNELLES
   ========================================================== */

fieldset.mentions-obligatoires,
fieldset.mentions-optionnelles {
  border: 2px solid #007bff;
  border-radius: 8px;
  padding: 1em 1.2em;
  margin: 0; /* compact, mesuré par JS */
  background-color: #f9fbff;
}

fieldset.mentions-obligatoires legend,
fieldset.mentions-optionnelles legend {
  font-weight: bold;
  color: #0056b3;
  padding: 0 0.5em;
}

fieldset.mentions-obligatoires p,
fieldset.mentions-optionnelles p { margin: 0.35em 0; }


/* ==========================================================
   PAGES STANDALONE (Paiement & Confirmation)
   ========================================================== */

body.standalone-page {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #fff;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.standalone-card {
  width: min(96%, 900px);
  margin: 2rem auto;
  padding: 1.25rem 1.4rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
}

.standalone-card h1 {
  margin: 0 0 0.75rem 0;
  font-size: 1.4rem;
}
.standalone-card p { margin: 0.4rem 0; color: #333; }

.tarifs { color: #444; margin: 0.5rem 0 1rem 0; }
.options { margin: 1rem 0; }

.buttons {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 0.7em 1.4em;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  background-color: #007bff;
  border: none;
  border-radius: 0.5em;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background-color: #0056b3; }
.btn.secondary { background: #6c757d; }
.btn.secondary:hover { background: #545b62; }


/* ==========================================================
   VUE PAIEMENT COURRIER (intégrée dans index.html) — SANS CADRE
   ========================================================== */

.payment-view {
  width: 100%;
  display: flex;
  justify-content: center;
}

.payment-card {
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent; /* pas de fond */
  border-radius: 0;        /* pas d’arrondis */
  box-shadow: none;        /* pas d’ombre */
  text-align: left;
}

.payment-card h1 {
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem;
}
.payment-card p { margin: 0.4rem 0; color: #333; }

.payment-tarifs { color: #444; margin: 0.5rem 0 1rem 0; }
.payment-options { margin: 1rem 0; }

.payment-buttons {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.payment-buttons .btn {
  padding: 0.7em 1.4em;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  background-color: #007bff;
  border: none;
  border-radius: 0.5em;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.payment-buttons .btn:hover { background-color: #0056b3; }
.payment-buttons .btn.secondary { background: #6c757d; }
.payment-buttons .btn.secondary:hover { background: #545b62; }


/* ==========================================================
   VUE CONFIRMATION (intégrée dans index.html)
   ========================================================== */

.confirm-view {
  width: 100%;
  display: flex;
  justify-content: center;
}
.confirm-text {
  color: #333;
  margin-top: 1rem;
  text-align: center;
}

/* Informations complémentaires (Page 3) */
.infos-sup {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fafafa;
}
.infos-sup h3 {
  margin: 0 0 6px 0;
  font-size: 1.05rem;
}
.infos-sup .muted {
  color: #6b7280;
  margin: 0 0 8px 0;
  font-size: 0.9rem;
}
.infos-sup textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 120px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  padding: 10px;
  font-size: 0.95rem;
  line-height: 1.4;
  background: #fff;
}
.char-counter {
  margin-top: 6px;
  font-size: 0.85rem;
  color: #6b7280;
  text-align: right;
}
