/* ============================================================================
   PlayNekst — shared design system
   Dark, calm, high-contrast. Used by every page (login, dashboards, tablet,
   mobile). Tokens first, then components. No external font/CDN dependencies so
   it works offline on club tablets.
   ========================================================================== */

:root {
  /* Brand / surfaces */
  --bg: #050816;
  --bg-2: #0b1120;
  --bg-grad: radial-gradient(circle at 18% -10%, #16223f, transparent 55%),
             radial-gradient(circle at 100% 0%, rgba(168, 85, 247, 0.10), transparent 45%),
             linear-gradient(135deg, #050816, #0b1120 60%);
  --panel: rgba(15, 23, 42, 0.92);
  --panel-2: rgba(15, 23, 42, 0.6);
  --card-border: rgba(148, 163, 184, 0.22);
  --hairline: rgba(148, 163, 184, 0.14);

  /* Accent */
  --primary: #38bdf8;
  --primary-strong: #0ea5e9;
  --primary-soft: rgba(56, 189, 248, 0.15);
  --accent: #a855f7;

  /* Status */
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.18);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.16);
  --danger: #f97373;
  --danger-strong: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.15);

  /* Text */
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  /* Geometry */
  --radius: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.4);
  --ring: 0 0 0 2px rgba(56, 189, 248, 0.55);

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;

  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body { background: var(--bg-grad); background-attachment: fixed; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.15; }
p { margin: 0; }

/* ---- Brand ---------------------------------------------------------------- */
.pn-brand { display: flex; align-items: center; gap: 10px; }
.pn-mark {
  width: 38px; height: 38px; flex: 0 0 auto;
  background: url("/icons/mark.svg") center / contain no-repeat;
  filter: drop-shadow(0 3px 10px rgba(56, 189, 248, 0.40));
  /* hide any legacy glyph rendered inside the mark */
  font-size: 0; color: transparent; line-height: 0;
}
.pn-name { font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; font-size: 19px; }
.pn-tagline { font-size: 11px; color: var(--text-muted); letter-spacing: 0.15em; text-transform: uppercase; }

/* ---- Layout --------------------------------------------------------------- */
.pn-shell { width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 18px 40px; }
.pn-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pn-row { display: flex; align-items: center; gap: 10px; }
.pn-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pn-grid { display: grid; gap: 14px; }
.pn-spacer { flex: 1 1 auto; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }

/* ---- Topbar --------------------------------------------------------------- */
.pn-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  background: rgba(5, 8, 22, 0.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}

/* ---- Card ----------------------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card-pad-sm { padding: 14px; }
.card-title { font-size: 16px; font-weight: 700; }
.card-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  padding: 9px 15px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; color: var(--text); background: var(--panel-2);
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease, opacity .12s ease, border-color .12s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-strong)); color: #06121f; box-shadow: 0 10px 22px rgba(56, 189, 248, 0.4); }
.btn-secondary { background: var(--panel); border-color: rgba(148,163,184,0.5); }
.btn-danger { background: var(--danger-soft); border-color: rgba(239,68,68,0.6); color: #fecaca; }
.btn-ghost { background: transparent; border-color: var(--hairline); color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); border-color: rgba(148,163,184,0.5); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 36px; height: 36px; border-radius: 10px; }

/* ---- Forms ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
label, .label { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #cbd5f5; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9); color: var(--text);
  outline: none; font-size: 14px; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--ring); }
.field-hint { font-size: 11px; color: var(--text-muted); }
.field-error { font-size: 12px; color: var(--danger); min-height: 16px; }

/* ---- Badges / pills ------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--hairline); background: rgba(15,23,42,0.9); color: var(--text-muted);
}
.badge-ok { color: #bbf7d0; border-color: rgba(34,197,94,0.55); background: var(--ok-soft); }
.badge-warn { color: #fde68a; border-color: rgba(251,191,36,0.5); background: var(--warn-soft); }
.badge-danger { color: #fecaca; border-color: rgba(239,68,68,0.5); background: var(--danger-soft); }
.badge-info { color: #bae6fd; border-color: rgba(56,189,248,0.5); background: var(--primary-soft); }
.dot { width: 8px; height: 8px; border-radius: var(--radius-pill); background: var(--ok); box-shadow: 0 0 10px rgba(34,197,94,0.8); display: inline-block; }
.dot.off { background: var(--danger); box-shadow: 0 0 10px rgba(248,113,113,0.8); }
.dot.warn { background: var(--warn); box-shadow: 0 0 10px rgba(251,191,36,0.8); }

/* ---- Tables --------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--hairline); }
.table td { padding: 12px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(56, 189, 248, 0.05); }
.table-empty { padding: 28px; text-align: center; color: var(--text-muted); }

/* ---- Toggle switch -------------------------------------------------------- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; border-radius: var(--radius-pill); background: rgba(148,163,184,0.35); transition: .18s; cursor: pointer; }
.switch .track::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .18s; }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::before { transform: translateX(20px); }
.switch input:disabled + .track { opacity: .5; cursor: not-allowed; }

/* ---- Stat tiles ----------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 16px; }
.stat-value { font-size: 26px; font-weight: 800; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-top: 2px; }

/* ---- Modal ---------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 16, 0.72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 60; }
.modal-backdrop[hidden] { display: none; }
.modal { width: 100%; max-width: 440px; background: var(--bg-2); border: 1px solid var(--card-border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.modal-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ---- Toast ---------------------------------------------------------------- */
.toast-host { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; align-items: center; }
.toast { padding: 10px 16px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-sm); border: 1px solid var(--hairline); background: var(--bg-2); color: var(--text); animation: toast-in .18s ease; }
.toast.ok { border-color: rgba(34,197,94,0.55); color: #bbf7d0; }
.toast.err { border-color: rgba(239,68,68,0.55); color: #fecaca; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- Utility -------------------------------------------------------------- */
.hidden, [hidden] { display: none !important; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(148,163,184,0.3); border-top-color: var(--primary); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, rgba(148,163,184,.08), rgba(148,163,184,.18), rgba(148,163,184,.08)); background-size: 200% 100%; animation: sk 1.2s ease infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---- Premium polish (The Control Room) ----------------------------------- */
/* Keyboard focus: the single place sky-blue glows. */
.btn:focus-visible, a:focus-visible, [role="button"]:focus-visible, select:focus-visible,
.table tbody tr:focus-visible, .switch input:focus-visible + .track {
  outline: none; box-shadow: var(--ring);
}
.btn-primary:focus-visible { box-shadow: var(--ring), 0 10px 22px rgba(56,189,248,.4); }

/* Tabular figures so timers and counts don't jitter. */
.mono, .stat-value, .timer, .big-timer, .ds-timer-clock { font-variant-numeric: tabular-nums; }

/* Intentional, eased motion on state changes. */
.btn { transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out); }
.card, .stat { transition: border-color var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out); }
.table tbody tr { transition: background-color var(--dur-1) var(--ease-out); }
.switch .track, .switch .track::before { transition: var(--dur-2) var(--ease-out); }
input, select, textarea { transition: border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out); }

/* Crisper glass on the sticky topbar. */
.pn-topbar { background: rgba(5,8,22,0.72); backdrop-filter: saturate(140%) blur(14px); }

/* Reduced motion: drop animation, keep the UI fully visible. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}
