/**
 * API Documentation Styles
 * Split-pane layout (docs left, code right) matching Readme.io UX.
 * Uses site CSS custom properties for light/dark mode support.
 */

/* ========================================================================
   0. Split-Pane Layout (Readme.io style)
   ======================================================================== */

/* page-layout is now full-width globally — no max-width override needed */

.api-split-layout {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: transparent;
  overflow: visible;
}

.api-docs-pane {
  padding: 1.5rem 2rem;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
  min-width: 0;
  overflow-x: auto;
}

.api-code-pane {
  background: #1b1f2e;
  color: #e2e8f0;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.5rem 1.25rem;
  position: sticky;
  top: 65px;
  max-height: calc(100vh - 65px);
  overflow-y: auto;
  align-self: start;
}

/* Endpoint banner: no extra box border inside the docs pane */
.api-docs-pane .api-endpoint-banner {
  border: none;
  box-shadow: none;
  background: var(--accent);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

/* Hide breadcrumb on API reference split pages */
.api-reference-page .nav-bar .breadcrumb {
  display: none;
}

/* Right pane scrollbar */
.api-code-pane::-webkit-scrollbar { width: 6px; }
.api-code-pane::-webkit-scrollbar-track { background: transparent; }
.api-code-pane::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
.api-code-pane::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* Section labels in right pane */
.api-pane-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8892a4;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-pane-section-label .api-creds-type {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #636d83;
}

.api-pane-section-label .api-creds-type svg {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}

/* Responsive: stack on smaller screens */
@media (max-width: 1100px) {
  .api-split-layout {
    grid-template-columns: 1fr;
  }
  .api-docs-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .api-code-pane {
    position: static;
    max-height: none;
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

/* ========================================================================
   1. API Endpoint Banner
   ======================================================================== */

.api-endpoint-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow-x: auto;
}

@media (max-width: 600px) {
  .api-endpoint-banner {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
}

/* ========================================================================
   2. HTTP Method Badges
   ======================================================================== */

.api-method {
  display: inline-block;
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.api-method-get { background: #22c55e; color: #fff; }
.api-method-post { background: #3b82f6; color: #fff; }
.api-method-put { background: #f59e0b; color: #fff; }
.api-method-patch { background: #a855f7; color: #fff; }
.api-method-delete { background: #ef4444; color: #fff; }

/* ========================================================================
   3. API Path
   ======================================================================== */

.api-path {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  color: var(--text);
  flex-grow: 1;
  user-select: all;
  word-break: break-all;
  line-height: 1.5;
}

.api-path .api-path-param {
  color: var(--primary);
  font-weight: 600;
}

/* ========================================================================
   4. Copy Button
   ======================================================================== */

.api-copy-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.api-copy-btn:hover { background: var(--accent); color: var(--text); }
.api-copy-btn:active { transform: scale(0.95); }
.api-copy-btn svg { width: 18px; height: 18px; }

.api-copy-btn .api-copy-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.api-copy-btn .api-copy-tooltip.visible { opacity: 1; }

.api-copy-btn .api-copy-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--primary);
}

/* ========================================================================
   5. Credentials Section (in right pane)
   ======================================================================== */

.api-creds-section {
  margin-bottom: 14px;
  padding-bottom: 0;
  border-bottom: none;
}

.api-creds-section .api-pane-section-label {
  margin-bottom: 6px;
}

.api-creds-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 6px 10px;
}

.api-creds-label {
  font-size: 12px;
  font-weight: 600;
  color: #8892a4;
  white-space: nowrap;
  min-width: 50px;
}

.api-creds-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #c7cdd8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  outline: none;
  padding: 4px 0;
}

.api-creds-input::placeholder {
  color: #636d83;
}

.api-creds-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #636d83;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.api-creds-lock:hover { color: #8892a4; background: rgba(255,255,255,0.06); }

/* ========================================================================
   6. Code Tabs (in right pane — dark theme)
   ======================================================================== */

.api-code-pane .api-code-tabs {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0;
  background: #141824;
}

.api-code-pane .api-code-tab-bar {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  gap: 0;
  padding: 0;
}

/* Hide scrollbar on tab bar */
.api-code-pane .api-code-tab-bar::-webkit-scrollbar { display: none; }
.api-code-pane .api-code-tab-bar { -ms-overflow-style: none; scrollbar-width: none; }

.api-code-pane .api-code-tab-bar button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: #8892a4;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
}

.api-code-pane .api-code-tab-bar button svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.api-code-pane .api-code-tab-bar button:hover { color: #c7cdd8; }

.api-code-pane .api-code-tab-bar button:focus {
  outline: none;
}

.api-code-pane .api-code-tab-bar button.active {
  color: #fff;
  font-weight: 600;
  background: transparent;
}

.api-code-pane .api-code-tab-bar button.active svg { opacity: 1; }

.api-code-pane .api-code-tab-bar button.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #fff;
  border-radius: 2px 2px 0 0;
}

.api-code-pane .api-code-tab-panel {
  display: none;
  padding: 0;
}

.api-code-pane .api-code-tab-panel.active {
  display: block;
}

.api-code-pane .api-code-tab-panel pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
  background: #141824;
  color: #c7cdd8;
  min-height: 60px;
}

/* Background matches pre so no gap visible when scrolling */
.api-code-pane .api-code-tab-panel {
  background: #141824;
}

/* Dark scrollbar for code blocks */
.api-code-pane .api-code-tab-panel pre::-webkit-scrollbar { height: 8px; }
.api-code-pane .api-code-tab-panel pre::-webkit-scrollbar-track { background: #141824; }
.api-code-pane .api-code-tab-panel pre::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.api-code-pane .api-code-tab-panel pre::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }
.api-code-pane .api-code-tab-panel pre { scrollbar-color: rgba(255,255,255,0.2) #141824; }

.api-code-pane .api-code-tab-panel code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  counter-reset: line;
}

/* Fallback: code tabs outside right pane (regular article pages) */
.api-code-tabs {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  background: var(--bg-card);
}

.api-code-tab-bar {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--accent);
  gap: 0;
}

.api-code-tab-bar button {
  position: relative;
  padding: 10px 18px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
}

.api-code-tab-bar button:hover { color: var(--text); }
.api-code-tab-bar button.active { color: var(--primary); font-weight: 600; }

.api-code-tab-bar button.active::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.api-code-tab-panel { display: none; padding: 0; }
.api-code-tab-panel.active { display: block; }

.api-code-tab-panel pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg-card);
  color: var(--text);
}

.api-code-tab-panel code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ========================================================================
   7. Line Numbers
   ======================================================================== */

.api-line {
  counter-increment: line;
}

.api-line::before {
  content: counter(line);
  display: inline-block;
  width: 2.5ch;
  margin-right: 1em;
  text-align: right;
  color: #4a5568;
  user-select: none;
  font-size: 12px;
}

/* Code block container — override global dark mode code background */
.api-code-pane .api-code-tab-panel code,
html.dark .api-code-pane .api-code-tab-panel code {
  display: block;
  padding: 0;
  background: transparent;
}

/* ========================================================================
   8. Syntax Highlighting (right pane)
   ======================================================================== */

.syn-keyword  { color: #c792ea; }  /* purple — keywords */
.syn-string   { color: #ecc48d; }  /* orange — strings */
.syn-flag     { color: #82aaff; }  /* blue — flags like --request */
.syn-method   { color: #c3e88d; }  /* green — HTTP methods */
.syn-url      { color: #89ddff; }  /* cyan — URLs */
.syn-comment  { color: #546e7a; }  /* gray — comments */
.syn-number   { color: #f78c6c; }  /* orange-red — numbers */
.syn-bool     { color: #ff5370; }  /* red — booleans */
.syn-null     { color: #546e7a; }  /* gray — null */
.syn-key      { color: #82aaff; }  /* blue — JSON keys */
.syn-curl     { color: #c3e88d; }  /* green — curl command */
.syn-continuation { color: #546e7a; } /* gray — line continuations \ */

/* ========================================================================
   9. Code Footer (Copy + Try It buttons)
   ======================================================================== */

.api-code-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: #141824;
  border-radius: 0 0 8px 8px;
}

.api-code-footer .api-code-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: #8892a4;
  font-size: 12px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
}

.api-code-footer .api-code-copy-btn:hover {
  color: #c7cdd8;
  background: rgba(255,255,255,0.06);
}

.api-code-footer .api-code-copy-btn svg {
  width: 14px;
  height: 14px;
}

.api-tryit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #22c55e;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.api-tryit-btn:hover { background: #16a34a; }

/* ========================================================================
   10. Try It Form (in right pane)
   ======================================================================== */

/* Legacy form styles removed — Try It now uses editable code blocks directly */

/* Hide try-it mount when empty */
#api-tryit-mount:empty {
  display: none;
}

/* Editable code block styling */
.api-code-pane .api-code-tab-panel pre[contenteditable="true"] {
  cursor: text;
  border: 1px solid transparent;
  transition: border-color 0.15s;
}

.api-code-pane .api-code-tab-panel pre[contenteditable="true"]:focus {
  border-color: rgba(255,255,255,0.15);
  outline: none;
}

/* Try It loading spinner in button */
.api-tryit-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: api-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

.api-tryit-group {
  margin-bottom: 14px;
}

.api-tryit-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8892a4;
  margin-bottom: 8px;
}

.api-tryit-field {
  margin-bottom: 8px;
}

.api-tryit-field-label {
  display: block;
  font-size: 12px;
  color: #8892a4;
  margin-bottom: 3px;
}

.api-tryit-field-required {
  color: #ef4444;
  margin-left: 2px;
}

.api-tryit-field-input {
  width: 100%;
  padding: 7px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  color: #c7cdd8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.api-tryit-field-input:focus {
  border-color: rgba(255,255,255,0.25);
}

.api-tryit-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 5px;
  color: #c7cdd8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  box-sizing: border-box;
  resize: vertical;
  outline: none;
  tab-size: 2;
}

.api-tryit-textarea:focus {
  border-color: rgba(255,255,255,0.25);
}

.api-tryit-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--primary, #2563eb);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  margin-top: 10px;
}

.api-tryit-send-btn:hover { opacity: 0.9; }
.api-tryit-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Spinner */
.api-tryit-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: api-spin 0.6s linear infinite;
}

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

/* Response area */
.api-tryit-response {
  margin-top: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  overflow: hidden;
}

.api-tryit-status {
  padding: 6px 10px;
  font-weight: 600;
  font-size: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.api-tryit-status--ok { background: rgba(34,197,94,0.15); color: #4ade80; }
.api-tryit-status--warn { background: rgba(245,158,11,0.15); color: #fbbf24; }
.api-tryit-status--error { background: rgba(239,68,68,0.15); color: #f87171; }

.api-tryit-response-body {
  margin: 0;
  padding: 12px;
  background: rgba(0,0,0,0.2);
  color: #c7cdd8;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* Response preview label */
.api-response-preview {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.api-response-preview .api-pane-section-label {
  margin-bottom: 8px;
}

.api-response-preview pre {
  margin: 0;
  padding: 12px;
  background: #141824;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  color: #c7cdd8;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  max-height: 300px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* Recent Requests link */
.api-recent-requests {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
  color: #636d83;
}

.api-recent-requests a {
  color: #82aaff;
}

/* ========================================================================
   11. Parameter Tables Enhancement
   ======================================================================== */

.required-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  vertical-align: middle;
  line-height: 1;
}

html.dark .required-badge {
  background: rgba(239, 68, 68, 0.15);
}

.type-badge {
  display: inline-block;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  background: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1.4;
}

.api-param-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 24px;
}

.api-param-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  background: var(--accent);
}

.api-param-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

.api-param-table tr:last-child td { border-bottom: none; }

.api-param-table .api-param-name {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.api-param-table .api-param-desc {
  color: var(--text-light);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.5;
}

/* ========================================================================
   12. Response Tabs (200, 400, 404, 500) — left pane
   ======================================================================== */

.api-response-tabs {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  background: var(--bg-card);
}

.api-response-tabs-bar {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--accent);
  gap: 0;
}

.api-response-tabs-bar button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  white-space: nowrap;
}

.api-response-tabs-bar button:hover { color: var(--text); }
.api-response-tabs-bar button.active { color: var(--text); font-weight: 600; }

.api-response-tabs-bar button.active::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.api-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  line-height: 1.3;
}

.api-status-2xx { background: rgba(34,197,94,0.15); color: #16a34a; }
.api-status-4xx { background: rgba(245,158,11,0.15); color: #d97706; }
.api-status-5xx { background: rgba(239,68,68,0.15); color: #dc2626; }

html.dark .api-status-2xx { background: rgba(34,197,94,0.12); color: #4ade80; }
html.dark .api-status-4xx { background: rgba(245,158,11,0.12); color: #fbbf24; }
html.dark .api-status-5xx { background: rgba(239,68,68,0.12); color: #f87171; }

.api-response-tab-panel { display: none; }
.api-response-tab-panel.active { display: block; }

.api-response-tab-panel pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.6;
  background: var(--bg-card);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* ========================================================================
   13. Try It Slide-Over Panel
   ======================================================================== */

/* Backdrop overlay */
.api-tryit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 1000;
  transition: background 0.25s ease;
}

.api-tryit-overlay.open {
  background: rgba(0, 0, 0, 0.45);
}

/* Slide-in panel */
.api-tryit-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 460px;
  max-width: 90vw;
  height: 100vh;
  background: #1b1f2e;
  color: #e2e8f0;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.api-tryit-panel.open {
  transform: translateX(0);
}

/* Panel header */
.api-tryit-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.api-tryit-panel-url {
  flex: 1;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  color: #8892a4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-tryit-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #8892a4;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
}

.api-tryit-panel-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Panel body — scrollable */
.api-tryit-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 300px;
}

.api-tryit-panel-body::-webkit-scrollbar { width: 6px; }
.api-tryit-panel-body::-webkit-scrollbar-track { background: transparent; }
.api-tryit-panel-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

/* Form groups */
.api-tryit-panel-group {
  margin-bottom: 18px;
}

.api-tryit-panel-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8892a4;
  margin-bottom: 8px;
}

/* Form fields */
.api-tryit-panel-field {
  margin-bottom: 10px;
}

.api-tryit-panel-field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #c7cdd8;
  margin-bottom: 4px;
}

.api-tryit-panel-required {
  color: #ef4444;
  font-weight: 700;
}

.api-tryit-panel-field-type {
  font-size: 11px;
  font-weight: 400;
  color: #636d83;
  margin-left: 4px;
}

.api-tryit-panel-field-input {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #e2e8f0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.api-tryit-panel-field-input:focus {
  border-color: rgba(255, 255, 255, 0.25);
}

.api-tryit-panel-field-input::placeholder {
  color: #4a5568;
  font-family: inherit;
  font-size: 12px;
}

/* Body textarea */
.api-tryit-panel-textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #e2e8f0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  box-sizing: border-box;
  resize: vertical;
  outline: none;
  tab-size: 2;
}

.api-tryit-panel-textarea:focus {
  border-color: rgba(255, 255, 255, 0.25);
}

/* Sticky footer with send button */
.api-tryit-panel-footer {
  flex-shrink: 0;
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #1b1f2e;
  display: flex;
  justify-content: flex-start;
}

.api-tryit-panel-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--primary, #2563eb);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.api-tryit-panel-send:hover {
  opacity: 0.9;
}

.api-tryit-panel-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


/* Response area inside panel */
.api-tryit-panel-response:empty {
  display: none;
}

.api-tryit-panel-response {
  margin-top: 16px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.api-tryit-panel-response .api-tryit-status {
  padding: 8px 12px;
  font-weight: 600;
  font-size: 12px;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.api-tryit-panel-response .api-tryit-response-body {
  margin: 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  color: #c7cdd8;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  font-family: "SFMono-Regular", Consolas, monospace;
}

/* Mobile: full-width panel */
@media (max-width: 500px) {
  .api-tryit-panel {
    width: 100vw;
    max-width: none;
  }
}
