/* Стилизация markdown контента документации */

.docs-content {
	font-size: 1rem;
	line-height: 1.75;
	color: #374151;
	min-width: 0;
}

/* Фикс для flex-контейнера */
.docs-main-content {
	min-width: 0;
}

/* Заголовки */
.docs-content h1 {
	font-size: 2.25rem;
	font-weight: 700;
	color: #111827;
	margin-top: 1rem;
	margin-bottom: 1rem;
	line-height: 1.25;
	border-bottom: 2px solid #e5e7eb;
	padding-bottom: 0.5rem;
}

.docs-content h2 {
	font-size: 1.875rem;
	font-weight: 700;
	color: #111827;
	margin-top: 2rem;
	margin-bottom: 1rem;
	line-height: 1.3;
	border-bottom: 1px solid #e5e7eb;
	padding-bottom: 0.5rem;
}

.docs-content h3 {
	font-size: 1.5rem;
	font-weight: 600;
	color: #111827;
	margin-top: 1.5rem;
	margin-bottom: 0.75rem;
	line-height: 1.35;
}

.docs-content h4 {
	font-size: 1.25rem;
	font-weight: 600;
	color: #111827;
	margin-top: 1.25rem;
	margin-bottom: 0.75rem;
	line-height: 1.4;
}

.docs-content h5 {
	font-size: 1.125rem;
	font-weight: 600;
	color: #111827;
	margin-top: 1rem;
	margin-bottom: 0.5rem;
	line-height: 1.45;
}

.docs-content h6 {
	font-size: 1rem;
	font-weight: 600;
	color: #4b5563;
	margin-top: 1rem;
	margin-bottom: 0.5rem;
	line-height: 1.5;
}

/* Заголовки с ID становятся кликабельными */
.docs-content h1[id],
.docs-content h2[id],
.docs-content h3[id],
.docs-content h4[id],
.docs-content h5[id],
.docs-content h6[id] {
	cursor: pointer;
}

/* Якорные ссылки в заголовках */
.docs-content .heading-anchor {
	margin-left: 0.5rem;
	color: #9ca3af;
	font-weight: 400;
	text-decoration: none;
	opacity: 0;
	transition: opacity 0.2s ease, color 0.2s ease;
}

.docs-content h2:hover .heading-anchor,
.docs-content h3:hover .heading-anchor,
.docs-content h4:hover .heading-anchor,
.docs-content h5:hover .heading-anchor,
.docs-content h6:hover .heading-anchor {
	opacity: 1;
}

.docs-content .heading-anchor:hover {
	color: #2563eb;
}

/* Параграфы */
.docs-content p {
	margin-top: 0.75rem;
	margin-bottom: 0.75rem;
}

/* Ссылки */
.docs-content a {
	color: #2563eb;
	text-decoration: none;
	font-weight: 500;
	transition: color 0.2s;
}

.docs-content a:hover {
	color: #1d4ed8;
	text-decoration: underline;
}

/* Списки */
.docs-content ul,
.docs-content ol {
	margin-top: 0.75rem;
	margin-bottom: 0.75rem;
	padding-left: 1.5rem;
}

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

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

.docs-content li {
	margin-top: 0.25rem;
	margin-bottom: 0.25rem;
}

.docs-content li > p {
	margin-top: 0.5rem;
	margin-bottom: 0.5rem;
}

/* Вложенные списки */
.docs-content ul ul,
.docs-content ul ol,
.docs-content ol ul,
.docs-content ol ol {
	margin-top: 0.5rem;
	margin-bottom: 0.5rem;
}

/* Inline код */
.docs-content code {
	background-color: #f3f4f6;
	padding: 0.125rem 0.375rem;
	border-radius: 0.25rem;
	font-size: 1rem;
	font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
	color: #1f2937;
	font-weight: 500;
}

/* Блоки кода */
.docs-content pre {
	background-color: #f6f8fa;
	color: #24292f;
	padding: 0.5rem;
	border-radius: 0.5rem;
	overflow-x: auto;
	overflow-y: hidden;
	margin-top: 1rem;
	margin-bottom: 1rem;
	font-size: 1rem;
	line-height: 1.5;
	position: relative;
	border: 1px solid #d0d7de;
	max-width: 100%;
	width: 100%;
	white-space: pre;
	box-sizing: border-box;
}

.docs-content pre code {
	background-color: transparent;
	padding: 0;
	border-radius: 0;
	color: inherit;
	font-size: 1rem;
	font-weight: normal;
	white-space: pre;
}

/* Контейнер блока кода с кнопкой копирования */
.code-block-wrapper {
	position: relative;
	margin-top: 1rem;
	margin-bottom: 1rem;
	max-width: 100%;
	min-width: 0;
}

.code-block-wrapper pre {
	margin-top: 0;
	margin-bottom: 0;
}

/* Кнопка копирования */
.code-copy-btn {
	position: absolute;
	top: 0;
	right: 0;
	padding: 0.375rem;
	background-color: transparent;
	border: none;
	border-radius: 0.375rem;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s ease, background-color 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
}

.code-block-wrapper:hover .code-copy-btn {
	opacity: 1;
}

.code-copy-btn:hover {
	/* background-color убран - кнопка остается прозрачной */
}

.code-copy-btn:active {
	background-color: #e5e7eb;
}

.code-copy-btn svg {
	width: 1rem;
	height: 1rem;
	stroke: #57606a;
	stroke-width: 2;
}

.code-copy-btn:hover svg {
	stroke: #24292f;
}

/* Tooltip для кнопки копирования */
.code-copy-btn[data-tooltip]::after {
	content: attr(data-tooltip);
	position: absolute;
	top: -2rem;
	right: 0;
	background-color: #24292f;
	color: #ffffff;
	padding: 0.25rem 0.5rem;
	border-radius: 0.25rem;
	font-size: 0.75rem;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.code-copy-btn[data-tooltip].show-tooltip::after {
	opacity: 1;
}

/* Цитаты */
.docs-content blockquote {
	border-left: 4px solid #3b82f6;
	padding: 0.5rem;
	margin-left: 0;
	margin-right: 0;
	margin-top: 1rem;
	margin-bottom: 1rem;
	color: #4b5563;
	background-color: #eff6ff;
	border-radius: 0.25rem;
}

.docs-content blockquote p {
	margin: 0.75rem 0;
}

.docs-content blockquote p:first-child {
	margin-top: 0.25rem;
}

.docs-content blockquote p:last-child {
	margin-bottom: 0.25rem;
}

/* Цветные blockquote */
.docs-content blockquote.blockquote-green {
	border-left-color: #10b981;
	background-color: #d1fae5;
	color: #065f46;
}

.docs-content blockquote.blockquote-red {
	border-left-color: #ef4444;
	background-color: #fee2e2;
	color: #991b1b;
}

.docs-content blockquote.blockquote-yellow {
	border-left-color: #f59e0b;
	background-color: #fef3c7;
	color: #92400e;
}

.docs-content blockquote.blockquote-default {
	border-left-color: #3b82f6;
	background-color: #eff6ff;
	color: #4b5563;
}

/* Скрываемые blockquote (details) */
.docs-content details.blockquote-hide {
	border-left: 4px solid #6b7280;
	padding: 0.5rem;
	margin-left: 0;
	margin-right: 0;
	margin-top: 1rem;
	margin-bottom: 1rem;
	background-color: #f3f4f6;
	border-radius: 0.25rem;
}

.docs-content details.blockquote-hide summary {
	cursor: pointer;
	font-weight: 600;
	color: #374151;
	user-select: none;
	list-style: none;
	display: flex;
	align-items: center;
}

/* Убираем стандартный треугольник */
.docs-content details.blockquote-hide summary::-webkit-details-marker {
	display: none;
}

/* Добавляем кастомную стрелку */
.docs-content details.blockquote-hide summary::before {
	content: '▶';
	margin-right: 0.5rem;
	transition: transform 0.2s ease;
	display: inline-block;
}

.docs-content details.blockquote-hide[open] summary::before {
	transform: rotate(90deg);
}

.docs-content .blockquote-hide-content {
	color: #4b5563;
}

.docs-content .blockquote-hide-content p {
	margin: 0.75rem 0;
}

.docs-content .blockquote-hide-content p:first-child {
	margin-top: 0.25rem;
}

.docs-content .blockquote-hide-content p:last-child {
	margin-bottom: 0.25rem;
}

/* Таблицы */
.docs-content table {
	width: 100%;
	border-collapse: collapse;
	margin-top: 1rem;
	margin-bottom: 1rem;
	font-size: 0.875rem;
}

.docs-content table thead {
	background-color: #ffffff;
}

.docs-content table th {
	border: 1px solid #e5e7eb;
	padding: 0.75rem;
	text-align: left;
	font-weight: 600;
	color: #111827;
}

.docs-content table td {
	border: 1px solid #e5e7eb;
	padding: 0.75rem;
}

.docs-content table tbody tr:nth-child(odd) {
	background-color: #ffffff;
}

.docs-content table tbody tr:nth-child(even) {
	background-color: #f3f4f6;
}

/* Горизонтальная линия */
.docs-content hr {
	border: none;
	border-top: 2px solid #e5e7eb;
	margin-top: 2rem;
	margin-bottom: 2rem;
}

/* Изображения */
.docs-content img {
	max-width: 100%;
	height: auto;
	border-radius: 0.5rem;
	margin-top: 1rem;
	margin-bottom: 1rem;
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Изображения с явно заданной шириной - используем указанную ширину */
.docs-content img[width] {
	max-width: 100%;
	/* width устанавливается через атрибут HTML, не переопределяем */
}

/* Чекбоксы (task lists) */
.docs-content ul:has(input[type="checkbox"]) {
	padding-left: 0;
}

.docs-content li:has(input[type="checkbox"]) {
	list-style: none;
}

.docs-content input[type="checkbox"] {
	margin-right: 0.5rem;
	cursor: default;
	accent-color: #2563eb;
}

.docs-content input[type="checkbox"][disabled] {
	cursor: not-allowed;
}

/* Жирный и курсив */
.docs-content strong {
	font-weight: 700;
	color: #111827;
}

.docs-content em {
	font-style: italic;
}

/* Зачеркнутый текст */
.docs-content del {
	text-decoration: line-through;
	color: #6b7280;
}

/* Адаптивность */
@media (max-width: 768px) {
	.docs-content {
		font-size: 1rem;
	}

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

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

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

	.docs-content table {
		font-size: 1rem;
	}
}

/* Ограничение ширины строк для читаемости */
.docs-content > * {
	max-width: 100%;
}

/* Smooth scroll для якорей */
html {
	scroll-behavior: smooth;
}

/* Отступ для якорей с учетом fixed header */
.docs-content h1[id],
.docs-content h2[id],
.docs-content h3[id],
.docs-content h4[id],
.docs-content h5[id],
.docs-content h6[id] {
	scroll-margin-top: 4rem;
}

/* === Адаптивная вёрстка для документации === */

/* Базовые стили - мобильные (< 768px): сайдбары скрыты, выезжают по кнопкам */
.docs-left-sidebar {
	position: fixed;
	top: 46px;
	left: 0;
	height: calc(100vh - 46px);
	z-index: 40; /* Выше overlay (30), ниже header (50) */
	transform: translateX(-100%);
}

.docs-right-toc {
	position: fixed;
	top: 46px;
	right: 0;
	height: calc(100vh - 46px);
	z-index: 40; /* Выше overlay (30), ниже header (50) */
	transform: translateX(100%);
}

/* Открытые состояния на мобилке */
.docs-left-sidebar.open {
	transform: translateX(0);
}

.docs-right-toc.open {
	transform: translateX(0);
}

/* Средние экраны (768px - 1279px): только левый сайдбар видим */
@media (min-width: 768px) and (max-width: 1279px) {
	.docs-left-sidebar {
		position: sticky;
		top: 46px;
		height: calc(100vh - 46px);
		transform: translateX(0);
		align-self: flex-start;
	}

	/* Правый TOC скрыт, но может быть открыт через кнопку */
	.docs-right-toc {
		position: fixed;
		top: 46px;
		right: 0;
		height: calc(100vh - 46px);
		z-index: 40;
		transform: translateX(100%);
	}

	.docs-right-toc.open {
		transform: translateX(0);
	}
}

/* Большие экраны (>= 1280px): оба сайдбара видны */
@media (min-width: 1280px) {
	.docs-left-sidebar {
		position: sticky;
		top: 46px;
		height: calc(100vh - 46px);
		transform: translateX(0);
		align-self: flex-start;
	}

	.docs-right-toc {
		position: sticky;
		top: 46px;
		height: calc(100vh - 46px);
		transform: translateX(0);
		align-self: flex-start;
	}
}

/* === Disabled состояния для кнопок управления === */

/* Левая кнопка disabled на >= 768px (когда левый сайдбар всегда виден) */
@media (min-width: 768px) {
	.docs-btn-left {
		opacity: 0.4;
		cursor: not-allowed;
		pointer-events: none;
	}
	.docs-btn-left svg {
		color: #9ca3af;
	}
}

/* Правая кнопка disabled на >= 1280px (когда правый TOC всегда виден) */
@media (min-width: 1280px) {
	.docs-btn-right {
		opacity: 0.4;
		cursor: not-allowed;
		pointer-events: none;
	}
	.docs-btn-right svg {
		color: #9ca3af;
	}
}

/* === Стили для правого TOC === */

/* Активный элемент TOC */
.toc-link.active {
	color: #2563eb;
	font-weight: 500;
}

/* Hover для ссылок TOC */
.toc-link:hover {
	padding-left-offset: 4px;
}

/* Hover для точек TOC */
.toc-link:hover .toc-bullet {
	color: #2563eb;
}

/* Плавные переходы для TOC ссылок */
.toc-link {
	transition: all 0.2s ease;
}

/* Маркер списка */
.toc-bullet {
	color: #9ca3af;
	font-size: 1rem;
	flex-shrink: 0;
}

/* Активный маркер */
.toc-link.active .toc-bullet {
	color: #2563eb;
}

/* === Навигация между страницами === */

.docs-page-navigation {
	display: flex;
	justify-content: space-between;
	align-items: stretch;
	gap: 0.75rem;
	margin-top: 0.75rem;
}

.docs-nav-link {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.75rem;
	border: 1px solid #e5e7eb;
	border-radius: 0.5rem;
	background-color: #ffffff;
	transition: all 0.2s ease;
	text-decoration: none;
	color: #374151;
	flex: 1;
	max-width: 48%;
}

.docs-nav-link:hover {
	border-color: #2563eb;
	background-color: #eff6ff;
	color: #1d4ed8;
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.docs-nav-prev {
	justify-content: flex-start;
}

.docs-nav-next {
	justify-content: flex-end;
	margin-left: auto;
}

.docs-nav-icon {
	width: 1.25rem;
	height: 1.25rem;
	flex-shrink: 0;
	color: #6b7280;
	transition: color 0.2s ease;
}

.docs-nav-link:hover .docs-nav-icon {
	color: #2563eb;
}

.docs-nav-title {
	font-size: 0.875rem;
	font-weight: 600;
	color: #111827;
	line-height: 1.25;
}

.docs-nav-link:hover .docs-nav-title {
	color: #2563eb;
}

/* Адаптивность для мобильных */
@media (max-width: 640px) {
	.docs-page-navigation {
		flex-direction: column;
		gap: 0.5rem;
	}

	.docs-nav-link {
		max-width: 100%;
	}

	.docs-nav-prev,
	.docs-nav-next {
		margin-left: 0;
	}

	.docs-nav-title {
		font-size: 0.8125rem;
	}
}

/* === Фикс мелькания стрелочек при инициализации Alpine === */

/* Скрываем стрелочки разворачивания до инициализации Alpine */
[x-data] button svg {
	opacity: 0;
	transition: opacity 0.15s ease, transform 0.2s ease;
}

/* Показываем стрелочки после инициализации Alpine */
body.alpine-ready [x-data] button svg {
	opacity: 1;
}
