/* API explorer and API key cards (Lib/api_explorer_view.php, Lib/api_auth_view.php).
   Page, cards, rows, labels and code blocks are the reference page components in
   Theme/css/bootstrap5-theme.css. Dark through data-bs-theme="dark". */


.api-page { --ref-width: 1150px; }
:is(.api-page, .api-explorer) a:not(.btn) { color: var(--bs-primary); text-decoration: none; font-weight: bold; }
:is(.api-page, .api-explorer) a:not(.btn):hover { text-decoration: underline; }

.ref-code .hl { color: var(--bs-emphasis-color); font-weight: bold; }
.ref-code .key { color: var(--bs-primary); }

.ref-filter { width: 300px; }

/* Header, then sidebar and endpoints. Title is smaller on the standalone reference. */
.api-sections { gap: 28px; }
#reference { scroll-margin-top: 60px; }
.ref-head h2.api-title-sm { font-size: 20px; line-height: 28px; }

/* Sidebar of groups beside the endpoint list */
.ref-layout { display: flex; gap: 28px; align-items: flex-start; }
.ref-sidebar {
  position: sticky;
  top: 60px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 22px;
  width: 250px;
  font-size: 14px;
}
.api-nav-module { gap: 2px; }
.ref-sidebar .group-link { padding: 7px 12px; border-radius: 6px; cursor: pointer; }
.ref-sidebar .group-link:hover { background-color: var(--bs-secondary-bg); color: var(--bs-emphasis-color); }
.ref-sidebar .group-link.active { font-weight: bold; color: var(--bs-emphasis-color); background-color: var(--bs-primary-bg-subtle); }
.ref-legend { display: flex; flex-direction: column; gap: 8px; padding: 16px 12px 0; border-top: 1px solid var(--bs-border-color); }

.ref-main { display: flex; flex-direction: column; flex-grow: 1; gap: 12px; min-width: 0; }
.ref-group-heading { margin-top: 16px; scroll-margin-top: 60px; }
.ref-group-heading:first-child { margin-top: 0; }

/* Endpoint: row, then parameters, request and response when open */
.api-method { width: 54px; }   /* GET and POST badges line up */
.endpoint-row .path { font-size: 14px; color: var(--bs-emphasis-color); }
.endpoint-row .desc { flex-grow: 1; min-width: 0; font-size: 14px; color: var(--bs-secondary-color); }
.endpoint-row .chevron { flex-shrink: 0; color: var(--bs-secondary-color); transition: transform 0.15s ease-out; }
.card.open .chevron { transform: rotate(180deg); }
.endpoint-body { display: flex; flex-direction: column; gap: 18px; padding: 20px; }
.endpoint-notes {
  margin: 0;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 20px;
  color: var(--bs-secondary-color);
  background-color: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
}

.param-table { display: flex; flex-direction: column; }
.param-row {
  display: grid;
  grid-template-columns: 130px 190px 1fr;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--bs-border-color);
}
.param-row:last-child { border-bottom: none; }
.param-row.param-head { padding: 8px 0; }
.param-row.param-head span,
.req-label { font-size: 12px; font-weight: bold; letter-spacing: 0.5px; color: var(--bs-secondary-color); }
.param-name { font-size: 13px; color: var(--bs-emphasis-color); word-break: break-all; }
.param-desc { font-size: 13px; line-height: 19px; }

.request-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.request-buttons { display: flex; gap: 8px; }

.response-block { max-height: 300px; overflow-y: auto; white-space: pre-wrap; color: var(--bs-info-text-emphasis); }

/* API key and authentication cards */
.api-auth-card p { margin: 0; font-size: 15px; line-height: 22px; }
.api-auth-card p strong { color: var(--bs-emphasis-color); }
.api-key-field { gap: 6px; }
.api-auth-rows { gap: 10px; }
.api-auth-row { display: flex; align-items: center; gap: 12px; }
.api-auth-tag { width: 116px; }
.api-auth-mono { font-size: 13px; }
.api-auth-mono .hl { color: var(--bs-emphasis-color); }

@media (max-width: 900px) {
  .ref-layout { flex-direction: column; }
  .ref-sidebar { position: static; width: 100%; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .ref-sidebar .ref-label { width: 100%; }
  .ref-sidebar .group-link { border: 1px solid var(--bs-border-color); }
  .ref-legend { display: none; }
  .param-row { grid-template-columns: 110px 1fr; }
  .param-row .param-desc { grid-column: 1 / -1; }
}
