/* ==========================================================================
   Docs Layout
   ========================================================================== */

.docs-layout {
	display: flex;
	gap: 3rem;
	align-items: flex-start;
	min-height: calc(100vh - 3.5rem - 10rem);
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.docs-sidebar {
	width: 220px;
	flex-shrink: 0;
	position: sticky;
	top: 5rem;
	max-height: calc(100vh - 6rem);
	overflow-y: auto;
	padding-bottom: 2rem;
}

.docs-sidebar::-webkit-scrollbar {
	width: 4px;
}

.docs-sidebar::-webkit-scrollbar-thumb {
	background: rgba(0,0,0,0.1);
	border-radius: 4px;
}

.dark .docs-sidebar::-webkit-scrollbar-thumb {
	background: rgba(255,255,255,0.1);
}

.docs-sidebar-heading {
	font-size: 0.7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #9ca3af;
	padding: 0 0.75rem;
	margin-bottom: 0.5rem;
}

.dark .docs-sidebar-heading {
	color: #6b7280;
}

.docs-sidebar-link {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.75rem;
	border-radius: 0.5rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: #6b7280;
	text-decoration: none;
	transition: all 0.15s;
	border-left: 2px solid transparent;
}

.docs-sidebar-link:hover {
	color: #111827;
	background: rgba(0,0,0,0.04);
}

.dark .docs-sidebar-link:hover {
	color: #f3f4f6;
	background: rgba(255,255,255,0.04);
}

.docs-sidebar-link.active {
	color: #7c3aed;
	background: rgba(124,58,237,0.06);
	border-left-color: #7c3aed;
}

.dark .docs-sidebar-link.active {
	color: #a78bfa;
	background: rgba(167,139,250,0.08);
	border-left-color: #a78bfa;
}

.docs-sidebar-link i {
	font-size: 1.1rem;
	flex-shrink: 0;
}

/* Search Trigger */
.docs-search-trigger {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.75rem;
	margin-bottom: 1rem;
	border-radius: 0.5rem;
	border: 1px solid #e5e7eb;
	background: rgba(0,0,0,0.02);
	font-size: 0.825rem;
	color: #9ca3af;
	cursor: pointer;
	transition: all 0.15s;
}

.docs-search-trigger:hover {
	border-color: #d1d5db;
	color: #6b7280;
	background: rgba(0,0,0,0.04);
}

.dark .docs-search-trigger {
	border-color: rgba(255,255,255,0.08);
	background: rgba(255,255,255,0.02);
}

.dark .docs-search-trigger:hover {
	border-color: rgba(255,255,255,0.15);
	color: #9ca3af;
	background: rgba(255,255,255,0.04);
}

.docs-search-trigger i {
	font-size: 1rem;
	flex-shrink: 0;
}

.docs-search-trigger span {
	flex: 1;
}

.docs-search-trigger kbd {
	font-family: inherit;
	font-size: 0.65rem;
	font-weight: 600;
	padding: 0.15rem 0.4rem;
	border-radius: 0.25rem;
	border: 1px solid #d1d5db;
	background: #f9fafb;
	color: #9ca3af;
	line-height: 1;
}

.dark .docs-search-trigger kbd {
	border-color: rgba(255,255,255,0.1);
	background: rgba(255,255,255,0.05);
	color: #6b7280;
}

/* Search Modal Overlay */
.docs-search-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 100;
	background: rgba(0,0,0,0.5);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	justify-content: center;
	padding-top: min(20vh, 140px);
}

.docs-search-overlay.open {
	display: flex;
}

.docs-search-modal {
	width: 100%;
	max-width: 560px;
	max-height: min(70vh, 480px);
	background: white;
	border-radius: 1rem;
	box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	animation: docs-search-appear 0.15s ease-out;
}

.dark .docs-search-modal {
	background: #1f2937;
	box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

@keyframes docs-search-appear {
	from { opacity: 0; transform: scale(0.98) translateY(-8px); }
	to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Search Input */
.docs-search-input-wrap {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid #e5e7eb;
}

.dark .docs-search-input-wrap {
	border-bottom-color: rgba(255,255,255,0.08);
}

.docs-search-input-wrap i {
	font-size: 1.25rem;
	color: #9ca3af;
	flex-shrink: 0;
}

.docs-search-input-wrap input {
	flex: 1;
	border: none;
	outline: none;
	background: transparent;
	font-size: 1rem;
	color: #111827;
	font-family: inherit;
}

.docs-search-input-wrap input::placeholder {
	color: #9ca3af;
}

.dark .docs-search-input-wrap input {
	color: #f9fafb;
}

.dark .docs-search-input-wrap input::placeholder {
	color: #6b7280;
}

.docs-search-input-wrap kbd {
	font-family: inherit;
	font-size: 0.65rem;
	font-weight: 600;
	padding: 0.2rem 0.45rem;
	border-radius: 0.25rem;
	border: 1px solid #d1d5db;
	background: #f9fafb;
	color: #9ca3af;
	line-height: 1;
	flex-shrink: 0;
}

.dark .docs-search-input-wrap kbd {
	border-color: rgba(255,255,255,0.1);
	background: rgba(255,255,255,0.05);
	color: #6b7280;
}

/* Search Results */
.docs-search-results {
	overflow-y: auto;
	padding: 0.5rem;
}

.docs-search-empty {
	padding: 2rem 1rem;
	text-align: center;
	font-size: 0.875rem;
	color: #9ca3af;
}

.docs-search-no-results {
	padding: 2rem 1rem;
	text-align: center;
	font-size: 0.875rem;
	color: #9ca3af;
}

.docs-search-result {
	display: block;
	padding: 0.625rem 0.875rem;
	border-radius: 0.5rem;
	text-decoration: none;
	transition: background 0.1s;
}

.docs-search-result:hover,
.docs-search-result.active {
	background: rgba(124,58,237,0.06);
}

.dark .docs-search-result:hover,
.dark .docs-search-result.active {
	background: rgba(167,139,250,0.08);
}

.docs-search-result-title {
	font-size: 0.875rem;
	font-weight: 500;
	color: #111827;
	line-height: 1.3;
}

.dark .docs-search-result-title {
	color: #f3f4f6;
}

.docs-search-result-title mark {
	background: rgba(124,58,237,0.15);
	color: #7c3aed;
	border-radius: 2px;
	padding: 0 1px;
}

.dark .docs-search-result-title mark {
	background: rgba(167,139,250,0.2);
	color: #c4b5fd;
}

.docs-search-result-meta {
	font-size: 0.75rem;
	color: #9ca3af;
	margin-top: 0.15rem;
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.docs-search-result-meta .docs-search-sep {
	color: #d1d5db;
}

.dark .docs-search-result-meta .docs-search-sep {
	color: #4b5563;
}

.docs-search-result-snippet {
	font-size: 0.775rem;
	color: #6b7280;
	margin-top: 0.2rem;
	line-height: 1.4;
}

.dark .docs-search-result-snippet {
	color: #9ca3af;
}

.docs-search-result-snippet mark {
	background: rgba(124,58,237,0.1);
	color: inherit;
	border-radius: 2px;
	padding: 0 1px;
}

/* Table of Contents */
.docs-toc-link {
	display: block;
	padding: 0.3rem 0.75rem;
	font-size: 0.8rem;
	color: #9ca3af;
	text-decoration: none;
	transition: color 0.15s;
	line-height: 1.4;
}

.docs-toc-link:hover {
	color: #6b7280;
}

.docs-toc-link.active {
	color: #7c3aed;
	font-weight: 500;
}

.dark .docs-toc-link {
	color: #6b7280;
}

.dark .docs-toc-link:hover {
	color: #9ca3af;
}

.dark .docs-toc-link.active {
	color: #a78bfa;
	font-weight: 500;
}

/* ==========================================================================
   Mobile Sidebar Toggle
   ========================================================================== */

.docs-mobile-toggle {
	display: none;
	width: 100%;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	margin-bottom: 1rem;
	border-radius: 0.75rem;
	border: 1px solid #e5e7eb;
	background: white;
	font-size: 0.875rem;
	font-weight: 500;
	color: #374151;
	cursor: pointer;
	transition: all 0.15s;
}

.dark .docs-mobile-toggle {
	border-color: rgba(255,255,255,0.1);
	background: rgba(255,255,255,0.03);
	color: #e5e7eb;
}

.docs-toggle-chevron {
	margin-left: auto;
	transition: transform 0.2s;
}

.docs-sidebar-open .docs-toggle-chevron {
	transform: rotate(180deg);
}

/* ==========================================================================
   Content — Markdown Prose
   ========================================================================== */

.docs-content {
	flex: 1;
	min-width: 0;
	max-width: 48rem;
}

/* Headings */
.docs-content h1 {
	font-size: 2rem;
	font-weight: 650;
	letter-spacing: -0.025em;
	color: #111827;
	margin: 0 0 0.5rem 0;
	padding-bottom: 0.75rem;
	border-bottom: 1px solid #e5e7eb;
	line-height: 1.2;
}

.dark .docs-content h1 {
	color: #f9fafb;
	border-bottom-color: rgba(255,255,255,0.08);
}

.docs-content h2 {
	font-size: 1.5rem;
	font-weight: 600;
	letter-spacing: -0.015em;
	color: #111827;
	margin: 2.5rem 0 1rem 0;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid #f3f4f6;
	line-height: 1.3;
	scroll-margin-top: 5rem;
}

.dark .docs-content h2 {
	color: #f9fafb;
	border-bottom-color: rgba(255,255,255,0.05);
}

.docs-content h3 {
	font-size: 1.2rem;
	font-weight: 550;
	color: #111827;
	margin: 2rem 0 0.75rem 0;
	line-height: 1.4;
}

.dark .docs-content h3 {
	color: #f3f4f6;
}

.docs-content h4 {
	font-size: 1rem;
	font-weight: 550;
	color: #374151;
	margin: 1.5rem 0 0.5rem 0;
}

.dark .docs-content h4 {
	color: #d1d5db;
}

/* Paragraphs */
.docs-content p {
	line-height: 1.75;
	margin: 1rem 0;
	color: #374151;
}

.dark .docs-content p {
	color: #d1d5db;
}

/* Links */
.docs-content a {
	color: #7c3aed;
	text-decoration: none;
	font-weight: 500;
}

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

.dark .docs-content a {
	color: #a78bfa;
}

/* Lists */
.docs-content ul,
.docs-content ol {
	margin: 1rem 0;
	padding-left: 1.75rem;
	color: #374151;
}

.dark .docs-content ul,
.dark .docs-content ol {
	color: #d1d5db;
}

.docs-content li {
	line-height: 1.75;
	margin: 0.25rem 0;
}

.docs-content li > ul,
.docs-content li > ol {
	margin: 0.25rem 0;
}

.docs-content ul > li {
	list-style-type: disc;
}

.docs-content ul > li > ul > li {
	list-style-type: circle;
}

.docs-content ol > li {
	list-style-type: decimal;
}

/* Code — Inline */
.docs-content code {
	font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
	font-size: 0.85em;
	padding: 0.15rem 0.4rem;
	border-radius: 0.375rem;
	background: #f3f4f6;
	color: #d946ef;
	word-break: break-word;
}

.dark .docs-content code {
	background: rgba(255,255,255,0.08);
	color: #c084fc;
}

/* Code — Blocks */
.docs-content pre {
	margin: 1.25rem 0;
	padding: 1.25rem 1.5rem;
	border-radius: 0.75rem;
	overflow-x: auto;
	background: #161b22 !important;
	border: 1px solid rgba(255,255,255,0.06);
	position: relative;
}

.docs-content pre code {
	font-size: 0.825rem;
	line-height: 1.7;
	padding: 0;
	border-radius: 0;
	background: transparent !important;
	color: #e6edf3 !important;
	word-break: normal;
}

/* Copy button */
.docs-copy-btn {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	padding: 0.25rem 0.6rem;
	border-radius: 0.375rem;
	border: 1px solid rgba(255,255,255,0.1);
	background: rgba(255,255,255,0.05);
	color: #9ca3af;
	font-size: 0.7rem;
	font-family: inherit;
	cursor: pointer;
	opacity: 0;
	transition: all 0.15s;
}

.docs-content pre:hover .docs-copy-btn {
	opacity: 1;
}

.docs-copy-btn:hover {
	background: rgba(255,255,255,0.1);
	color: #e5e7eb;
}

.docs-copy-btn.copied {
	color: #34d399;
	border-color: rgba(52,211,153,0.3);
}

/* Tables */
.docs-content table {
	width: 100%;
	margin: 1.25rem 0;
	border-collapse: collapse;
	font-size: 0.875rem;
	border-radius: 0.75rem;
	overflow: hidden;
	border: 1px solid #e5e7eb;
}

.dark .docs-content table {
	border-color: rgba(255,255,255,0.08);
}

.docs-content thead th {
	text-align: left;
	padding: 0.625rem 0.875rem;
	font-weight: 600;
	font-size: 0.8rem;
	color: #6b7280;
	background: #f9fafb;
	border-bottom: 1px solid #e5e7eb;
}

.dark .docs-content thead th {
	color: #9ca3af;
	background: rgba(255,255,255,0.03);
	border-bottom-color: rgba(255,255,255,0.08);
}

.docs-content tbody td {
	padding: 0.625rem 0.875rem;
	border-bottom: 1px solid #f3f4f6;
	color: #374151;
	vertical-align: top;
}

.dark .docs-content tbody td {
	border-bottom-color: rgba(255,255,255,0.04);
	color: #d1d5db;
}

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

.docs-content tbody tr:nth-child(even) {
	background: rgba(0,0,0,0.015);
}

.dark .docs-content tbody tr:nth-child(even) {
	background: rgba(255,255,255,0.015);
}

/* Inline code in tables */
.docs-content td code,
.docs-content th code {
	font-size: 0.8em;
	padding: 0.1rem 0.35rem;
}

/* Blockquotes */
.docs-content blockquote {
	margin: 1.25rem 0;
	padding: 0.75rem 1.25rem;
	border-left: 3px solid #7c3aed;
	background: rgba(124,58,237,0.04);
	border-radius: 0 0.5rem 0.5rem 0;
}

.dark .docs-content blockquote {
	border-left-color: #a78bfa;
	background: rgba(167,139,250,0.06);
}

.docs-content blockquote p {
	color: #6b7280;
	margin: 0.25rem 0;
}

.dark .docs-content blockquote p {
	color: #9ca3af;
}

/* Images */
.docs-content img {
	max-width: 100%;
	height: auto;
	border-radius: 0.75rem;
	margin: 1.5rem 0;
	box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
}

.dark .docs-content img {
	box-shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

/* Horizontal rules */
.docs-content hr {
	border: none;
	border-top: 1px solid #e5e7eb;
	margin: 2.5rem 0;
}

.dark .docs-content hr {
	border-top-color: rgba(255,255,255,0.08);
}

/* Strong / Bold */
.docs-content strong {
	font-weight: 600;
	color: #111827;
}

.dark .docs-content strong {
	color: #f3f4f6;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
	.docs-layout {
		flex-direction: column;
		gap: 0;
	}

	.docs-mobile-toggle {
		display: flex;
	}

	.docs-sidebar {
		display: none;
		position: static;
		width: 100%;
		max-height: none;
		margin-bottom: 1rem;
		padding: 0.75rem;
		border-radius: 0.75rem;
		border: 1px solid #e5e7eb;
		background: white;
	}

	.dark .docs-sidebar {
		border-color: rgba(255,255,255,0.08);
		background: rgba(255,255,255,0.02);
	}

	.docs-sidebar-open .docs-sidebar {
		display: block;
	}

	.docs-sidebar .docs-sidebar-toc {
		display: none;
	}

	.docs-content {
		max-width: 100%;
	}

	.docs-content h1 {
		font-size: 1.625rem;
	}

	.docs-content h2 {
		font-size: 1.25rem;
	}

	.docs-content pre {
		padding: 1rem;
		border-radius: 0.5rem;
		margin-left: -0.5rem;
		margin-right: -0.5rem;
	}

	.docs-search-trigger kbd {
		display: none;
	}

	.docs-search-modal {
		max-width: calc(100% - 2rem);
		max-height: 60vh;
	}

	.docs-search-overlay {
		padding-top: 1rem;
		padding-left: 1rem;
		padding-right: 1rem;
	}
}
