/**
 * Форма записи на приём.
 *
 * Все классы начинаются с caf__, а свойства задаются напрямую — тема и Elementor
 * не должны перебивать оформление, и наоборот. Переменные объявлены на корне формы,
 * чтобы палитру можно было переопределить одним правилом в настройках сайта.
 */

.caf {
	--caf-ground: #357575;
	--caf-ground-deep: #2c6363;
	--caf-field: #5d9191;
	--caf-field-hover: #6a9c9c;
	--caf-field-border: #74a5a5;
	--caf-accent: #acd4cb;
	--caf-accent-hover: #ffffff;
	--caf-accent-ink: #1f3d3b;
	--caf-ink: #ffffff;
	/* Плейсхолдеры и подписи белые: приглушённый серый на этом фоне не читается. */
	--caf-ink-muted: #ffffff;
	--caf-ink-faint: #ffffff;
	--caf-disabled: #5d9191;
	--caf-disabled-ink: #ffffff;
	--caf-error: #f2b0a4;
	--caf-error-border: #e08c7d;
	--caf-warn: #e8b06a;

	--caf-radius-field: 10px;
	--caf-gap: 14px;

	box-sizing: border-box;
	/* Фон и отступы задаёт секция страницы: форма встраивается в готовый блок. */
	background: none;
	padding: 0;
	margin: 0;
	color: var(--caf-ink);
	font-family: inherit;
	line-height: 1.5;
}

.caf *,
.caf *::before,
.caf *::after {
	box-sizing: border-box;
}

/**
 * Тема рисует поверх кнопок собственный псевдоэлемент с заливкой — он полностью
 * закрывает поле и делает его светлым. Внутри формы такие подложки не нужны.
 * Исключение — наш индикатор загрузки, он объявлен ниже с своим ::after.
 */
.caf .caf__control::before,
.caf .caf__doc::before,
.caf .caf__doc::after,
.caf .caf__submit::before,
.caf .caf__submit::after,
.caf .caf__nav::before,
.caf .caf__nav::after,
.caf .caf__menu-item::before,
.caf .caf__menu-item::after,
.caf .caf__cal-day::before,
.caf .caf__cal-day::after {
	content: none !important;
	display: none !important;
	background: none !important;
}

/**
 * Сброс оформления темы.
 *
 * Темы и конструкторы задают полям собственный фон, рамки и тени — без сброса
 * форма наследует чужой вид. Правила намеренно объявлены через .caf, чтобы
 * перебить их специфичностью, но не вылезти за пределы формы.
 */
.caf input[type="text"],
.caf input[type="tel"],
.caf button {
	appearance: none;
	-webkit-appearance: none;
	background-image: none;
	box-shadow: none;
	text-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	line-height: normal;
	min-height: 0;
	max-width: none;
	width: auto;
}

.caf input[type="text"],
.caf input[type="tel"] {
	background: transparent;
	border: 0;
	border-radius: 0;
	color: inherit;
	font-size: 15px;
	height: 100%;
	padding: 0;
	margin: 0;
	outline: none;
}

.caf input[type="text"]:focus,
.caf input[type="tel"]:focus {
	background: transparent;
	border: 0;
	box-shadow: none;
	outline: none;
	color: inherit;
}

.caf__form {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin: 0;
}

.caf__rows {
	display: flex;
	flex-direction: column;
	gap: var(--caf-gap);
}

.caf__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--caf-gap);
}

.caf__field {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 7px;
	min-width: 0;
}

.caf__label {
	font-size: 10.5px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-weight: 600;
	color: var(--caf-ink);
}

.caf__req {
	margin-left: 3px;
	color: var(--caf-accent);
}

.caf__req--off {
	color: var(--caf-disabled-ink);
}

/* ---------- поля ---------- */

.caf .caf__control {
	position: relative;
	display: flex;
	align-items: center;
	gap: 9px;
	width: 100%;
	height: 52px;
	min-height: 52px;
	padding: 0 14px;
	margin: 0;
	/* Тема задаёт полям свой фон с высокой специфичностью — без !important
	   он побеждает и поля светлеют. */
	background: var(--caf-field) !important;
	background-image: none;
	border: 1.5px solid transparent;
	border-radius: var(--caf-radius-field);
	box-shadow: none;
	font-family: inherit;
	font-size: 15px;
	font-weight: 400;
	letter-spacing: normal;
	text-transform: none;
	color: var(--caf-ink);
	text-align: left;
	opacity: 1;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.caf .caf__control:hover:not(.is-disabled) {
	background: var(--caf-field-hover) !important;
}

.caf .caf__control.is-open {
	background: var(--caf-field-hover) !important;
	border-color: var(--caf-accent);
}

.caf__control.is-filled {
	border-color: rgba(172, 212, 203, 0.45);
}

.caf__control.is-error {
	border-color: var(--caf-error-border);
}

.caf .caf__control.is-disabled {
	background: var(--caf-disabled) !important;
	color: var(--caf-disabled-ink);
	opacity: 1;
	cursor: not-allowed;
}

.caf__control:focus-visible {
	outline: 2px solid var(--caf-accent);
	outline-offset: 2px;
}

.caf__control--input {
	cursor: text;
}

.caf__value {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.caf__value--placeholder {
	color: var(--caf-ink-muted);
}

.caf__control.is-disabled .caf__value--placeholder {
	color: var(--caf-disabled-ink);
}

.caf__chevron {
	flex: none;
	width: 15px;
	height: 15px;
	opacity: 0.85;
	transition: transform 0.18s ease;
}

.caf__control.is-open .caf__chevron {
	transform: rotate(180deg);
}

.caf__lead {
	flex: none;
	width: 17px;
	height: 17px;
	opacity: 0.9;
}

.caf__lock {
	flex: none;
	width: 14px;
	height: 14px;
	opacity: 0.6;
}

/* ---------- ввод текста ---------- */

.caf__input {
	flex: 1;
	min-width: 0;
	height: 100%;
	padding: 0;
	margin: 0;
	background: none;
	border: 0;
	font-family: inherit;
	font-size: 15px;
	color: var(--caf-ink);
	outline: none;
	box-shadow: none;
}

.caf .caf__input::placeholder {
	color: var(--caf-ink);
	opacity: 0.75;
}

.caf .caf__input::-webkit-input-placeholder {
	color: var(--caf-ink);
	opacity: 0.75;
}

.caf .caf__input::-moz-placeholder {
	color: var(--caf-ink);
	opacity: 0.75;
}

.caf__input--digits {
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
}

.caf__prefix {
	flex: none;
	padding-right: 8px;
	margin-right: 2px;
	border-right: 1px solid var(--caf-field-border);
	font-variant-numeric: tabular-nums;
	color: var(--caf-ink);
}

/* ---------- выпадающие списки ---------- */

.caf__menu {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 30;
	display: flex;
	flex-direction: column;
	gap: 2px;
	max-height: 260px;
	overflow-y: auto;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var(--caf-ground-deep);
	border: 1px solid var(--caf-field-border);
	border-radius: var(--caf-radius-field);
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
}

.caf__menu[hidden] {
	display: none;
}

.caf__menu li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.caf__menu-item {
	width: 100%;
	padding: 10px 12px;
	margin: 0;
	background: none;
	border: 0;
	border-radius: 7px;
	font-family: inherit;
	font-size: 14px;
	color: var(--caf-ink);
	text-align: left;
	cursor: pointer;
}

.caf__menu-item:hover,
.caf__menu-item:focus-visible {
	background: var(--caf-field);
	outline: none;
}

.caf__menu-item.is-picked {
	background: var(--caf-field);
	font-weight: 600;
}

.caf__menu--time .caf__menu-item {
	font-variant-numeric: tabular-nums;
}

.caf__menu--time .caf__menu-item.is-picked {
	background: var(--caf-accent);
	color: var(--caf-accent-ink);
	font-weight: 650;
}

.caf__menu-empty {
	padding: 12px;
	font-size: 13px;
	color: var(--caf-ink-muted);
}

/* ---------- карусель врачей ---------- */

.caf__carousel {
	grid-column: 1 / -1;
	display: flex;
	flex-direction: column;
	gap: 11px;
	padding: 14px;
	background: var(--caf-ground-deep) !important;
	border: 1px solid var(--caf-field-border);
	border-radius: var(--caf-radius-field);
}

.caf__carousel[hidden] {
	display: none;
}

.caf__carousel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.caf__carousel-title {
	font-size: 10.5px;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	font-weight: 600;
	color: var(--caf-ink-muted);
}

.caf__carousel-nav {
	display: flex;
	gap: 6px;
}

.caf__carousel-nav[hidden] {
	display: none;
}

.caf__nav {
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	padding: 0;
	background: var(--caf-field);
	border: 1px solid var(--caf-field-border);
	border-radius: 8px;
	color: var(--caf-ink);
	cursor: pointer;
}

.caf__nav:hover:not(:disabled) {
	background: var(--caf-field-hover);
}

.caf__nav:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.caf__nav svg {
	width: 14px;
	height: 14px;
}

.caf__track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - 3 * 10px) / 4);
	gap: 10px;
	overflow-x: auto;
	padding-bottom: 4px;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	scrollbar-color: var(--caf-field-border) transparent;
}

.caf__track::-webkit-scrollbar {
	height: 6px;
}

.caf__track::-webkit-scrollbar-thumb {
	background: var(--caf-field-border);
	border-radius: 3px;
}

.caf .caf__doc {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 9px 9px 11px;
	background: var(--caf-ground) !important;
	background-image: none;
	border: 1.5px solid transparent;
	border-radius: 10px;
	box-shadow: none;
	font-family: inherit;
	color: var(--caf-ink);
	text-align: left;
	cursor: pointer;
	scroll-snap-align: start;
	transition: transform 0.18s ease, border-color 0.15s ease, box-shadow 0.18s ease;
}

.caf .caf__doc:hover {
	background: var(--caf-ground) !important;
	transform: scale(1.04);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.caf .caf__doc.is-picked {
	background: var(--caf-ground) !important;
	border-color: var(--caf-accent);
}

.caf__doc:focus-visible {
	outline: 2px solid var(--caf-accent);
	outline-offset: 2px;
}

.caf__doc-photo {
	display: grid;
	place-items: center;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--caf-field) !important;
	border-radius: 8px;
}

.caf__doc-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.caf__doc-photo svg {
	width: 46%;
	height: 46%;
	opacity: 0.55;
}

.caf__doc-name {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	font-size: 12.5px;
	line-height: 1.3;
	font-weight: 600;
}

.caf__doc-spec {
	font-size: 11px;
	color: var(--caf-ink-muted);
}

/* ---------- календарь ---------- */

.caf__calendar {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 30;
	width: min(320px, 100%);
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 12px;
	background: #ffffff;
	color: #2a3f3d;
	border-radius: var(--caf-radius-field);
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
}

.caf__calendar[hidden] {
	display: none;
}

.caf__cal-head {
	display: flex;
	align-items: center;
	gap: 8px;
}

.caf__cal-head .caf__nav {
	background: var(--caf-ground);
	border-color: var(--caf-ground);
	color: #ffffff;
}

.caf__cal-head .caf__nav:hover:not(:disabled) {
	background: var(--caf-ground-deep);
}

.caf__cal-month {
	flex: 1;
	text-align: center;
	font-size: 14px;
	font-weight: 650;
}

.caf__cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
	font-variant-numeric: tabular-nums;
}

.caf__cal-dow {
	padding: 3px 0;
	font-size: 10.5px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-weight: 600;
	color: #6d8683;
	text-align: center;
}

.caf__cal-day {
	display: grid;
	place-items: center;
	aspect-ratio: 1 / 1;
	padding: 0;
	background: #eaf1f0;
	border: 0;
	border-radius: 7px;
	font-family: inherit;
	font-size: 13px;
	color: #2a3f3d;
	cursor: pointer;
	transition: background 0.12s ease;
}

.caf__cal-day:hover:not(:disabled) {
	background: var(--caf-accent);
}

.caf__cal-day:disabled {
	background: transparent;
	color: #c2cfcd;
	cursor: not-allowed;
}

.caf__cal-day.is-free {
	background: #d8ede7;
	color: #1f3d3b;
	font-weight: 650;
}

.caf__cal-day.is-picked {
	background: var(--caf-ground);
	color: #ffffff;
	font-weight: 650;
}

.caf__cal-day--empty {
	background: transparent;
	cursor: default;
}

.caf__cal-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	padding-top: 8px;
	border-top: 1px solid #e4edeb;
	font-size: 11.5px;
	color: #5c716e;
}

.caf__cal-legend i {
	display: inline-block;
	width: 10px;
	height: 10px;
	margin-right: 5px;
	border-radius: 3px;
	vertical-align: -1px;
}

.caf__cal-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
}

/* В календаре светлый фон — кружок должен быть тёмным, а не белым. */
.caf__cal-loading .caf__spinner {
	border-color: rgba(53, 117, 117, 0.2);
	border-top-color: var(--caf-ground);
}

/* ---------- индикатор загрузки ---------- */

.caf__carousel-loading {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 40px 14px;
	font-size: 13px;
	color: var(--caf-ink);
}

.caf__spinner {
	width: 18px;
	height: 18px;
	border: 2px solid rgba(255, 255, 255, 0.25);
	border-top-color: var(--caf-accent);
	border-radius: 50%;
	animation: caf-spin 0.7s linear infinite;
}

@keyframes caf-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ---------- сообщения ---------- */

.caf__notice {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	background: rgba(232, 176, 106, 0.16);
	border: 1px solid rgba(232, 176, 106, 0.42);
	border-radius: var(--caf-radius-field);
	font-size: 13px;
	line-height: 1.45;
	color: #f5dfc2;
}

.caf__notice[hidden] {
	display: none;
}

.caf__notice .caf__info {
	flex: none;
	width: 16px;
	height: 16px;
	margin-top: 1px;
	color: var(--caf-warn);
}

.caf__hint {
	margin: 0;
	font-size: 12px;
	color: var(--caf-ink-faint);
}

.caf__hint--error {
	color: var(--caf-error);
}

.caf__hint[hidden] {
	display: none;
}

.caf__status {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: 12.5px;
	color: var(--caf-ink-faint);
}

.caf__status[hidden] {
	display: none;
}

.caf__status .caf__info {
	flex: none;
	width: 14px;
	height: 14px;
}

.caf__result {
	padding: 14px 16px;
	border-radius: var(--caf-radius-field);
	font-size: 14px;
	line-height: 1.5;
}

.caf__result[hidden] {
	display: none;
}

.caf__result--ok {
	background: rgba(172, 212, 203, 0.18);
	border: 1px solid rgba(172, 212, 203, 0.5);
	color: var(--caf-ink);
}

.caf__result--error {
	background: rgba(224, 140, 125, 0.16);
	border: 1px solid rgba(224, 140, 125, 0.5);
	color: #ffdfd8;
}

/* ---------- кнопка ---------- */

.caf__actions {
	display: flex;
}

.caf .caf__submit {
	height: 52px;
	min-height: 52px;
	padding: 0 30px;
	background: var(--caf-accent) !important;
	background-image: none;
	border: 1.5px solid transparent;
	border-radius: var(--caf-radius-field);
	box-shadow: none;
	text-shadow: none;
	font-family: inherit;
	font-size: 15px;
	font-weight: 650;
	letter-spacing: normal;
	text-transform: none;
	color: var(--caf-accent-ink);
	opacity: 1;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.caf .caf__submit:hover:not(.is-disabled) {
	background: var(--caf-accent-hover) !important;
	color: var(--caf-accent-ink);
}

.caf__submit:focus-visible {
	outline: 2px solid var(--caf-ink);
	outline-offset: 2px;
}

.caf .caf__submit.is-disabled,
.caf .caf__submit:disabled {
	background: var(--caf-disabled) !important;
	color: var(--caf-disabled-ink);
	opacity: 1;
	cursor: not-allowed;
}

/* ---------- ловушка для ботов ---------- */

.caf__honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------- адаптив ---------- */

@media (max-width: 700px) {
	.caf {
		padding: 26px 20px 24px;
	}

	.caf__row {
		grid-template-columns: 1fr;
	}

	.caf__track {
		grid-auto-columns: calc((100% - 10px) / 2);
	}

	.caf__calendar {
		position: static;
		width: 100%;
		box-shadow: none;
	}

	.caf__menu {
		position: static;
		max-height: none;
		box-shadow: none;
	}

	.caf__submit {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.caf .caf__doc,
	.caf .caf__control,
	.caf__chevron,
	.caf .caf__submit {
		transition: none;
	}

	.caf .caf__doc:hover {
		transform: none;
	}

	.caf__track {
		scroll-behavior: auto;
	}

	.caf__spinner {
		animation: none;
	}
}
