/* ==========================================================================
   NOFAIL · Composants partagés (landing + app)
   Boutons, logo, badges, fenêtres (cartes), champs, toasts, modales.
   ========================================================================== */

/* ---------- Logo : le « O » en cible, « FAIL » barré au surligneur ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--fg);
  white-space: nowrap;
}
.logo__target {
  width: .78em; height: .78em;
  border-radius: 50%;
  border: .14em solid currentColor;
  display: inline-grid;
  place-items: center;
  margin-inline: .04em;
}
.logo__target::after {
  content: "";
  width: .22em; height: .22em;
  border-radius: 50%;
  background: var(--c-signal);
}
.logo__fail { position: relative; }
.logo__fail::after {
  content: "";
  position: absolute;
  left: -2%; top: 52%;
  height: .2em;
  width: 104%;
  background: var(--c-signal);
  transform-origin: left center;
  transform: scaleX(0) translateY(-50%);
  animation: strike .7s .35s var(--ease) forwards;
  mix-blend-mode: normal;
  opacity: .9;
}
@keyframes strike { to { transform: scaleX(1) translateY(-50%); } }

/* ---------- Boutons ---------- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--fg);
  --btn-border: var(--line);
  --btn-shadow: var(--highlight);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 16px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-s);
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: var(--btn-shadow);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .2s, background .2s, filter .2s;
  white-space: nowrap;
}
.btn:hover { --btn-border: var(--line-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* Reflet qui balaie le bouton au survol */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .22) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .7s var(--ease-out);
  pointer-events: none;
}
.btn:hover::after { transform: translateX(120%); }

.btn--primary {
  --btn-bg: linear-gradient(180deg, #3A7FFF, var(--c-signal));
  --btn-fg: var(--c-on-signal);
  --btn-border: rgba(255, 255, 255, .18);
  --btn-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 20px -6px rgba(31, 107, 255, .7);
}
.btn--primary:hover { --btn-border: rgba(255, 255, 255, .3); --btn-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 10px 30px -6px rgba(31, 107, 255, .85); }
.btn--ai {
  --btn-bg: linear-gradient(180deg, #5CCBFA, var(--c-ai));
  --btn-fg: var(--c-on-ai);
  --btn-border: rgba(255, 255, 255, .2);
  --btn-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 20px -6px rgba(56, 189, 248, .6);
}
:root[data-theme="light"] .btn--ai { --btn-bg: var(--c-ai); }
.btn--ai:hover { --btn-border: rgba(255, 255, 255, .35); }
.btn--ghost { --btn-bg: transparent; --btn-shadow: none; }
.btn--ghost:hover { --btn-bg: var(--surface-2); }
.btn--ghost::after { display: none; }
.btn--lg { padding: 14px 22px; font-size: 15px; border-radius: var(--radius-m); }
.btn--sm { padding: 6px 11px; font-size: 13px; }
.btn--icon { padding: 8px; width: 36px; height: 36px; }

/* ---------- Badges / pastilles ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--fg-muted);
  white-space: nowrap;
}
.badge--signal { border-color: rgba(31, 107, 255, .45); color: var(--fg); background: var(--signal-soft); }
.badge--ai { border-color: rgba(56, 189, 248, .4); color: var(--c-ai); background: var(--ai-soft); }
.badge--alert { border-color: rgba(255, 90, 31, .45); color: var(--c-alert); background: var(--alert-soft); }
.badge__dot { position: relative; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* Point « en direct » qui pulse */
.badge__dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: dot-ping 1.8s var(--ease-out) infinite; }
@keyframes dot-ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  color: var(--fg-muted);
  background: var(--surface-2);
}

/* ---------- Fenêtres / cartes ----------
   Fond dégradé discret, reflet en haut, bordure fine, ombre douce.
   Le halo qui suit la souris vient de js/ui/effects.js (variables --mx / --my). */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--highlight), var(--shadow-soft);
  padding: var(--space-5);
}
.card--hard {
  transition: border-color .3s var(--ease-out), transform .4s var(--ease-out), box-shadow .4s var(--ease-out);
}
.card--hard:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: var(--highlight), var(--shadow-pop); }
.card--ai {
  border-color: rgba(56, 189, 248, .35);
  background: linear-gradient(var(--ai-soft), var(--ai-soft)), var(--surface);
}

/* Halo lumineux sous le curseur (cartes marquées data-spotlight) */
[data-spotlight] { position: relative; }
[data-spotlight]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -200px), var(--spot), transparent 45%);
  opacity: 0;
  transition: opacity .35s var(--ease-out);
  pointer-events: none;
}
[data-spotlight]:hover::before { opacity: 1; }

/* ---------- Champs ---------- */
.field { display: grid; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--fg-muted); }
.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  transition: border-color .2s, box-shadow .2s;
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--line-strong); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--signal-soft); }
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.textarea--ai { border-color: rgba(56, 189, 248, .4); background: var(--ai-soft); }
.textarea--ai:focus { border-color: var(--c-ai); box-shadow: 0 0 0 4px var(--ai-soft); }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  left: var(--space-4);
  display: grid;
  justify-items: end;
  gap: var(--space-2);
  z-index: 100;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: 380px;
  padding: 12px 14px 12px 16px;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-m);
  box-shadow: var(--highlight), var(--shadow-pop);
  font-size: 14px;
  animation: toast-in .45s var(--ease-out);
}
.toast--success { border-color: rgba(31, 107, 255, .5); box-shadow: var(--highlight), var(--glow-signal); }
.toast--ai { border-color: rgba(56, 189, 248, .5); box-shadow: var(--highlight), var(--glow-ai); }
.toast--alert { border-color: rgba(255, 90, 31, .55); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); filter: blur(4px); } }

/* ---------- Modales ---------- */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: start center;
  padding: 10vh var(--space-4) var(--space-4);
  background: var(--overlay);
  backdrop-filter: blur(8px);
  z-index: 90;
  animation: fade-in .25s var(--ease-out);
}
.modal[hidden] { display: none; }
.modal__panel {
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--highlight), var(--shadow-pop);
  animation: panel-in .45s var(--ease-out);
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(16px) scale(.97); filter: blur(6px); } }
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
}
.modal__body { padding: var(--space-5); display: grid; gap: var(--space-4); }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line);
}

/* ---------- Divers ---------- */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.theme-toggle { font-family: var(--font-mono); font-size: 12px; }
