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

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-glass: rgba(255,255,255,0.03);
  --border: rgba(255,255,255,0.06);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-glow: rgba(99,102,241,0.3);
  --green: #22c55e;
  --green-glow: rgba(34,197,94,0.2);
  --red: #ef4444;
  --red-glow: rgba(239,68,68,0.2);
  --yellow: #eab308;
  --cyan: #06b6d4;
  --purple: #a855f7;
  --gradient-1: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
  --gradient-2: linear-gradient(135deg, #06b6d4, #6366f1);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

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

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

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ===== INDEX PAGE ===== */
.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.landing::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  top: -200px; right: -100px;
  animation: pulse-glow 8s ease-in-out infinite;
}

.landing::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(168,85,247,0.15), transparent 70%);
  bottom: -100px; left: -50px;
  animation: pulse-glow 6s ease-in-out infinite reverse;
}

@keyframes pulse-glow {
  0%,100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.15); }
}

.landing-content {
  text-align: center;
  z-index: 2;
  padding: 40px;
}

.landing-logo {
  font-size: 72px;
  font-weight: 900;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -2px;
  margin-bottom: 16px;
  animation: fade-up 1s ease;
}

.landing-sub {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  animation: fade-up 1s ease 0.2s both;
}

.landing-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  padding: 14px 28px;
  border-radius: 50px;
  font-size: 14px;
  color: var(--green);
  animation: fade-up 1s ease 0.4s both;
}

.landing-status .dot {
  width: 10px; height: 10px;
  background: var(--green);
  border-radius: 50%;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%,100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 48px;
  animation: fade-up 1s ease 0.6s both;
}

.landing-stat {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  padding: 24px;
  border-radius: var(--radius);
  transition: all 0.3s;
}

.landing-stat:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.landing-stat h3 {
  font-size: 28px;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-stat p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.login-box {
  width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
  animation: fade-up 0.6s ease;
}

.login-box h1 {
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-box .sub { text-align: center; color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }

.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  transition: all 0.3s;
  outline: none;
}

.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
}

.btn-primary {
  width: 100%;
  background: var(--gradient-1);
  color: white;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-glow); }

.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 8px; }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { box-shadow: 0 4px 16px var(--green-glow); }
.btn-red { background: var(--red); color: white; }
.btn-red:hover { box-shadow: 0 4px 16px var(--red-glow); }
.btn-ghost { background: var(--bg-glass); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--text-primary); }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
}

.alert-error { background: var(--red-glow); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: var(--green-glow); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }

/* ===== DASHBOARD LAYOUT ===== */
.dash-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  padding: 24px 0;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 0 24px;
  font-size: 22px;
  font-weight: 800;
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 32px;
  text-align: center;
}

.sidebar-nav { flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border-right: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover, .nav-item.active {
  color: var(--text-primary);
  background: var(--bg-glass);
  border-right-color: var(--accent);
}

.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.main-content {
  flex: 1;
  margin-right: 260px;
  padding: 32px;
  min-height: 100vh;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-header h1 { font-size: 28px; font-weight: 800; }
.page-header p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}

.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 20px;
}

.stat-card .stat-icon.purple { background: rgba(99,102,241,0.15); color: var(--accent); }
.stat-card .stat-icon.green { background: var(--green-glow); color: var(--green); }
.stat-card .stat-icon.red { background: var(--red-glow); color: var(--red); }
.stat-card .stat-icon.cyan { background: rgba(6,182,212,0.15); color: var(--cyan); }

.stat-card .stat-value { font-size: 32px; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ===== TABLES ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.card-header h2 { font-size: 16px; font-weight: 700; }
.card-body { padding: 24px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-glass); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
}

.badge-green { background: var(--green-glow); color: var(--green); }
.badge-red { background: var(--red-glow); color: var(--red); }
.badge-yellow { background: rgba(234,179,8,0.15); color: var(--yellow); }
.badge-blue { background: rgba(6,182,212,0.15); color: var(--cyan); }

.mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 460px;
  max-width: 90vw;
  animation: fade-up 0.3s ease;
}

.modal h2 { font-size: 20px; font-weight: 700; margin-bottom: 24px; }

/* ===== LOGS ===== */
.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.log-entry:last-child { border-bottom: none; }

.log-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.log-dot.success { background: var(--green); }
.log-dot.danger { background: var(--red); }
.log-dot.warning { background: var(--yellow); }
.log-dot.info { background: var(--cyan); }

.log-time { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: 11px; min-width: 140px; }
.log-action { font-weight: 600; color: var(--accent); min-width: 80px; }
.log-details { color: var(--text-secondary); flex: 1; }

/* ===== CHART AREA ===== */
.chart-container { height: 280px; padding: 16px; }

/* ===== SECTION TABS ===== */
.tab-section { display: none; }
.tab-section.active { display: block; }

/* ===== TOAST ===== */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  animation: slide-in 0.3s ease;
  min-width: 280px;
  box-shadow: var(--shadow);
}

.toast-success { background: #065f46; border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.toast-error { background: #7f1d1d; border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(60px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .landing-grid { grid-template-columns: 1fr; max-width: 300px; margin-left: auto; margin-right: auto; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .login-box { width: 90%; padding: 32px 24px; }
}
