@import "./shared.css";

/* ── LAYOUT ── */
.docs-container {
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr);
	gap: 3rem;
	max-width: 1280px; /* 260px + 960px + gap = 1280px */
	margin: 0 auto;
	padding: 2.5rem 2rem;
}

/* Sticky, scrollable sidebar on desktop */
.docs-sidebar {
	position: sticky;
	top: 80px;
	height: calc(100vh - 120px);
	overflow-y: auto;
	padding-right: 1.5rem;
	border-right: 1px solid var(--border);
}

/* Scrollbar styling for sidebar */
.docs-sidebar::-webkit-scrollbar {
	width: 4px;
}
.docs-sidebar::-webkit-scrollbar-track {
	background: transparent;
}
.docs-sidebar::-webkit-scrollbar-thumb {
	background: var(--border);
	border-radius: 4px;
}
.docs-sidebar::-webkit-scrollbar-thumb:hover {
	background: var(--muted);
}

/* Main reading pane with a max-width of 960px */
.docs-content {
	max-width: 960px;
	width: 100%;
	min-width: 0;
}

/* ── TYPOGRAPHY & HEADING HIERARCHIES ── */
.docs-content h1 {
	font-size: 2.5rem;
	font-weight: 800;
	letter-spacing: -0.03em;
	margin-top: 0;
	margin-bottom: 1.5rem;
	color: var(--text);
	line-height: 1.2;
}

.docs-content h2 {
	font-size: 1.8rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	margin-top: 3rem;
	margin-bottom: 1rem;
	color: var(--text);
	border-bottom: 1px solid var(--border);
	padding-bottom: 0.5rem;
}

.docs-content h3 {
	font-size: 1.35rem;
	font-weight: 600;
	margin-top: 2rem;
	margin-bottom: 0.75rem;
	color: var(--text);
}

.docs-content h4 {
	font-size: 1.1rem;
	font-weight: 600;
	margin-top: 1.5rem;
	margin-bottom: 0.5rem;
	color: var(--text);
}

.docs-content p {
	font-size: 1rem;
	line-height: 1.7;
	color: var(--muted);
	margin-bottom: 1.5rem;
}

/* List item styles */
.docs-content ul,
.docs-content ol {
	margin-bottom: 1.5rem;
	padding-left: 1.5rem;
}

.docs-content li {
	font-size: 0.975rem;
	line-height: 1.6;
	color: var(--muted);
	margin-bottom: 0.6rem;
}

.docs-content li strong {
	color: var(--text);
}

/* Anchor tags */
.docs-content a {
	color: var(--accent);
	text-decoration: none;
	transition: opacity 0.2s;
}

.docs-content a:hover {
	text-decoration: underline;
}

/* Code block styles */
.docs-content code {
	font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
	font-size: 0.85em;
	background: var(--surface-2);
	padding: 0.2rem 0.4rem;
	border-radius: 4px;
	color: var(--accent);
	word-wrap: break-word;
	word-break: break-all;
}

.docs-content pre {
	background: var(--surface);
	border: 1px solid var(--border);
	padding: 1.25rem;
	border-radius: 8px;
	overflow-x: auto;
	margin-bottom: 1.5rem;
	max-width: 100%;
}

.docs-content pre code {
	background: none;
	padding: 0;
	color: var(--text);
	font-size: 0.9em;
	word-break: normal;
	word-wrap: normal;
	white-space: pre;
}

/* ── RESPONSIVE TABLES ── */
.table-wrapper {
	overflow-x: auto;
	margin-bottom: 1.75rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--surface);
	max-width: 100%;
}

.docs-content table {
	width: 100%;
	border-collapse: collapse;
	text-align: left;
	font-size: 0.9rem;
}

.docs-content th {
	background: var(--surface-2);
	color: var(--text);
	font-weight: 600;
	padding: 0.85rem 1rem;
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}

.docs-content th:first-child {
	min-width: 220px;
}

.docs-content td {
	padding: 0.85rem 1rem;
	color: var(--muted);
	border-bottom: 1px solid var(--border);
}

.docs-content td:first-child {
	min-width: 220px;
}

.docs-content tr:last-child td {
	border-bottom: none;
}

/* ── CUSTOM CALLOUT CARDS ── */
.callout {
	padding: 1.25rem;
	border-radius: 8px;
	margin-bottom: 1.75rem;
	border-left: 4px solid;
	font-size: 0.95rem;
}

.callout p {
	margin-bottom: 0;
	color: var(--text);
}

.callout p:not(:last-child) {
	margin-bottom: 0.75rem;
}

/* Blue for security notes */
.callout-security {
	background: rgba(79, 142, 247, 0.08);
	border-color: var(--accent);
}

.callout-security strong {
	color: var(--accent);
}

/* Amber for rate warnings */
.callout-warning {
	background: rgba(245, 158, 11, 0.08);
	border-color: var(--warn);
}

.callout-warning strong {
	color: var(--warn);
}

/* ── MOBILE / RESPONSIVE STACK ── */
@media (max-width: 768px) {
	.docs-container {
		grid-template-columns: minmax(0, 1fr);
		gap: 2rem;
		padding: 1.5rem;
	}

	.docs-sidebar {
		position: static;
		height: auto;
		overflow-y: visible;
		padding-right: 0;
		border-right: none;
		border-bottom: 1px solid var(--border);
		padding-bottom: 1.5rem;
	}
}

/* ── SEARCH & QUICK JUMP COMPONENT STYLES ── */

.sidebar-search-container {
	position: relative;
	margin-bottom: 1.5rem;
	width: 100%;
}

.sidebar-search-input {
	width: 100%;
	padding: 0.6rem 2.2rem 0.6rem 0.8rem;
	font-family: inherit;
	font-size: 0.9rem;
	color: var(--text);
	background: var(--surface-2);
	border: 1px solid var(--border);
	border-radius: 6px;
	outline: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sidebar-search-input::placeholder {
	color: var(--muted);
	opacity: 0.8;
}

.sidebar-search-input:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.15);
}

.clear-search-btn {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	color: var(--muted);
	font-size: 1.2rem;
	cursor: pointer;
	line-height: 1;
	padding: 0.2rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.clear-search-btn:hover {
	color: var(--text);
	background-color: rgba(255, 255, 255, 0.05);
}

.quick-jump-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 1.25rem;
	margin: 2rem 0;
}

.quick-jump-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 1.25rem;
	text-decoration: none;
	color: var(--text);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 0.75rem;
	transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.quick-jump-card:hover {
	transform: translateY(-2px);
	border-color: var(--accent);
	box-shadow: 0 4px 12px rgba(79, 142, 247, 0.15);
}

.quick-jump-card .arrow,
.quick-jump-card .quick-jump-arrow,
.quick-jump-card span.arrow {
	display: inline-block;
	transition: transform 0.2s ease;
}

.quick-jump-card:hover .arrow,
.quick-jump-card:hover .quick-jump-arrow,
.quick-jump-card:hover span.arrow {
	transform: translateX(4px);
}

/* ── CUSTOM DOCUMENTATION STYLES ── */
.docs-sidebar h3 {
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text);
	margin-top: 1.5rem;
	margin-bottom: 0.5rem;
}
.docs-sidebar h3:first-of-type {
	margin-top: 0;
}
.docs-sidebar ul {
	list-style: none;
	padding: 0;
	margin: 0 0 1.5rem 0;
}
.docs-sidebar li {
	margin-bottom: 0.4rem;
}
.docs-sidebar a {
	display: block;
	color: var(--muted);
	text-decoration: none;
	font-size: 0.9rem;
	transition: color 0.2s, padding-left 0.2s;
	padding: 0.2rem 0;
}
.docs-sidebar a:hover {
	color: var(--accent);
	padding-left: 4px;
}
.docs-sidebar a.active {
	color: var(--accent);
	font-weight: 600;
	padding-left: 4px;
	border-left: 2px solid var(--accent);
}

/* ── NAVIGATION BUTTONS ── */
.btn-nav {
	background: var(--accent-2);
	display: inline-block;
}

/* ── ERROR CARDS ── */
.error-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 1.5rem;
	margin-bottom: 1.5rem;
	transition: border-color 0.2s, box-shadow 0.2s;
}
.error-card:hover {
	border-color: var(--accent);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.error-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 1rem;
	border-bottom: 1px solid var(--border);
	padding-bottom: 0.75rem;
	flex-wrap: wrap;
	gap: 0.5rem;
}
.error-code-title {
	font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
	font-size: 1.2rem;
	font-weight: 700;
	color: var(--text);
}
.error-badge {
	font-size: 0.75rem;
	font-weight: 700;
	padding: 0.25rem 0.6rem;
	border-radius: 4px;
	text-transform: uppercase;
}
.error-badge-unauthorized {
	background: rgba(239, 68, 68, 0.1);
	color: var(--danger);
	border: 1px solid rgba(239, 68, 68, 0.2);
}
.error-badge-forbidden {
	background: rgba(245, 158, 11, 0.1);
	color: var(--warn);
	border: 1px solid rgba(245, 158, 11, 0.2);
}
.error-badge-badrequest {
	background: rgba(79, 142, 247, 0.1);
	color: var(--accent);
	border: 1px solid rgba(79, 142, 247, 0.2);
}
.error-badge-internal {
	background: rgba(124, 58, 237, 0.1);
	color: var(--accent-2);
	border: 1px solid rgba(124, 58, 237, 0.2);
}

/* ── SPEC LABELS ── */
.spec-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--accent);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 0.25rem;
}
