/* ================================================================
   UGC Video Pro — Design System
   Dark theme, Inter font, Indigo accent (#6366f1)
   ================================================================ */

/* ── Google Fonts ──────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Custom Properties (Design Tokens) ───────────────── */
:root {
  /* Color Palette — Dark Theme */
  --bg-base:        #0d0d0f;
  --bg-surface:     #111115;
  --bg-elevated:    #18181d;
  --bg-overlay:     #1f1f26;
  --bg-hover:       #25252e;
  --bg-active:      #2b2b36;

  /* Border */
  --border-subtle:  rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.10);
  --border-strong:  rgba(255,255,255,0.18);

  /* Text */
  --text-primary:   #f0f0f5;
  --text-secondary: #9898a8;
  --text-muted:     #5e5e6e;
  --text-inverse:   #0d0d0f;

  /* Accent — Indigo */
  --accent:         #6366f1;
  --accent-hover:   #5254cc;
  --accent-light:   rgba(99,102,241,0.15);
  --accent-ring:    rgba(99,102,241,0.35);

  /* Semantic Colors */
  --success:        #22c55e;
  --success-bg:     rgba(34,197,94,0.12);
  --warning:        #f59e0b;
  --warning-bg:     rgba(245,158,11,0.12);
  --danger:         #ef4444;
  --danger-bg:      rgba(239,68,68,0.12);
  --info:           #3b82f6;
  --info-bg:        rgba(59,130,246,0.12);

  /* Typography */
  --font-sans:      'Inter', system-ui, -apple-system, sans-serif;
  --text-xs:        0.75rem;    /* 12px */
  --text-sm:        0.8125rem;  /* 13px */
  --text-base:      0.875rem;   /* 14px */
  --text-md:        1rem;       /* 16px */
  --text-lg:        1.125rem;   /* 18px */
  --text-xl:        1.375rem;   /* 22px */
  --text-2xl:       1.75rem;    /* 28px */

  /* Spacing (4px base) */
  --sp-1:  0.25rem;   /* 4px */
  --sp-2:  0.5rem;    /* 8px */
  --sp-3:  0.75rem;   /* 12px */
  --sp-4:  1rem;      /* 16px */
  --sp-5:  1.25rem;   /* 20px */
  --sp-6:  1.5rem;    /* 24px */
  --sp-8:  2rem;      /* 32px */
  --sp-10: 2.5rem;    /* 40px */
  --sp-12: 3rem;      /* 48px */
  --sp-16: 4rem;      /* 64px */

  /* Border Radius */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.3);
  --shadow-accent: 0 0 0 3px var(--accent-ring);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast:   120ms;
  --t-base:   180ms;
  --t-slow:   280ms;

  /* Layout */
  --sidebar-width: 220px;
  --sidebar-collapsed: 60px;
  --header-height: 56px;
  --content-max: 1200px;
}

/* ── Reset & Base ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--accent-hover); }

img, svg { display: block; }

button { font-family: inherit; cursor: pointer; border: none; background: none; }

input, textarea, select {
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* ── Typography ──────────────────────────────────── */
h1 { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; }
h2 { font-size: var(--text-xl);  font-weight: 600; letter-spacing: -0.3px; line-height: 1.3; }
h3 { font-size: var(--text-lg);  font-weight: 600; letter-spacing: -0.2px; }
h4 { font-size: var(--text-md);  font-weight: 600; }
p  { line-height: 1.6; }

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md   { font-size: var(--text-md); }
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-accent    { color: var(--accent); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }
.text-warning   { color: var(--warning); }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--t-base) var(--ease-out);
  white-space: nowrap;
  user-select: none;
  height: 36px;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(99,102,241,0.3);
}
.btn-primary:hover  { background: var(--accent-hover); box-shadow: 0 2px 8px rgba(99,102,241,0.4); }
.btn-primary:active { background: #4749b8; transform: translateY(1px); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover  { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-secondary:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover  { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.2);
}
.btn-success:hover { background: rgba(34,197,94,0.22); }

.btn-sm { height: 30px; padding: var(--sp-1) var(--sp-3); font-size: var(--text-xs); }
.btn-lg { height: 44px; padding: var(--sp-3) var(--sp-6); font-size: var(--text-base); }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-full { width: 100%; }

/* Loading spinner in button */
.btn .spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Inputs ───────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); }

.form-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}

.form-input::placeholder { color: var(--text-muted); }

.form-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
}

.form-textarea {
  width: 100%;
  padding: var(--sp-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: 1.6;
  resize: vertical;
  min-height: 100px;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}

.form-hint  { font-size: var(--text-xs); color: var(--text-muted); }
.form-error { font-size: var(--text-xs); color: var(--danger); display: none; }
.form-error.visible { display: block; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
}

.card-elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
}

.card-selectable {
  background: var(--bg-elevated);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  cursor: pointer;
  transition: all var(--t-base) var(--ease-out);
  user-select: none;
}

.card-selectable:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.card-selectable.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

.card-selectable.selected .card-check {
  opacity: 1;
  transform: scale(1);
}

.card-check {
  width: 20px; height: 20px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: all var(--t-base) var(--ease-out);
  flex-shrink: 0;
}
.card-check::after {
  content: '';
  width: 6px; height: 10px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-pending  { background: var(--warning-bg); color: var(--warning); }
.badge-processing { background: var(--info-bg);  color: var(--info); }
.badge-completed  { background: var(--success-bg); color: var(--success); }
.badge-failed     { background: var(--danger-bg);  color: var(--danger); }
.badge-admin      { background: var(--accent-light); color: var(--accent); }
.badge-user       { background: var(--bg-hover); color: var(--text-secondary); }

/* Pulse animation for processing */
.badge-processing::before { animation: pulse-dot 1.4s ease-in-out infinite; }

/* ── Tables ─────────────────────────────────────────────── */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

thead th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--t-fast);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody td:first-child { color: var(--text-primary); }

.table-actions { display: flex; gap: var(--sp-2); align-items: center; }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border-subtle); }

.tab-item {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast);
  white-space: nowrap;
  user-select: none;
  margin-bottom: -1px;
}

.tab-item:hover { color: var(--text-secondary); }
.tab-item.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Modals ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(8px) scale(0.98);
  transition: transform var(--t-slow) var(--ease-out);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
}

.modal-title { font-size: var(--text-lg); font-weight: 600; }

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all var(--t-fast);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-footer {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border-subtle);
}

/* ── Toast Notifications ────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: toast-in var(--t-slow) var(--ease-out) forwards;
}

.toast.leaving { animation: toast-out var(--t-slow) var(--ease-out) forwards; }

.toast-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }

.toast-body { flex: 1; }
.toast-title  { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.toast-message { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; }

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info    { border-left: 3px solid var(--info); }

/* ── Auth Pages (Login/Register) ──────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: var(--sp-4);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--sp-8);
  box-shadow: var(--shadow-lg);
  animation: fade-up 0.4s var(--ease-out) both;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-8);
  color: var(--text-primary);
}

.auth-logo img, .auth-logo svg {
  height: 32px;
  width: auto;
}

.auth-title {
  font-size: var(--text-xl);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--sp-2);
}

.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--sp-8);
}

.auth-form { display: flex; flex-direction: column; gap: var(--sp-5); }

.auth-footer {
  text-align: center;
  margin-top: var(--sp-6);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.auth-error {
  padding: var(--sp-3) var(--sp-4);
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--danger);
  display: none;
}
.auth-error.visible { display: block; }

.auth-success {
  padding: var(--sp-3) var(--sp-4);
  background: var(--success-bg);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--success);
  display: none;
}
.auth-success.visible { display: block; }

/* ── App Layout ───────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  transition: width var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow: hidden;
  gap: var(--sp-3);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  color: var(--text-primary);
  gap: var(--sp-3);
  text-decoration: none;
  white-space: nowrap;
}

.sidebar-logo-icon { flex-shrink: 0; width: 28px; height: 28px; }
.sidebar-logo-text {
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  opacity: 1;
  transition: opacity var(--t-base);
}
.sidebar.collapsed .sidebar-logo-text { opacity: 0; }

.sidebar-toggle {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--text-muted);
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-3) var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--sp-3) var(--sp-2) var(--sp-1);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--t-base);
}
.sidebar.collapsed .sidebar-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-item-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item-text {
  opacity: 1;
  transition: opacity var(--t-base);
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar.collapsed .nav-item-text { opacity: 0; }

.sidebar-footer {
  padding: var(--sp-3) var(--sp-2);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--t-slow) var(--ease-out);
  max-width: calc(100vw - var(--sidebar-width));
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
  max-width: calc(100vw - var(--sidebar-collapsed));
}

/* ── Header ───────────────────────────────────────────────── */
.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-base);
  position: sticky;
  top: 0;
  z-index: 40;
  gap: var(--sp-4);
}

.header-left { display: flex; align-items: center; gap: var(--sp-4); }

.hamburger {
  display: none;
  color: var(--text-secondary);
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.hamburger:hover { background: var(--bg-hover); color: var(--text-primary); }

.header-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.header-right { display: flex; align-items: center; gap: var(--sp-3); }

.user-menu {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.user-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

/* ── Page Content ───────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: var(--sp-6);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.page-section { display: none; }
.page-section.active { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.section-title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.3px;
}

.section-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

/* ── Wizard / Stepper ───────────────────────────────────────── */
.wizard-container {
  max-width: 680px;
  margin: 0 auto;
}

.wizard-progress {
  margin-bottom: var(--sp-8);
}

.wizard-steps-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
}

.wizard-step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  flex-shrink: 0;
}

.step-dot-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--t-base) var(--ease-out);
  flex-shrink: 0;
}

.wizard-step-dot.completed .step-dot-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.wizard-step-dot.active .step-dot-circle {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-accent);
}

.step-dot-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.wizard-step-dot.active .step-dot-label   { color: var(--accent); }
.wizard-step-dot.completed .step-dot-label { color: var(--success); }

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--border-default);
  border-radius: 1px;
  margin-top: -14px;
  align-self: flex-start;
  transition: background var(--t-slow);
}
.step-connector.filled { background: var(--accent); }

.wizard-progress-bar-wrap {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.wizard-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: var(--radius-full);
  transition: width var(--t-slow) var(--ease-out);
}

.wizard-step-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--sp-2);
}

.wizard-step-label span { color: var(--accent); font-weight: 600; }

/* Wizard Step Body */
.wizard-body {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  animation: fade-up 0.3s var(--ease-out) both;
}

.wizard-step-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--sp-2);
}

.wizard-step-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--sp-6);
  line-height: 1.6;
}

/* Mode/Model selection grids */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.mode-card {
  background: var(--bg-elevated);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  cursor: pointer;
  transition: all var(--t-base) var(--ease-out);
  text-align: center;
  user-select: none;
}

.mode-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.mode-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 1px var(--accent);
}

.mode-card-icon {
  font-size: 28px;
  margin-bottom: var(--sp-3);
  line-height: 1;
}

.mode-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}

.mode-card-desc {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.4;
}

.model-card {
  background: var(--bg-elevated);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  cursor: pointer;
  transition: all var(--t-base) var(--ease-out);
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.model-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.model-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.model-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.model-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.model-card-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.model-card-clip {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Duration selection */
.duration-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.duration-btn {
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-elevated);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
}

.duration-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.duration-btn.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

.duration-custom-wrap {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

/* Language selection */
.lang-grid {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.lang-btn {
  flex: 1;
  padding: var(--sp-4);
  background: var(--bg-elevated);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-base) var(--ease-out);
  text-align: center;
  user-select: none;
}

.lang-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.lang-btn.selected { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
  cursor: pointer;
  transition: all var(--t-base) var(--ease-out);
  position: relative;
}

.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
  transform: scale(1.01);
}

.upload-zone.has-file {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-bg);
}

.upload-icon { font-size: 32px; margin-bottom: var(--sp-3); }
.upload-title { font-size: var(--text-base); font-weight: 600; margin-bottom: var(--sp-1); }
.upload-desc { font-size: var(--text-xs); color: var(--text-muted); }

.upload-preview {
  margin-top: var(--sp-4);
  display: none;
  position: relative;
}

.upload-preview.visible { display: flex; align-items: center; gap: var(--sp-3); }

.upload-preview img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.upload-file-info { text-align: left; }
.upload-filename { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.upload-filesize { font-size: var(--text-xs); color: var(--text-muted); }

.upload-remove {
  margin-left: auto;
  color: var(--text-muted);
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
}
.upload-remove:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Wizard Summary (Step 6) ──────────────────────────────── */
.summary-grid {
  display: grid;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.summary-row {
  display: flex;
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: var(--sp-3);
}

.summary-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 80px;
}

.summary-value {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

/* ── Wizard Navigation ───────────────────────────────────────── */
.wizard-nav {
  display: flex;
  gap: var(--sp-3);
  justify-content: space-between;
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border-subtle);
}

.wizard-nav-right { display: flex; gap: var(--sp-3); margin-left: auto; }

/* ── Video Task List ────────────────────────────────────────── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
}

.video-task-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  transition: border-color var(--t-fast);
}

.video-task-card:hover { border-color: var(--border-default); }

.task-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.task-meta { display: flex; flex-direction: column; gap: var(--sp-1); }
.task-mode { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.task-model { font-size: var(--text-xs); color: var(--text-muted); }

.task-body { margin-bottom: var(--sp-3); }

.task-info-row {
  display: flex;
  gap: var(--sp-4);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}

.task-info-item { display: flex; align-items: center; gap: var(--sp-1); }

.task-progress {
  margin-bottom: var(--sp-3);
  display: none;
}
.task-progress.visible { display: block; }

.task-progress-bar-wrap {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--sp-1);
}

.task-progress-bar {
  height: 100%;
  background: var(--info);
  border-radius: var(--radius-full);
  transition: width var(--t-slow) var(--ease-out);
}

.task-progress-text {
  font-size: var(--text-xs);
  color: var(--info);
}

.task-error {
  font-size: var(--text-xs);
  color: var(--danger);
  background: var(--danger-bg);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-3);
  display: none;
}
.task-error.visible { display: block; }

.task-footer {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  justify-content: space-between;
}

.task-date { font-size: var(--text-xs); color: var(--text-muted); }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-16) var(--sp-4);
  text-align: center;
  color: var(--text-muted);
  gap: var(--sp-4);
}

.empty-icon { font-size: 48px; opacity: 0.5; }
.empty-title { font-size: var(--text-base); font-weight: 600; color: var(--text-secondary); }
.empty-desc  { font-size: var(--text-sm); max-width: 280px; line-height: 1.6; }

/* ── Skeleton Loaders ─────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated) 25%,
    var(--bg-hover) 50%,
    var(--bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text  { height: 14px; border-radius: var(--radius-sm); }
.skeleton-title { height: 20px; border-radius: var(--radius-sm); }
.skeleton-card  {
  height: 120px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

/* ── Admin Panel ─────────────────────────────────────────────── */
.admin-section { animation: fade-up 0.3s var(--ease-out) both; }

.invite-code-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-family: 'Courier New', monospace;
  font-size: var(--text-sm);
}

.invite-code-value {
  flex: 1;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.invite-code-status { flex-shrink: 0; }

.invite-code-copy {
  flex-shrink: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--t-fast);
}
.invite-code-copy:hover { color: var(--accent); }

.generate-codes-wrap {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-end;
  margin-bottom: var(--sp-5);
}

/* ── Inline progress for video tasks ─────────────────────────── */
.inline-progress {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--info);
}

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--sp-5) 0;
}

/* ── Tooltip ───────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-overlay);
  color: var(--text-primary);
  font-size: var(--text-xs);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast);
  border: 1px solid var(--border-default);
  z-index: 300;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Utility classes ────────────────────────────────────────────── */
.flex           { display: flex; }
.flex-col       { display: flex; flex-direction: column; }
.items-center   { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.mt-4  { margin-top: var(--sp-4); }
.mt-6  { margin-top: var(--sp-6); }
.mb-4  { margin-bottom: var(--sp-4); }
.mb-6  { margin-bottom: var(--sp-6); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.admin-only { display: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-width: var(--sidebar-collapsed); }
  .sidebar-logo-text { opacity: 0; }
  .nav-item-text { opacity: 0; }
  .sidebar-section-label { opacity: 0; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    width: var(--sidebar-width);
    transform: translateX(-100%);
    width: 260px;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    width: 260px;
  }
  .sidebar.mobile-open .sidebar-logo-text { opacity: 1; }
  .sidebar.mobile-open .nav-item-text { opacity: 1; }
  .sidebar.mobile-open .sidebar-section-label { opacity: 1; }

  .main-content {
    margin-left: 0 !important;
    max-width: 100vw !important;
  }

  .hamburger { display: flex; }

  .sidebar-toggle { display: none; }

  .mode-grid { grid-template-columns: 1fr; }
  .model-grid { grid-template-columns: 1fr; }

  .lang-grid { flex-direction: column; }

  .page-content { padding: var(--sp-4); }
  .app-header { padding: 0 var(--sp-4); }

  #toast-container { bottom: var(--sp-4); right: var(--sp-4); left: var(--sp-4); }
  .toast { min-width: unset; }

  .section-header { flex-direction: column; align-items: flex-start; }

  .modal { padding: var(--sp-5); }
}

@media (max-width: 480px) {
  .mode-grid { grid-template-columns: 1fr; }
  .wizard-steps-header { gap: var(--sp-1); }
  .step-dot-label { display: none; }
  .auth-card { padding: var(--sp-6); }
  .video-grid { grid-template-columns: 1fr; }
}

/* ── Mobile overlay backdrop ──────────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 45;
}
.sidebar-backdrop.visible { display: block; }

/* ── Input number spin remove ───────────────────────────────────── */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
input[type=number] { -moz-appearance: textfield; }

/* ── Focus visible (accessibility) ────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Footer ───────────────────────────────────────────────── */
.page-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.page-footer a { color: var(--text-muted); }
.page-footer a:hover { color: var(--text-secondary); }
