/* ==========================================================================
   Composants partagés (site public, admin, OTM)
   ========================================================================== */

/* ---- Boutons ---- */
.btn {
  --_bg: var(--surface);
  --_fg: var(--text);
  --_bd: var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--tap);
  padding: 0.6rem 1.15rem;
  border-radius: var(--btn-radius, var(--r-md));
  border: 1px solid var(--_bd);
  background: var(--_bg);
  color: var(--_fg);
  font: 600 var(--fs-sm) / 1.2 var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:hover { --_bg: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.btn--primary { --_bg: var(--btn-bg); --_fg: var(--on-primary); --_bd: transparent; }
.btn--primary:hover { --_bg: var(--btn-bg-hover); }
.btn--accent { --_bg: var(--accent); --_fg: var(--on-accent); --_bd: transparent; }
.btn--accent:hover { --_bg: var(--accent-hover); }
.btn--ghost { --_bg: transparent; --_bd: transparent; --_fg: var(--text-2); }
.btn--ghost:hover { --_bg: var(--surface-2); --_fg: var(--text); }
.btn--danger { --_bg: var(--danger-soft); --_fg: var(--danger); --_bd: transparent; }
.btn--danger:hover { --_bg: color-mix(in oklab, var(--danger) 18%, var(--surface)); }
.btn--light { --_bg: #fff; --_fg: var(--primary-deep); --_bd: transparent; }
.btn--light:hover { --_bg: #eef3f9; }
.btn--outline-light { --_bg: transparent; --_fg: #fff; --_bd: rgb(255 255 255 / 0.5); }
.btn--outline-light:hover { --_bg: rgb(255 255 255 / 0.14); }
.btn--sm { min-height: 36px; padding: 0.35rem 0.8rem; }
.btn--lg { min-height: 54px; padding: 0.8rem 1.6rem; font-size: var(--fs-md); }
.btn--icon { padding: 0; width: var(--tap); }
.btn--sm.btn--icon { width: 36px; }
.btn--block { width: 100%; }

/* ---- Cartes ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

/* ---- Badges et pastilles ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}
.badge--plain::before { display: none; }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--info { background: var(--primary-soft); color: var(--link); }
.badge--accent { background: var(--accent-soft); color: color-mix(in oklab, var(--accent) 45%, var(--text)); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.35rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.chip:hover { border-color: var(--primary); color: var(--text); }
.chip[aria-pressed="true"] {
  background: var(--btn-bg);
  border-color: var(--btn-bg);
  color: var(--on-primary);
}

/* ---- Marque du club (en-têtes de toutes les zones) ---- */
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--text); text-decoration: none; }
.brand__mark { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; flex: none; border-radius: 50%; background: var(--primary); color: var(--accent); }
.brand__mark .i { width: 1.7rem; height: 1.7rem; stroke-width: 1.8; }
.brand__text { display: grid; line-height: 1.15; }
.brand__text strong { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 800; letter-spacing: -0.02em; }
.brand__text small { font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); }

/* ---- Tuile de date (site public et OTM) ---- */
.date-tile {
  display: grid;
  justify-items: center;
  align-content: center;
  width: 3.8rem;
  min-height: 4.2rem;
  flex: none;
  padding: 0.35rem;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: color-mix(in oklab, var(--accent) 38%, var(--text));
  line-height: 1.05;
  text-align: center;
}
.date-tile span { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.date-tile b { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; }

/* ---- Avatar ---- */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--link);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.avatar--sm { width: 1.9rem; height: 1.9rem; font-size: var(--fs-xs); }
.avatar--accent { background: var(--accent-soft); color: color-mix(in oklab, var(--accent) 45%, var(--text)); }

/* ---- Formulaires ---- */
.field { display: grid; gap: 0.4rem; }
.field > label,
.label { font-size: var(--fs-sm); font-weight: 650; color: var(--text); }
.hint { font-size: var(--fs-xs); color: var(--text-3); }

.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { min-height: 7.5rem; resize: vertical; }
.input::placeholder,
.textarea::placeholder { color: var(--text-3); }
.input:hover,
.select:hover,
.textarea:hover { border-color: var(--text-3); }
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 22%, transparent);
}
.select {
  appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a98ad' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 1.1rem;
}
.input--score {
  width: 3.4rem;
  min-height: 40px;
  padding-inline: 0.2rem;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Contrôle segmenté (choix exclusif, remplace une liste déroulante pour 2 à 4 options) */
.seg {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0.25rem 0.95rem;
  border-radius: calc(var(--r-md) - 4px);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-2);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg input:focus-visible + span { outline: 3px solid color-mix(in oklab, var(--accent) 80%, white); outline-offset: 1px; }

/* Interrupteur */
.switch { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; font-weight: 600; font-size: var(--fs-sm); }
.switch input { position: absolute; opacity: 0; }
.switch i {
  position: relative;
  width: 2.7rem;
  height: 1.55rem;
  border-radius: var(--r-pill);
  background: var(--border-strong);
  transition: background-color var(--dur) var(--ease);
}
.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + i { background: var(--btn-bg); }
.switch input:checked + i::after { transform: translateX(1.15rem); }
.switch input:focus-visible + i { outline: 3px solid color-mix(in oklab, var(--accent) 80%, white); outline-offset: 2px; }

/* ---- Tableaux ---- */
.table-wrap { overflow-x: auto; }
.table th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background-color var(--dur) var(--ease); }
.table tbody tr:hover { background: color-mix(in oklab, var(--primary) 4%, var(--surface)); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ---- Scores ---- */
.score {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.score small { font-size: 0.7em; font-weight: 600; color: var(--text-3); }
.score--win { color: var(--success); }
.score--loss { color: var(--danger); }

/* ---- Tiroir latéral et feuille du bas ---- */
dialog.drawer,
dialog.sheet,
dialog.palette {
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-3);
}
dialog.drawer {
  margin: 0 0 0 auto;
  width: min(30rem, 100vw);
  height: 100dvh;
  max-height: none;
  border-radius: var(--r-lg) 0 0 var(--r-lg);
}
dialog.drawer[open] { animation: slide-in 240ms var(--ease); }
dialog.sheet {
  margin: auto auto 0;
  width: min(30rem, 100%);
  max-width: 100%;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
dialog.sheet[open] { animation: sheet-up 260ms var(--ease); }
dialog.palette {
  margin: 12vh auto auto;
  width: min(36rem, calc(100% - 2rem));
  border-radius: var(--r-lg);
}
dialog::backdrop { background: rgb(8 16 28 / 0.55); backdrop-filter: blur(3px); }
@keyframes slide-in { from { transform: translateX(100%); } }
@keyframes sheet-up { from { transform: translateY(100%); } }

/* ---- Messages de confirmation (toasts) ---- */
.toasts {
  position: fixed;
  z-index: 300;
  inset: auto 0 1.25rem 0;
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  padding-inline: 1rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  max-width: min(32rem, 100%);
  padding: 0.7rem 0.8rem 0.7rem 1.1rem;
  border-radius: var(--r-md);
  background: #0e1a2b;
  color: #fff;
  box-shadow: var(--shadow-3);
  font-size: var(--fs-sm);
  font-weight: 550;
  pointer-events: auto;
  animation: toast-in 260ms var(--ease);
}
.toast .i { color: #6ee7a0; }
.toast button {
  min-height: 34px;
  padding: 0.2rem 0.8rem;
  border: 0;
  border-radius: var(--r-sm);
  background: rgb(255 255 255 / 0.14);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.toast button:hover { background: rgb(255 255 255 / 0.24); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity 200ms, transform 200ms; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

/* ---- État vide ---- */
.empty {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  padding: var(--s-7) var(--s-5);
  text-align: center;
  color: var(--text-2);
}
.empty .i { width: 2.6rem; height: 2.6rem; color: var(--text-3); }
.empty strong { font-size: var(--fs-lg); color: var(--text); }

.kbd {
  display: inline-block;
  min-width: 1.6rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font: 600 var(--fs-xs) / 1.5 var(--font);
  text-align: center;
}

/* Bandeau « maquette » */
.mock-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: color-mix(in oklab, var(--accent) 40%, var(--text));
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Texte mis en forme (actualités) : paragraphes, titres, puces, liens. Servi par RichText, jamais du HTML saisi. */
.prewrap { white-space: pre-line; }
.prose { display: grid; gap: var(--s-4); max-width: 68ch; line-height: 1.65; overflow-wrap: anywhere; }
.prose h2 { margin-top: var(--s-3); font-size: var(--fs-xl); font-weight: 800; letter-spacing: -0.01em; line-height: 1.25; }
.prose h3 { margin-top: var(--s-2); font-size: var(--fs-lg); font-weight: 750; line-height: 1.3; }
.prose ul { display: grid; gap: 0.35rem; padding-left: 1.2rem; list-style: disc; }
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 0.18em; }
.prose a:hover { text-decoration-thickness: 2px; }
.i--flip { transform: scaleX(-1); }
