/* ScaTube design system: tokens and components shared by every ScaTube page
   and the moderation admin. Page layouts live in scatube-app.css.

   Rules of the system
   - One accent (brand pink) for the primary action and the active state only.
   - Flat surfaces in three steps; elevation only for menus, modals and toasts.
   - Radii: 4 px small parts, 8 px controls and thumbnails, 12 px panels.
   - Icons are the SVG sprite in core/scatube_ui.php (24 px grid, 1.75 stroke). No emoji. */

:root {
  color-scheme: dark;

  --st-bg: #0d090d;
  --st-surface-1: #170f16;
  --st-surface-2: #1f141d;
  --st-surface-3: #2a1b27;
  --st-surface-hover: #33202f;
  --st-line: rgba(255, 140, 210, .11);
  --st-line-strong: rgba(255, 140, 210, .19);

  --st-text: #fff2fa;
  --st-text-2: #c4b7c0;
  --st-text-3: #9d8a98;
  --st-text-on-accent: #fff;

  --st-accent: #ff24b8;
  --st-accent-hover: #ff4cc6;
  --st-accent-press: #e0129f;
  --st-accent-text: #ff8cdb;
  --st-accent-tint: rgba(255, 36, 184, .14);
  --st-gold: #ffd84a;
  --st-gold-tint: rgba(255, 216, 74, .12);

  --st-success: #3fcf8e;
  --st-success-tint: rgba(63, 207, 142, .12);
  --st-warning: #f3a83b;
  --st-warning-tint: rgba(243, 168, 59, .13);
  --st-danger: #ff5a6a;
  --st-danger-tint: rgba(255, 90, 106, .12);
  --st-info: #62a8ff;
  --st-info-tint: rgba(98, 168, 255, .12);
  --st-violet: #b48cff;
  --st-violet-tint: rgba(180, 140, 255, .13);

  --st-font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --st-font-display: "Bebas Neue", Impact, "Arial Narrow", sans-serif;
  --st-text-xs: 12px;
  --st-text-sm: 13px;
  --st-text-md: 14px;
  --st-text-lg: 16px;
  --st-text-xl: 18px;
  --st-text-2xl: 22px;
  --st-text-3xl: 28px;

  --st-space-1: 4px;
  --st-space-2: 8px;
  --st-space-3: 12px;
  --st-space-4: 16px;
  --st-space-5: 20px;
  --st-space-6: 24px;
  --st-space-8: 32px;
  --st-space-10: 40px;

  --st-radius-sm: 4px;
  --st-radius: 8px;
  --st-radius-lg: 12px;
  --st-radius-pill: 999px;

  --st-shadow-pop: 0 10px 30px rgba(0, 0, 0, .55), 0 0 0 1px var(--st-line-strong);
  --st-ease: cubic-bezier(.2, .7, .2, 1);
  --st-fast: 120ms;
  --st-base: 200ms;
  --st-focus: 0 0 0 2px var(--st-bg), 0 0 0 4px rgba(255, 140, 219, .8);

  --st-header-h: 60px;
  --st-sidebar-w: 232px;
}

/* ── Base ─────────────────────────────────────────────────── */
.st-body {
  margin: 0;
  background: var(--st-bg);
  color: var(--st-text);
  font: 400 var(--st-text-md)/1.5 var(--st-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.st-body *, .st-body *::before, .st-body *::after { box-sizing: border-box; }
.st-body a { color: inherit; text-decoration: none; }
.st-body button, .st-body input, .st-body select, .st-body textarea { font: inherit; color: inherit; }
.st-body img, .st-body video { max-width: 100%; }
.st-body :focus-visible { outline: none; box-shadow: var(--st-focus); border-radius: var(--st-radius-sm); }
.st-body ::selection { background: rgba(255, 36, 184, .35); }
.st-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Icons ────────────────────────────────────────────────── */
.st-ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.st-ico--sm { width: 16px; height: 16px; }
.st-ico--lg { width: 24px; height: 24px; }
.st-ico--fill { fill: currentColor; stroke: none; }

/* ── Buttons ──────────────────────────────────────────────── */
.st-btn {
  --btn-bg: var(--st-surface-3);
  --btn-bg-hover: var(--st-surface-hover);
  --btn-fg: var(--st-text);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--st-space-2);
  min-height: 36px; padding: 0 var(--st-space-4);
  border: 1px solid transparent; border-radius: var(--st-radius);
  background: var(--btn-bg); color: var(--btn-fg);
  font: 600 var(--st-text-md)/1 var(--st-font); white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background var(--st-fast) var(--st-ease), border-color var(--st-fast) var(--st-ease), color var(--st-fast) var(--st-ease), transform var(--st-fast) var(--st-ease);
}
.st-btn:hover { background: var(--btn-bg-hover); }
.st-btn:active { transform: translateY(1px); }
.st-btn[disabled], .st-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.st-btn--primary { --btn-bg: var(--st-accent); --btn-bg-hover: var(--st-accent-hover); --btn-fg: var(--st-text-on-accent); }
.st-btn--primary:active { background: var(--st-accent-press); }
.st-btn--secondary { --btn-bg: transparent; --btn-bg-hover: var(--st-surface-3); border-color: var(--st-line-strong); }
.st-btn--ghost { --btn-bg: transparent; --btn-bg-hover: var(--st-surface-3); --btn-fg: var(--st-text-2); }
.st-btn--ghost:hover { color: var(--st-text); }
.st-btn--success { --btn-bg: var(--st-success); --btn-bg-hover: #5ad9a0; --btn-fg: #07140e; }
.st-btn--danger { --btn-bg: transparent; --btn-bg-hover: var(--st-danger-tint); --btn-fg: var(--st-danger); border-color: rgba(255, 90, 106, .4); }
.st-btn--sm { min-height: 30px; padding: 0 var(--st-space-3); font-size: var(--st-text-sm); border-radius: 6px; }
.st-btn--lg { min-height: 44px; padding: 0 var(--st-space-5); font-size: var(--st-text-lg); }
.st-btn--block { width: 100%; }
.st-icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 0; border-radius: var(--st-radius-pill); background: transparent; color: var(--st-text-2);
  cursor: pointer; transition: background var(--st-fast) var(--st-ease), color var(--st-fast) var(--st-ease);
}
.st-icon-btn:hover { background: var(--st-surface-3); color: var(--st-text); }
.st-icon-btn--sm { width: 32px; height: 32px; }
.st-icon-btn[aria-pressed="true"] { color: var(--st-accent-text); }

/* ── Chips (category and filter pills) ────────────────────── */
.st-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 var(--st-space-3);
  border: 1px solid var(--st-line); border-radius: var(--st-radius);
  background: var(--st-surface-2); color: var(--st-text-2);
  font: 600 var(--st-text-sm)/1 var(--st-font); white-space: nowrap; cursor: pointer;
  transition: background var(--st-fast) var(--st-ease), color var(--st-fast) var(--st-ease), border-color var(--st-fast) var(--st-ease);
}
.st-chip:hover { background: var(--st-surface-3); color: var(--st-text); }
.st-chip .st-ico { width: 16px; height: 16px; }
.st-chip.is-active, .st-chip[aria-pressed="true"], .st-chip[aria-selected="true"] { background: var(--st-text); border-color: var(--st-text); color: var(--st-bg); }
.st-chip--gold.is-active, .st-chip--gold[aria-pressed="true"] { background: var(--st-gold); border-color: var(--st-gold); color: #1d1300; }

/* ── Badges and status ────────────────────────────────────── */
.st-badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
  border-radius: var(--st-radius-sm); background: var(--st-surface-3); color: var(--st-text-2);
  font: 700 11px/1 var(--st-font); letter-spacing: .02em; white-space: nowrap;
}
.st-badge .st-ico { width: 12px; height: 12px; stroke-width: 2.2; }
.st-badge--accent { background: var(--st-accent-tint); color: var(--st-accent-text); }
.st-badge--gold { background: var(--st-gold-tint); color: var(--st-gold); }
.st-badge--success { background: var(--st-success-tint); color: var(--st-success); }
.st-badge--warning { background: var(--st-warning-tint); color: var(--st-warning); }
.st-badge--danger { background: var(--st-danger-tint); color: var(--st-danger); }
.st-badge--info { background: var(--st-info-tint); color: var(--st-info); }
.st-badge--violet { background: var(--st-violet-tint); color: var(--st-violet); }
.st-duration {
  position: absolute; right: 6px; bottom: 6px; padding: 2px 5px; border-radius: var(--st-radius-sm);
  background: rgba(0, 0, 0, .82); color: #fff; font: 600 12px/1.2 var(--st-font); font-variant-numeric: tabular-nums;
}
.st-verified { display: inline-block; width: 14px; height: 14px; margin-left: 3px; vertical-align: -2px; color: var(--st-text-3); }

/* ── Forms ────────────────────────────────────────────────── */
.st-field { display: grid; gap: 6px; margin-bottom: var(--st-space-4); }
.st-label { color: var(--st-text-2); font: 600 var(--st-text-sm)/1.3 var(--st-font); }
.st-hint { color: var(--st-text-3); font-size: var(--st-text-xs); }
.st-input, .st-select, .st-textarea {
  width: 100%; min-height: 40px; padding: 9px var(--st-space-3);
  border: 1px solid var(--st-line-strong); border-radius: var(--st-radius);
  background: var(--st-surface-1); color: var(--st-text); font-size: var(--st-text-md);
  transition: border-color var(--st-fast) var(--st-ease), background var(--st-fast) var(--st-ease);
}
.st-input::placeholder, .st-textarea::placeholder { color: var(--st-text-3); }
.st-input:hover, .st-select:hover, .st-textarea:hover { border-color: rgba(255, 255, 255, .22); }
.st-input:focus, .st-select:focus, .st-textarea:focus { outline: none; border-color: var(--st-accent-text); background: var(--st-bg); box-shadow: none; }
.st-textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.st-select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b7aebb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.st-select option { background: var(--st-surface-2); color: var(--st-text); }
.st-check { display: inline-flex; align-items: center; gap: var(--st-space-2); cursor: pointer; color: var(--st-text-2); font-size: var(--st-text-sm); }
.st-check input { width: 16px; height: 16px; accent-color: var(--st-accent); }
.st-error-text { color: var(--st-danger); font-size: var(--st-text-sm); }

/* ── Panels, menus, modals, toasts ────────────────────────── */
.st-panel { border: 1px solid var(--st-line); border-radius: var(--st-radius-lg); background: var(--st-surface-1); }
.st-menu {
  position: absolute; z-index: 60; min-width: 200px; padding: 6px;
  border-radius: var(--st-radius-lg); background: var(--st-surface-2); box-shadow: var(--st-shadow-pop);
  animation: st-pop var(--st-fast) var(--st-ease);
}
.st-menu[hidden] { display: none; }
.st-menu-item {
  display: flex; align-items: center; gap: var(--st-space-3); width: 100%; min-height: 36px; padding: 0 var(--st-space-3);
  border: 0; border-radius: 6px; background: none; color: var(--st-text); font-size: var(--st-text-md); text-align: left; cursor: pointer;
}
.st-menu-item:hover, .st-menu-item:focus-visible { background: var(--st-surface-hover); box-shadow: none; }
.st-menu-item .st-ico { color: var(--st-text-2); }
.st-menu-item--danger, .st-menu-item--danger .st-ico { color: var(--st-danger); }
.st-menu-sep { height: 1px; margin: 6px 0; background: var(--st-line); }

.st-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: var(--st-space-4); background: rgba(5, 4, 6, .72); }
.st-modal[hidden] { display: none; }
.st-dialog {
  position: relative; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  border: 1px solid var(--st-line-strong); border-radius: var(--st-radius-lg); background: var(--st-surface-1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6); animation: st-rise var(--st-base) var(--st-ease);
}
.st-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: var(--st-space-3); padding: var(--st-space-4) var(--st-space-5); border-bottom: 1px solid var(--st-line); }
.st-dialog__title { margin: 0; font: 700 var(--st-text-xl)/1.25 var(--st-font); }
.st-dialog__body { padding: var(--st-space-5); }
.st-dialog__foot { display: flex; justify-content: flex-end; gap: var(--st-space-2); padding: var(--st-space-4) var(--st-space-5); border-top: 1px solid var(--st-line); }

.st-toast-region { position: fixed; left: 50%; bottom: 24px; z-index: 300; display: grid; gap: 8px; transform: translateX(-50%); width: min(440px, calc(100% - 32px)); }
.st-toast {
  display: flex; align-items: flex-start; gap: var(--st-space-3); padding: var(--st-space-3) var(--st-space-4);
  border-radius: var(--st-radius); background: var(--st-surface-3); box-shadow: var(--st-shadow-pop);
  color: var(--st-text); font-size: var(--st-text-md); animation: st-rise var(--st-base) var(--st-ease);
}
.st-toast .st-ico { margin-top: 1px; }
.st-toast--success .st-ico { color: var(--st-success); }
.st-toast--error .st-ico { color: var(--st-danger); }

.st-alert { display: flex; gap: var(--st-space-3); padding: var(--st-space-3) var(--st-space-4); border-radius: var(--st-radius); background: var(--st-surface-2); color: var(--st-text-2); font-size: var(--st-text-sm); line-height: 1.45; }
.st-alert strong { color: var(--st-text); }
.st-alert .st-ico { margin-top: 1px; }
.st-alert--info { background: var(--st-info-tint); } .st-alert--info .st-ico { color: var(--st-info); }
.st-alert--warning { background: var(--st-warning-tint); } .st-alert--warning .st-ico { color: var(--st-warning); }
.st-alert--danger { background: var(--st-danger-tint); } .st-alert--danger .st-ico { color: var(--st-danger); }
.st-alert--success { background: var(--st-success-tint); } .st-alert--success .st-ico { color: var(--st-success); }

/* ── Progress ─────────────────────────────────────────────── */
.st-progress { height: 6px; overflow: hidden; border-radius: var(--st-radius-pill); background: var(--st-surface-3); }
.st-progress__bar { height: 100%; width: 0; border-radius: inherit; background: var(--st-accent); transition: width var(--st-base) linear; }
.st-progress--indeterminate .st-progress__bar { width: 35%; animation: st-indeterminate 1.3s var(--st-ease) infinite; }
.st-spinner { width: 18px; height: 18px; border: 2px solid var(--st-line-strong); border-top-color: var(--st-text); border-radius: 50%; animation: st-spin .8s linear infinite; }

/* ── Tabs ─────────────────────────────────────────────────── */
.st-tabs { display: flex; gap: var(--st-space-1); border-bottom: 1px solid var(--st-line); overflow-x: auto; scrollbar-width: none; }
.st-tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 var(--st-space-4);
  border: 0; background: none; color: var(--st-text-2); font: 600 var(--st-text-md)/1 var(--st-font); white-space: nowrap; cursor: pointer;
}
.st-tab:hover { color: var(--st-text); }
.st-tab.is-active, .st-tab[aria-selected="true"] { color: var(--st-text); }
.st-tab.is-active::after, .st-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--st-text); }
.st-count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 5px; border-radius: var(--st-radius-pill); background: var(--st-surface-3); color: var(--st-text-2); font: 700 11px/1 var(--st-font); }
.st-count--alert { background: var(--st-accent); color: #fff; }

/* ── Avatars ──────────────────────────────────────────────── */
.st-avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; object-fit: cover; background: var(--st-surface-3); }
.st-avatar--sm { width: 24px; height: 24px; }
.st-avatar--lg { width: 48px; height: 48px; }

/* ── Skeleton loading ─────────────────────────────────────── */
.st-skel { position: relative; overflow: hidden; border-radius: var(--st-radius); background: var(--st-surface-2); }
.st-skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .045), transparent); animation: st-shimmer 1.4s infinite; }
.st-skel--line { height: 12px; margin-top: 8px; border-radius: var(--st-radius-sm); }

/* ── Vote control (like / dislike) ────────────────────────── */
.st-vote { display: inline-flex; align-items: stretch; height: 36px; border-radius: var(--st-radius-pill); background: var(--st-surface-3); }
.st-vote__btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 0 14px; border: 0; background: none; color: var(--st-text);
  font: 600 var(--st-text-md)/1 var(--st-font); font-variant-numeric: tabular-nums; cursor: pointer;
  transition: background var(--st-fast) var(--st-ease), color var(--st-fast) var(--st-ease);
}
.st-vote__btn:first-child { border-radius: var(--st-radius-pill) 0 0 var(--st-radius-pill); padding-left: 16px; }
.st-vote__btn:last-child { border-radius: 0 var(--st-radius-pill) var(--st-radius-pill) 0; padding-right: 16px; }
.st-vote__btn + .st-vote__btn { border-left: 1px solid var(--st-line-strong); }
.st-vote__btn:hover { background: var(--st-surface-hover); }
.st-vote__btn .st-ico { transition: transform var(--st-base) var(--st-ease); }
.st-vote__btn:active .st-ico { transform: scale(.86); }
.st-vote__btn.is-on .st-ico, .st-vote__btn[aria-pressed="true"] .st-ico { fill: currentColor; }
.st-vote__btn.is-on[data-vote="like"], .st-vote__btn[aria-pressed="true"][data-vote="like"] { color: var(--st-accent-text); }
.st-vote__btn.is-pop .st-ico { animation: st-vote-pop 360ms var(--st-ease); }
.st-vote__ratio { height: 2px; margin: 6px 14px 0; border-radius: 2px; background: var(--st-surface-3); overflow: hidden; }
.st-vote__ratio > span { display: block; height: 100%; background: var(--st-text-2); }

/* ── Tables (admin) ───────────────────────────────────────── */
.st-table { width: 100%; border-collapse: collapse; font-size: var(--st-text-sm); }
.st-table th { padding: 10px 12px; border-bottom: 1px solid var(--st-line); color: var(--st-text-3); font: 600 var(--st-text-xs)/1.2 var(--st-font); text-align: left; text-transform: uppercase; letter-spacing: .06em; }
.st-table td { padding: 12px; border-bottom: 1px solid var(--st-line); vertical-align: top; }
.st-table tr:hover td { background: rgba(255, 255, 255, .015); }

/* ── Empty state ──────────────────────────────────────────── */
.st-empty { display: grid; justify-items: center; gap: var(--st-space-2); padding: var(--st-space-10) var(--st-space-4); color: var(--st-text-3); text-align: center; }
.st-empty .st-ico { width: 32px; height: 32px; stroke-width: 1.5; }
.st-empty strong { color: var(--st-text-2); font-size: var(--st-text-lg); }

/* ── Motion ───────────────────────────────────────────────── */
@keyframes st-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes st-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes st-spin { to { transform: rotate(360deg); } }
@keyframes st-shimmer { to { transform: translateX(100%); } }
@keyframes st-indeterminate { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@keyframes st-vote-pop { 40% { transform: scale(1.25) rotate(-8deg); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .st-body *, .st-body *::before, .st-body *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
