/* ═══════════════════════════════════════════════════════════════════
   TIKTOK UPLOADER STUDIO — Premium Dark UI
   Theme: Cyberpunk neon + glassmorphism
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --bg-0: #07080d;
  --bg-1: #0d1018;
  --bg-2: #141826;
  --bg-3: #1c2238;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.16);

  --text-1: #f5f7ff;
  --text-2: #b9c0d4;
  --text-3: #6c7491;
  --text-mute: #4a526b;

  --accent: #ff2d6f;        /* TikTok pink */
  --accent-2: #25f4ee;       /* TikTok cyan */
  --accent-3: #a855f7;       /* purple highlight */
  --success: #22d39a;
  --warning: #ffb547;
  --danger: #ff4d6d;

  --gradient-1: linear-gradient(135deg, #ff2d6f 0%, #a855f7 50%, #25f4ee 100%);
  --gradient-2: linear-gradient(135deg, #25f4ee 0%, #a855f7 100%);
  --gradient-bg: radial-gradient(ellipse at top left, rgba(168,85,247,0.12), transparent 50%),
                 radial-gradient(ellipse at bottom right, rgba(37,244,238,0.10), transparent 50%),
                 radial-gradient(ellipse at center, rgba(255,45,111,0.08), transparent 60%);

  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 24px rgba(255,45,111,0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --font-sans: 'Inter', -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-0);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  background-image: var(--gradient-bg);
  background-attachment: fixed;
  background-size: 100% 100%;
}

/* Animated gradient orbs in background */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  pointer-events: none;
  z-index: -1;
  animation: float-orb 20s ease-in-out infinite;
}
body::before {
  top: -200px; left: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent), transparent);
}
body::after {
  bottom: -200px; right: -200px;
  width: 700px; height: 700px;
  background: radial-gradient(circle, var(--accent-2), transparent);
  animation-delay: -10s;
}
@keyframes float-orb {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(60px,40px) scale(1.15); }
}

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

::selection { background: var(--accent); color: white; }

/* ─── Layout ─────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(7,8,13,0.7);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gradient-1);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  color: white;
  box-shadow: var(--shadow-glow);
  animation: pulse-glow 3s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 24px rgba(255,45,111,0.25); }
  50% { box-shadow: 0 0 36px rgba(255,45,111,0.5); }
}
.brand-text { font-weight: 700; font-size: 14px; line-height: 1.2; }
.brand-text small { display: block; font-weight: 400; font-size: 11px; color: var(--text-3); }

.nav-section { margin-bottom: 8px; }
.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-mute);
  padding: 12px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: var(--radius-md);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.nav-link:hover {
  background: var(--surface-hover);
  color: var(--text-1);
}
.nav-link.active {
  background: linear-gradient(135deg, rgba(255,45,111,0.15), rgba(168,85,247,0.15));
  color: var(--text-1);
  border: 1px solid rgba(255,45,111,0.3);
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gradient-1);
  border-radius: 0 3px 3px 0;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.user-pill {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 16px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gradient-2);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--bg-0);
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }

.main-content { padding: 32px 40px; max-width: 100%; overflow-x: hidden; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-subtitle { color: var(--text-3); margin-top: 4px; font-size: 13px; }

/* ─── Cards / Surfaces ──────────────────────────────────────────── */
.card {
  background: rgba(20,24,38,0.6);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.card:hover { border-color: var(--border-bright); }
.card-glow:hover {
  box-shadow: 0 0 32px rgba(255,45,111,0.15);
  border-color: rgba(255,45,111,0.3);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 16px; font-weight: 700; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

/* ─── Stat tiles ─────────────────────────────────────────────────── */
.stat-tile {
  background: rgba(20,24,38,0.6);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition);
}
.stat-tile:hover { transform: translateY(-2px); border-color: var(--border-bright); }
.stat-tile::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-1);
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-tile:hover::before { opacity: 1; }
.stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.stat-value { font-size: 32px; font-weight: 800; margin-top: 8px; line-height: 1; letter-spacing: -1px; }
.stat-meta { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.stat-value.gradient {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-bright);
  background: var(--surface);
  color: var(--text-1);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.btn:hover { background: var(--surface-hover); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--gradient-1);
  border-color: transparent;
  color: white;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover {
  background: var(--gradient-1);
  border-color: transparent;
  filter: brightness(1.15);
  box-shadow: 0 0 32px rgba(255,45,111,0.45);
}

.btn-ghost { background: transparent; border-color: var(--border); }
.btn-danger { background: rgba(255,77,109,0.12); border-color: rgba(255,77,109,0.4); color: var(--danger); }
.btn-danger:hover { background: rgba(255,77,109,0.2); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ─── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(7,8,13,0.6);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-family: inherit;
  font-size: 13px;
  transition: all var(--transition);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,45,111,0.15);
}
.form-textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.form-help { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* File input drop zone */
.dropzone {
  border: 2px dashed var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  background: rgba(7,8,13,0.4);
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(255,45,111,0.05);
}
.dropzone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  background: var(--gradient-1);
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  animation: bounce-y 2s ease-in-out infinite;
}
@keyframes bounce-y { 0%,100%{transform:translateY(0);} 50%{transform:translateY(-6px);} }
.dropzone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.dropzone-text { font-weight: 600; }
.dropzone-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* Multi-select pills */
.account-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(7,8,13,0.6);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.account-pill input { display: none; }
.account-pill:hover { border-color: var(--text-3); }
.account-pill:has(input:checked),
.account-pill.checked {
  background: linear-gradient(135deg, rgba(255,45,111,0.2), rgba(168,85,247,0.2));
  border-color: var(--accent);
  color: var(--text-1);
  box-shadow: 0 0 16px rgba(255,45,111,0.2);
}
.account-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
}
.account-pill.inactive .dot { background: var(--text-mute); }

/* ─── Badges / Status ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-success { background: rgba(34,211,154,0.12); color: var(--success); border: 1px solid rgba(34,211,154,0.3); }
.badge-danger { background: rgba(255,77,109,0.12); color: var(--danger); border: 1px solid rgba(255,77,109,0.3); }
.badge-warn { background: rgba(255,181,71,0.12); color: var(--warning); border: 1px solid rgba(255,181,71,0.3); }
.badge-info { background: rgba(37,244,238,0.12); color: var(--accent-2); border: 1px solid rgba(37,244,238,0.3); }
.badge-muted { background: var(--surface); color: var(--text-3); border: 1px solid var(--border); }

.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.badge-pulse::before { animation: pulse-dot 1.5s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% {opacity:1;} 50%{opacity:0.4;} }

/* ─── Tables ─────────────────────────────────────────────────────── */
.table-wrap {
  background: rgba(20,24,38,0.6);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: rgba(7,8,13,0.4);
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr { transition: background var(--transition); }
.table tr:hover { background: var(--surface); }
.table tr.highlight {
  background: rgba(255,45,111,0.06);
  animation: row-flash 1.5s ease-in-out;
}
@keyframes row-flash {
  0% { background: rgba(255,45,111,0.2); }
  100% { background: rgba(255,45,111,0.06); }
}

/* ─── Toolbar / Filters ──────────────────────────────────────────── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar select {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  color: var(--text-1);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 12px;
}

/* ─── Auth Pages ─────────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(20,24,38,0.7);
  backdrop-filter: blur(30px);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  animation: card-rise 600ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes card-rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  background: var(--gradient-1);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  color: white;
  box-shadow: 0 0 48px rgba(255,45,111,0.4);
  animation: logo-rotate 8s linear infinite;
}
@keyframes logo-rotate {
  0% { transform: rotate(0deg); border-radius: 18px; }
  50% { transform: rotate(180deg); border-radius: 24px; }
  100% { transform: rotate(360deg); border-radius: 18px; }
}
.auth-title { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--text-3); font-size: 12px; margin-bottom: 28px; }

.auth-error {
  background: rgba(255,77,109,0.12);
  border: 1px solid rgba(255,77,109,0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
  animation: shake 400ms ease-in-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ─── Log viewer ────────────────────────────────────────────────── */
.log-box {
  background: #050608;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #c8d3eb;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.6;
}
.log-box::-webkit-scrollbar { width: 6px; }
.log-box::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

/* Marker color in log */
.log-box .ok { color: var(--success); }
.log-box .err { color: var(--danger); }

/* ─── Mobile ─────────────────────────────────────────────────────── */
.menu-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-1);
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 260px;
    height: 100vh;
    transition: left var(--transition);
  }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-flex; }
  .main-content { padding: 20px; }
  .page-title { font-size: 22px; }
}

/* ─── Toast / Flash ────────────────────────────────────────────── */
.flash-banner {
  background: linear-gradient(135deg, rgba(34,211,154,0.15), rgba(37,244,238,0.15));
  border: 1px solid rgba(34,211,154,0.3);
  color: var(--success);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

/* ─── Loader ─────────────────────────────────────────────────────── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-bright);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Empty state ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-3);
}
.empty-state-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
}
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text-1); margin-bottom: 4px; }

/* fade in */
.fade-in { animation: fade-in 400ms ease-out; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* nav badge */
.nav-link .badge-count {
  margin-left: auto;
  background: var(--gradient-1);
  color: white;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}
