/* ===== Reset & Variables ===== */
:root {
  --bg-primary: #0f0f10;
  --bg-secondary: #18181b;
  --bg-card: #1e1e22;
  --bg-hover: #27272a;
  --border-color: #2e2e32;
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #6d5cff;
  --accent-hover: #7c6eff;
  --accent-light: rgba(109, 92, 255, 0.12);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ===== Inline SVG Icons ===== */
svg.icon {
  width: 16px;
  height: 16px;
  vertical-align: -2px;
  flex-shrink: 0;
  display: inline-block;
}

/* ===== Navbar ===== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.navbar-brand .logo {
  width: 28px;
  height: 28px;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 18px rgba(109, 92, 255, 0.18));
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}

.navbar-nav a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: all 0.15s;
}

.navbar-nav a:hover, .navbar-nav a.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-ghost { border: none; background: transparent; }

/* ===== Layout ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.container-sm { max-width: 480px; margin: 0 auto; padding: 2rem; }
.container-md { max-width: 800px; margin: 0 auto; padding: 2rem; }

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

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

.card-header h3 { font-size: 1rem; font-weight: 600; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.stat-card .stat-value.accent { color: var(--accent); }

/* ===== Forms ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.9rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus { border-color: var(--accent); }

.form-control::placeholder { color: var(--text-muted); }

/* ===== Tables ===== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
}

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tr:hover td { background: var(--bg-hover); }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-muted { background: var(--bg-hover); color: var(--text-muted); }

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 6rem 2rem 4rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Features ===== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 0 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: border-color 0.2s;
}

.feature-card:hover { border-color: var(--accent); }

.feature-card .icon {
  width: 48px;
  height: 48px;
  background: var(--accent-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--accent);
}

.feature-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ===== API Docs ===== */
.docs-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.docs-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
}

.docs-sidebar a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
}

.docs-sidebar a:hover, .docs-sidebar a.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.docs-sidebar .section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.35rem;
  font-weight: 600;
}

.docs-content h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  padding-top: 1rem;
}

.docs-content h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--text-primary);
}

.docs-content p, .docs-content li {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.docs-content ul, .docs-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.endpoint-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
  font-size: 0.85rem;
}

.endpoint-box .method {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.method-post { background: rgba(34,197,94,0.2); color: var(--success); }
.method-get { background: rgba(96,165,250,0.2); color: #60a5fa; }
.method-delete { background: rgba(239,68,68,0.2); color: var(--danger); }

.param-table { margin-bottom: 1.5rem; }

.param-table th {
  font-size: 0.75rem;
}

.param-name { font-family: monospace; color: var(--accent); }
.param-required { color: var(--danger); font-size: 0.75rem; }

pre {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

code {
  font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
  background: var(--bg-hover);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85em;
}

pre code {
  background: none;
  padding: 0;
}

/* ===== Dashboard Sidebar ===== */
.dash-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 60px);
}

.dash-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem 0.75rem;
}

.dash-sidebar a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.15rem;
  transition: all 0.12s;
}

.dash-sidebar a:hover, .dash-sidebar a.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.dash-sidebar .sidebar-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 1rem 0.85rem 0.35rem;
  font-weight: 600;
}

.dash-main {
  padding: 2rem;
  overflow-y: auto;
}

/* ===== Key display ===== */
.key-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.key-display .key-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Alert ===== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-error { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.alert-success { background: rgba(34,197,94,0.15); color: var(--success); border: 1px solid rgba(34,197,94,0.3); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  min-width: 360px;
  max-width: 90vw;
}

.modal h3 { margin-bottom: 1rem; }

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-color);
  margin-top: 2rem;
}

/* ===== Misc ===== */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--accent); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar { display: none; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar { display: none; }
  .navbar { padding: 0 1rem; }
  .container { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
