/* ==========================================================================
   Avangard Dark 2.0 · css3.css
   Современные доработки оформления XenForo: скругления углов блоков,
   подсветка строк под курсором, метки «Новое» / «Закреплено», плавные переходы.
   Подключается глобально (как в стандартной теме MyBB).
   ========================================================================== */

/* --- Углы блоков (.block-container) --- */
.tborder {
	border-radius: var(--ad-radius);
}

.thead {
	border-top-left-radius: 3px;
	border-top-right-radius: 3px;
}

.tborder .thead_collapsed {
	border-radius: var(--ad-radius);
}

.tborder tbody tr:last-child > td:first-child {
	border-bottom-left-radius: 3px;
}

.tborder tbody tr:last-child > td:last-child {
	border-bottom-right-radius: 3px;
}

.tborder thead:last-child tr:last-child > td:first-child {
	border-bottom-left-radius: 3px;
}

.tborder thead:last-child tr:last-child > td:last-child {
	border-bottom-right-radius: 3px;
}

/* --- Плавные переходы --- */
a,
a.button,
.pagination a,
.usercp_nav_item,
.modcp_nav_item,
.popup_menu .popup_item,
.forum_status,
.subforumicon,
.trow1,
.trow2 {
	transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, filter .15s ease;
}

/* --- Подсветка строк под курсором (.node:hover в XenForo) --- */
.tborder tr:has(> td > .forum_status):hover > td {
	background-color: var(--ad-hover);
}

/* --- Подсветка строк под курсором (расширенные эффекты — в конце файла) --- */
.tborder tr.inline_row:hover > td {
	background-color: var(--ad-hover);
}

/* --- Непрочитанный узел: жирный заголовок (.node--unread .node-title) --- */
.tborder tr:has(> td > .forum_status.forum_on) > td:nth-child(2) strong {
	font-weight: 700;
}

/* --- Метка «Новое» (.uix_newIndicator / .label) --- */
.tborder tr:has(> td > .forum_status.forum_on) > td:nth-child(2) strong > a::after {
	content: "Новое";
	display: inline-block;
	vertical-align: middle;
	margin-left: 8px;
	padding: 1px .4em;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.3;
	color: #fff;
	background-color: var(--ad-accent);
	background-image: var(--ad-gradient);
	border-radius: var(--ad-radius);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

/* --- Метка «Закреплено» в списке тем --- */
.tborder tr.inline_row:has(td.sticky) > td:nth-child(3)::before {
	content: "Закреплено";
	display: inline-block;
	vertical-align: middle;
	margin: 0 8px 2px 0;
	padding: 1px .4em;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.3;
	color: #fff;
	background: var(--ad-amber);
	border-radius: var(--ad-radius);
}

/* --- В XenForo у списка форумов нет строки-шапки: подписи «Темы»/«Сообщения»
       уже стоят внутри узла, поэтому дублирующую строку скрываем --- */
.tborder:has(.forum_status) tr:has(> td.tcat + td.tcat) {
	display: none;
}

/* -------------------------------------------------------------------------
   Легенда под списком форумов
   В XenForo (и на эталонном форуме) такой легенды нет, поэтому она скрыта.
   Вернуть: удалите display: none или замените на display: block.
   ------------------------------------------------------------------------- */
.forum_legend {
	display: none;
}

/* -------------------------------------------------------------------------
   Защита от растягивания страницы длинными строками
   (длинные URL аватарок и ссылок, заголовки/названия без пробелов)
   ------------------------------------------------------------------------- */
.node-extra,
.node-extra-title,
.node-extra-meta,
.node-main,
.node-title,
.node-description,
.structItem-cell--main,
.structItem-title,
.structItem-minor,
.post_body,
.lastpost {
	overflow-wrap: anywhere;
	word-wrap: break-word;
}

/* В стандартной разметке MyBB у колонки «последнее сообщение» стоит
   стиль white-space: nowrap — из-за длинных ссылок таблица растягивалась. */
.tborder tr:has(> td > .forum_status) > td:last-child,
.tborder tr.inline_row > td:last-child {
	white-space: normal !important;
}

/* -------------------------------------------------------------------------
   Аватары в списке тем (плагин avangarddark)
   слева — автор темы, справа — автор последнего сообщения
   ------------------------------------------------------------------------- */
.structItem-cell--icon {
	width: 1%;
	white-space: nowrap;
	text-align: center;
}

.structItem-cell--latest {
	width: 220px;
}

.ad-thread-avatar {
	display: inline-block;
	vertical-align: middle;
	line-height: 0;
}

/* пока плагина нет, маркер в шаблоне пустой и не занимает места */
.ad-thread-avatar:empty {
	display: none;
}

.ad-thread-avatar img,
.ad-avatar-link img {
	width: 36px;
	height: 36px;
	object-fit: cover;
	border-radius: 50%;
	background: var(--ad-block-alt);
	box-shadow: 0 1px 3px rgba(0, 0, 0, .40);
	transition: transform .3s cubic-bezier(.22, .61, .36, 1), box-shadow .3s ease;
}

.ad-thread-avatar--author {
	margin-right: 8px;
}

.ad-thread-avatar--last {
	margin-left: 8px;
}

.ad-thread-avatar--last img {
	width: 32px;
	height: 32px;
}

.ad-avatar-link {
	display: inline-block;
	line-height: 0;
}

tr.ad-clickable-row {
	cursor: pointer;
}

/* -------------------------------------------------------------------------
   Подсвечивание и премиальная анимация при наведении
   ------------------------------------------------------------------------- */

/* --- Раздел: подъём строки, голубая заливка, свечение и пробегающий блик --- */
.node-cell .node-body {
	position: relative;
	overflow: hidden;
	transition: transform .32s cubic-bezier(.22, .61, .36, 1), box-shadow .32s ease, background-color .32s ease;
}

.node-body::before,
.node-body::after {
	content: "";
	position: absolute;
	top: 0;
	height: 100%;
	pointer-events: none;
	opacity: 0;
}

.node-body::before {
	left: 0;
	width: 100%;
	background-image: linear-gradient(90deg, rgba(87, 169, 246, .14) 0%, rgba(87, 169, 246, .05) 45%, rgba(87, 169, 246, 0) 100%);
	transition: opacity .32s ease;
}

.node-body::after {
	left: -55%;
	width: 40%;
	background-image: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .06) 45%, rgba(255, 255, 255, .11) 50%, rgba(255, 255, 255, .06) 55%, rgba(255, 255, 255, 0) 100%);
	transform: translateX(0) skewX(-14deg);
}

.node:hover .node-body {
	transform: translateY(-1px);
	box-shadow: inset 3px 0 0 var(--ad-accent), inset 0 0 0 1px rgba(87, 169, 246, .18), 0 8px 22px rgba(0, 0, 0, .40);
}

.node:hover .node-body::before {
	opacity: 1;
}

.node:hover .node-body::after {
	opacity: 1;
	animation: ad-shine .9s cubic-bezier(.35, 0, .25, 1);
}

.node-icon,
.forum_status {
	transition: transform .32s cubic-bezier(.22, .61, .36, 1), box-shadow .3s ease;
}

.node:hover .node-icon {
	transform: scale(1.07);
}

.node-title > a,
.structItem-title a,
span[id^="tid_"] a {
	transition: color .2s ease;
}

.node:hover .node-title > a {
	color: var(--ad-link-hover);
}

/* --- Тема: подсветка строки, акцентные полосы по краям, отклик аватарок --- */
.p-thread-table tr.inline_row > td,
.tborder tr.inline_row > td {
	transition: background-color .3s ease, box-shadow .3s ease, border-color .3s ease;
}

.p-thread-table tr.inline_row:hover > td,
.tborder tr.inline_row:hover > td {
	background-color: var(--ad-hover);
	border-color: rgba(87, 169, 246, .22);
}

.p-thread-table tr.inline_row:hover > td:first-child,
.tborder tr.inline_row:hover > td:first-child {
	box-shadow: inset 3px 0 0 var(--ad-accent);
}

.p-thread-table tr.inline_row:hover > td:last-child {
	box-shadow: inset -3px 0 0 rgba(87, 169, 246, .38);
}

.p-thread-table tr.inline_row:hover .structItem-title a,
.tborder tr.inline_row:hover span[id^="tid_"] a {
	color: var(--ad-link-hover);
}

.p-thread-table tr.inline_row:hover .thread_status,
.tborder tr.inline_row:hover .thread_status {
	box-shadow: 0 0 12px var(--ad-accent-glow);
}

.p-thread-table tr.inline_row:hover .ad-thread-avatar img,
.tborder tr.inline_row:hover .ad-thread-avatar img {
	transform: scale(1.08);
	box-shadow: 0 0 0 2px rgba(87, 169, 246, .35), 0 4px 12px rgba(0, 0, 0, .45);
}

/* --- Строки разделов в стандартной разметке MyBB (тема без шаблонов) --- */
.tborder tr:has(> td > .forum_status) > td {
	transition: background-color .3s ease, box-shadow .3s ease, border-color .3s ease;
}

.tborder tr:has(> td > .forum_status):hover > td {
	background-color: var(--ad-hover);
	border-color: rgba(87, 169, 246, .22);
}

.tborder tr:has(> td > .forum_status):hover > td:first-child {
	box-shadow: inset 3px 0 0 var(--ad-accent);
}

.tborder tr:has(> td > .forum_status):hover .forum_status {
	transform: scale(1.08);
	box-shadow: 0 0 12px var(--ad-accent-glow);
}

@keyframes ad-shine {
	from {
		transform: translateX(0) skewX(-14deg);
	}
	to {
		transform: translateX(400%) skewX(-14deg);
	}
}

/* --- Уважаем системную настройку «уменьшить движение» --- */
@media (prefers-reduced-motion: reduce) {
	.node-cell .node-body,
	.node:hover .node-body,
	.node-icon,
	.node:hover .node-icon,
	.forum_status,
	.ad-thread-avatar img,
	.ad-avatar-link img,
	.p-thread-table tr.inline_row > td,
	.tborder tr.inline_row > td,
	.tborder tr:has(> td > .forum_status) > td {
		transition: none;
	}

	.node:hover .node-body,
	.node:hover .node-icon,
	.tborder tr:has(> td > .forum_status):hover .forum_status {
		transform: none;
	}

	.node:hover .node-body::after {
		animation: none;
		opacity: 0;
	}
}

/* --- Доступность и мелочи --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
	outline: 2px solid var(--ad-accent);
	outline-offset: 2px;
}

input.textbox::placeholder,
textarea::placeholder {
	color: var(--ad-faint);
}

@media (hover: none) {
	.forum_status.forum_on:hover::before {
		background: var(--ad-accent);
	}
}
