/* Плавающие кнопки быстрой связи в правом нижнем углу */
.floating-contacts {
	position: fixed;
	top: auto;
	bottom: 132px;
	right: max(12px, env(safe-area-inset-right));
	z-index: 900;
	display: flex;
	flex-direction: column;
	gap: 10px;
	font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* На поддоменах без виджета Medflex кнопка трубки стоит прямо в правом нижнем углу */
.floating-contacts--single {
	bottom: max(22px, env(safe-area-inset-bottom));
	right: max(14px, env(safe-area-inset-right));
}

.floating-contacts__phone-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.floating-contacts__button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	box-shadow: 0 4px 14px rgba(1, 87, 155, 0.28);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	text-decoration: none;
	overflow: hidden;
	cursor: pointer;
}

.floating-contacts__button:hover,
.floating-contacts__button:focus {
	transform: scale(1.06);
	box-shadow: 0 6px 18px rgba(1, 87, 155, 0.4);
	text-decoration: none;
}

.floating-contacts__button:focus-visible {
	outline: 3px solid #01579b;
	outline-offset: 3px;
}

.floating-contacts__button:active {
	transform: scale(0.96);
}

.floating-contacts__button--phone {
	background-color: #01579b;
}

.floating-contacts__button--max {
	background: linear-gradient(135deg, #27a7e7 0%, #5b5bff 45%, #8b3dff 100%);
}

.floating-contacts__button--whatsapp {
	background-color: #25d366;
}

.floating-contacts__icon {
	display: block;
	width: 100%;
	height: 100%;
}

/* Поповер с номерами филиала и обратным звонком (только для ПК) */
.floating-contacts__popover {
	display: none;
}

@media (min-width: 768px) {
	/* На основном сайте выстраиваем кнопки по центру над круглым виджетом Medflex (96px, right: 32px, bottom: 32px) */
	.floating-contacts {
		bottom: 144px;
		right: 56px;
		gap: 12px;
	}

	.floating-contacts__button {
		width: 48px;
		height: 48px;
	}

	/* На поддоменах без Medflex ставим кнопку в правый нижний угол симметрично кнопке «наверх» (30px, 55px) */
	.floating-contacts--single {
		bottom: 30px;
		right: 30px;
	}

	.floating-contacts--single .floating-contacts__button {
		width: 54px;
		height: 54px;
	}

	/* Внешняя обёртка поповера с правым отступом работает как бесшовный мост для курсора */
	.floating-contacts__popover {
		display: block;
		position: absolute;
		right: 100%;
		bottom: -6px;
		padding-right: 14px;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transform: translateX(6px);
		transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
		z-index: 910;
	}

	.floating-contacts--single .floating-contacts__popover {
		bottom: 0;
	}

	.floating-contacts__popover--open {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
		transform: translateX(0);
	}

	.floating-contacts__card {
		position: relative;
		min-width: 266px;
		padding: 14px 16px;
		background: #ffffff;
		border: 1px solid rgba(1, 87, 155, 0.14);
		border-radius: 12px;
		box-shadow: 0 12px 32px rgba(1, 35, 68, 0.18);
		box-sizing: border-box;
		text-align: left;
	}

	.floating-contacts__card::after {
		content: '';
		position: absolute;
		right: -7px;
		bottom: 24px;
		width: 12px;
		height: 12px;
		background: #ffffff;
		border-top: 1px solid rgba(1, 87, 155, 0.14);
		border-right: 1px solid rgba(1, 87, 155, 0.14);
		transform: rotate(45deg);
	}

	.floating-contacts--single .floating-contacts__card::after {
		bottom: 20px;
	}

	.floating-contacts__title {
		margin: 0 0 8px;
		font-size: 12px;
		font-weight: 600;
		line-height: 1.3;
		color: #6b7c8f;
		text-transform: uppercase;
		letter-spacing: 0.04em;
	}

	.floating-contacts__phones {
		display: flex;
		flex-direction: column;
		gap: 6px;
		margin-bottom: 10px;
	}

	.floating-contacts__copy {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		width: 100%;
		padding: 7px 10px;
		margin: 0;
		background: #f4f8fc;
		border: 1px solid #dbe6f2;
		border-radius: 8px;
		color: #162a3e;
		font-family: inherit;
		font-size: 15px;
		font-weight: 700;
		line-height: 1.25;
		white-space: nowrap;
		cursor: pointer;
		transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
	}

	.floating-contacts__copy:hover,
	.floating-contacts__copy:focus-visible {
		background: #e8f2fb;
		border-color: #01579b;
		outline: none;
	}

	.floating-contacts__copy--copied {
		background: #eaf7ef;
		border-color: #2e9d5b;
		color: #1b6f3d;
	}

	.floating-contacts__copy-icon {
		flex: 0 0 auto;
		width: 16px;
		height: 16px;
		color: #5b738b;
		transition: color 0.15s ease;
	}

	.floating-contacts__copy:hover .floating-contacts__copy-icon {
		color: #01579b;
	}

	.floating-contacts__copy--copied .floating-contacts__copy-icon {
		color: #1b6f3d;
	}

	.floating-contacts__hint {
		margin: 0 0 10px;
		font-size: 12px;
		line-height: 1.3;
		color: #6b7c8f;
		min-height: 16px;
		transition: color 0.15s ease;
	}

	.floating-contacts__hint--copied {
		color: #1b6f3d;
		font-weight: 600;
	}

	.floating-contacts__callback {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 38px;
		padding: 0 14px;
		margin: 0;
		background: #01579b;
		border: 0;
		border-radius: 8px;
		color: #ffffff;
		font-family: inherit;
		font-size: 14px;
		font-weight: 600;
		line-height: 1;
		cursor: pointer;
		transition: background-color 0.15s ease;
	}

	.floating-contacts__callback:hover,
	.floating-contacts__callback:focus-visible {
		background: #014174;
		color: #ffffff;
		outline: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.floating-contacts__button,
	.floating-contacts__popover,
	.floating-contacts__copy,
	.floating-contacts__callback {
		transition: none;
	}
}
