/* ─────────────────────────────────────────────────────────────
   VirtuVerse Examples — shared shell styles
   ───────────────────────────────────────────────────────────── */

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

body {
  font-family: system-ui, sans-serif;
  background: #0b0b0f;
  color: #eee;
  margin: 0;
  min-height: 100vh;
}

a { color: #e94560; }

/* ── Header ─────────────────────────────────────────────────── */

.ex-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: #0f0f15;
}

.ex-back {
  font-size: 0.82rem;
  color: #555;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s;
}
.ex-back:hover { color: #eee; }

.ex-header-title {
  font-size: 1rem;
  font-weight: 700;
  color: #eee;
  margin: 0;
}

.ex-header-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #e94560;
  background: rgba(233,69,96,0.1);
  border: 1px solid rgba(233,69,96,0.2);
  border-radius: 4px;
  padding: 2px 7px;
  text-transform: uppercase;
}

/* ── No-key warning ─────────────────────────────────────────── */

.ex-no-key {
  margin: 16px 28px 0;
  padding: 12px 16px;
  background: rgba(233,69,96,0.08);
  border: 1px solid rgba(233,69,96,0.25);
  border-radius: 8px;
  font-size: 0.83rem;
  color: #e94560;
  line-height: 1.5;
}
.ex-no-key.hidden { display: none; }

/* ── Two-column layout ──────────────────────────────────────── */

.ex-body {
  display: flex;
  gap: 0;
  height: 100vh;
  overflow: hidden;
}

/* ── Left panel (controls) ──────────────────────────────────── */

.ex-panel {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.06);
  background: #0f0f15;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ex-panel h3 {
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #e94560;
}

.ex-panel label.field-label {
  font-size: 0.75rem;
  color: #666;
  display: block;
  margin-bottom: 4px;
}

.ex-panel input,
.ex-panel select {
  width: 100%;
  padding: 7px 10px;
  background: #1a1a22;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: #eee;
  font-size: 0.85rem;
  outline: none;
}
.ex-panel input:focus,
.ex-panel select:focus { border-color: #e94560; }

/* Toggle row */
.ex-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #888;
}

.ex-toggle {
  position: relative;
  width: 34px;
  height: 19px;
  flex-shrink: 0;
}
.ex-toggle input { opacity: 0; width: 0; height: 0; }
.ex-toggle-track {
  position: absolute;
  inset: 0;
  background: #222;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid rgba(255,255,255,0.06);
}
.ex-toggle input:checked + .ex-toggle-track { background: #e94560; border-color: #e94560; }
.ex-toggle-track::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.ex-toggle input:checked + .ex-toggle-track::after { transform: translateX(15px); }

/* Buttons */
.ex-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, border-color 0.15s;
  text-align: center;
  background: #1a1a22;
  color: #aaa;
}
.ex-btn:hover { opacity: 0.85; border-color: rgba(255,255,255,0.15); }
.ex-btn:active { opacity: 0.7; }
.ex-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.ex-btn--primary { background: #e94560; color: #fff; border-color: #e94560; }
.ex-btn--ghost   { background: transparent; }

/* Divider */
.ex-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.05);
  margin: 2px 0;
}

/* Event log */
.ex-log {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ex-log-entry {
  font-size: 0.72rem;
  font-family: monospace;
  line-height: 1.45;
  padding: 6px 8px;
  border-radius: 5px;
  background: #111118;
  border: 1px solid rgba(255,255,255,0.05);
  word-break: break-all;
  color: #666;
}
.ex-log-entry.ok   { color: #50c878; border-color: rgba(80,200,120,0.2); }
.ex-log-entry.err  { color: #e94560; border-color: rgba(233,69,96,0.2); }
.ex-log-thumb {
  display: block;
  width: 100%;
  max-height: 72px;
  object-fit: cover;
  border-radius: 3px;
  margin-top: 5px;
}

/* ── Right side (tabs + content) ────────────────────────────── */

.ex-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ex-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: #0f0f15;
  padding: 0 24px;
  flex-shrink: 0;
}

.ex-tab {
  padding: 12px 18px;
  font-size: 0.83rem;
  font-weight: 600;
  color: #555;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.ex-tab:hover { color: #aaa; }
.ex-tab.active { color: #eee; border-bottom-color: #e94560; }

.ex-tab-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}
.ex-tab-panel.active { display: block; }

/* ── Code tab ───────────────────────────────────────────────── */

.ex-code-section + .ex-code-section { margin-top: 28px; }
.ex-code-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 8px;
}

pre.ex-pre {
  margin: 0;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
  background: #111118 !important;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 16px 20px;
}
pre.ex-pre code {
  font-family: 'Fira Code', 'Cascadia Code', 'Menlo', monospace;
  background: none !important;
}

/* ── Options tab ────────────────────────────────────────────── */

.ex-options-intro {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 20px;
  line-height: 1.6;
}

.ex-options-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.ex-options-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #555;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ex-options-table td {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #aaa;
  line-height: 1.5;
}
.ex-options-table tr:last-child td { border-bottom: none; }
.ex-options-table tr:hover td { background: rgba(255,255,255,0.02); }

.ex-opt-name {
  font-family: monospace;
  color: #eee;
  white-space: nowrap;
}
.ex-opt-type {
  font-family: monospace;
  color: #e94560;
  white-space: nowrap;
}
.ex-opt-default {
  font-family: monospace;
  color: #f5a623;
  white-space: nowrap;
}

/* ── Events tab ─────────────────────────────────────────────── */

.ex-events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.ex-events-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #555;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ex-events-table td {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #aaa;
  line-height: 1.5;
}
.ex-events-table tr:last-child td { border-bottom: none; }
.ex-events-table tr:hover td { background: rgba(255,255,255,0.02); }
.ex-evt-name { font-family: monospace; color: #eee; }
.ex-evt-payload { font-family: monospace; color: #f5a623; font-size: 0.78rem; }

/* ── API Explorer ───────────────────────────────────────────── */

.api-key-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: #0f0f15;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 12px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.api-key-bar label { font-size: 0.78rem; color: #555; white-space: nowrap; }
.api-key-bar input {
  width: 300px;
  padding: 7px 11px;
  background: #111118;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  color: #eee;
  font-size: 0.83rem;
  font-family: monospace;
  outline: none;
}
.api-key-bar input:focus { border-color: #e94560; }
.api-key-bar .hint { font-size: 0.75rem; color: #444; }
.api-key-bar .hint a { color: #e94560; text-decoration: none; }

.api-explorer {
  padding: 32px 28px;
  max-width: 860px;
}

.api-group { margin-bottom: 40px; }

.api-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.api-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.api-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #aaa;
}

/* Endpoint card */
.api-endpoint {
  background: #0f0f15;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.api-endpoint.open { border-color: rgba(255,255,255,0.1); }

.api-endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.api-endpoint-header:hover { background: rgba(255,255,255,0.02); }
.api-endpoint.open .api-endpoint-header { background: rgba(255,255,255,0.02); }

.api-method {
  font-family: monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  min-width: 58px;
  text-align: center;
  flex-shrink: 0;
}
.api-method--GET    { background: rgba(74,222,128,0.1);  color: #4ade80; border: 1px solid rgba(74,222,128,0.25); }
.api-method--POST   { background: rgba(96,165,250,0.1);  color: #60a5fa; border: 1px solid rgba(96,165,250,0.25); }
.api-method--DELETE { background: rgba(233,69,96,0.1);   color: #e94560; border: 1px solid rgba(233,69,96,0.25); }
.api-method--PATCH  { background: rgba(251,191,36,0.1);  color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }

.api-path {
  font-family: monospace;
  font-size: 0.85rem;
  color: #ddd;
  flex-shrink: 0;
}

.api-endpoint-desc {
  font-size: 0.78rem;
  color: #555;
  flex: 1;
  line-height: 1.4;
}

.api-chevron {
  color: #444;
  font-size: 0.65rem;
  transition: transform 0.2s;
  margin-left: auto;
  flex-shrink: 0;
}
.api-endpoint.open .api-chevron { transform: rotate(90deg); }

/* Body (expanded) */
.api-endpoint-body {
  display: none;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding: 18px 20px 20px;
}
.api-endpoint.open .api-endpoint-body { display: block; }

.api-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #444;
  margin: 0 0 10px;
}

/* Parameter row */
.api-field {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: start;
  gap: 6px 14px;
  margin-bottom: 10px;
}
.api-field-meta { padding-top: 7px; }
.api-field-name {
  font-family: monospace;
  font-size: 0.82rem;
  color: #eee;
  display: block;
}
.api-field-req  { font-size: 0.62rem; font-weight: 700; color: #e94560; letter-spacing: 0.04em; }
.api-field-opt  { font-size: 0.62rem; color: #444; }
.api-field-hint { font-size: 0.71rem; color: #555; margin-top: 2px; line-height: 1.4; }

.api-field input[type="text"],
.api-field input[type="number"] {
  width: 100%;
  padding: 7px 10px;
  background: #111118;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  color: #eee;
  font-size: 0.83rem;
  font-family: monospace;
  outline: none;
}
.api-field input[type="text"]:focus,
.api-field input[type="number"]:focus { border-color: rgba(233,69,96,0.6); }
.api-field input[type="file"] {
  width: 100%;
  padding: 6px 10px;
  background: #111118;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  color: #666;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.api-send-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.api-send-btn {
  padding: 8px 22px;
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.api-send-btn:hover { opacity: 0.85; }
.api-send-btn:active { opacity: 0.7; }
.api-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.api-clear-btn {
  padding: 8px 14px;
  background: none;
  color: #555;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.api-clear-btn:hover { color: #aaa; border-color: rgba(255,255,255,0.15); }

/* Response panel */
.api-response {
  margin-top: 14px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  display: none;
}
.api-response.visible { display: block; }

.api-response-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: #111118;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.73rem;
}

.api-status {
  font-family: monospace;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
}
.api-status--2xx { background: rgba(74,222,128,0.1);  color: #4ade80;  border: 1px solid rgba(74,222,128,0.2); }
.api-status--3xx { background: rgba(96,165,250,0.1);  color: #60a5fa;  border: 1px solid rgba(96,165,250,0.2); }
.api-status--4xx { background: rgba(233,69,96,0.1);   color: #e94560;  border: 1px solid rgba(233,69,96,0.2); }
.api-status--5xx { background: rgba(251,191,36,0.1);  color: #fbbf24;  border: 1px solid rgba(251,191,36,0.2); }

.api-response-time { color: #444; font-family: monospace; font-size: 0.7rem; margin-left: auto; }

.api-response-body {
  padding: 14px 16px;
  font-family: 'Fira Code', 'Cascadia Code', 'Menlo', monospace;
  font-size: 0.77rem;
  line-height: 1.65;
  color: #aaa;
  background: #0b0b0f;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre;
  word-break: break-all;
}

/* JSON syntax colouring */
.api-json-key    { color: #60a5fa; }
.api-json-str    { color: #4ade80; }
.api-json-num    { color: #f5a623; }
.api-json-bool   { color: #e94560; }
.api-json-null   { color: #888; }
