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

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --bg:          #080e1a;
  --surface:     #0e1525;
  --surface-2:   #141e30;
  --surface-3:   #1b2840;
  --border:      rgba(255,255,255,0.07);
  --border-2:    rgba(255,255,255,0.12);
  --accent:      #6366f1;
  --accent-lt:   #818cf8;
  --accent-glow: rgba(99,102,241,0.22);
  --cyan:        #22d3ee;
  --green:       #22c55e;
  --yellow:      #f59e0b;
  --red:         #ef4444;
  --blue:        #3b82f6;
  --text-1:      #f1f5f9;
  --text-2:      #94a3b8;
  --text-3:      #475569;
  --sidebar-w:   252px;
  --topbar-h:    62px;
  --r:           10px;
  --r-lg:        14px;
  --ease:        .18s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--bg); }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg); color: var(--text-1);
  min-height: 100vh; display: flex;
  opacity: 0; transition: opacity .38s ease;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body.ready { opacity: 1; }
a { text-decoration: none; color: inherit; }

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

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand img {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--surface-3);
}
.sidebar-brand-name { font-size: 14.5px; font-weight: 700; color: var(--text-1); letter-spacing: -.2px; }
.sidebar-brand-sub  { font-size: 10.5px; color: var(--text-3); font-weight: 500; letter-spacing: .4px; margin-top: 1px; }
.sidebar-badge {
  display: inline-block; background: var(--red); color: #fff;
  font-size: 8.5px; font-weight: 700; padding: 2px 5px; border-radius: 3px;
  margin-left: 5px; letter-spacing: .5px; vertical-align: middle;
}

.sidebar-nav { flex: 1; padding: 14px 10px; overflow-y: auto; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section-label {
  font-size: 9.5px; font-weight: 700; color: var(--text-3);
  letter-spacing: 1.2px; text-transform: uppercase;
  padding: 14px 10px 5px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r);
  font-size: 13px; color: var(--text-2); font-weight: 400;
  transition: background var(--ease), color var(--ease); cursor: pointer;
  margin-bottom: 2px; position: relative;
}
.sidebar-item:hover { background: rgba(255,255,255,0.05); color: var(--text-1); }
.sidebar-item.active {
  background: rgba(99,102,241,0.14); color: var(--accent-lt); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.sidebar-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); }
.sidebar-logout {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r);
  font-size: 12.5px; color: var(--text-3); cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.sidebar-logout:hover { background: rgba(239,68,68,0.1); color: var(--red); }

/* ── Main ────────────────────────────────────────────────────── */
.admin-main {
  margin-left: var(--sidebar-w); flex: 1;
  display: flex; flex-direction: column; min-height: 100vh;
}

.admin-topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text-1); letter-spacing: -.3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-admin-badge {
  background: rgba(239,68,68,0.1); color: var(--red); border: 1px solid rgba(239,68,68,0.22);
  font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 20px; letter-spacing: .6px;
}
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; cursor: default;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.35);
}

.admin-content { padding: 28px 32px; flex: 1; }

/* ── Stat cards ──────────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 18px; margin-bottom: 32px;
}
.stat-card {
  background: var(--surface); border-radius: var(--r-lg);
  padding: 22px 22px 18px; border: 1px solid var(--border);
  position: relative; overflow: hidden;
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
  cursor: default;
}
.stat-card:hover {
  border-color: var(--border-2);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
/* Colored top bar per card */
.stats-grid .stat-card:nth-child(1) { border-top: 2px solid #6366f1; }
.stats-grid .stat-card:nth-child(2) { border-top: 2px solid #f59e0b; }
.stats-grid .stat-card:nth-child(3) { border-top: 2px solid #22c55e; }
.stats-grid .stat-card:nth-child(4) { border-top: 2px solid #ef4444; }

.stat-label {
  font-size: 10.5px; color: var(--text-3); font-weight: 600;
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: .8px;
}
.stat-value {
  font-size: 32px; font-weight: 800; color: var(--text-1);
  margin-bottom: 6px; letter-spacing: -1.5px; line-height: 1;
}
.stat-trend { font-size: 11.5px; color: var(--text-3); }
.stat-trend.up   { color: var(--green); }
.stat-trend.down { color: var(--red); }
.stat-icon {
  position: absolute; right: 18px; bottom: 16px;
  font-size: 30px; opacity: 0.12; line-height: 1;
}

/* ── Section headers ─────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 14.5px; font-weight: 600; color: var(--text-1); letter-spacing: -.2px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-sm {
  font-size: 12.5px; font-weight: 600; padding: 8px 18px; border-radius: var(--r);
  border: none; cursor: pointer; transition: all var(--ease);
  display: inline-flex; align-items: center; gap: 6px; font-family: inherit;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,0.3);
}
.btn-primary:hover { background: #4f46e5; box-shadow: 0 6px 20px rgba(99,102,241,0.45); transform: translateY(-1px); }
.btn-primary-sm { background: var(--accent); color: #fff; border-radius: var(--r); font-family: inherit; }
.btn-primary-sm:hover { background: #4f46e5; }
.btn-ghost-sm {
  background: rgba(255,255,255,0.06); color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 7px 16px; font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: all var(--ease); font-family: inherit;
}
.btn-ghost-sm:hover { background: rgba(255,255,255,0.1); color: var(--text-1); border-color: var(--border-2); }

/* ── Table ───────────────────────────────────────────────────── */
.admin-table-wrap {
  background: var(--surface); border-radius: var(--r-lg);
  border: 1px solid var(--border); overflow: hidden; margin-bottom: 28px;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  padding: 12px 18px; text-align: left;
  font-size: 10px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .8px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.015); white-space: nowrap;
}
.admin-table td {
  padding: 13px 18px; color: var(--text-2);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr { transition: background var(--ease); }
.admin-table tbody tr:hover td {
  background: rgba(99,102,241,0.05); color: var(--text-1);
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 600;
  white-space: nowrap; letter-spacing: .3px;
}
.badge-green  { background: rgba(34,197,94,0.12); color: #4ade80; }
.badge-yellow { background: rgba(245,158,11,0.12); color: #fbbf24; }
.badge-red    { background: rgba(239,68,68,0.12);  color: #f87171; }
.badge-blue   { background: rgba(99,102,241,0.15); color: #818cf8; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 64px 20px; }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 14px; display: block; opacity: .6; }
.empty-state p { font-size: 13.5px; color: var(--text-3); }

/* ── Hamburger ───────────────────────────────────────────────── */
.sidebar-toggle {
  display: none; background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: var(--r); color: var(--text-2);
  font-size: 20px; line-height: 1; transition: background var(--ease);
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.07); color: var(--text-1); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65); z-index: 99; backdrop-filter: blur(3px);
}
body.sidebar-open .sidebar-overlay { display: block; }
body.sidebar-open .admin-sidebar   { transform: translateX(0); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 1024px) {
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    z-index: 100;
  }
  .admin-main { margin-left: 0; }
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .admin-topbar { padding: 0 16px; }
  .admin-content { padding: 20px 16px; }
}
@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-admin-badge { display: none; }
}
