/* ────────────────────────────────────────────────────────────────────────
 * snippets.css — API-direct-call snippet generator for llmdeal.me
 * Inherits global tokens from style-Dj_EuJWP.css.
 * Sibling of setup.css; reuses .tab-bar / .tab-btn / .code-wrap / .btn-copy
 * patterns from there so it should be loaded AFTER setup.css if both ever
 * shipped on the same page (snippets.html only loads this one).
 * ──────────────────────────────────────────────────────────────────────── */

/* ── Page shell ─────────────────────────────────────────────────────── */
.snip-wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

/* ── Hero ───────────────────────────────────────────────────────────── */
.snip-hero {
  text-align: center;
  margin-bottom: 36px;
  padding: 0 8px;
}
.snip-eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(0, 204, 102, 0.07);
  border: 1px solid rgba(0, 204, 102, 0.22);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}
.snip-hero h1 {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.12;
  color: var(--text);
  margin: 0 0 16px;
}
.snip-hero h1 .accent {
  color: var(--accent);
}
.snip-hero p.sub {
  font-size: 17px;
  color: var(--text-dim);
  line-height: 1.55;
  max-width: 700px;
  margin: 0 auto;
}

/* ── Session / key row ──────────────────────────────────────────────── */
.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 22px;
}
.key-row .key-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
  min-width: 0;
  flex: 1 1 auto;
}
.key-row .key-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-fade);
  flex-shrink: 0;
}
.key-row .key-status.logged-in .dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 204, 102, 0.12);
}
.key-row .key-status .preview {
  font-family: var(--mono);
  color: var(--text);
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}
.key-row .key-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}
.key-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border-hot);
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.key-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(0, 204, 102, 0.06);
  text-decoration: none;
}
.key-btn[disabled],
.key-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.key-btn.primary {
  color: var(--accent);
  border-color: rgba(0, 204, 102, 0.5);
  background: rgba(0, 204, 102, 0.08);
}
.key-btn.primary:hover {
  background: rgba(0, 204, 102, 0.14);
}
.key-btn svg {
  width: 13px;
  height: 13px;
}

/* ── Reveal warning banner ──────────────────────────────────────────── */
.reveal-warn {
  display: none;
  align-items: flex-start;
  gap: 10px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 22px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
}
.reveal-warn.show {
  display: flex;
  animation: fadeIn 0.18s ease-out;
}
.reveal-warn svg {
  color: var(--warn);
  flex-shrink: 0;
  margin-top: 2px;
}
.reveal-warn strong {
  color: var(--warn);
  font-weight: 600;
}

/* ── Controls bar (model + prompt) ──────────────────────────────────── */
.controls {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 18px;
}
.control-field label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-fade);
  margin-bottom: 8px;
}
.control-field select,
.control-field textarea,
.control-field input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.5;
  transition: border-color 0.15s;
  resize: vertical;
}
.control-field select:focus,
.control-field textarea:focus,
.control-field input:focus {
  outline: none;
  border-color: var(--accent);
}
.control-field textarea {
  min-height: 60px;
  font-family: var(--sans);
  font-size: 14px;
}
.control-hint {
  font-size: 12px;
  color: var(--text-fade);
  margin-top: 6px;
  font-family: var(--mono);
}

/* ── Tab bar (mirrors setup.css) ────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 22px;
  position: sticky;
  top: 64px;
  z-index: 10;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--text);
  background: var(--bg-elev);
  text-decoration: none;
}
.tab-btn.active {
  color: var(--accent);
  background: rgba(0, 204, 102, 0.07);
  border-color: rgba(0, 204, 102, 0.3);
}
.tab-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Panels ─────────────────────────────────────────────────────────── */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
  animation: fadeIn 0.18s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Snippet card (one per tab) ─────────────────────────────────────── */
.snip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.snip-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
}
.snip-meta .lang-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.snip-meta .lang-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex-shrink: 0;
}
.snip-meta .lang-note {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-fade);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Code block ─────────────────────────────────────────────────────── */
.code-wrap {
  position: relative;
  background: var(--bg);
  border: 0;
  border-radius: 0;
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-fade);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg-card);
  border: 1px solid var(--border-hot);
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-copy:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(0, 204, 102, 0.06);
}
.btn-copy.copied {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(0, 204, 102, 0.1);
}
.btn-copy svg {
  width: 12px;
  height: 12px;
}
.code-wrap pre {
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 18px 20px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
  word-wrap: normal;
}
.code-wrap pre code {
  background: transparent;
  padding: 0;
  border: 0;
  font-size: inherit;
  color: inherit;
  display: block;
}

/* ── Tiny vanilla syntax highlighter shading ────────────────────────── */
.tok-kw   { color: #c084fc; }   /* keyword: import, def, const, etc.  */
.tok-str  { color: #86efac; }   /* string literal */
.tok-num  { color: #fbbf24; }   /* number */
.tok-com  { color: var(--text-fade); font-style: italic; }
.tok-fn   { color: #60a5fa; }   /* function call */
.tok-prop { color: #f472b6; }   /* JSON key / object prop */
.tok-flag { color: #fb923c; }   /* curl -X --header etc. */
.tok-url  { color: #93c5fd; }   /* URLs in curl */
.tok-key  { color: #fde047; font-weight: 600; }   /* The lld_ key itself */
.tok-ph   { color: var(--warn); }                 /* lld_YOUR_KEY_HERE placeholder */

/* ── Run-this-snippet panel ─────────────────────────────────────────── */
.run-panel {
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
.run-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 22px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color 0.15s, background 0.15s;
  text-align: left;
}
.run-toggle:hover {
  color: var(--accent);
  background: rgba(0, 204, 102, 0.04);
}
.run-toggle .chev {
  transition: transform 0.18s;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}
.run-toggle[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}
.run-toggle .run-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.run-body {
  display: none;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--border);
}
.run-body.show {
  display: block;
}
.run-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.run-actions .key-btn {
  margin: 0;
}
.run-status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-fade);
}
.run-status.ok   { color: var(--accent); }
.run-status.err  { color: var(--bad); }
.run-status.busy { color: var(--warn); }
.run-output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 14px 16px;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-height: 360px;
  overflow-y: auto;
}
.run-output:empty {
  display: none;
}
.run-output .err-line {
  color: var(--bad);
}
.run-anon-note {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  padding: 8px 0 0;
}
.run-anon-note a {
  color: var(--accent);
}

/* ── What-this-is explainer ─────────────────────────────────────────── */
.snip-explainer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 22px 26px;
  margin-top: 28px;
}
.snip-explainer h3 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-fade);
  margin: 0 0 10px;
}
.snip-explainer p {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 10px;
}
.snip-explainer p:last-child {
  margin-bottom: 0;
}
.snip-explainer a {
  color: var(--accent);
}

/* ── Footer CTA ─────────────────────────────────────────────────────── */
.snip-footer {
  text-align: center;
  margin-top: 48px;
  padding: 36px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.snip-footer h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0 0 8px;
}
.snip-footer p {
  font-size: 15px;
  color: var(--text-dim);
  margin: 0 0 20px;
}
.snip-footer .footer-actions {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Toast (a11y copy feedback) ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 1000;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .snip-wrap {
    padding: 32px 16px 64px;
  }
  .snip-hero h1 {
    font-size: 28px;
  }
  .snip-hero p.sub {
    font-size: 15.5px;
  }
  .controls {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px 18px;
  }
  .key-row {
    padding: 12px 14px;
  }
  .key-row .key-status .preview {
    max-width: 100%;
  }
  /* Tabs become horizontally scrollable on narrow screens */
  .tab-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    position: static;
    padding: 4px;
  }
  .tab-btn {
    flex: 0 0 auto;
    padding: 10px 14px;
    font-size: 12.5px;
  }
  .snip-meta {
    padding: 12px 16px;
  }
  .code-wrap pre {
    font-size: 12.5px;
    padding: 14px 16px;
  }
  .run-toggle {
    padding: 12px 16px;
  }
  .run-body {
    padding: 12px 16px 18px;
  }
}
@media (max-width: 480px) {
  .snip-hero h1 {
    font-size: 24px;
  }
  .tab-btn .tab-label {
    font-size: 12px;
  }
}
