/* Стили взаимодействий: репосты, подсказки о лайках и репостах, меню действий публикации.
   Файл подключается глобально из application/appearance/standart/sample.tpl. */

.reaction-hover,
.post-actions .reaction-hover,
.post-detail-actions .reaction-hover {
	--reaction-accent: #6d5ce6;
	--reaction-accent-soft: #8b7cf0;
	--social-border: var(--social-border, #e6e8f0);
	--social-surface: var(--social-surface, #fff);
	--social-soft: var(--social-soft, #f6f7fb);
	--social-muted: var(--social-muted, #737d90);
	--social-text: var(--social-text, #252c3b);
	--reaction-panel-bg: #fff;
	--reaction-panel-border: #e6e8f0;
	--reaction-panel-shadow: 0 18px 44px rgba(24, 30, 48, .18);
	position: relative;
	display: inline-flex;
	align-items: center;
}

html[data-bs-theme="dark"] .reaction-hover {
	--reaction-panel-bg: #1e2030;
	--reaction-panel-border: #2c3049;
	--reaction-panel-shadow: 0 18px 44px rgba(0, 0, 0, .5);
}

.reaction-hover > button,
.reaction-hover > .btn,
.reaction-hover > span.btn {
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
}

.reaction-hover-reposts > .post-action-repost.is-reposted,
.reaction-hover-reposts > .post-action-repost.is-reposted .bi {
	color: var(--reaction-accent);
}

.reaction-hover-panel {
	position: absolute;
	left: 0;
	bottom: calc(100% + 10px);
	z-index: 40;
	display: block;
	width: min(320px, 82vw);
	max-height: 340px;
	overflow-x: hidden;
	overflow-y: auto;
	padding: 12px;
	border: 1px solid var(--reaction-panel-border, #e6e8f0);
	border-radius: 16px;
	background: var(--reaction-panel-bg, #fff);
	box-shadow: var(--reaction-panel-shadow, 0 18px 44px rgba(24, 30, 48, .18));
	color: var(--social-text);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
	pointer-events: none;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.reaction-hover:hover > .reaction-hover-panel,
.reaction-hover:focus-within > .reaction-hover-panel,
.reaction-hover.is-hover-open > .reaction-hover-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	pointer-events: auto;
}

/*
	Панель подсказки скрыта по умолчанию, но при наведении или фокусе
	показывается даже если у неё остался атрибут hidden (его снимает скрипт).
*/
.reaction-hover-panel[hidden] {
	display: none;
}

.reaction-hover:hover > .reaction-hover-panel[hidden],
.reaction-hover:focus-within > .reaction-hover-panel[hidden],
.reaction-hover.is-hover-open > .reaction-hover-panel[hidden] {
	display: block;
}


/*
	Мостик между счётчиком и панелью: без него курсор по дороге к панели
	покидает блок и подсказка закрывается. Размещаем его на обёртке, потому что
	сама панель прокручивается и обрезала бы такой элемент.
*/
.reaction-hover::after {
	position: absolute;
	right: 0;
	bottom: 100%;
	left: 0;
	height: 14px;
	pointer-events: none;
	content: '';
}

.reaction-hover:hover::after,
.reaction-hover:focus-within::after,
.reaction-hover.is-hover-open::after {
	pointer-events: auto;
}

.reaction-hover-title {
	margin-bottom: 8px;
	color: var(--social-muted);
	font-size: 11px;
	font-weight: 750;
	letter-spacing: .07em;
	text-transform: uppercase;
}

.reaction-hover-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.reaction-hover-user {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 6px 7px;
	border-radius: 12px;
	transition: background-color .15s ease;
}

.reaction-hover-user:hover {
	background: color-mix(in srgb, var(--reaction-accent) 8%, var(--social-surface));
}

.reaction-hover-user.is-extra {
	display: none;
}

.reaction-hover-avatar {
	flex: 0 0 auto;
	display: block;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--social-soft);
}

.reaction-hover-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.reaction-hover-info {
	min-width: 0;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
}

.reaction-hover-name {
	overflow: hidden;
	color: var(--social-text);
	font-size: 13px;
	font-weight: 650;
	line-height: 1.25;
	text-decoration: none;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.reaction-hover-name:hover {
	color: var(--reaction-accent);
}

.reaction-hover-date {
	color: var(--social-muted);
	font-size: 11px;
	line-height: 1.3;
}

.reaction-hover-kind {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--reaction-accent) 12%, transparent);
	color: var(--reaction-accent);
	font-size: 11px;
}

.reaction-hover-user.is-like .reaction-hover-kind {
	background: rgba(226, 76, 106, .13);
	color: #e24c6a;
}

.reaction-hover-empty {
	padding: 8px 6px;
	color: var(--social-muted);
	font-size: 13px;
	text-align: center;
}

.reaction-hover-more {
	margin-top: 8px;
	text-align: center;
}

.reaction-hover-more[hidden] {
	display: none !important;
}

.reaction-hover-more-btn {
	width: 100%;
	padding: 7px 10px;
	border: 1px solid var(--social-border);
	border-radius: 12px;
	background: var(--social-soft);
	color: var(--reaction-accent);
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
	transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.reaction-hover-more-btn:hover:not(:disabled) {
	border-color: color-mix(in srgb, var(--reaction-accent) 45%, var(--social-border));
	background: color-mix(in srgb, var(--reaction-accent) 10%, var(--social-surface));
}

.reaction-hover-more-btn:disabled {
	cursor: default;
	opacity: .7;
}

/* ---------------------------------------------------------------- */
/* Шапка репоста и цитата исходной публикации                       */
/* ---------------------------------------------------------------- */

.post-repost-notice {
	display: flex;
	align-items: center;
	gap: 9px;
	margin: 0 0 12px;
	padding: 9px 12px;
	border: 1px solid color-mix(in srgb, #6d5ce6 20%, var(--social-border, #e6e8f0));
	border-radius: 14px;
	background: linear-gradient(100deg, color-mix(in srgb, #6d5ce6 8%, transparent), var(--social-surface, #fff) 72%);
	color: var(--social-muted, #737d90);
	font-size: 13px;
}

.post-repost-notice.is-missing {
	border-color: var(--social-border, #e6e8f0);
	background: var(--social-soft, #f6f7fb);
	color: var(--social-muted, #737d90);
}

.post-repost-icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: color-mix(in srgb, #6d5ce6 14%, transparent);
	color: #6d5ce6;
	font-size: 13px;
}

.post-repost-caption {
	min-width: 0;
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 6px;
}

.post-repost-author {
	color: #6d5ce6;
	font-weight: 700;
	text-decoration: none;
}

.post-repost-author:hover {
	color: #8b7cf0;
	text-decoration: underline;
}

.post-repost-date {
	color: var(--social-muted, #737d90);
	font-size: 11px;
}

.post-repost-open {
	flex: 0 0 auto;
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 9px;
	background: color-mix(in srgb, #6d5ce6 10%, transparent);
	color: #6d5ce6;
	text-decoration: none;
	transition: background-color .15s ease, color .15s ease;
}

.post-repost-open:hover {
	background: #6d5ce6;
	color: #fff;
}

.post-repost-source {
	margin: 10px 0 0;
	padding: 12px 13px;
	border: 1px solid var(--social-border, #e6e8f0);
	border-left: 3px solid #6d5ce6;
	border-radius: 14px;
	background: var(--social-soft, #f6f7fb);
}

.post-repost-source-head {
	display: flex;
	align-items: center;
	gap: 9px;
	margin-bottom: 8px;
}

.post-repost-source-avatar {
	flex: 0 0 auto;
	display: block;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--social-surface, #fff);
}

.post-repost-source-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.post-repost-source-info {
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.post-repost-source-name {
	font-size: 13px;
	font-weight: 700;
	line-height: 1.25;
}

.post-repost-source-date {
	color: var(--social-muted, #737d90);
	font-size: 11px;
}

.post-repost-source-link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.post-repost-source-text {
	display: -webkit-box;
	overflow: hidden;
	color: var(--social-text, #252c3b);
	font-size: 14px;
	line-height: 1.45;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
}

.post-repost-source-link:hover .post-repost-source-text {
	color: #6d5ce6;
}

.post-repost-source-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-top: 10px;
	color: var(--social-muted, #737d90);
	font-size: 12px;
}

.post-repost-source-stat {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.post-repost-source-open {
	margin-left: auto;
	color: #6d5ce6;
	font-weight: 700;
	text-decoration: none;
}

.post-repost-source-open:hover {
	color: #8b7cf0;
	text-decoration: underline;
}

/* ---------------------------------------------------------------- */
/* Диалог репоста (собственный блок, без Bootstrap-модалки)         */
/* ---------------------------------------------------------------- */

.repost-dialog-host {
	position: fixed;
	inset: 0;
	z-index: 1085;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px;
}

.repost-dialog-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(18, 22, 36, .55);
	backdrop-filter: blur(2px);
}

.repost-dialog {
	position: relative;
	z-index: 1;
	width: min(480px, 100%);
	max-height: min(90vh, 720px);
	overflow-x: hidden;
	overflow-y: auto;
	padding: 18px;
	border: 1px solid var(--social-border, #e6e8f0);
	border-radius: 18px;
	background: var(--social-surface, #fff);
	box-shadow: 0 26px 70px rgba(18, 22, 36, .28);
	color: var(--social-text, #252c3b);
	animation: sociqRepostIn .18s ease-out;
}

@keyframes sociqRepostIn {
	from { opacity: 0; transform: translateY(10px) scale(.985); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.repost-dialog-head {
	display: flex;
	align-items: center;
	gap: 11px;
	margin-bottom: 14px;
}

.repost-dialog-icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 13px;
	background: linear-gradient(135deg, #6d5ce6, #8b7cf0);
	color: #fff;
	font-size: 17px;
}

.repost-dialog-title {
	min-width: 0;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
}

.repost-dialog-title strong {
	font-size: 16px;
	font-weight: 750;
	letter-spacing: -.01em;
}

.repost-dialog-title small {
	color: var(--social-muted, #737d90);
	font-size: 12px;
}

.repost-dialog-close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 1px solid var(--social-border, #e6e8f0);
	border-radius: 11px;
	background: var(--social-soft, #f6f7fb);
	color: var(--social-muted, #737d90);
	cursor: pointer;
	transition: color .15s ease, border-color .15s ease;
}

.repost-dialog-close:hover {
	border-color: #6d5ce6;
	color: #6d5ce6;
}

.repost-dialog-preview {
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin-bottom: 14px;
	padding: 11px 12px;
	border: 1px dashed var(--social-border, #e6e8f0);
	border-radius: 14px;
	background: var(--social-soft, #f6f7fb);
}

.repost-preview-label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: #6d5ce6;
	font-size: 11px;
	font-weight: 750;
	letter-spacing: .05em;
	text-transform: uppercase;
}

.repost-preview-text {
	display: -webkit-box;
	overflow: hidden;
	color: var(--social-text, #252c3b);
	font-size: 13px;
	line-height: 1.4;
	overflow-wrap: anywhere;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.repost-dialog-options {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	margin-bottom: 14px;
}

.repost-option {
	position: relative;
	display: block;
	cursor: pointer;
}

.repost-option input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.repost-option > span {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 7px;
	padding: 12px 8px;
	border: 1px solid var(--social-border, #e6e8f0);
	border-radius: 14px;
	background: var(--social-surface, #fff);
	color: var(--social-muted, #737d90);
	font-size: 12px;
	font-weight: 650;
	text-align: center;
	transition: border-color .15s ease, color .15s ease, background-color .15s ease, transform .15s ease;
}

.repost-option > span .bi {
	font-size: 18px;
}

.repost-option:hover > span {
	border-color: color-mix(in srgb, #6d5ce6 42%, var(--social-border, #e6e8f0));
	transform: translateY(-1px);
}

.repost-option input:checked + span {
	border-color: #6d5ce6;
	background: color-mix(in srgb, #6d5ce6 9%, var(--social-surface, #fff));
	color: #6d5ce6;
}

.repost-option input:focus-visible + span {
	outline: 2px solid #8b7cf0;
	outline-offset: 2px;
}

.repost-dialog-field {
	margin-bottom: 12px;
}

.repost-dialog-field[hidden] {
	display: none;
}

.repost-dialog-field label {
	display: block;
	margin-bottom: 5px;
	color: var(--social-muted, #737d90);
	font-size: 12px;
	font-weight: 650;
}

.repost-optional {
	font-weight: 500;
	opacity: .75;
}

.repost-dialog .form-select,
.repost-dialog .form-control {
	border-radius: 13px;
	border-color: var(--social-border, #e6e8f0);
	background-color: var(--social-surface, #fff);
	color: var(--social-text, #252c3b);
}

.repost-dialog .form-control:focus,
.repost-dialog .form-select:focus {
	border-color: #8b7cf0;
	box-shadow: 0 0 0 3px rgba(139, 124, 240, .18);
}

.repost-dialog-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 9px;
}

.repost-dialog-actions .btn {
	padding: 9px 16px;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 700;
}

.repost-dialog-actions .btn-primary {
	border-color: transparent;
	background: linear-gradient(135deg, #6d5ce6, #8b7cf0);
	color: #fff;
}

.repost-dialog-actions .btn-primary:disabled,
.repost-dialog-actions .btn-primary.is-loading {
	opacity: .68;
	cursor: progress;
}

/* ---------------------------------------------------------------- */
/* Репост в переписке                                               */
/* ---------------------------------------------------------------- */

.chat-repost {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-top: 2px;
	padding: 10px;
	border: 1px solid color-mix(in srgb, #6d5ce6 22%, var(--social-border, #e6e8f0));
	border-radius: 14px;
	background: color-mix(in srgb, #6d5ce6 6%, var(--social-surface, #fff));
	max-width: 100%;
}

.chat-repost-avatar {
	flex: 0 0 auto;
	display: block;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--social-surface, #fff);
}

.chat-repost-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.chat-repost-body {
	min-width: 0;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.chat-repost-head {
	display: flex;
	align-items: baseline;
	gap: 7px;
	min-width: 0;
}

.chat-repost-name {
	overflow: hidden;
	font-size: 13px;
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chat-repost-date {
	flex: 0 0 auto;
	margin-left: auto;
	color: var(--social-muted, #737d90);
	font-size: 11px;
}

.chat-repost-text {
	display: -webkit-box;
	overflow: hidden;
	color: var(--social-text, #252c3b);
	font-size: 13px;
	line-height: 1.4;
	overflow-wrap: anywhere;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.chat-repost-link {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
	padding: 5px 11px;
	border-radius: 999px;
	background: linear-gradient(135deg, #6d5ce6, #8b7cf0);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	text-decoration: none;
	transition: filter .15s ease;
}

.chat-repost-link:hover {
	filter: brightness(1.07);
	color: #fff;
}

.chat-repost-comment {
	display: block;
	margin-bottom: 5px;
	overflow-wrap: anywhere;
}

.chat-repost-missing {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--social-muted, #737d90);
	font-size: 13px;
}

/* ---------------------------------------------------------------- */
/* Тёмная тема                                                      */
/* ---------------------------------------------------------------- */

html[data-bs-theme="dark"] .reaction-hover,
html[data-bs-theme="dark"] .post-repost-source,
html[data-bs-theme="dark"] .repost-dialog,
html[data-bs-theme="dark"] .chat-repost {
	--reaction-accent: #8b7cf0;
	--reaction-accent-soft: #a99dff;
	--social-border: rgba(157, 169, 191, .17);
	--social-soft: #232936;
	--social-surface: #1b202b;
	--social-muted: #99a3b8;
	--social-text: #e8ecf5;
}

html[data-bs-theme="dark"] .reaction-hover-panel {
	box-shadow: 0 20px 48px rgba(4, 6, 14, .55);
}

html[data-bs-theme="dark"] .post-repost-notice {
	border-color: rgba(139, 124, 240, .3);
	background: linear-gradient(100deg, rgba(139, 124, 240, .14), var(--social-surface, #1b202b) 72%);
	color: var(--social-muted, #99a3b8);
}

html[data-bs-theme="dark"] .post-repost-source {
	background: var(--social-soft, #232936);
}

html[data-bs-theme="dark"] .repost-dialog-backdrop {
	background: rgba(6, 8, 16, .66);
}

html[data-bs-theme="dark"] .repost-dialog,
html[data-bs-theme="dark"] .repost-dialog .form-select,
html[data-bs-theme="dark"] .repost-dialog .form-control,
html[data-bs-theme="dark"] .repost-option > span,
html[data-bs-theme="dark"] .repost-dialog-actions .btn-light {
	background-color: var(--social-surface, #1b202b);
	border-color: var(--social-border, rgba(157, 169, 191, .17));
	color: var(--social-text, #e8ecf5);
}

html[data-bs-theme="dark"] .repost-option input:checked + span {
	background: rgba(139, 124, 240, .17);
	color: #a99dff;
}

html[data-bs-theme="dark"] .reaction-hover-user:hover {
	background: rgba(139, 124, 240, .12);
}

html[data-bs-theme="dark"] .chat-repost {
	background: rgba(139, 124, 240, .12);
}

html[data-bs-theme="dark"] .reaction-hover-kind {
	background: rgba(139, 124, 240, .2);
	color: #a99dff;
}

/* ---------------------------------------------------------------- */
/* Мобильные экраны и тач-устройства                                */
/* ---------------------------------------------------------------- */

@media (max-width: 575.98px) {
	.reaction-hover-panel {
		left: 50%;
		width: min(280px, 88vw);
		transform: translate(-50%, 6px);
	}

	.reaction-hover:hover .reaction-hover-panel,
	.reaction-hover:focus-within .reaction-hover-panel {
		transform: translate(-50%, 0);
	}

	.repost-dialog {
		padding: 15px;
		border-radius: 16px;
	}

	.repost-dialog-options {
		grid-template-columns: 1fr;
	}

	.repost-option > span {
		flex-direction: row;
		justify-content: flex-start;
		padding: 10px 12px;
		text-align: left;
	}

	.repost-dialog-actions {
		flex-direction: column-reverse;
	}

	.repost-dialog-actions .btn {
		width: 100%;
	}
}

@media (max-width: 380px) {
	.repost-dialog-options {
		grid-template-columns: 1fr;
	}
}

/* На тач-устройствах подсказка не нужна: не перекрываем вёрстку. */
@media (hover: none) {
	.reaction-hover-panel {
		display: none !important;
	}
}
