/* ── Layout ────────────────────────────────────────────────────────────────── */
.demo-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

@media (max-width: 800px) {
  .demo-layout { grid-template-columns: 1fr; }
  .demo-sidebar { position: static !important; }
}

.demo-sidebar { min-width: 0; }
.demo-main    { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ── Endpoint card ─────────────────────────────────────────────────────────── */
.ep-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.ep-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.ep-method {
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.ep-method.get    { background: #e8f5e9; color: #2e7d32; }
.ep-method.post   { background: #e3f2fd; color: #1565c0; }
.ep-method.delete { background: #fce4ec; color: #c62828; }

.ep-path {
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

.ep-badge {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 7px;
  border-radius: 10px;
}
.ep-badge.public { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }

.ep-desc {
  font-size: .8rem;
  color: var(--muted);
  margin-left: auto;
}

.ep-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Form ──────────────────────────────────────────────────────────────────── */
.ep-form     { display: flex; flex-direction: column; gap: 10px; }
.ep-form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.ep-form-row .ep-field { flex: 1; min-width: 200px; }

.ep-field { display: flex; flex-direction: column; gap: 4px; }
.ep-field label { font-size: .75rem; font-weight: 600; color: var(--text); }
.ep-field .req  { color: var(--danger); }

/* ── Actions ───────────────────────────────────────────────────────────────── */
.ep-actions { display: flex; gap: 8px; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-danger:hover { opacity: .85; }
.btn-danger:active { opacity: .7; }

/* ── curl box ──────────────────────────────────────────────────────────────── */
.ep-curl-wrap {
  background: #1e1e2e;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ep-curl-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  font-size: .7rem;
  color: rgba(255,255,255,.5);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.ep-curl-label .copy-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,.25);
  color: rgba(255,255,255,.6);
  font-size: .7rem;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.ep-curl-label .copy-btn:hover { color: #fff; border-color: rgba(255,255,255,.6); }
.ep-curl-label .copy-btn.copied { color: #69db7c; border-color: #69db7c; }

.ep-curl {
  margin: 0;
  padding: 12px;
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: .75rem;
  color: #cdd6f4;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 40px;
}

/* ── Response box ──────────────────────────────────────────────────────────── */
.ep-response { display: flex; flex-direction: column; gap: 0; }
.ep-response.hidden { display: none; }

.ep-resp-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: .75rem;
  color: var(--muted);
}
.ep-resp-meta .status-2xx { color: var(--success); font-weight: 700; }
.ep-resp-meta .status-4xx { color: var(--danger);  font-weight: 700; }
.ep-resp-meta .status-5xx { color: var(--danger);  font-weight: 700; }
.ep-resp-meta .resp-time   { margin-left: auto; }

.ep-resp-body {
  margin: 0;
  padding: 12px;
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: .75rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow-y: auto;
}
.ep-resp-body .json-key     { color: var(--primary); }
.ep-resp-body .json-str     { color: #2e7d32; }
.ep-resp-body .json-num     { color: #7b1fa2; }
.ep-resp-body .json-bool    { color: #e65100; }
.ep-resp-body .json-null    { color: var(--muted); }

/* ── Mini CaptureBox inside playground ─────────────────────────────────────── */
.ep-capture .capture-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  background: var(--surface2);
  min-height: 60px;
}

/* ── Sidebar extras ────────────────────────────────────────────────────────── */
.field-label { font-size: .8rem; font-weight: 600; color: var(--text); display: block; margin-bottom: 4px; }
.field-hint  { font-size: .72rem; color: var(--muted); margin: 4px 0 0; }
.field-hint code { background: var(--surface2); border-radius: 3px; padding: 1px 4px; font-family: var(--mono,monospace); }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
