/* Smart News Manager — стили фронтенда */

.snm-archive-wrap { padding: 20px; }
/* .snm-archive-title: размер/шрифт выводятся динамически в class-frontend.php
   (с учётом "Наследовать тему", см. h_inherit_theme) — см. .snm-single-title выше. */
.snm-archive-title { margin-bottom: 24px; }

/* Табы категорий над сеткой карточек */
.snm-category-tabs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	margin-bottom: 24px;
}
.snm-category-tabs .snm-tab-link {
	display: inline-block;
	text-decoration: none;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
	white-space: nowrap;
}
.snm-category-tabs .snm-tab-link:hover {
	opacity: 0.85;
}
@media (max-width: 600px) {
	.snm-category-tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		margin-left: -12px;
		margin-right: -12px;
		padding-left: 12px;
		padding-right: 12px;
	}
	.snm-category-tabs .snm-tab-link { flex: 0 0 auto; }
}

/* Табы в вертикальном положении (когда выводятся в правой колонке) */
.snm-category-tabs.snm-tabs-vertical {
	flex-direction: column;
	align-items: stretch;
	margin-bottom: 0;
}
.snm-category-tabs.snm-tabs-vertical .snm-tab-link { text-align: left; }

/* Двухколоночная раскладка страницы архива: лента слева, боковая колонка
   (табы вертикально и/или блок меток) справа. Та же пропорция 2:1, что и
   на странице одиночной записи. */
.snm-archive-layout { display: flex; gap: 32px; align-items: flex-start; }
.snm-archive-main { flex: 2 1 0; min-width: 0; }
.snm-archive-sidebar { flex: 1 1 0; min-width: 0; flex-shrink: 0; position: sticky; top: 32px; align-self: flex-start; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 900px) {
	.snm-archive-layout { flex-direction: column; gap: 24px; }
	.snm-archive-main, .snm-archive-sidebar { flex: none; width: 100%; }
	.snm-archive-sidebar { position: static; }
}

/* Блок меток */
.snm-tags-sidebar-block {
	background: var(--snm-toc-bg-color, #f7f7f8);
	border: 1px solid #eee;
	border-radius: 8px;
	padding: 14px 16px;
}
.snm-tags-sidebar-title { font-weight: 700; margin-bottom: 10px; color: var(--snm-toc-heading-color, #1d2327); }
.snm-tags-list { display: flex; flex-wrap: wrap; }
.snm-tags-list .snm-tag-link {
	display: inline-flex;
	align-items: center;
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.snm-tags-list .snm-tag-link:hover { opacity: 0.85; }
.snm-tags-list .snm-tag-checkbox {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.snm-tags-apply-btn { margin-top: 14px; width: 100%; }
/* Кнопка "Применить" нужна только как фолбэк без JavaScript — когда скрипт
   фильтрации активен, он скрывает её через класс на форме (см. infinite-scroll.js). */
.snm-tags-form.snm-js-active .snm-tags-apply-btn { display: none; }

/* Сетка карточек */
.snm-cards-grid {
	display: grid;
	grid-template-columns: repeat(var(--snm-card-columns, 3), 1fr);
	gap: var(--snm-card-gap, 20px);
}
@media (max-width: 1024px) {
	.snm-cards-grid { grid-template-columns: repeat(2, 1fr); }
	.snm-archive-wrap { padding: 16px; }
}
@media (max-width: 600px) {
	.snm-cards-grid { grid-template-columns: 1fr; gap: 16px; }
	.snm-archive-wrap { padding: 12px; }
	.snm-archive-title { margin-bottom: 16px; }
}

/* Карточка */
.snm-card {
	background: var(--snm-card-bg, #fff);
	border: var(--snm-card-border, 1px solid #e2e4e7);
	border-radius: var(--snm-card-radius, 8px);
	box-shadow: var(--snm-card-shadow, none);
	padding: var(--snm-card-padding, 16px);
	overflow: hidden;
	transition: transform .25s ease, box-shadow .25s ease, opacity .4s ease;
}
@media (max-width: 600px) {
	.snm-card { padding: calc(var(--snm-card-padding, 16px) * 0.75); }
	.snm-card-title { font-size: 1.05em; }
	.snm-card-excerpt { font-size: .92em; -webkit-line-clamp: 3; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
}
.snm-card-image { position: relative; overflow: hidden; border-radius: calc(var(--snm-card-radius, 8px) - 4px); margin-bottom: 12px; }
.snm-card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.snm-ratio-1-1 { aspect-ratio: 1 / 1; }
.snm-ratio-4-3 { aspect-ratio: 4 / 3; }
.snm-ratio-16-9 { aspect-ratio: 16 / 9; }
.snm-card-image-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg,#eee,#ddd); min-height: 160px; }

.snm-hover-zoom .snm-card-image img { transition: transform .35s ease; }
.snm-hover-zoom:hover .snm-card-image img { transform: scale(1.06); }
.snm-hover-shadow:hover { box-shadow: 0 12px 28px rgba(0,0,0,.15); }
.snm-hover-highlight:hover { border-color: var(--snm-h2-color, #2271b1); }

.snm-card-title { font-size: 1.1em; margin: 0 0 8px; line-height: 1.35; }
.snm-card-title a { color: inherit; text-decoration: none; }
.snm-card-excerpt { color: #555; font-size: .95em; margin: 0 0 10px; }
.snm-card-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: .82em; color: #767676; align-items: center; }
.snm-card-rating .snm-star { color: #f0b429; }
.snm-star-empty { color: #d8d8d8 !important; }

/* Анимации появления карточек */
.snm-anim-fade { opacity: 0; animation: snm-fade-in .5s ease forwards; }
.snm-anim-slide-up { opacity: 0; transform: translateY(24px); animation: snm-slide-up .5s ease forwards; }
@keyframes snm-fade-in { to { opacity: 1; } }
@keyframes snm-slide-up { to { opacity: 1; transform: translateY(0); } }

/* Загрузка/спиннер */
.snm-load-more-wrap { text-align: center; margin-top: 28px; }
.snm-loading-spinner { width: 32px; height: 32px; margin: 16px auto; border: 3px solid #eee; border-top-color: #2271b1; border-radius: 50%; animation: snm-spin 0.8s linear infinite; }
@keyframes snm-spin { to { transform: rotate(360deg); } }
.snm-no-more-message { color: #888; }

/* Хлебные крошки */
.snm-breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-family: var(--snm-breadcrumbs-font, inherit); font-size: var(--snm-breadcrumbs-size, .85em); color: var(--snm-breadcrumbs-color, #767676); margin-bottom: 16px; }
.snm-breadcrumbs a { color: var(--snm-breadcrumbs-link-color, #2271b1); text-decoration: none; }
.snm-breadcrumbs a:hover { text-decoration: underline; }
.snm-breadcrumb-sep { opacity: .6; }
.snm-breadcrumb-current { font-weight: 500; }

/* Одиночная запись */
.snm-single-header { text-align: left; margin-bottom: 20px; }
/* .snm-single-title: шрифт/размер/цвет заголовка теперь выводятся динамически
   в class-frontend.php::output_dynamic_styles(), с учётом переключателя
   "Наследовать тему" — см. h_inherit_theme. Раньше эти значения были жёстко
   прописаны прямо тут (с var()+фолбэком), из-за чего они применялись всегда,
   даже при включённом "Наследовать тему" — заголовок игнорировал тему сайта. */
.snm-meta-info { display: flex; gap: 14px; font-size: var(--snm-meta-size, .9em); color: var(--snm-meta-color, #767676); font-family: var(--snm-meta-font, inherit); font-weight: var(--snm-meta-weight, 400); flex-wrap: wrap; }
.snm-single-thumbnail { margin: 0 auto 24px; }
.snm-single-thumbnail img { width: 100%; border-radius: 8px; display: block; }

.snm-single-layout { display: flex; gap: 40px; align-items: flex-start; }
.snm-toc-position-bottom .snm-content-wrap { display: block; }
.snm-layout-columns.snm-toc-position-right .snm-content-wrap { order: 1; }
.snm-layout-columns.snm-toc-position-right .snm-toc-sidebar { order: 2; }
.snm-layout-columns.snm-toc-position-left .snm-toc-sidebar { order: 1; }
.snm-layout-columns.snm-toc-position-left .snm-content-wrap { order: 2; }

/* Колоночная раскладка: левая колонка (заголовок, метаданные, картинка, текст) — 2/3 ширины,
   правая колонка (оглавление) — 1/3 ширины. Пропорция задаётся через flex-grow (2 к 1),
   а не фиксированной шириной в пикселях — так раскладка остаётся гибкой на любом экране. */
.snm-layout-columns .snm-content-wrap { flex: 2 1 0; min-width: 0; }
.snm-layout-columns .snm-toc-sidebar { flex: 1 1 0; min-width: 0; }

.snm-content-wrap { flex: 1; min-width: 0; }

/* TOC */
.snm-toc-sidebar { flex-shrink: 0; position: sticky; top: 32px; align-self: flex-start; }
.snm-toc-wrapper { background: var(--snm-toc-bg-color, #f7f7f8); border: 1px solid #eee; border-radius: 8px; padding: 14px 16px; }
.snm-toc-heading { font-weight: 700; margin-bottom: 10px; font-family: var(--snm-toc-font, inherit); color: var(--snm-toc-heading-color, #1d2327); }
.snm-toc-list { list-style: none; margin: 8px 0 0; padding: 0; }
.snm-toc-item { margin: 6px 0; }
.snm-toc-item a { color: var(--snm-toc-link-color, #2271b1); text-decoration: none; font-size: var(--snm-toc-size, .92em); font-family: var(--snm-toc-font, inherit); display: inline-block; padding: 3px 0; }
.snm-toc-item a.snm-toc-active { font-weight: 700; color: var(--snm-toc-active-color, #0a4b78); }
.snm-toc-sub { padding-left: 16px; font-size: .95em; }

/* Блок "Другие новости" — альтернатива оглавлению */
.snm-other-news {
	background: var(--snm-toc-bg-color, #f7f7f8);
	border: 1px solid #eee;
	border-radius: 8px;
	padding: 14px 16px;
}
.snm-other-news-heading {
	font-weight: 700;
	margin-bottom: 10px;
	font-family: var(--snm-toc-font, inherit);
	color: var(--snm-toc-heading-color, #1d2327);
}
.snm-other-news-list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 520px;
	overflow-y: auto;
}
.snm-other-news-item { border-top: 1px solid rgba(0,0,0,0.06); }
.snm-other-news-item:first-child { border-top: none; }
.snm-other-news-link {
	display: block;
	padding: 10px 2px;
	text-decoration: none;
	color: inherit;
}
.snm-other-news-title {
	display: block;
	font-size: var(--snm-toc-size, .92em);
	font-family: var(--snm-toc-font, inherit);
	color: var(--snm-toc-link-color, #2271b1);
	line-height: 1.35;
}
.snm-other-news-link:hover .snm-other-news-title { text-decoration: underline; }
.snm-other-news-date {
	display: block;
	margin-top: 3px;
	font-size: .8em;
	color: var(--snm-meta-color, #767676);
}

@media (max-width: 900px) {
	.snm-single-layout { flex-direction: column; gap: 24px; align-items: stretch; }
	.snm-toc-sidebar, .snm-layout-columns .snm-toc-sidebar,
	.snm-content-wrap, .snm-layout-columns .snm-content-wrap { flex: none; width: 100%; }
	.snm-toc-sidebar { position: static; }
	.snm-content-wrap { max-width: 100% !important; }
}
@media (max-width: 600px) {
	.snm-single-header, .snm-content-wrap, .snm-comments-wrap { padding-left: 4px; padding-right: 4px; }
	.snm-meta-info { gap: 10px; font-size: .85em; }
}

/* Рейтинг: read-only и интерактивный */
.snm-stars { letter-spacing: 1px; }
.snm-rating-widget { margin-top: 32px; padding-top: 20px; border-top: 1px solid #eee; }
.snm-rating-vote { margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.snm-rating-stars-input { display: inline-flex; }
.snm-star-btn { background: none; border: none; font-size: 24px; color: #d8d8d8; cursor: pointer; padding: 6px; line-height: 1; transition: color .15s ease; }
.snm-star-btn:hover, .snm-star-btn.snm-star-hover { color: #f0b429; }
.snm-rating-thanks { color: #2a8a3e; font-size: .92em; }
@media (max-width: 600px) {
	.snm-star-btn { font-size: 30px; padding: 8px; }
}

/* Список "Последние новости" (Elementor-виджет и Gutenberg-блок) */
.snm-latest-news-list { list-style: none; margin: 0; padding: 0; }
.snm-latest-news-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eee; }
.snm-latest-news-item:last-child { border-bottom: none; }
.snm-latest-news-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.snm-latest-news-body { display: flex; flex-direction: column; gap: 3px; }
.snm-latest-news-title { font-weight: 600; text-decoration: none; color: inherit; }
.snm-latest-news-date, .snm-latest-news-author { font-size: .82em; color: #888; }

/* Комментарии — базовая стилизация под дизайн плагина */
.snm-comments-wrap { margin-top: 40px; }
.snm-comments-wrap .comment-form input[type=text],
.snm-comments-wrap .comment-form input[type=email],
.snm-comments-wrap .comment-form textarea { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 16px; }

/* Кнопки подгрузки — во всю ширину и крупнее на мобильном для удобства нажатия */
@media (max-width: 600px) {
	.snm-load-more-btn, .snm-show-all-btn { width: 100%; padding: 12px; font-size: 15px; }
}

/* Страница "Мои подписки" ([news_subscriptions]) — оформление настраивается
   отдельно на вкладке "Подписки" в админке (см. --snm-sub-* переменные в
   output_dynamic_styles() класса SNM_Frontend). Здесь только базовый макет. */
.snm-subscriptions { max-width: 640px; }
.snm-subscriptions-hint { opacity: 0.8; margin-bottom: 16px; }
.snm-subscriptions-tags { display: flex; flex-wrap: wrap; margin-bottom: 16px; }
.snm-subscriptions-tags .snm-subscriptions-tag { cursor: pointer; border: none; font: inherit; }
.snm-subscriptions-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.snm-subscriptions-status { font-size: 0.9em; opacity: 0.85; }
.snm-subscriptions-status.snm-status-error { color: #d63638; opacity: 1; }
.snm-subscriptions-divider { margin: 28px 0; border: none; border-top: 1px solid #e2e4e7; }
.snm-subscriptions-telegram h3 { margin-top: 0; }
.snm-telegram-connected-msg { color: #1e7e34; font-weight: 600; }
.snm-telegram-link-box { margin-top: 12px; padding: 12px 14px; background: #f5f5f6; border-radius: 8px; }
.snm-telegram-waiting { font-size: 0.9em; opacity: 0.8; margin: 6px 0 0; }
.snm-subscriptions-guest p { font-size: 1.05em; }
