/* ─────────────────────────────────────────────────────────────
   FunPhantom API Dashboard — Premium Dark UI
   Used by api_keys.html and api_docs.html
   ───────────────────────────────────────────────────────────── */

:root {
  --api-bg: #0b0f19;
  --api-card: rgba(15, 23, 42, 0.72);
  --api-card-solid: #111827;
  --api-border: rgba(148, 163, 184, 0.16);
  --api-text: #e2e8f0;
  --api-muted: #94a3b8;
  --api-primary: #6366f1;
  --api-primary-2: #8b5cf6;
  --api-accent: #06b6d4;
  --api-danger: #ef4444;
  --api-success: #22c55e;
  --api-warning: #f59e0b;
  --api-radius: 20px;
  --api-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --api-glow: 0 0 30px rgba(99, 102, 241, 0.22);
}

.api-page {
  background: var(--api-bg);
  color: var(--api-text);
  min-height: 100vh;
  padding-bottom: 80px;
}

.api-hero {
  position: relative;
  padding: 64px 0 48px;
  overflow: hidden;
  border-bottom: 1px solid var(--api-border);
}

.api-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(99, 102, 241, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(6, 182, 212, 0.12) 0%, transparent 50%);
  pointer-events: none;
}

.api-hero__inner {
  position: relative;
  z-index: 1;
}

.api-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--api-accent);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.2);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.api-hero__title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.api-hero__subtitle {
  color: var(--api-muted);
  font-size: 1.1rem;
  max-width: 640px;
  line-height: 1.6;
}

.api-glass-card {
  background: var(--api-card);
  backdrop-filter: blur(24px);
  border: 1px solid var(--api-border);
  border-radius: var(--api-radius);
  box-shadow: var(--api-shadow);
  overflow: hidden;
}

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

.api-card-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.api-card-header p {
  margin: 0;
  color: var(--api-muted);
  font-size: 0.95rem;
}

.api-card-body {
  padding: 28px;
}

.api-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.api-btn--primary {
  background: linear-gradient(135deg, var(--api-primary) 0%, var(--api-primary-2) 100%);
  color: #fff;
  box-shadow: var(--api-glow);
}

.api-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.35);
}

.api-btn--secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--api-text);
  border: 1px solid var(--api-border);
}

.api-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.api-btn--sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.api-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.api-stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--api-border);
  border-radius: 16px;
  padding: 22px;
  transition: transform 0.2s ease;
}

.api-stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.3);
}

.api-stat-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 14px;
}

.api-stat-card__icon--purple { background: rgba(99, 102, 241, 0.15); color: var(--api-primary); }
.api-stat-card__icon--cyan { background: rgba(6, 182, 212, 0.15); color: var(--api-accent); }
.api-stat-card__icon--green { background: rgba(34, 197, 94, 0.15); color: var(--api-success); }
.api-stat-card__icon--orange { background: rgba(245, 158, 11, 0.15); color: var(--api-warning); }

.api-stat-card__value {
  font-size: 1.7rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.api-stat-card__label {
  font-size: 0.85rem;
  color: var(--api-muted);
}

.api-key-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.api-key-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--api-border);
  border-radius: 16px;
  flex-wrap: wrap;
}

.api-key-item__info { flex: 1; min-width: 200px; }
.api-key-item__name { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.api-key-item__meta { color: var(--api-muted); font-size: 0.85rem; margin-top: 4px; }
.api-key-item__key {
  font-family: 'Fira Code', 'SF Mono', monospace;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--api-border);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.9rem;
  color: var(--api-accent);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.api-key-item__actions { display: flex; gap: 8px; }

.api-empty {
  text-align: center;
  padding: 56px 20px;
}

.api-empty__icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: var(--api-primary);
  margin-bottom: 22px;
}

.api-empty h4 { font-weight: 700; margin-bottom: 8px; }
.api-empty p { color: var(--api-muted); margin-bottom: 24px; }

.api-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 6px;
}

.api-badge--success { background: rgba(34, 197, 94, 0.15); color: var(--api-success); }
.api-badge--danger { background: rgba(239, 68, 68, 0.15); color: var(--api-danger); }

.api-docs-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  align-items: start;
}

.api-docs-sidebar {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 8px;
}

.api-docs-sidebar::-webkit-scrollbar { width: 6px; }
.api-docs-sidebar::-webkit-scrollbar-thumb { background: var(--api-border); border-radius: 3px; }

.api-docs-sidebar__title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--api-muted);
  margin-bottom: 16px;
  padding: 0 12px;
}

.api-docs-nav,
.api-docs-sidebar .toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.api-docs-nav li,
.api-docs-sidebar .toc li { margin-bottom: 4px; }

.api-docs-nav a,
.api-docs-sidebar .toc a {
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--api-muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.api-docs-nav a:hover,
.api-docs-nav a.active,
.api-docs-sidebar .toc a:hover,
.api-docs-sidebar .toc a.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.12);
  border-left-color: var(--api-primary);
}

.api-docs-sidebar .toc > ul > li > a { font-weight: 600; font-size: 0.98rem; }
.api-docs-sidebar .toc > ul > li > ul > li > a { padding-left: 22px; font-size: 0.88rem; }

.api-docs-content {
  background: var(--api-card);
  backdrop-filter: blur(24px);
  border: 1px solid var(--api-border);
  border-radius: var(--api-radius);
  box-shadow: var(--api-shadow);
  padding: 40px 48px;
  min-width: 0;
}

.api-docs-content h1,
.api-docs-content h2,
.api-docs-content h3 {
  color: #fff;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 18px;
  scroll-margin-top: 100px;
}

.api-docs-content h1 { font-size: 2.2rem; margin-top: 0; }
.api-docs-content h2 { font-size: 1.6rem; padding-bottom: 12px; border-bottom: 1px solid var(--api-border); }
.api-docs-content h3 { font-size: 1.25rem; color: #c7d2fe; }

.api-docs-content p,
.api-docs-content li {
  color: var(--api-text);
  line-height: 1.75;
}

.api-docs-content a { color: var(--api-accent); text-decoration: none; }
.api-docs-content a:hover { text-decoration: underline; }

.api-docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.92rem;
}

.api-docs-content th,
.api-docs-content td {
  padding: 12px 14px;
  border: 1px solid var(--api-border);
  text-align: left;
}

.api-docs-content th {
  background: rgba(99, 102, 241, 0.1);
  color: #fff;
  font-weight: 600;
}

.api-docs-content td { background: rgba(255, 255, 255, 0.02); color: var(--api-text); }

.api-docs-content code {
  font-family: 'Fira Code', 'SF Mono', monospace;
  font-size: 0.85em;
  background: rgba(99, 102, 241, 0.12);
  color: #c7d2fe;
  padding: 2px 6px;
  border-radius: 5px;
}

.api-docs-content pre {
  position: relative;
  background: #0f172a;
  border: 1px solid var(--api-border);
  border-radius: 14px;
  padding: 20px;
  overflow-x: auto;
  margin: 20px 0;
}

.api-docs-content pre code {
  background: transparent;
  color: #e2e8f0;
  padding: 0;
  font-size: 0.88rem;
  line-height: 1.6;
}

.api-copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--api-border);
  color: var(--api-muted);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.api-copy-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #fff;
}

.api-copy-btn.copied { background: rgba(34, 197, 94, 0.2); color: var(--api-success); }

.api-modal-content {
  background: var(--api-card-solid);
  border: 1px solid var(--api-border);
  border-radius: var(--api-radius);
  color: var(--api-text);
}

.api-modal-content .modal-header,
.api-modal-content .modal-footer {
  border-color: var(--api-border);
}

.api-form-control {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--api-border);
  border-radius: 12px;
  color: #fff;
  padding: 12px 16px;
}

.api-form-control:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--api-primary);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.api-form-label { color: var(--api-muted); font-weight: 600; font-size: 0.9rem; }

.api-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--api-border);
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.02);
}

.api-tab {
  padding: 16px 18px;
  color: var(--api-muted);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.api-tab:hover,
.api-tab.active {
  color: #fff;
  border-bottom-color: var(--api-primary);
}

@media (max-width: 991px) {
  .api-docs-layout { grid-template-columns: 1fr; }
  .api-docs-sidebar { position: relative; top: 0; max-height: none; order: 2; }
  .api-docs-content { order: 1; padding: 28px; }
}

@media (max-width: 576px) {
  .api-hero { padding: 40px 0 32px; }
  .api-card-header { padding: 20px; }
  .api-card-body { padding: 20px; }
  .api-docs-content { padding: 20px; }
}
