/* ============================================================
   Composants UI génériques
   ============================================================ */

/* ---- Cartes ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--sp-5); }

/* ---- Boutons ---- */
.btn, button:not(.unstyled), input[type="submit"] {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 11px 20px;
  background: var(--brand);
  color: #fff;
  transition: transform .06s, box-shadow .15s, background .15s;
  box-shadow: 0 6px 16px rgba(14, 159, 110, .28);
}
.btn:hover, button:not(.unstyled):hover { background: var(--brand-600); text-decoration: none; }
.btn:active, button:not(.unstyled):active { transform: translateY(1px); }
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 13px; font-size: .85rem; box-shadow: none; }
.btn-danger { background: var(--live); box-shadow: 0 6px 16px rgba(229, 72, 77, .26); }
.btn-danger:hover { background: #cf3b40; }
.btn-block { display: block; width: 100%; text-align: center; }

/* ---- Formulaires ---- */
label { display: block; font-weight: 600; font-size: .9rem; color: var(--ink-soft); margin-bottom: 6px; }
input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-50);
}
input[type="checkbox"] { width: auto; accent-color: var(--brand); }
textarea { min-height: 110px; resize: vertical; }
::placeholder { color: var(--faint); }
.field { margin-bottom: var(--sp-4); }

.form-narrow { max-width: 420px; }
.form-narrow.card { padding: var(--sp-5); }

/* ---- Authentification ---- */
.auth { max-width: 420px; margin: var(--sp-6) auto; }
.auth .page-head { text-align: center; }
.auth .card { padding: var(--sp-5); }
.auth .alt { text-align: center; margin-top: var(--sp-4); color: var(--muted); font-size: .9rem; }

/* ---- Bannière mode démo (accueil, classement…) ---- */
.demo-mock-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  background: var(--gold);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-4);
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: var(--sp-4);
}
.demo-mock-banner a { font-weight: 800; color: var(--brand-700); }

/* ---- Alertes ---- */
.alert {
  padding: 12px 15px;
  border-radius: var(--r-sm);
  font-size: .92rem;
  margin-bottom: var(--sp-4);
  border: 1px solid;
}
.alert-ok { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.alert-err { background: #fdecec; border-color: #f7c9cb; color: #b42a2f; }
.hint { color: var(--muted); font-size: .85rem; }
.legal { color: var(--faint); font-size: .78rem; }

/* ---- Pills / tags ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: .72rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.pill-live { background: #fdecec; color: var(--live); border-color: #f7c9cb; }
.pill-brand { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }

/* ---- Tableaux ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .92rem; }
thead th {
  text-align: left;
  font-family: var(--display);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 700;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* ---- État vide ---- */
.empty-state {
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
}
.empty-state .emo { font-size: 2rem; display: block; margin-bottom: 8px; }

/* ---- Toast ---- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px);
  transform: translateX(-50%) translateY(20px);
  z-index: 100;
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { background: var(--brand-700); }
#toast.ko { background: var(--live); }

/* ---- Grille utilitaire ---- */
.grid { display: grid; gap: var(--sp-4); }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
