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

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

:root {
  --bg:        #06091a;
  --bg2:       #0d1130;
  --card:      rgba(255,255,255,0.04);
  --card-b:    rgba(255,255,255,0.08);
  --primary:   #4f8ef5;
  --primary-d: #2563eb;
  --accent:    #7c3aed;
  --success:   #10b981;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --text:      #e2e8f0;
  --text-muted:#8898aa;
  --border:    rgba(255,255,255,0.1);
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --glow:      0 0 30px rgba(79,142,245,0.2);
}

html { scroll-behavior: smooth; }

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

a { color: var(--primary); text-decoration: none; }
a:hover { color: #7ec8fd; }

/* ── LAYOUT ───────────────────────────────────────────────────────────────── */
.page-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOP NAV ──────────────────────────────────────────────────────────────── */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  background: rgba(13,17,48,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 100;
}
.navbar-brand {
  font-size: 1.2rem; font-weight: 800;
  background: linear-gradient(135deg, #4f8ef5, #7c3aed);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.navbar-brand span { font-weight: 300; }
.navbar-links { display: flex; gap: 0.5rem; align-items: center; }
.navbar-links a, .navbar-links button {
  color: var(--text-muted);
  font-size: 0.88rem; font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  border: none; background: none; cursor: pointer;
  transition: all .2s;
}
.navbar-links a:hover, .navbar-links button:hover {
  color: var(--text);
  background: var(--card-b);
}
.navbar-links a.active { color: var(--primary); background: rgba(79,142,245,0.1); }

/* ── SIDEBAR (Admin) ──────────────────────────────────────────────────────── */
.admin-layout { display: flex; flex: 1; }

.sidebar {
  width: 240px; min-height: calc(100vh - 64px);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  flex-shrink: 0;
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto;
}
.sidebar-section { margin-bottom: 1.5rem; }
.sidebar-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: .1em;
  color: var(--text-muted); text-transform: uppercase;
  padding: 0 0.75rem; margin-bottom: 0.5rem;
}
.sidebar-link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
  transition: all .2s;
  cursor: pointer;
}
.sidebar-link:hover { color: var(--text); background: var(--card); }
.sidebar-link.active { color: var(--primary); background: rgba(79,142,245,0.12); }
.sidebar-link svg { width:18px; height:18px; flex-shrink:0; }

/* ── MAIN CONTENT ─────────────────────────────────────────────────────────── */
.main-content { flex: 1; padding: 2rem; max-width: 1200px; }
.page-header { margin-bottom: 2rem; }
.page-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-subtitle { color: var(--text-muted); font-size: 0.9rem; }

/* ── CARDS ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--card-b);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  transition: box-shadow .3s, transform .3s;
}
.card:hover { box-shadow: var(--glow); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1rem; font-weight: 700; }

/* ── STATS GRID ───────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--card); border: 1px solid var(--card-b);
  border-radius: var(--radius); padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--glow); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue { background: rgba(79,142,245,0.15); color: var(--primary); }
.stat-icon.purple { background: rgba(124,58,237,0.15); color: #a78bfa; }
.stat-icon.green { background: rgba(16,185,129,0.15); color: var(--success); }
.stat-icon.orange { background: rgba(245,158,11,0.15); color: var(--warning); }
.stat-icon svg { width:24px; height:24px; }
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ── TABLE ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  background: rgba(79,142,245,0.1);
  color: var(--primary); font-weight: 600; font-size: 0.78rem;
  letter-spacing: .05em; text-transform: uppercase;
  padding: 0.75rem 1rem; text-align: left;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid rgba(255,255,255,0.04); transition: background .15s; }
tbody tr:hover { background: rgba(255,255,255,0.03); }
tbody td { padding: 0.7rem 1rem; color: var(--text); vertical-align: middle; }
tbody td:last-child { text-align: right; }

/* ── FORMS ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 0.4rem; letter-spacing: .03em;
}
.form-control {
  width: 100%; padding: 0.65rem 1rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-family: inherit; font-size: 0.9rem;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,142,245,0.15);
}
.form-control::placeholder { color: rgba(255,255,255,0.25); }
select.form-control { cursor: pointer; }
select.form-control option { background: #1a2040; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row.cols3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.88rem; font-weight: 600;
  border: none; cursor: pointer; transition: all .2s;
  text-decoration: none; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary-d), var(--accent));
  color: #fff;
  box-shadow: 0 2px 10px rgba(79,142,245,0.3);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 20px rgba(79,142,245,0.4); color: #fff; }
.btn-secondary { background: var(--card-b); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); color: var(--danger); }
.btn-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.25); color: var(--success); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; }
.btn svg { width: 16px; height: 16px; }

/* ── BADGES ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700;
}
.badge-blue { background: rgba(79,142,245,0.15); color: var(--primary); }
.badge-green { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-purple { background: rgba(124,58,237,0.15); color: #a78bfa; }

/* ── ALERTS ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.9rem 1.25rem; border-radius: var(--radius-sm);
  margin-bottom: 1.25rem; font-size: 0.88rem; font-weight: 500;
  display: flex; align-items: center; gap: 0.6rem;
}
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-danger  { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-info    { background: rgba(79,142,245,0.12); border: 1px solid rgba(79,142,245,0.3); color: #93c5fd; }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }

/* ── LOGIN PAGE ───────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 40%, rgba(79,142,245,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 70%, rgba(124,58,237,0.06) 0%, transparent 60%),
              var(--bg);
}
.login-box {
  width: 100%; max-width: 420px;
  background: var(--card); border: 1px solid var(--card-b);
  border-radius: calc(var(--radius) * 1.5); padding: 2.5rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: fadeInUp 0.5s ease;
}
.login-logo {
  text-align: center; margin-bottom: 2rem;
}
.login-logo-icon {
  width: 64px; height: 64px; margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--primary-d), var(--accent));
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(79,142,245,0.4);
}
.login-logo-icon svg { width: 32px; height: 32px; color: #fff; }
.login-title { font-size: 1.5rem; font-weight: 800; }
.login-subtitle { color: var(--text-muted); font-size: 0.88rem; margin-top: 0.25rem; }

/* ── UPLOAD PAGE ──────────────────────────────────────────────────────────── */
.hero-section {
  min-height: calc(100vh - 64px);
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(79,142,245,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(124,58,237,0.1) 0%, transparent 50%),
    var(--bg);
  padding: 2rem;
}
.hero-content { text-align: center; max-width: 700px; width: 100%; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgba(79,142,245,0.1); border: 1px solid rgba(79,142,245,0.3);
  color: var(--primary); padding: 0.35rem 1rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; margin-bottom: 1.5rem;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 30%, rgba(255,255,255,0.6));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-subtitle { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 2.5rem; }

.upload-zone {
  background: var(--card); border: 2px dashed rgba(79,142,245,0.3);
  border-radius: calc(var(--radius) * 1.5); padding: 3rem 2rem;
  text-align: center; cursor: pointer;
  transition: all .3s;
  position: relative; overflow: hidden;
}
.upload-zone::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(79,142,245,0.05) 0%, transparent 70%);
  opacity: 0; transition: opacity .3s;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(79,142,245,0.05);
}
.upload-zone:hover::before, .upload-zone.drag-over::before { opacity: 1; }

.upload-icon {
  width: 80px; height: 80px; margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, rgba(79,142,245,0.2), rgba(124,58,237,0.2));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  transition: transform .3s;
}
.upload-zone:hover .upload-icon { transform: scale(1.05); }
.upload-icon svg { width: 36px; height: 36px; color: var(--primary); }
.upload-zone h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.upload-zone p { color: var(--text-muted); font-size: 0.88rem; }
.upload-zone .file-types {
  display: inline-flex; gap: 0.5rem; margin-top: 1rem;
}
.upload-zone .file-type {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.75rem; color: var(--text-muted);
}
#fileInput { display: none; }

/* ── PROGRESS / LOADING ───────────────────────────────────────────────────── */
.processing-card {
  background: var(--card); border: 1px solid var(--card-b);
  border-radius: var(--radius); padding: 2.5rem; text-align: center;
}
.spinner {
  width: 48px; height: 48px; margin: 0 auto 1.5rem;
  border: 3px solid rgba(79,142,245,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.progress-bar-wrap { background: rgba(255,255,255,0.06); border-radius: 999px; height: 6px; margin: 1rem 0; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary-d), var(--accent)); width: 0; transition: width 0.5s ease; }

/* ── MODAL ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-box {
  background: #0f1535; border: 1px solid var(--card-b);
  border-radius: var(--radius); padding: 2rem; max-width: 480px; width: 90%;
  transform: translateY(20px); transition: transform .3s;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.modal-overlay.active .modal-box { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.3rem; line-height: 1; }
.modal-close:hover { color: var(--text); }

/* ── ANIMATIONS ───────────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-fade { animation: fadeInUp 0.4s ease; }

/* ── DIVIDER ──────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 1.5rem 0; }

/* ── EMPTY STATE ──────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 1rem; opacity: 0.3; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text); }

/* ── UTILITY ──────────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.p-0 { padding: 0; }
.w-full { width: 100%; }

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 1rem; }
  .form-row { grid-template-columns: 1fr; }
  .form-row.cols3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 2rem; }
}
