/* assets/css/app.css — ViralGen Admin UI */

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

:root {
  --bg:       #0d0f14;
  --surface:  #161b24;
  --card:     #1e2533;
  --border:   #2a3244;
  --accent:   #6c63ff;
  --accent2:  #ff6584;
  --success:  #22c55e;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #38bdf8;
  --text:     #e2e8f0;
  --muted:    #64748b;
  --radius:   10px;
  --radius-lg:16px;
  font-size: 15px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

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

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  top: 0; left: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}
.sidebar-logo span { font-size: 11px; color: var(--muted); display: block; margin-top: 2px; }

.nav { padding: 12px 0; flex: 1; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  border-radius: 0;
}
.nav a:hover { color: var(--text); background: rgba(108,99,255,0.08); }
.nav a.active { color: var(--accent); background: rgba(108,99,255,0.12); border-right: 2px solid var(--accent); }
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.sidebar-footer a { color: var(--muted); text-decoration: none; }
.sidebar-footer a:hover { color: var(--danger); }

.main { margin-left: 220px; padding: 28px 32px; flex: 1; }

.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--text); }
.page-header p  { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* ── Stats row ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat-card .sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-card.accent .value { color: var(--accent); }
.stat-card.success .value { color: var(--success); }
.stat-card.warning .value { color: var(--warning); }
.stat-card.info .value    { color: var(--info); }

/* ── Form elements ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select option { background: var(--card); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover  { background: #5a52e0; }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover  { opacity: 0.85; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover   { opacity: 0.85; }
.btn-ghost    { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover    { color: var(--text); border-color: var(--muted); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-pending   { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-processing{ background: rgba(56,189,248,0.15); color: var(--info); }
.badge-ready     { background: rgba(34,197,94,0.15);  color: var(--success); }
.badge-posted    { background: rgba(108,99,255,0.15); color: var(--accent); }
.badge-failed    { background: rgba(239,68,68,0.15);  color: var(--danger); }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { 
  text-align: left; padding: 10px 12px; 
  font-size: 12px; font-weight: 500; color: var(--muted); 
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
tbody td { padding: 13px 12px; border-bottom: 1px solid rgba(42,50,68,0.5); vertical-align: middle; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom: none; }

.thumb-cell img { width: 45px; height: 80px; object-fit: cover; border-radius: 6px; }
.headline-cell  { max-width: 240px; }
.headline-cell strong { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.headline-cell span   { font-size: 12px; color: var(--muted); }
.actions { display: flex; gap: 6px; align-items: center; }

/* ── Video create form ── */
.create-form { max-width: 600px; }
.niche-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.niche-option { display: none; }
.niche-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.niche-option:checked + .niche-label {
  border-color: var(--accent);
  background: rgba(108,99,255,0.12);
  color: var(--accent);
}
.niche-label:hover { border-color: var(--muted); }

/* ── Progress indicator ── */
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text); }

/* ── Video preview ── */
.video-preview { width: 100%; max-height: 400px; object-fit: contain; border-radius: var(--radius); background: #000; }

/* ── Social accounts ── */
.account-list { display: flex; flex-direction: column; gap: 10px; }
.account-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.account-info { display: flex; align-items: center; gap: 12px; }
.platform-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.platform-icon.fb { background: rgba(24,119,242,0.15); }
.platform-icon.yt { background: rgba(255,0,0,0.12); }
.account-name { font-weight: 500; font-size: 14px; }
.account-sub  { font-size: 12px; color: var(--muted); }

/* ── Alerts ── */
.alert {
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.alert-success { background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.25);  color: var(--success); }
.alert-danger  { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.25);  color: var(--danger); }
.alert-info    { background: rgba(56,189,248,0.1); border: 1px solid rgba(56,189,248,0.25); color: var(--info); }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 6px; }

/* ── Login ── */
.login-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg);
}
.login-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}
.login-box h1 { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login-box p  { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 28px; }

/* ── Script viewer ── */
.script-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
  color: var(--text);
}

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

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Pulse for processing ── */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
.pulse { animation: pulse 1.5s ease-in-out infinite; }
