/* S-M Limited - плаващ бутон „Пишете ни във Viber" с панел (B9.1). Макет за бутона няма;
   панелът е като картата на попъпа (nachalna-popup-desktop.html). `position:fixed` е разрешено
   за бутона и панела (плаващ елемент, TASKS.md B9). z-index 80: под дроуъра (90/91) и попъпа (95). */

.sm-chat {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 80;
	font-family: var(--sm-font);
	color: var(--sm-ink);
}

/* ---------- Бутонът: общо ---------- */
.sm-chat__toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--sm-ink);
	color: #FFFFFF;
	box-shadow: 0 4px 14px rgba(31, 31, 31, .18);
	cursor: pointer;
	box-sizing: border-box;
}

.sm-chat__toggle:hover {
	filter: brightness(.92);
}

.sm-chat__icon {
	display: block;
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	fill: currentColor;
}

.sm-chat__toggle:focus-visible,
.sm-chat__close:focus-visible,
.sm-chat__open:focus-visible,
.sm-chat__copy:focus-visible {
	outline: 2px solid var(--sm-accent);
	outline-offset: 2px;
}

/* v1 - кръг 56px, фон --sm-ink (общото горе). */

/* v2 - хапче 48px с текст. */
.sm-chat--v2 .sm-chat__toggle {
	width: auto;
	height: 48px;
	padding: 0 20px 0 16px;
	border-radius: 999px;
	font: 700 15px var(--sm-font);
	white-space: nowrap;
}

.sm-chat--v2 .sm-chat__icon {
	width: 22px;
	height: 22px;
}

/* v3 - кръг 56px в цвета на Viber. */
.sm-chat--v3 .sm-chat__toggle {
	background: #7360F2;
}

/* ---------- Панелът ---------- */
.sm-chat__panel {
	position: absolute;
	right: 0;
	bottom: calc(100% + 12px);
	width: 340px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 20px;
	background: #FFFFFF;
	border: 1px solid var(--sm-line);
	border-radius: var(--sm-radius);
	box-shadow: 0 8px 28px rgba(31, 31, 31, .14);
	box-sizing: border-box;
}

.sm-chat__panel[hidden] {
	display: none;
}

.sm-chat__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin: -8px -12px 0 0;
}

.sm-chat__who {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding-top: 8px;
	min-width: 0;
}

.sm-chat__title {
	font-size: 18px;
	font-weight: 800;
	line-height: 1.25;
}

.sm-chat__subtitle {
	font-size: 13px;
	line-height: 1.4;
	color: var(--sm-muted);
}

.sm-chat__close {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border: 0;
	background: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--sm-ink);
	padding: 0;
}

.sm-chat__message {
	margin: 0;
	padding: 12px 14px;
	background: var(--sm-surface);
	border-radius: var(--sm-radius);
	font-size: 15px;
	line-height: 1.5;
	color: var(--sm-muted);
}

.sm-chat__open,
.sm-chat__copy {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 48px;
	padding: 0 20px;
	border-radius: var(--sm-radius);
	font: 700 15px var(--sm-font);
	text-align: center;
	cursor: pointer;
	box-sizing: border-box;
}

.sm-chat__open {
	background: var(--sm-ink);
	color: #FFFFFF;
}

.sm-chat__open:hover {
	color: #FFFFFF;
	filter: brightness(.92);
}

.sm-chat__copy {
	border: 1px solid var(--sm-ink);
	background: #FFFFFF;
	color: var(--sm-ink);
}

.sm-chat__copy:hover {
	background: var(--sm-surface);
}

.sm-chat__number {
	font-size: 13px;
	line-height: 1.4;
	color: var(--sm-muted);
	text-align: center;
}

/* ---------- Мобилно (≤767px) ---------- */
@media (max-width: 767px) {
	.sm-chat {
		right: 16px;
		bottom: 16px;
	}

	/* Над `.sm-pdp-bar` на продукта (~68px + safe-area). */
	.single-product .sm-chat {
		bottom: calc(16px + 68px + env(safe-area-inset-bottom, 0px));
	}

	.sm-chat--v2 .sm-chat__toggle {
		width: 52px;
		height: 52px;
		padding: 0;
		border-radius: 50%;
	}

	.sm-chat--v2 .sm-chat__label {
		display: none;
	}

	.sm-chat__panel {
		width: calc(100vw - 32px);
	}
}
