/* ═══════════════════════════════════════════════════════════
   Docling API — Shared Design System
   Single source of truth for all pages.
   ═══════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  --bg-deepest: #06060d;
  --bg-base: #0b0b16;
  --bg-surface: #111122;
  --bg-elevated: #181830;
  --bg-glass: rgba(18, 18, 42, 0.65);
  --border: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(240, 165, 0, 0.15);
  --text: #f0eeea;
  --text-secondary: #8e8a84;
  --text-muted: #5c5860;
  --gold: #f0a500;
  --gold-hover: #f5c542;
  --gold-soft: #fde68a;
  --gold-glow: rgba(240, 165, 0, 0.2);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.12);
  --coral: #f87171;
  --coral-soft: rgba(248, 113, 113, 0.12);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --font-arabic: 'Noto Naskh Arabic', serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-deepest);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Ambient Background ── */
body.ambient::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(240, 165, 0, 0.04) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 40%, rgba(240, 165, 0, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 20% 80%, rgba(16, 185, 129, 0.02) 0%, transparent 60%);
}

body.ambient::after {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .03;
  background-image:
    linear-gradient(rgba(255, 255, 255, .5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .5) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 70%);
}

/* ── Layout ── */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
  z-index: 1;
}

.section-padding { padding: 100px 0; }

/* ── Skip Link ── */
.skip-link {
  position: absolute; top: -100px; left: 16px; z-index: 999;
  background: var(--gold); color: #0a0a0a;
  padding: 8px 16px; border-radius: 8px;
  font-weight: 600; font-size: .9rem; text-decoration: none;
  transition: top .2s;
}
.skip-link:focus { top: 8px; }

/* ── Navigation ── */
nav, .navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8, 8, 18, .85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  transition: all .3s;
}

nav .inner, .navbar .inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.logo span { color: var(--gold); }

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: .92rem;
  font-weight: 500;
  transition: color .2s;
}

.nav-link:hover { color: var(--text); }

/* ── Mobile Navigation ── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  z-index: 101;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all .3s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 6, 13, .97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 99;
  padding: 100px 28px 40px;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.mobile-menu.open { display: flex; }

.mobile-menu a {
  display: block;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: background .2s;
}

.mobile-menu a:hover { background: rgba(255, 255, 255, .04); }

.mobile-menu .mobile-cta {
  background: linear-gradient(135deg, var(--gold) 0%, #d48900 100%);
  color: #0a0a0a;
  text-align: center;
  margin-top: 12px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  font-size: .9rem;
  cursor: pointer;
  border: none;
  transition: all .2s;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, #d48900 100%);
  color: #0a0a0a;
  box-shadow: 0 0 20px var(--gold-glow), 0 2px 8px rgba(0, 0, 0, .3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(240, 165, 0, .35), 0 4px 16px rgba(0, 0, 0, .4);
}

.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .12);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .03);
}

.btn-danger {
  background: none;
  color: var(--coral);
  font-weight: 500;
  padding: 6px 12px;
  font-size: .85rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}

.btn-danger:hover { background: var(--coral-soft); }

.btn-lg { padding: 14px 30px; font-size: .95rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }

.btn-full { width: 100%; justify-content: center; }

/* ── Cards ── */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

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

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: .92rem;
  transition: border-color .2s, box-shadow .2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(240, 165, 0, .08);
}

.form-group textarea { resize: vertical; min-height: 100px; }

.form-group .hint {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Status Messages ── */
.error-msg {
  background: rgba(248, 113, 113, .1);
  border: 1px solid rgba(248, 113, 113, .2);
  color: var(--coral);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: .88rem;
  margin-bottom: 16px;
  display: none;
}

.success-msg {
  background: rgba(16, 185, 129, .1);
  border: 1px solid rgba(16, 185, 129, .2);
  color: var(--emerald);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: .88rem;
  margin-bottom: 16px;
  display: none;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: .88rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
  transform: translateY(120px);
  opacity: 0;
  transition: all .3s;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ── Spinner ── */
.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

.spinner-dark {
  border-color: rgba(0, 0, 0, .2);
  border-top-color: #0a0a0a;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: .88rem;
}

th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: .72rem;
  font-weight: 600;
}

.badge-active { background: rgba(16, 185, 129, .12); color: var(--emerald); }
.badge-revoked { background: rgba(248, 113, 113, .12); color: var(--coral); }
.badge-free { background: rgba(255, 255, 255, .05); color: var(--text-secondary); }
.badge-pro { background: rgba(240, 165, 0, .1); color: var(--gold); }
.badge-business { background: rgba(16, 185, 129, .1); color: var(--emerald); }

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card .label { font-size: 0.85rem; color: var(--text-secondary); }
.stat-card .value { font-size: 1.75rem; font-weight: 700; color: var(--gold); }
.stat-card .limit { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

.usage-bar {
  height: 6px;
  background: rgba(255, 255, 255, .05);
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}

.usage-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.usage-bar-fill.safe { background: var(--emerald); }
.usage-bar-fill.warn { background: var(--gold); }
.usage-bar-fill.danger { background: var(--coral); }

/* ── Section ── */
.section {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

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

/* ── Section Labels ── */
.section-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--gold);
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  margin-bottom: 16px;
  line-height: 1.2;
}

.section-desc {
  color: var(--text-secondary);
  max-width: 560px;
  font-size: 1rem;
}

/* ── Footer ── */
.footer-text {
  text-align: center;
  margin-top: 20px;
  font-size: .88rem;
  color: var(--text-secondary);
}

.footer-text a {
  color: var(--gold);
  text-decoration: none;
}

.footer-text a:hover { text-decoration: underline; }

/* ── Key Display ── */
.api-key-display {
  background: #030308;
  color: #a6e3a1;
  padding: 14px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .84rem;
  word-break: break-all;
  margin: 12px 0;
  user-select: all;
  border: 1px solid var(--border);
}

/* ── Key Cell ── */
.key-cell {
  font-family: var(--font-mono);
  font-size: .85rem;
}

/* ── Loading ── */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.empty {
  text-align: center;
  padding: 20px;
  color: var(--text-secondary);
  font-size: .9rem;
}

/* ── Honeypot ── */
.honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  overflow: hidden;
}

/* ── Focus Visible ── */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .form-row { grid-template-columns: 1fr; }
  .nav-links .hide-mobile { display: none; }
  .hamburger { display: flex; }
  .section-padding { padding: 64px 0; }
  .container { padding: 0 20px; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
}
