/* =============================================================================
   Playground — identité visuelle Transform
   Reprend les tokens de pulsaride-ui/src/theme.js pour que les deux surfaces
   se ressemblent : un prospect passe de l'une à l'autre pendant la même
   démonstration. L'ancienne palette ardoise (#38bdf8, #94a3b8, #475569) était
   celle d'avant le rebranding, que DESIGN_LANGUAGE.md demande d'abandonner.
   ========================================================================== */

:root {
  --bg:          #060812;
  --bg-elevated: #0A0E1C;
  --surface:     rgba(16, 20, 41, 0.55);
  --surface-2:   #161B33;
  --border:      rgba(148, 163, 253, 0.14);
  --border-soft: rgba(148, 163, 253, 0.08);

  --indigo: #4F5BFF;
  --blue:   #2E8BFF;
  --cyan:   #22D3EE;
  --violet: #8B7CFF;

  --text:     #EAEDFB;
  --text-dim: #B7BEDD;
  --muted:    #8890B5;
  --muted-2:  #5C6389;

  --danger:  #F87171;
  --success: #34D399;

  --grad-brand: linear-gradient(135deg, var(--indigo) 0%, var(--blue) 45%, var(--cyan) 100%);
  --grad-text:  linear-gradient(120deg, #A9B4FF 0%, #6DD8FF 50%, #8B7CFF 100%);

  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-pill: 999px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(79, 91, 255, 0.16), transparent 60%),
    radial-gradient(760px 460px at 92% 8%, rgba(34, 211, 238, 0.10), transparent 62%),
    var(--bg);
  padding: 32px clamp(16px, 4vw, 48px) 56px;
}

/* ── En-tête ──────────────────────────────────────────────────────────────── */

.hero { max-width: 1400px; margin: 0 auto 34px; }

.brand { display: flex; align-items: center; gap: 9px; margin-bottom: 24px; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.brand-sep  { color: var(--muted-2); }
.brand-sub  { font-family: var(--font-mono); font-size: 12px; color: var(--cyan); letter-spacing: 0.08em; text-transform: uppercase; }
.mark-particle { filter: drop-shadow(0 0 4px rgba(234, 237, 251, 0.8)); }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  max-width: 760px;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle { color: var(--text-dim); font-size: 15.5px; line-height: 1.65; max-width: 700px; margin: 0; }
.subtitle b { color: var(--text); font-weight: 600; }

.hero-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.status-msg { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }

/* ── Panneaux ─────────────────────────────────────────────────────────────── */

.grid {
  max-width: 1400px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 20px;
}

.panel {
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 24px 24px;
  box-shadow: 0 18px 46px -22px rgba(0, 0, 0, 0.9);
}
/* Une fine barre colorée distingue la source de la cible d'un coup d'œil. */
.panel-source { border-top: 2px solid var(--indigo); }
.panel-target { border-top: 2px solid var(--cyan); }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.panel-title { display: flex; align-items: center; gap: 10px; }
.panel-head h2 { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }

.panel-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-source { background: var(--indigo); box-shadow: 0 0 10px rgba(79, 91, 255, 0.7); }
.dot-target { background: var(--cyan);   box-shadow: 0 0 10px rgba(34, 211, 238, 0.7); }

/* Le point de la cible pulse : elle vit, elle se met à jour toute seule. */
.live-dot { animation: pg-pulse 2.2s ease-in-out infinite; }
@keyframes pg-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.82); }
}

.panel-tag {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); padding: 3px 9px; border-radius: var(--r-pill);
  background: rgba(148, 163, 253, 0.08); border: 1px solid var(--border-soft);
}

.badge {
  display: inline-block; font-family: var(--font-mono); font-size: 11.5px;
  color: var(--cyan); padding: 5px 11px; border-radius: var(--r-pill);
  background: rgba(34, 211, 238, 0.10); border: 1px solid rgba(34, 211, 238, 0.22);
  margin-bottom: 14px;
}

/* ── Sélecteurs ───────────────────────────────────────────────────────────── */

select {
  font-family: var(--font-body); font-size: 13.5px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 8px 12px; cursor: pointer;
}
select:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* ── Tableaux ─────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto; border: 1px solid var(--border-soft);
  border-radius: var(--r-md); background: rgba(6, 8, 18, 0.4);
}

table { border-collapse: collapse; width: 100%; font-size: 13px; }

th {
  text-align: left; font-family: var(--font-display); font-weight: 600;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); padding: 11px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  background: rgba(22, 27, 51, 0.6);
}

td {
  padding: 10px 14px; border-bottom: 1px solid var(--border-soft);
  color: var(--text-dim); font-family: var(--font-mono); font-size: 12.5px;
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 140ms ease; }
tbody tr:hover { background: rgba(79, 91, 255, 0.07); }

.empty { padding: 26px 16px; text-align: center; color: var(--muted-2); font-size: 13.5px; }

/* ── Formulaire ───────────────────────────────────────────────────────────── */

.row-form {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border-soft);
}

.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}

input {
  font-family: var(--font-mono); font-size: 13px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 11px; min-width: 132px;
}
input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
input::placeholder { color: var(--muted-2); }

/* ── Boutons ──────────────────────────────────────────────────────────────── */

.btn {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  padding: 9px 16px; border-radius: var(--r-md); border: 1px solid transparent;
  cursor: pointer; color: var(--text); background: var(--grad-brand);
  transition: transform 120ms ease, opacity 120ms ease;
}
.btn:hover  { transform: translateY(-1px); opacity: 0.94; }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.btn-ghost {
  background: rgba(148, 163, 253, 0.08); border-color: var(--border); color: var(--text-dim);
}
.btn-ghost:hover { background: rgba(148, 163, 253, 0.14); color: var(--text); }

.btn-insert { background: var(--grad-brand); }
.btn-save   { background: linear-gradient(135deg, var(--violet) 0%, var(--blue) 100%); }

.btn-danger {
  background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.30); color: var(--danger);
  padding: 6px 12px; font-size: 12px;
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.20); }

/* Les actions par ligne restent discrètes : le tableau prime sur ses boutons. */
td .btn { padding: 5px 11px; font-size: 11.5px; margin-right: 6px; }

.error { color: var(--danger); font-family: var(--font-mono); font-size: 12.5px; margin-top: 12px; }

/* ── Pied de page ─────────────────────────────────────────────────────────── */

.foot {
  max-width: 1400px; margin: 44px auto 0; padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted-2); font-size: 12.5px; line-height: 1.7;
}
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--cyan); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Porte d'accès ────────────────────────────────────────────────────────────
   Affichee quand l'API repond 401. Sans elle la page restait vide et muette :
   un visiteur en concluait que l'environnement etait casse. */

.token-gate {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(6, 8, 18, 0.86);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}

.token-gate-card {
  max-width: 480px; width: 100%; padding: 32px 34px;
  background: var(--surface); border: 1px solid var(--border);
  border-top: 2px solid var(--cyan); border-radius: var(--r-lg);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.95);
}

.token-gate-label {
  display: inline-block; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--cyan);
  padding: 4px 10px; border-radius: var(--r-pill);
  background: rgba(34, 211, 238, 0.10); border: 1px solid rgba(34, 211, 238, 0.22);
  margin-bottom: 16px;
}

.token-gate-card h2 {
  font-family: var(--font-display); font-size: 21px; font-weight: 600;
  letter-spacing: -0.01em; margin: 0 0 10px;
}

.token-gate-card p { color: var(--text-dim); font-size: 14px; line-height: 1.65; margin: 0 0 20px; }

.token-gate-form { display: flex; gap: 10px; flex-wrap: wrap; }
.token-gate-form input { flex: 1 1 220px; min-width: 0; }

.token-gate-foot { font-size: 12.5px; color: var(--muted-2); margin: 18px 0 0 !important; }
.token-gate-foot a { color: var(--muted); text-decoration: none; }
.token-gate-foot a:hover { color: var(--cyan); }
