/**
 * ui-kit.css — Kit de fondation « Apple » (2026-06-18)
 * Composants réutilisables dont les écrans métier hériteront ensuite :
 *   - .btn-pill        bouton capsule (press-state, focus ring)
 *   - .segmented       contrôle segmenté à thumb glissant (JS : segmented.js)
 *   - .skeleton(-text) placeholders shimmer (coupés si reduced-motion)
 *   - .halo            lueur radiale navy/bleu désaturée (en-têtes, héros)
 *   - .empty-state     état vide (picto + halo + texte + action)
 *
 * Tokens consommés (définis dans app.css) : --ease, --ease-spring, --dur*,
 * --shadow-*, --r-pill, --halo-color, --tint, --label-*, --fill-*, --bg-*,
 * --separator, --ring-focus. Thème sombre géré via ces tokens (auto).
 * Aucun JS inline (CSP) ; ARIA portée par le markup / segmented.js.
 */

/* ════════════════════════════════════════════════════════════════════
   1. Bouton pilule — .btn-pill
   Capsule pleine (tint), press-state scale(.97) + assombrissement,
   focus ring net. Variantes : .btn-pill--ghost (contour), .btn-pill--quiet
   (fill discret). Taille : .btn-pill--sm / .btn-pill--lg.
   ════════════════════════════════════════════════════════════════════ */
.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.6rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill, 100px);
  background: var(--tint);
  color: var(--bg-secondary);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--dur-fast, 0.15s) var(--ease, ease),
    filter var(--dur-fast, 0.15s) var(--ease, ease),
    box-shadow var(--dur-fast, 0.15s) var(--ease, ease),
    background var(--dur-fast, 0.15s) var(--ease, ease);
}
.btn-pill > svg { width: 1.15em; height: 1.15em; flex: 0 0 auto; }
.btn-pill:hover { filter: brightness(1.08); }
.btn-pill:active { transform: scale(0.97); filter: brightness(0.92); }
.btn-pill:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus, 0 0 0 3px rgba(94,127,168,0.35));
}
.btn-pill:disabled,
.btn-pill[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Variante contour (ghost) : surface neutre, bord net */
.btn-pill--ghost {
  background: var(--bg-secondary);
  color: var(--label-primary);
  border-color: var(--separator);
}
.btn-pill--ghost:hover { filter: none; background: var(--fill-tertiary); }
.btn-pill--ghost:active { filter: none; background: var(--fill-secondary); transform: scale(0.97); }

/* Variante discrète (quiet) : fill translucide, sans bord */
.btn-pill--quiet {
  background: var(--fill-primary);
  color: var(--label-primary);
}
.btn-pill--quiet:hover { filter: none; background: var(--fill-secondary); }
.btn-pill--quiet:active { filter: none; background: var(--fill-secondary); transform: scale(0.97); }

/* Variante destructive */
.btn-pill--danger { background: var(--system-red); color: #fff; }

.btn-pill--sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.btn-pill--lg { padding: 0.8rem 1.6rem; font-size: 1.05rem; }

@media (prefers-reduced-motion: reduce) {
  .btn-pill { transition: filter var(--dur-fast, 0.15s) linear, background var(--dur-fast, 0.15s) linear; }
  .btn-pill:active { transform: none; }
}

/* ════════════════════════════════════════════════════════════════════
   2. Segmented control — .segmented
   role="tablist" ; chaque option = <button role="tab">. Un thumb glissant
   (.segmented-thumb) est positionné par segmented.js (variables --seg-x /
   --seg-w). Sans JS : reste lisible (le bouton sélectionné est teinté).
   ════════════════════════════════════════════════════════════════════ */
.segmented {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  padding: 3px;
  background: var(--fill-secondary);
  border-radius: var(--r-pill, 100px);
  isolation: isolate;
}
.segmented-thumb {
  position: absolute;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  width: var(--seg-w, 0px);
  transform: translateX(var(--seg-x, 0px));
  background: var(--bg-secondary);
  border-radius: var(--r-pill, 100px);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--dur, 0.25s) var(--ease, ease),
    width var(--dur, 0.25s) var(--ease, ease);
  z-index: 0;
  pointer-events: none;
}
.segmented-thumb[hidden] { display: none; }
.segmented [role="tab"] {
  position: relative;
  z-index: 1;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--label-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.45rem 1rem;
  border-radius: var(--r-pill, 100px);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur, 0.25s) var(--ease, ease);
}
.segmented [role="tab"]:hover { color: var(--label-primary); }
.segmented [role="tab"][aria-selected="true"] { color: var(--label-primary); }
.segmented [role="tab"]:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus, 0 0 0 3px rgba(94,127,168,0.35));
}
/* Repli sans JS / thumb caché : teinte le bouton actif */
.segmented:not(.segmented--ready) [role="tab"][aria-selected="true"] {
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
}
@media (prefers-reduced-motion: reduce) {
  .segmented-thumb { transition: none; }
}

/* ════════════════════════════════════════════════════════════════════
   3. Skeleton shimmer — .skeleton / .skeleton-text
   Placeholder de chargement. Le shimmer est coupé si reduced-motion
   (reste un bloc gris statique, toujours lisible comme « en attente »).
   ════════════════════════════════════════════════════════════════════ */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--fill-secondary);
  border-radius: var(--radius-md, 10px);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    var(--fill-primary),
    transparent
  );
  animation: skeletonShimmer 1.4s ease-in-out infinite;
}
.skeleton-text {
  height: 0.85em;
  margin: 0.35em 0;
  border-radius: var(--radius-sm, 6px);
}
.skeleton-text:last-child { width: 65%; }
.skeleton-circle { border-radius: 50%; }
@keyframes skeletonShimmer {
  100% { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton::after { display: none; }
}

/* ════════════════════════════════════════════════════════════════════
   4. Halo radial — .halo
   Lueur navy/bleu DÉSATURÉE (--halo-color = #5e7fa8, charte lumière bleue)
   diffuse derrière en-têtes / héros / empty states. Décoratif :
   aria-hidden implicite (pas de texte), pointer-events:none.
   À poser sur un parent position:relative (le halo se centre derrière).
   ════════════════════════════════════════════════════════════════════ */
.halo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 480px;
  height: 480px;
  max-width: 120%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--halo-color) 0%, transparent 68%);
  filter: blur(8px);
  pointer-events: none;
  z-index: 0;
}
.halo--top { top: 0; }
.halo--sm { width: 280px; height: 280px; }
.halo--lg { width: 680px; height: 680px; }
/* Conteneur qui héberge un halo : garde le contenu au-dessus */
.has-halo { position: relative; }
.has-halo > :not(.halo) { position: relative; z-index: 1; }

/* ════════════════════════════════════════════════════════════════════
   5. Empty state — .empty-state
   Picto SVG (dans .empty-state-icon) + halo + titre + texte + action.
   Centré, respirant. Le picto est décoratif (aria-hidden côté markup).
   ════════════════════════════════════════════════════════════════════ */
.empty-state {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  padding: clamp(2rem, 6vw, 3.5rem) 1.5rem;
  overflow: hidden;
}
.empty-state > * { position: relative; z-index: 1; }
.empty-state > .halo { z-index: 0; }
.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-xl, 18px);
  background: var(--fill-secondary);
  color: var(--label-secondary);
}
.empty-state-icon svg { width: 30px; height: 30px; }
.empty-state-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--label-primary);
}
.empty-state-text {
  margin: 0;
  max-width: 38ch;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--label-secondary);
}
.empty-state-action { margin-top: 0.75rem; }
