/**
 * APDB API Reference Page Styles
 *
 * 3-column layout: sidebar nav | documentation | code examples
 * Uses theme CSS custom properties from style.css (:root).
 */

/* ----------------------------------------------------------------
   Container — 3-column grid
   ---------------------------------------------------------------- */

.apdb-api-ref {
	display: grid;
	grid-template-columns: 220px 1fr;
	gap: 0;
	max-width: 1600px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 14px;
	line-height: 1.6;
	color: var(--text-primary, #2c2c48);
}

/* ----------------------------------------------------------------
   Sidebar navigation
   ---------------------------------------------------------------- */

.apdb-api-ref__nav {
	position: sticky;
	top: var(--header-height, 50px);
	align-self: start;
	border-right: 1px solid var(--border-light, #d4d4d4);
	padding: 24px 0 24px 0;
	background: var(--bg-secondary, #fafafa);
}

.apdb-api-ref__nav-toggle {
	display: none;
}

.apdb-api-ref__nav-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.apdb-api-ref__nav-group {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--border-light, #d4d4d4);
}

.apdb-api-ref__nav-link {
	display: block;
	padding: 4px 16px;
	color: var(--text-secondary, #404040);
	text-decoration: none;
	font-size: 13px;
	border-left: 3px solid transparent;
	transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.apdb-api-ref__nav-heading {
	padding: 8px 16px 8px 12px;
	margin: 24px 10px 4px;
	border-left: 3px solid var(--text-primary, #2c2c48);
	border-radius: 2px;
	background: var(--bg-tertiary, #f5f5f5);
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-primary, #2c2c48);
}

.apdb-api-ref__nav-link:hover {
	background: var(--bg-tertiary, #f5f5f5);
	color: var(--text-primary, #2c2c48);
}

.apdb-api-ref__nav-link--active {
	border-left-color: var(--primary, #1a1a2e);
	color: var(--primary, #1a1a2e);
	font-weight: 600;
	background: var(--bg-tertiary, #f5f5f5);
}

.apdb-api-ref__nav-link--section {
	font-weight: 500;
	color: var(--text-primary, #2c2c48);
	padding: 6px 16px;
}

.apdb-api-ref__nav-link--group {
	font-weight: 600;
	color: var(--text-primary, #2c2c48);
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	padding: 6px 16px 4px;
}

.apdb-api-ref__nav-link--endpoint {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	padding: 3px 16px 3px 20px;
}

/* ----------------------------------------------------------------
   Method badges
   ---------------------------------------------------------------- */

.apdb-api-ref__method-badge {
	display: inline-block;
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 700;
	font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	line-height: 1.4;
	text-transform: uppercase;
	flex-shrink: 0;
}

.apdb-api-ref__method-badge--large {
	padding: 2px 8px;
	font-size: 12px;
}

.apdb-api-ref__method-badge--get {
	background: #e8f5e9;
	color: #2e7d32;
}

.apdb-api-ref__method-badge--post {
	background: #e3f2fd;
	color: #1565c0;
}

.apdb-api-ref__method-badge--put {
	background: #fff3e0;
	color: #e65100;
}

.apdb-api-ref__method-badge--delete {
	background: #fce4ec;
	color: #c62828;
}

/* ----------------------------------------------------------------
   Main content area
   ---------------------------------------------------------------- */

.apdb-api-ref__content {
	min-width: 0;
}

.apdb-api-ref__header {
	padding: 40px 40px 32px;
	border-bottom: 1px solid var(--border-light, #d4d4d4);
}

.apdb-api-ref__header h1 {
	margin: 0 0 4px;
	font-size: 28px;
	color: var(--text-primary, #2c2c48);
}

.apdb-api-ref__version {
	display: inline-block;
	padding: 2px 8px;
	background: var(--bg-tertiary, #f5f5f5);
	border-radius: 4px;
	font-size: 12px;
	font-weight: 600;
	color: var(--text-secondary, #404040);
	margin: 0 0 12px;
}

.apdb-api-ref__intro {
	margin: 0;
	color: var(--text-secondary, #404040);
	max-width: 700px;
}

.apdb-api-ref__intro code {
	background: var(--bg-tertiary, #f5f5f5);
	padding: 2px 6px;
	border-radius: 3px;
	font-size: 13px;
}

/* ----------------------------------------------------------------
   Section — 2-column row: docs | code
   ---------------------------------------------------------------- */

.apdb-api-ref__section {
	border-bottom: 1px solid var(--border-light, #d4d4d4);
}

.apdb-api-ref__section-row {
	display: grid;
	grid-template-columns: 1fr minmax(320px, 460px);
	gap: 0;
}

.apdb-api-ref__section-docs {
	padding: 32px 40px;
}

.apdb-api-ref__section-docs h2 {
	margin: 0 0 12px;
	font-size: 22px;
	color: var(--text-primary, #2c2c48);
}

.apdb-api-ref__section-docs h3 {
	margin: 0 0 8px;
	font-size: 16px;
	color: var(--text-primary, #2c2c48);
}

.apdb-api-ref__section-docs h4 {
	margin: 16px 0 8px;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--text-secondary, #404040);
}

.apdb-api-ref__section-docs p {
	margin: 0 0 12px;
	color: var(--text-secondary, #404040);
}

.apdb-api-ref__note {
	font-size: 13px;
	color: var(--text-tertiary, #737373);
}

/* ----------------------------------------------------------------
   Code examples column (dark panel)
   ---------------------------------------------------------------- */

.apdb-api-ref__section-code {
	background: #1e1e2e;
	padding: 32px 24px;
	border-left: 1px solid #2a2a3c;
}

.apdb-api-ref__code-block {
	margin-bottom: 16px;
	border-radius: 6px;
	overflow: hidden;
	background: #13131d;
	border: 1px solid #2a2a3c;
}

.apdb-api-ref__code-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 12px;
	background: #2a2a3c;
	font-size: 12px;
	font-weight: 500;
	color: #a0a0b8;
}

.apdb-api-ref__copy-btn {
	background: transparent;
	border: 1px solid #3a3a4c;
	border-radius: 4px;
	padding: 2px 8px;
	font-size: 11px;
	color: #a0a0b8;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
}

.apdb-api-ref__copy-btn:hover {
	background: #3a3a4c;
	color: #e0e0f0;
}

.apdb-api-ref__copy-btn--copied {
	color: #4ade80;
	border-color: #4ade80;
}

.apdb-api-ref__code {
	margin: 0;
	padding: 12px 16px;
	overflow-x: auto;
	font-size: 12px;
	line-height: 1.5;
	color: #e0e0f0;
	font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	white-space: pre;
}

.apdb-api-ref__code code {
	color: inherit;
	background: none;
	padding: 0;
	font-size: inherit;
}

/* ----------------------------------------------------------------
   Tables
   ---------------------------------------------------------------- */

.apdb-api-ref__table {
	width: 100%;
	border-collapse: collapse;
	margin: 8px 0 16px;
	font-size: 13px;
}

.apdb-api-ref__table th {
	text-align: left;
	padding: 8px 12px;
	font-weight: 600;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--text-secondary, #404040);
	background: var(--bg-tertiary, #f5f5f5);
	border-bottom: 2px solid var(--border-light, #d4d4d4);
}

.apdb-api-ref__table td {
	padding: 8px 12px;
	border-bottom: 1px solid var(--bg-tertiary, #f5f5f5);
	vertical-align: top;
	color: var(--text-secondary, #404040);
}

.apdb-api-ref__table code {
	background: var(--bg-tertiary, #f5f5f5);
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 12px;
	color: var(--text-primary, #2c2c48);
}

.apdb-api-ref__required {
	display: inline-block;
	margin-left: 4px;
	padding: 0 4px;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	color: #c62828;
	background: #fce4ec;
}

.apdb-api-ref__default {
	font-size: 12px;
	color: var(--text-tertiary, #737373);
}

/* ----------------------------------------------------------------
   Endpoint blocks
   ---------------------------------------------------------------- */

.apdb-api-ref__endpoint {
	border-top: 1px solid var(--border-light, #d4d4d4);
}

.apdb-api-ref__endpoint:first-child {
	border-top: none;
}

.apdb-api-ref__endpoint-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
}

.apdb-api-ref__endpoint-path {
	font-size: 15px;
	font-weight: 500;
	color: var(--text-primary, #2c2c48);
	background: none;
	padding: 0;
}

.apdb-api-ref__anchor-link {
	color: var(--text-tertiary, #737373);
	text-decoration: none;
	font-size: 16px;
	opacity: 0;
	transition: opacity 0.15s;
}

.apdb-api-ref__endpoint-header:hover .apdb-api-ref__anchor-link {
	opacity: 1;
}

.apdb-api-ref__endpoint-summary {
	margin: 0 0 4px;
	font-size: 16px;
}

.apdb-api-ref__endpoint-desc {
	margin: 0 0 12px;
}

.apdb-api-ref__access {
	margin: 0 0 16px;
	padding: 8px 12px;
	background: var(--bg-tertiary, #f5f5f5);
	border-radius: 4px;
	font-size: 13px;
	color: var(--text-secondary, #404040);
}

.apdb-api-ref__group-desc {
	margin: 0 0 4px;
	padding: 0 40px 16px;
	color: var(--text-secondary, #404040);
}

/* ----------------------------------------------------------------
   Response status badges
   ---------------------------------------------------------------- */

.apdb-api-ref__response {
	margin-bottom: 8px;
}

.apdb-api-ref__response-status {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
	font-size: 13px;
}

.apdb-api-ref__response-status code {
	font-weight: 700;
}

.apdb-api-ref__status--2xx code {
	color: #2e7d32;
}

.apdb-api-ref__status--4xx code {
	color: #c62828;
}

.apdb-api-ref__status--5xx code {
	color: #e65100;
}

/* ----------------------------------------------------------------
   Responsive: tablet (<1100px) — code moves below docs
   ---------------------------------------------------------------- */

@media (max-width: 1100px) {
	.apdb-api-ref__section-row {
		grid-template-columns: 1fr;
	}

	.apdb-api-ref__section-code {
		border-left: none;
		border-top: 1px solid #2a2a3c;
	}
}

/* ----------------------------------------------------------------
   Responsive: mobile (<769px) — single column, hamburger nav
   ---------------------------------------------------------------- */

@media (max-width: 769px) {
	.apdb-api-ref {
		grid-template-columns: 1fr;
	}

	.apdb-api-ref__nav {
		position: relative;
		top: auto;
		height: auto;
		overflow: visible;
		border-right: none;
		border-bottom: 1px solid var(--border-light, #d4d4d4);
		padding: 0;
	}

	.apdb-api-ref__nav-toggle {
		display: flex;
		align-items: center;
		gap: 8px;
		width: 100%;
		padding: 12px 16px;
		background: var(--bg-secondary, #fafafa);
		border: none;
		border-bottom: 1px solid var(--border-light, #d4d4d4);
		font-size: 14px;
		font-weight: 600;
		color: var(--text-primary, #2c2c48);
		cursor: pointer;
	}

	.apdb-api-ref__nav-toggle-icon {
		display: inline-block;
		width: 18px;
		height: 2px;
		background: currentColor;
		position: relative;
	}

	.apdb-api-ref__nav-toggle-icon::before,
	.apdb-api-ref__nav-toggle-icon::after {
		content: "";
		display: block;
		width: 18px;
		height: 2px;
		background: currentColor;
		position: absolute;
		left: 0;
	}

	.apdb-api-ref__nav-toggle-icon::before {
		top: -6px;
	}

	.apdb-api-ref__nav-toggle-icon::after {
		top: 6px;
	}

	.apdb-api-ref__nav-list {
		display: none;
		padding: 12px 0;
	}

	.apdb-api-ref__nav-list--open {
		display: flex;
	}

	.apdb-api-ref__header {
		padding: 24px 16px 20px;
	}

	.apdb-api-ref__header h1 {
		font-size: 22px;
	}

	.apdb-api-ref__section-docs {
		padding: 24px 16px;
	}

	.apdb-api-ref__section-code {
		padding: 16px;
	}

	.apdb-api-ref__group-desc {
		padding-left: 16px;
		padding-right: 16px;
	}

	.apdb-api-ref__table {
		font-size: 12px;
	}

	.apdb-api-ref__table th,
	.apdb-api-ref__table td {
		padding: 6px 8px;
	}
}

/* ----------------------------------------------------------------
   Dark mode
   ---------------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .apdb-api-ref {
		color: #e0e0f0;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__nav {
		background: #16161e;
		border-right-color: #2a2a3c;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__nav-link {
		color: #a0a0b8;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__nav-link:hover {
		background: #1e1e2e;
		color: #e0e0f0;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__nav-link--active {
		border-left-color: #a0a0f0;
		color: #e0e0f0;
		background: #1e1e2e;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__nav-link--section,
	:root:not([data-theme="light"]) .apdb-api-ref__nav-link--group {
		color: #e0e0f0;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__nav-group {
		border-top-color: #2a2a3c;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__nav-heading {
		color: #c0c0d8;
		border-left-color: #c0c0d8;
		background: #1e1e2e;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__header {
		border-bottom-color: #2a2a3c;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__header h1 {
		color: #e0e0f0;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__version {
		background: #2a2a3c;
		color: #a0a0b8;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__intro,
	:root:not([data-theme="light"]) .apdb-api-ref__section-docs p {
		color: #a0a0b8;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__intro code {
		background: #2a2a3c;
		color: #e0e0f0;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__section {
		border-bottom-color: #2a2a3c;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__section-docs h2,
	:root:not([data-theme="light"]) .apdb-api-ref__section-docs h3 {
		color: #e0e0f0;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__section-docs h4 {
		color: #a0a0b8;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__endpoint {
		border-top-color: #2a2a3c;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__endpoint-path {
		color: #e0e0f0;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__access {
		background: #1e1e2e;
		color: #a0a0b8;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__group-desc {
		color: #a0a0b8;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__table th {
		background: #1e1e2e;
		color: #a0a0b8;
		border-bottom-color: #2a2a3c;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__table td {
		color: #a0a0b8;
		border-bottom-color: #1e1e2e;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__table code {
		background: #2a2a3c;
		color: #e0e0f0;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__section-code {
		background: #0d0d14;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__code-block {
		background: #0a0a10;
		border-color: #1e1e2e;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__code-header {
		background: #1e1e2e;
	}

	:root:not([data-theme="light"]) .apdb-api-ref__nav-toggle {
		background: #16161e;
		color: #e0e0f0;
		border-bottom-color: #2a2a3c;
	}
}
