/*
 * Единые кнопки действий витрины (Сравнить, Отложить, список желаний, снижение цены, поступление)
 * и окно-уведомление по центру экрана. Разметка: functions/ui.php, окно: js/catalog_notice.js.
 * Цвета и скругления темы можно задать переменными (на :root или на любом контейнере):
 *   --ci-accent, --ci-accent-soft, --ci-text, --ci-muted, --ci-border, --ci-radius,
 *   --ci-success, --ci-warning, --ci-danger
 * Если их нет, берутся --site-accent / --site-text / --site-border / --site-radius темы, затем запасные значения.
 */

.ci-action,
.ci-notice {
	--_accent: var(--ci-accent, var(--site-accent, #1f6feb));
	--_accent-soft: var(--ci-accent-soft, rgba(31, 111, 235, .09));
	--_text: var(--ci-text, var(--site-text, #1f2430));
	--_muted: var(--ci-muted, var(--site-text-muted, #6b7280));
	--_border: var(--ci-border, var(--site-border, #d7dce4));
	--_radius: var(--ci-radius, var(--site-radius, 10px));
	--_success: var(--ci-success, var(--site-success, #1f9d57));
	--_warning: var(--ci-warning, #b7791f);
	--_danger: var(--ci-danger, #c0392b);
}

/* ---------- Кнопки действий ---------- */

.ci-action {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	box-sizing: border-box;
	min-height: 40px;
	padding: 0 16px;
	border: 1px solid var(--_border);
	border-radius: var(--_radius);
	background: #fff;
	color: var(--_text);
	font-weight: 600;
	font-size: 14px;
	line-height: 1.25;
	font-family: inherit;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	max-width: 100%;
	vertical-align: middle;
	transition: border-color .15s ease, color .15s ease, background-color .15s ease;
	-webkit-tap-highlight-color: transparent;
}

.ci-action:hover {
	border-color: var(--_accent);
	color: var(--_accent);
	text-decoration: none;
}

.ci-action:focus-visible {
	outline: 2px solid var(--_accent);
	outline-offset: 2px;
}

.ci-action .ci-icon {
	flex: none;
	width: 20px;
	height: 20px;
}

.ci-action.is-active {
	border-color: var(--_accent);
	background: var(--_accent-soft);
	color: var(--_accent);
}

/* Добавленное в избранное сердце закрашивается */
.ci-action--watchlist.is-active .ci-icon path,
.ci-action--watch.is-active .ci-icon path {
	fill: currentColor;
}

/* Только значок: подпись остаётся для скринридеров и во всплывающей подсказке */
.ci-action--icon {
	width: 40px;
	padding: 0;
	justify-content: center;
}

.ci-action--icon .ci-action__label {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.ci-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* ---------- Окно-уведомление ---------- */

.ci-notice {
	position: fixed;
	z-index: 100000;
	top: 50%;
	left: 50%;
	box-sizing: border-box;
	width: min(92vw, 420px);
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, -46%) scale(.96);
	transition: opacity .18s ease, transform .18s ease;
	font-family: inherit;
	color: var(--_text);
}

.ci-notice.is-open {
	opacity: 1;
	pointer-events: auto;
	transform: translate(-50%, -50%) scale(1);
}

.ci-notice__card {
	position: relative;
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr);
	column-gap: 14px;
	row-gap: 14px;
	align-items: center;
	padding: 20px;
	border-radius: 16px;
	background: #fff;
	box-shadow: 0 18px 50px rgba(15, 23, 42, .28), 0 2px 8px rgba(15, 23, 42, .12);
	max-height: 92vh;
	overflow-x: hidden;
	overflow-y: auto;
}

.ci-notice__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--_accent-soft);
	color: var(--_accent);
}

.ci-notice__icon .ci-icon {
	width: 22px;
	height: 22px;
}

.ci-notice--success .ci-notice__icon { background: rgba(31, 157, 87, .12); color: var(--_success); }
.ci-notice--warning .ci-notice__icon { background: rgba(183, 121, 31, .14); color: var(--_warning); }
.ci-notice--error .ci-notice__icon { background: rgba(192, 57, 43, .12); color: var(--_danger); }

.ci-notice__body {
	min-width: 0;
	padding-right: 26px;
	font-size: 15px;
	line-height: 1.4;
}

.ci-notice__text {
	font-weight: 600;
	font-size: 16px;
	overflow-wrap: anywhere;
}

.ci-notice__html {
	font-size: 14px;
	color: var(--_text);
}

.ci-notice__html.is-text {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
}

.ci-notice__html:empty,
.ci-notice__text:empty {
	display: none;
}

.ci-notice__html a { color: var(--_accent); font-weight: 600; text-decoration: underline; }

/* Блок «войдите в кабинет» из модуля клиентов внутри окна без собственной рамки и фона */
.ci-notice__html .account-alert {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
}

.ci-notice__close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--_muted);
	cursor: pointer;
}

.ci-notice__close:hover { background: rgba(15, 23, 42, .07); color: var(--_text); }
.ci-notice__close .ci-icon { width: 16px; height: 16px; }

.ci-notice__actions {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 8px;
}

.ci-notice__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 38px;
	padding: 0 16px;
	border: 1px solid var(--_border);
	border-radius: var(--_radius);
	background: #fff;
	color: var(--_text);
	font-weight: 600;
	font-size: 14px;
	line-height: 1.2;
	font-family: inherit;
	text-decoration: none;
	cursor: pointer;
}

.ci-notice__btn:hover { border-color: var(--_accent); color: var(--_accent); text-decoration: none; }
.ci-notice__btn.is-primary { border-color: var(--_accent); background: var(--_accent); color: #fff; }
.ci-notice__btn.is-primary:hover { filter: brightness(.92); color: #fff; }

/* Полоска времени до автозакрытия */
.ci-notice__timer {
	position: absolute;
	left: 0;
	bottom: 0;
	height: 3px;
	width: 100%;
	background: var(--_accent);
	transform-origin: left center;
	opacity: .55;
	animation: ci-notice-timer var(--ci-timeout, 4s) linear forwards;
}

.ci-notice--success .ci-notice__timer { background: var(--_success); }
.ci-notice--warning .ci-notice__timer { background: var(--_warning); }
.ci-notice--error .ci-notice__timer { background: var(--_danger); }
.ci-notice.is-paused .ci-notice__timer { animation-play-state: paused; }

@keyframes ci-notice-timer {
	from { transform: scaleX(1); }
	to { transform: scaleX(0); }
}

@media (max-width: 480px) {
	.ci-notice__card {
		grid-template-columns: 40px minmax(0, 1fr);
		column-gap: 12px;
		padding: 18px 16px;
	}
	.ci-notice__icon { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
	.ci-notice { transition: opacity .01s; transform: translate(-50%, -50%); }
	.ci-notice__timer { animation: none; display: none; }
}
