/* ============================================================
   COMPONENTS — boutons, cartes, formulaires, pastilles, modales,
   toasts. Partagés par les pages publiques et le backoffice.
   ============================================================ */

/* === Boutons === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--f-display); font-weight: 700; font-size: 16px; line-height: 1.15;
  /* Même hauteur que les champs (48 px), y compris quand le libellé passe à la ligne. */
  min-height: var(--control-h); padding: 8px 22px; border-radius: var(--r-pill); border: 2px solid transparent;
  text-align: center; vertical-align: middle;
  text-decoration: none; cursor: pointer; transition: transform .15s var(--ease), background .15s, border-color .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary { background: var(--c-yellow); color: var(--c-black); }
.btn-primary:hover { background: #ffd633; }
.btn-blue { background: var(--c-blue-ink); color: #fff; }
/* Vert : actions de l'inscription et de l'espace famille (servi partout, pas seulement sur Nos accueils). */
.btn-green { background: var(--c-green-ink); color: #fff; }
.btn-green:hover { background: #00672A; }
.btn-blue:hover { background: #005f88; }
/* .btn-outline : nom du socle Codia (écrans et confirmations des modules partagés). */
.btn-ghost, .btn-outline { background: #fff; color: var(--c-black); border-color: var(--c-line); }
.btn-ghost:hover, .btn-outline:hover { border-color: var(--c-black); }
.btn-danger { background: #fff; color: #B42318; border-color: #F3C7C3; }
.btn-danger:hover { border-color: #B42318; }
.btn-sm { min-height: var(--control-h-sm); padding: 5px 14px; font-size: 14px; }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.link-more { font-weight: 800; color: var(--c-rub-ink); text-decoration: none; }
.link-more:hover { text-decoration: underline; }

/* === Cartes à liseré coloré === */
.card {
  position: relative; background: var(--c-paper); border: 1px solid var(--c-line);
  border-radius: var(--r-md); padding: 22px; box-shadow: var(--shadow);
}
.card--accent { border-top: 5px solid var(--accent, var(--c-rub)); }
.card h3 { margin-bottom: 6px; }
.card p { color: var(--c-mute); margin: 0; }
a.card { display: block; text-decoration: none; color: inherit; transition: transform .2s var(--ease), box-shadow .2s; }
a.card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(14, 12, 12, .1); }
.card .link-more { display: inline-block; margin-top: 12px; }

/* === Pastilles / badges === */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800;
  padding: 3px 11px; border-radius: var(--r-pill); background: var(--c-rub-soft); color: var(--c-rub-ink);
}
.pill--neutral { background: #F1F3F6; color: var(--c-mute); }
.pill--green { background: var(--c-green-soft); color: var(--c-green-ink); }
.pill--yellow { background: var(--c-yellow-soft); color: var(--c-yellow-ink); }
.pill--magenta { background: var(--c-magenta-soft); color: var(--c-magenta-ink); }
.pill--orange { background: var(--c-orange-soft); color: var(--c-orange-ink); }
.pill--blue { background: var(--c-blue-soft); color: var(--c-blue-ink); }
.pill--red { background: #FEE4E2; color: #B42318; }

/* Badge « Option » : fonction chiffrée en option au devis (phase 2),
   montrée dans la maquette sans être comprise dans le socle. */
.badge-option {
  display: inline-flex; align-items: center; font-family: var(--f-body); font-size: 11px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; line-height: 1; vertical-align: middle;
  padding: 4px 8px; border-radius: var(--r-pill); background: #fff; color: var(--c-orange-ink);
  border: 1.5px dashed var(--c-orange);
}

/* === Formulaires ===
   Hauteurs communes : --control-h (champs, boutons) et --control-h-sm
   (outils du backoffice, petits boutons). Un champ ne s'étire jamais
   pour suivre son voisin de ligne (align-content: start). */
.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .field > .label { font-weight: 800; font-size: 15px; }
.field .hint { font-size: 14px; color: var(--c-mute); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid #CDD3DB; border-radius: var(--r-sm);
  background-color: #fff; font-size: 16px; line-height: 1.3;
}
.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]), .field select { height: var(--control-h); padding-top: 0; padding-bottom: 0; }
.field input[type="file"] { min-height: var(--control-h); padding: 10px 12px; }
/* Listes déroulantes : flèche dessinée à 14 px du bord (la flèche du navigateur colle au bord). */
select:not([multiple]) {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2346505C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
  padding-right: 42px; text-overflow: ellipsis;
}
select:not([multiple]):disabled { cursor: not-allowed; opacity: .7; }
.field textarea { min-height: 120px; }
/* Champs de texte long : hauteur fixe, le texte défile dedans (pas de poignée pour les agrandir). */
textarea { resize: none; overflow-y: auto; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--c-focus); box-shadow: 0 0 0 3px rgba(0, 112, 160, .18); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: #B42318; }
.field .error { color: #B42318; font-size: 14px; font-weight: 700; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--c-green); }
fieldset { border: 1px solid var(--c-line); border-radius: var(--r-md); padding: 18px 20px 20px; margin: 0; background: #fff; }
legend { font-family: var(--f-display); font-weight: 700; font-size: 19px; padding: 0 8px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.notice {
  border-radius: var(--r-md); padding: 14px 18px; background: var(--c-blue-soft);
  border-left: 5px solid var(--c-blue); color: var(--c-ink);
}
.notice--success { background: var(--c-green-soft); border-color: var(--c-green); }
.notice--warn { background: var(--c-yellow-soft); border-color: var(--c-yellow); }
.notice--error { background: #FEE4E2; border-color: #B42318; }
.notice p:last-child { margin: 0; }

/* === Tableaux (backoffice) === */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--r-md); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--c-mute); background: #F6F7F9; padding: 11px 14px; white-space: nowrap; }
.table td { padding: 12px 14px; border-top: 1px solid var(--c-line); vertical-align: middle; }
.table tr:hover td { background: #FBFCFD; }
.table .num { text-align: right; }
.empty { padding: 28px; text-align: center; color: var(--c-mute); }

/* === Modale === */
.modal {
  position: fixed; inset: 0; z-index: 200; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px;
  background: rgba(14, 12, 12, .45); opacity: 0; transition: opacity .2s;
}
.modal.is-open { opacity: 1; }
.modal-panel {
  width: min(760px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: #fff; border-radius: var(--r-lg); box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
  transform: translateY(12px); transition: transform .25s var(--ease);
}
.modal.is-open .modal-panel { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--c-line); }
.modal-head h2 { font-size: 24px; margin: 0; }
.modal-close { border: 0; background: #F1F3F6; width: 38px; height: 38px; border-radius: 50%; font-size: 22px; line-height: 1; }
.modal-body { padding: 20px 24px; overflow-y: auto; min-width: 0; overflow-wrap: anywhere; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--c-line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* Texte long rendu depuis le Markdown (règlement, projets, articles) */
.prose h2 { font-size: 22px; margin-top: 1.4em; }
.prose h3 { font-size: 18px; margin-top: 1.2em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .3em; }

/* === Toasts === */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: grid; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  background: var(--c-black); color: #fff; border-radius: var(--r-md); padding: 13px 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .2); font-size: 15px; display: flex; gap: 12px; align-items: center;
  animation: toast-in .3s var(--ease);
}
.toast button { margin-left: auto; background: var(--c-yellow); color: var(--c-black); border: 0; border-radius: var(--r-pill); padding: 5px 12px; font-weight: 800; font-size: 13px; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* Vignette de photo simulée (jeu de données fictif) */
.ph-img {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-sm); overflow: hidden;
  background: var(--ph-bg, var(--c-blue-soft)); display: grid; place-items: center;
}
.ph-img svg { width: 42%; height: auto; opacity: .9; }
.ph-img img { width: 100%; height: 100%; object-fit: cover; }

/* Filtres en pastilles (écrans du backoffice), fenêtre large, lien de retour */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.filters button { border: 1px solid var(--c-line); background: #fff; border-radius: var(--r-pill); padding: 7px 16px; font-weight: 700; font-size: 15px; }
.filters button[aria-pressed="true"] { background: var(--c-magenta); border-color: var(--c-magenta); color: #fff; }
.modal-panel--wide { width: min(980px, 100%); }
.back-link { display: inline-block; margin-bottom: 16px; font-weight: 800; color: var(--c-magenta-ink); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
