/*!
 * TimeStage, chronometre de scene
 * © 2026 Arnisound Tools (Theo Arnissolle). Tous droits reserves.
 * Logiciel proprietaire : toute reproduction, modification, distribution ou
 * exploitation sans autorisation ecrite prealable est interdite. Voir LICENSE.
 */
/* TimeStage : systeme de design commun */
:root {
  /* Charte du logo : badge noir, or, blanc. */
  --bg: #08080b;
  --bg-soft: #101014;
  --panel: #15151a;
  --panel-2: #1e1e25;
  --line: #2c2c35;
  --line-soft: #232329;
  --text: #f4f1ea;
  --muted: #9b958a;
  --accent: #cb8a27;
  --accent-light: #e2ab52;
  --accent-ink: #140f05;
  --accent-glow: rgba(203, 138, 39, .18);
  /* Couleurs de signalisation du chrono : volontairement distinctes de l'or,
     pour qu'un bouton de l'interface ne se confonde jamais avec une alerte. */
  --ok: #22c55e;
  --warn: #facc15;
  --danger: #ef4444;
  --violet: #a78bfa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 650; line-height: 1.2; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .92rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: .8rem; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.hidden { display: none !important; }

.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.tight { gap: .35rem; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: .5rem; }
.stack > * + * { margin-top: .6rem; }

/* --- Panneaux ------------------------------------------------------------ */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.panel > header,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .75rem;
}
.panel-title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

/* --- Boutons ------------------------------------------------------------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: .5rem .8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  transition: background .12s ease, border-color .12s ease, transform .05s ease, opacity .12s;
  user-select: none;
}
.btn:hover { background: #26262f; border-color: #3d3d49; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-light); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #05210f; }
.btn.ok:hover { filter: brightness(1.08); }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #2a2200; }
.btn.danger { background: transparent; border-color: #5c2b2b; color: #ff9a9a; }
.btn.danger:hover { background: #3a1d1d; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: .3rem .55rem; font-size: .82rem; }
.btn.lg { padding: .8rem 1.1rem; font-size: 1.05rem; }
.btn.block { width: 100%; }
.btn.icon { padding: .4rem; min-width: 2rem; }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* --- Champs -------------------------------------------------------------- */
input[type="text"], input[type="number"], input[type="search"], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .5rem .6rem;
  width: 100%;
  min-width: 0;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 4.5rem; }
label { font-size: .82rem; color: var(--muted); display: block; margin-bottom: .2rem; }
.field { display: flex; flex-direction: column; }
.field-row { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }

.check { display: flex; align-items: center; gap: .5rem; color: var(--text); font-size: .88rem; cursor: pointer; margin: 0; }
.check input { width: auto; accent-color: var(--accent); width: 1rem; height: 1rem; }

/* --- Etiquettes ---------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
}
.chip.ok { color: #9af5bd; border-color: #1c5234; background: #0f2a1b; }
.chip.warn { color: #fde68a; border-color: #5c4d18; background: #2b2508; }
.chip.danger { color: #ffb3b3; border-color: #5c2b2b; background: #2b1010; }
.chip.accent { color: #f0cd8e; border-color: #5c4318; background: #2a1e08; }

.dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px rgba(34, 197, 94, .7); }
.dot.accent { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); }

.code-badge {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .18em;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .25rem .6rem;
}

/* --- Listes -------------------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.list-item {
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: .6rem .7rem;
  display: flex;
  gap: .6rem;
  align-items: flex-start;
}
.list-item.active { border-color: var(--accent); background: #211806; }
.list-item.done { opacity: .55; }
.empty { color: var(--muted); font-size: .85rem; padding: .8rem; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-sm); }

/* --- Modale -------------------------------------------------------------- */
dialog {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
  max-width: min(92vw, 640px);
  width: 100%;
}
dialog::backdrop { background: rgba(3, 6, 12, .7); backdrop-filter: blur(2px); }
.dialog-body { padding: 1.1rem; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.dialog-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.1rem; border-top: 1px solid var(--line); }

/* --- Toasts -------------------------------------------------------------- */
.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  z-index: 60;
  pointer-events: none;
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: .6rem .8rem;
  font-size: .86rem;
  box-shadow: var(--shadow);
  animation: toast-in .18s ease;
  max-width: 22rem;
}
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* --- QR ------------------------------------------------------------------ */
.qr-card { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; }
.qr-frame { background: #fff; padding: .5rem; border-radius: var(--radius-sm); line-height: 0; }
.qr-frame svg, .qr-frame img { width: 100%; height: auto; display: block; }
.qr-link { font-family: var(--mono); font-size: .75rem; word-break: break-all; color: var(--muted); }

.kbd {
  font-family: var(--mono);
  font-size: .72rem;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: .05rem .3rem;
  background: var(--panel-2);
  color: var(--muted);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
