/* Premium Scraper — Dark Theme */
:root {
  --bg-base:    #05050f;
  --bg-card:    rgba(255,255,255,0.03);
  --bg-input:   #0f1724;
  --border:     rgba(255,255,255,0.06);
  --border-alt: rgba(99,102,241,0.2);
  --accent:     #6366f1;
  --accent-2:   #818cf8;
  --green:      #34d399;
  --yellow:     #fbbf24;
  --red:        #f87171;
  --text:       #e2e8f0;
  --text-muted: #64748b;
  --text-dim:   #94a3b8;
  --sidebar-w:  220px;
  --radius:     14px;
  --radius-sm:  8px;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

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

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: rgba(5,5,20,0.95);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
}
.logo-icon { font-size: 22px; }
.logo-text { font-weight: 700; font-size: 15px; color: var(--text); }

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-item:hover { background: rgba(99,102,241,0.08); color: var(--text-dim); }
.nav-item.active { background: rgba(99,102,241,0.15); color: var(--accent-2); }
.nav-icon { font-size: 16px; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── Cards ─────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(10px);
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--border-alt); }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 800; line-height: 1; }
.stat-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.stat-icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

/* ── Page Header ─────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 6px 20px rgba(99,102,241,0.45); }
.btn-danger  { background: rgba(239,68,68,0.15);  color: var(--red);   border: 1px solid rgba(239,68,68,0.25); }
.btn-success { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.25); }
.btn-ghost   { background: rgba(255,255,255,0.05); color: var(--text-dim); border: 1px solid var(--border); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-icon { padding: 7px; border-radius: 8px; }

/* ── Form ─────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.form-control {
  width: 100%; padding: 9px 14px;
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s;
  outline: none;
}
.form-control:focus { border-color: var(--accent); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ── Table ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.03); color: var(--text-dim); }
tr:hover td { background: rgba(255,255,255,0.02); }
tr:last-child td { border-bottom: none; }

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-completed { background: rgba(16,185,129,0.12); color: var(--green); }
.badge-running   { background: rgba(245,158,11,0.12); color: var(--yellow); }
.badge-failed    { background: rgba(239,68,68,0.12);  color: var(--red); }
.badge-pending   { background: rgba(148,163,184,0.12);color: var(--text-dim); }
.badge-cancelled { background: rgba(148,163,184,0.12);color: var(--text-muted); }

/* ── Progress ─────────────────────────────────────────── */
.progress-bar { height: 5px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 3px; transition: width 0.4s; }

/* ── Loading ─────────────────────────────────────────── */
.loading-spinner { display: flex; justify-content: center; align-items: center; height: 200px; }
.spinner { width: 36px; height: 36px; border: 3px solid rgba(99,102,241,0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ─────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 9999; }
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  backdrop-filter: blur(20px);
  animation: slideIn 0.25s ease;
  max-width: 320px;
}
.toast-success { background: rgba(16,185,129,0.2); border: 1px solid rgba(16,185,129,0.3); color: var(--green); }
.toast-error   { background: rgba(239,68,68,0.2);  border: 1px solid rgba(239,68,68,0.3);  color: var(--red); }
.toast-info    { background: rgba(99,102,241,0.2); border: 1px solid rgba(99,102,241,0.3); color: var(--accent-2); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Misc ─────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; text-align: center;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-dim); margin-bottom: 8px; }
.empty-sub { font-size: 13px; color: var(--text-muted); }

.chip {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.15);
  color: var(--accent-2);
  border-radius: 20px;
  font-size: 11px;
  margin: 2px;
}

.toggle {
  position: relative;
  width: 40px; height: 22px;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 11px;
  transition: 0.2s;
}
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle-track::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: 0.2s;
}
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .logo-text, .nav-item span:last-child, .sidebar-footer span { display: none; }
  .main-content { margin-left: 60px; padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}
