/* ==========================================================================
   Aiffinity Developer Portal — dev.css
   Served at dev.aiffinity.me
   Design: dark brand (#0D0D0D bg, #FF9021 orange, Satoshi font)
   ========================================================================== */

@font-face {
  font-family: 'Satoshi';
  src: url('./assets/Satoshi-Variable.ttf') format('truetype');
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --bg:        #0D0D0D;
  --surface:   #161616;
  --elevated:  #1C1C1C;
  --border:    #2C2C2C;
  --border-hi: #404040;
  --text:      #F5F5F5;
  --text-2:    #949A9C;
  --text-3:    #798183;
  --orange:    #FF9021;
  --orange-bg: rgba(255,144,33,0.10);
  --orange-bd: rgba(255,144,33,0.25);
  --red:       #F87171;
  --red-bg:    rgba(248,113,113,0.10);
  --green:     #4ADE80;
  --green-bg:  rgba(74,222,128,0.10);
  --amber:     #FBBF24;
  --amber-bg:  rgba(251,191,36,0.10);
  --card-bg:   linear-gradient(180deg, rgba(28,28,28,0.96), rgba(22,22,22,0.96));
  --card-bd:   rgba(255,255,255,0.06);
  --card-hi:   rgba(255,255,255,0.05);
  --shadow:    0 24px 60px rgba(0,0,0,0.35);
  --font:      'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:      'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  --radius:    10px;
  --sidebar-w: 230px;
}

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

html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  line-height: 1.5;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  background: #0A0A0A;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: block;
}

.sidebar-brand-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-brand-name svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-brand-sub {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 3px;
}

.sidebar nav {
  padding: 0.75rem 0;
  flex: 1;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.5625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  transition: color 0.15s, background 0.15s;
  position: relative;
}

.sidebar nav a:hover {
  color: var(--text);
  background: var(--surface);
}

.sidebar nav a.active {
  color: var(--orange);
  background: var(--orange-bg);
}

.sidebar nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--orange);
  border-radius: 0 2px 2px 0;
}

.sidebar nav a svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar nav a.active svg { opacity: 1; }

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

.sidebar-footer a {
  font-size: 0.75rem;
  color: var(--text-3);
  transition: color 0.15s;
}

.sidebar-footer a:hover { color: var(--text-2); }

/* ── Main content ─────────────────────────────────────────────────────────── */

main {
  flex: 1;
  min-height: 100vh;
  overflow-x: hidden;
}

.content {
  max-width: 1060px;
  padding: 2.25rem 2rem;
}

/* ── Page header ──────────────────────────────────────────────────────────── */

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

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

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

.page-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8125rem;
  color: var(--text-3);
  margin-bottom: 1rem;
  transition: color 0.15s;
}

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

/* ── Card ─────────────────────────────────────────────────────────────────── */

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--card-hi), var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card h2 {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
}

.card-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* ── Form elements ────────────────────────────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.field:last-child { margin-bottom: 0; }

label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

input::placeholder, textarea::placeholder {
  color: var(--text-3);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-bg);
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23798183' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

textarea { resize: vertical; font-family: var(--mono); font-size: 0.8125rem; line-height: 1.6; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 7px;
  padding: 9px 18px;
  font-size: 0.875rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--orange);
  color: #0D0D0D;
}
.btn-primary:hover:not(:disabled) { opacity: 0.88; }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface); border-color: var(--text-3); }

.btn-danger {
  background: var(--red-bg);
  border: 1px solid rgba(248,113,113,0.25);
  color: var(--red);
}
.btn-danger:hover:not(:disabled) { background: rgba(248,113,113,0.18); }

.btn-sm { padding: 6px 13px; font-size: 0.8125rem; }

.btn-row { display: flex; gap: 10px; align-items: center; margin-top: 1.25rem; }
.inline-row { display: flex; gap: 8px; align-items: center; }

/* ── Badges ───────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-sandbox  { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(251,191,36,0.2); }
.badge-active   { background: var(--green-bg);  color: var(--green);  border: 1px solid rgba(74,222,128,0.2); }
.badge-suspended{ background: var(--red-bg);    color: var(--red);    border: 1px solid rgba(248,113,113,0.2); }
.badge-basic    { background: var(--green-bg);  color: var(--green);  border: 1px solid rgba(74,222,128,0.2); }
.badge-data     { background: rgba(96,165,250,0.10); color: #60A5FA; border: 1px solid rgba(96,165,250,0.2); }
.badge-interactive { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-bd); }

/* ── Alerts ───────────────────────────────────────────────────────────────── */

.alert {
  padding: 11px 15px;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.alert-success { background: var(--green-bg);  border: 1px solid rgba(74,222,128,0.2);  color: var(--green); }
.alert-error   { background: var(--red-bg);    border: 1px solid rgba(248,113,113,0.2); color: var(--red); }
.alert-info    { background: var(--orange-bg); border: 1px solid var(--orange-bd);      color: var(--orange); }

/* ── Table ────────────────────────────────────────────────────────────────── */

.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--card-hi);
  overflow: hidden;
}

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

thead th {
  text-align: left;
  padding: 11px 16px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,0.6);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(22,22,22,0.6); }
tbody td { padding: 13px 16px; font-size: 0.875rem; vertical-align: middle; }

/* ── Code / Pre ───────────────────────────────────────────────────────────── */

pre, code {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
}

pre {
  background: #111111;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px 16px;
  overflow-x: auto;
  color: #D4D4D4;
}

code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-2);
}

/* ── Domain verified / unverified ─────────────────────────────────────────── */

.domain-ok  { color: var(--green);  font-size: 0.875rem; font-weight: 600; }
.domain-bad { color: var(--red);    font-size: 0.875rem; }

/* ── Component pill toggle ────────────────────────────────────────────────── */

.pill-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.pill-group button {
  padding: 4px 13px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--border-hi);
  background: transparent;
  color: var(--text-2);
  transition: all 0.12s;
  width: auto;
}

.pill-group button:hover { border-color: var(--text-2); color: var(--text); background: var(--surface); }

.pill-group button.on {
  background: var(--orange-bg);
  border-color: var(--orange-bd);
  color: var(--orange);
}

/* ── Tier filter ──────────────────────────────────────────────────────────── */

.tier-filter { display: flex; gap: 8px; margin-bottom: 1.5rem; flex-wrap: wrap; }

.tier-filter button {
  padding: 5px 16px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--border-hi);
  background: transparent;
  color: var(--text-2);
  transition: all 0.12s;
  width: auto;
}

.tier-filter button:hover { border-color: var(--text-2); color: var(--text); }

.tier-filter button.active {
  background: var(--orange-bg);
  border-color: var(--orange-bd);
  color: var(--orange);
}

/* ── Docs grid ────────────────────────────────────────────────────────────── */

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: 1.125rem;
}

.doc-card {
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--card-hi);
  padding: 1.25rem;
}

.doc-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.doc-card .comp-name {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text);
}

.doc-card .comp-desc {
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: 14px;
  line-height: 1.55;
}

.doc-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 5px;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */

.empty {
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--card-hi);
  padding: 3.5rem 2rem;
  text-align: center;
}

.empty p { color: var(--text-2); font-size: 0.9375rem; margin-bottom: 1.25rem; }

/* ── Hero (no-key state) ──────────────────────────────────────────────────── */

.hero-card {
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 var(--card-hi), var(--shadow);
  padding: 3rem 2.5rem;
  max-width: 580px;
  margin: 4rem auto 0;
}

.hero-card h1 {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  line-height: 1.1;
}

.hero-card h1 span { color: var(--orange); }

.hero-card p {
  color: var(--text-2);
  font-size: 1rem;
  line-height: 1.65;
  margin-bottom: 1.75rem;
}

.hero-card .feature-list {
  list-style: none;
  margin-bottom: 2rem;
}

.hero-card .feature-list li {
  font-size: 0.9375rem;
  color: var(--text-2);
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-card .feature-list li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}

/* ── Loading ──────────────────────────────────────────────────────────────── */

.loading { color: var(--text-3); font-size: 0.9375rem; padding: 2rem 0; }

/* ── Misc utils ───────────────────────────────────────────────────────────── */

.mono { font-family: var(--mono); font-size: 0.8125rem; }
.text-muted { color: var(--text-2); }
.text-sm { font-size: 0.8125rem; }

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 820px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; min-height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 0.75rem 1rem; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-brand { padding: 0; border: none; flex: 1; }
  .sidebar nav { display: flex; padding: 0; }
  .sidebar nav a { padding: 0.5rem 0.75rem; border-left: none !important; }
  .sidebar nav a.active::before { display: none; }
  .sidebar-footer { display: none; }
  .card-grid-2 { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .docs-grid { grid-template-columns: 1fr; }
  .content { padding: 1.5rem 1rem; }
}
