/* AJAX CATALOG — стили в общей системе сайта
----------------------------------------------- */
.ac-wrap {
	position: relative;
	z-index: 1;
	margin-bottom: 20px;
	overflow: visible;
}

.ac-wrap.is-open {
	z-index: 90;
}

.ac-wrap .nuks__header {
	margin-bottom: 14px;
}

.ajax-catalog {
	position: relative;
	z-index: 1;
	font: inherit;
	color: var(--tt);
	overflow: visible;
}

.ac-wrap.is-open .ajax-catalog {
	z-index: 90;
}

.ajax-catalog *,
.ajax-catalog *::before,
.ajax-catalog *::after {
	box-sizing: border-box;
}

.ajax-catalog ul,
.ajax-catalog ol {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ajax-catalog a {
	text-decoration: none;
	color: inherit;
}

/* Панель: язык + спецсимволы */
.ac-toolbar {
	display: flex;
	align-items: stretch;
	gap: 10px;
	margin-bottom: 12px;
}

.ac-catalog-global {
	display: flex;
	flex-shrink: 0;
	gap: 6px;
}

.ac-catalog-global li {
	flex: 0 0 auto;
}

.ac-catalog-global li a {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	border-radius: var(--radius-md);
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: rgba(var(--tt-rgb), 0.78);
	background: var(--bg-darker);
	outline: 1px solid rgba(var(--bdc-rgb), 0.45);
	transition: color 0.2s ease, background-color 0.2s ease, outline-color 0.2s ease, box-shadow 0.2s ease;
}

.dt .ac-catalog-global li a {
	background: rgba(255, 255, 255, 0.04);
	outline-color: rgba(255, 255, 255, 0.1);
}

.ac-catalog-global li a:hover,
.ac-catalog-global li a.active {
	color: var(--accent);
	background: rgba(var(--accent-rgb), 0.12);
	outline-color: rgba(var(--accent-rgb), 0.42);
	box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.12);
}

.ac-catalog-lang span {
	display: none;
}

.ac-catalog-lang span.current {
	display: block;
}

/* Буквы алфавита */
.ac-letters {
	position: relative;
	border-radius: var(--radius-md);
	background: var(--bg-darker);
	outline: 1px solid rgba(var(--bdc-rgb), 0.38);
	overflow: hidden;
}

.dt .ac-letters {
	background: rgba(255, 255, 255, 0.03);
	outline-color: rgba(255, 255, 255, 0.08);
}

.ac-catalog {
	display: none;
	flex-wrap: wrap;
	gap: 0;
}

.ac-catalog.current {
	display: flex;
}

.ac-catalog li {
	flex: 1 1 0;
	min-width: 0;
}

.ac-catalog li a {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	min-height: 44px;
	padding: 8px 4px;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	text-align: center;
	color: rgba(var(--tt-rgb), 0.72);
	transition: color 0.2s ease, background-color 0.2s ease;
}

.ac-catalog li a::after {
	content: '';
	position: absolute;
	left: 50%;
	bottom: 4px;
	width: 0;
	height: 2px;
	border-radius: 999px;
	background: var(--accent);
	transition: left 0.2s ease, width 0.2s ease;
}

.ac-catalog li a:hover,
.ac-catalog li a.active {
	color: var(--accent);
	background: rgba(var(--accent-rgb), 0.08);
}

.ac-catalog li a.active::after,
.ac-catalog li a:hover::after {
	left: 20%;
	width: 60%;
}

/* Выпадающий блок результатов */
.ac-result {
	display: none;
	flex-direction: column;
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	z-index: 50;
	max-height: min(580px, 75vh);
	border-radius: var(--radius-lg);
	background: var(--bg);
	outline: 1px solid rgba(var(--bdc-rgb), 0.42);
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.55) inset,
		var(--bsh-block),
		0 24px 48px rgba(15, 23, 42, 0.14);
	overflow: hidden;
}

.ac-result.is-portal {
	position: fixed;
	z-index: 95;
	right: auto;
	top: auto;
	left: auto;
}

.dt .ac-result {
	background: var(--bg-darker);
	outline-color: rgba(255, 255, 255, 0.1);
	box-shadow:
		0 0 0 1px rgba(0, 0, 0, 0.4),
		0 24px 52px rgba(0, 0, 0, 0.45);
}

.ac-result.loading .ac-result-list::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 2;
	background: rgba(var(--bg-rgb), 0.72);
	backdrop-filter: blur(2px);
}

.ac-result.loading .ac-result-list::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	width: 36px;
	height: 36px;
	margin: -18px 0 0 -18px;
	border: 3px solid rgba(var(--accent-rgb), 0.22);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: ac-spin 0.75s linear infinite;
}

@keyframes ac-spin {
	to { transform: rotate(360deg); }
}

.ac-result-empty {
	display: none;
	flex: 1 1 auto;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 180px;
	padding: 32px 20px;
	color: rgba(var(--tt-rgb), 0.55);
	text-align: center;
}

.ac-result-empty__icon {
	font-size: 28px;
	color: rgba(var(--accent-rgb), 0.55);
}

.ac-result-empty__text {
	font-size: 14px;
}

ul.ac-result-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(130px, calc(50% - 8px)), 1fr));
	gap: 12px;
	flex: 1 1 auto;
	min-height: 0;
	position: relative;
	padding: 14px;
	margin: 0;
	overflow-x: hidden;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

ul.ac-result-list::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

ul.ac-result-list::-webkit-scrollbar-track {
	background: transparent;
}

ul.ac-result-list::-webkit-scrollbar-thumb {
	background: rgba(var(--tt-rgb), 0.18);
	border-radius: 999px;
}

.ac-result-list__item {
	min-width: 0;
	list-style: none;
}

.ac-result-list .lodyt {
	height: auto;
}

.ac-result-list .grid-items__item {
	width: 100%;
}

/* Подвал: сортировка и ссылка */
.ac-result-footer {
	display: flex;
	flex: 0 0 auto;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 16px;
	padding: 10px 14px;
	border-top: 1px solid rgba(var(--bdc-rgb), 0.45);
	background: var(--bg-darker);
}

.dt .ac-result-footer {
	background: rgba(0, 0, 0, 0.18);
	border-top-color: rgba(255, 255, 255, 0.08);
}

.ac-sort {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.ac-sort li {
	padding: 7px 12px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	color: rgba(var(--tt-rgb), 0.72);
	background: var(--bg);
	outline: 1px solid rgba(var(--bdc-rgb), 0.4);
	transition: color 0.2s ease, background-color 0.2s ease, outline-color 0.2s ease;
}

.dt .ac-sort li {
	background: rgba(255, 255, 255, 0.04);
	outline-color: rgba(255, 255, 255, 0.1);
}

.ac-sort li:hover {
	color: var(--accent);
	outline-color: rgba(var(--accent-rgb), 0.4);
	background: rgba(var(--accent-rgb), 0.1);
}

.ac-sort li.current {
	cursor: default;
	color: #fff;
	background: var(--accent);
	outline-color: transparent;
}

.ac-options {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
}

.ac-options li {
	list-style: none;
}

.ac-options .ac-result-link {
	white-space: nowrap;
}

/* Настройки (админ) */
.ac-settings-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ac-settings-list li {
	padding: 10px 15px 10px 460px;
	border-bottom: 1px solid rgba(var(--bdc-rgb), 0.45);
}

.ac-settings-list li:nth-child(2n) {
	background: var(--bg-darker);
}

.ac-settings-list li::after {
	content: '';
	display: block;
	clear: both;
}

.ac-settings-list-title {
	float: left;
	margin-left: -450px;
	width: 430px;
	color: rgba(var(--tt-rgb), 0.72);
	font-size: 12px;
}

.ac-settings-list-title strong {
	display: block;
	font-weight: 700;
	font-size: 13px;
	line-height: 1.4;
	color: var(--tt);
}

input.ac-settings-input,
select.ac-settings-input {
	display: block;
	width: 100%;
	padding: 0 15px;
	border: 1px solid rgba(var(--bdc-rgb), 0.55);
	border-radius: var(--ui-bdrs);
	box-shadow: none;
	background: var(--bg);
	color: var(--tt);
}

input.ac-settings-input {
	height: 35px;
}

select.ac-settings-input {
	padding: 10px 15px;
	height: 170px;
}

.ac-chbox {
	display: inline-block;
	position: relative;
	overflow: hidden;
	line-height: 20px;
	cursor: pointer;
	padding-right: 45px;
}

.ac-chbox input {
	position: absolute;
	display: none;
}

.ac-chbox span {
	position: absolute;
	top: 0;
	right: 0;
	display: inline-block;
	height: 20px;
	width: 40px;
	border-radius: 10px;
	background: rgba(var(--tt-rgb), 0.22);
}

.ac-chbox span::after {
	content: '';
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 3px rgba(0, 0, 0, 0.25);
	transition: left 0.2s ease, right 0.2s ease;
}

.ac-chbox input:checked + span {
	background: var(--accent);
}

.ac-chbox input:checked + span::after {
	left: auto;
	right: 2px;
}

.ac-rebuild-area {
	position: fixed;
	inset: 0;
	background: rgba(8, 10, 15, 0.82);
	z-index: 10000;
	backdrop-filter: blur(4px);
}

.ac-rebuild-wrapper {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: min(500px, calc(100vw - 32px));
	padding: 28px 24px 24px;
	border-radius: var(--radius-lg);
	background: var(--bg);
	outline: 1px solid rgba(var(--bdc-rgb), 0.45);
	box-shadow: var(--bsh-long);
}

.ac-rebuild-progress-info {
	text-align: center;
	font-size: 13px;
	color: rgba(var(--tt-rgb), 0.72);
	margin-bottom: 14px;
}

.ac-rebuild-progress-help {
	text-align: center;
	font-size: 11px;
	color: rgba(var(--tt-rgb), 0.5);
	margin-top: 14px;
}

.ac-rebuild-progress {
	background: var(--bg-darker);
	border-radius: 999px;
	overflow: hidden;
	padding: 2px;
}

.ac-rebuild-bar {
	height: 4px;
	width: 0%;
	border-radius: 999px;
	background: var(--accent);
	transition: width 0.2s ease;
}

/* Адаптив */
@media screen and (max-width: 950px) {
	ul.ac-result-list {
		grid-template-columns: repeat(auto-fill, minmax(min(120px, calc(50% - 6px)), 1fr));
		gap: 10px;
		padding: 12px;
	}
}

@media screen and (max-width: 760px) {
	.ac-toolbar {
		flex-direction: column;
		gap: 8px;
	}

	.ac-catalog-global {
		width: 100%;
		justify-content: flex-start;
	}

	.ac-letters {
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.ac-letters::-webkit-scrollbar {
		display: none;
	}

	.ac-catalog.current {
		flex-wrap: nowrap;
		min-width: max-content;
	}

	.ac-catalog li {
		flex: 0 0 36px;
	}

	.ac-catalog li a {
		min-height: 40px;
		font-size: 12px;
	}

	.ac-result-footer {
		flex-direction: column;
		align-items: stretch;
	}

	.ac-sort {
		width: 100%;
	}

	.ac-sort li {
		flex: 1 1 calc(50% - 3px);
		text-align: center;
		padding: 8px 8px;
	}

	.ac-options {
		width: 100%;
	}

	.ac-options .ac-result-link {
		display: flex;
		width: 100%;
		justify-content: center;
	}
}

@media screen and (max-width: 470px) {
	ul.ac-result-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
		padding: 10px;
	}

	.ac-result-list .lodyt__title {
		font-size: 12px;
	}

	.ac-result-list .lodyt__year {
		font-size: 11px;
	}

	.ac-settings-list li {
		padding: 12px;
	}

	.ac-settings-list-title {
		float: none;
		margin: 0 0 8px;
		width: 100%;
	}
}
