/* ==========================================================================
   Clinic Booking Wizard
   ========================================================================== */

#clinic-booking-wizard {
	font-family: "Actay";
	font-size: var(--text-m);
	line-height: 1.5;
	color: var(--base);
	max-width: 780px;
	margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Common
   -------------------------------------------------------------------------- */
.cbw {
	background: var(--white);
	border-radius: var(--radius-m);
	border: 1px solid var(--primary);
	overflow: hidden;
}

.cbw__header {
	padding: var(--space-m) var(--space-m) var(--space-s);
	border-bottom: 1px solid var(--primary-light-trans-20);
	display: flex;
	align-items: center;
	flex-wrap: wrap;
}

.cbw__title {
	margin: 0;
	font-size: var(--h2);
	font-weight: 700;
	color: var(--base);
	flex: 1;
}

.cbw__subtitle {
	width: 100%;
	margin: 4px 0 0;
	color: var(--base);
}

.cbw__section {
	padding: var(--space-s) var(--space-m) var(--space-s);
}

.cbw__section+.cbw__section {
	border-top: 1px solid var(--primary-light-trans-20);
}

.cbw__section-title {
	margin: 0 0 var(--space-s);
	font-size: var(--h5);
	font-weight: 700;
	text-transform: uppercase;
	color: var(--base);
}

.cbw__footer {
	padding: var(--space-s) var(--space-m);
	border-top: 1px solid var(--primary-light-trans-20);
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: var(--space-xs);
	flex-wrap: wrap;
}

.cbw__footer .cbw-back {
	margin-right: auto;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.cbw-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 20px;
	border-radius: var(--radius-m);
	border: none;
	cursor: pointer;
	font-size: var(--text-s);
	font-weight: 400;
	transition: background 0.15s, color 0.15s, opacity 0.15s;
	text-decoration: none;
}

.cbw-btn--primary {
	background: var(--primary);
	color: var(--white);
}

.cbw-btn--primary:hover:not(:disabled) {
	background: var(--primary-hover);
}

.cbw-btn--primary:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.cbw-btn--secondary {
	background: #f3f4f6;
	color: #374151;
}

.cbw-btn--secondary:hover {
	background: #e5e7eb;
}

.cbw-btn--ghost {
	background: transparent;
	color: #6b7280;
	padding-left: 0;
}

.cbw-btn--ghost:hover {
	color: var(--base);
}

.cbw-btn--icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #f3f4f6;
	color: #374151;
	padding: 6px 12px;
	border-radius: 6px;
	line-height: 0;
}

.cbw-btn--icon:hover {
	background: #e5e7eb;
}

.cbw-carousel__icon {
	display: block;
	width: 1.25rem;
	height: 1.25rem;
	object-fit: contain;
}

.cbw-back__arrow {
	display: inline-flex;
	align-items: center;
	line-height: 1;
}

.cbw-back__arrow-img {
	display: block;
	width: 1.1em;
	height: 1.1em;
	object-fit: contain;
}

/* --------------------------------------------------------------------------
   Search
   -------------------------------------------------------------------------- */
.cbw__search-wrap {
	padding: var(--space-s) var(--space-m) var(--space-s);
}

.cbw-search {
	width: 100%;
	box-sizing: border-box;
	padding: .75em 1.25em;
	border: 1.5px solid var(--primary-light);
	border-radius: var(--radius-m);
	font-size: var(--text-s);
	outline: none;
	transition: border-color 0.15s;
}

.cbw-search:focus {
	border-color: var(--primary);
}

/* --------------------------------------------------------------------------
   Specialties grid
   -------------------------------------------------------------------------- */
.cbw-specialties {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.cbw-specialty-card {
	padding: .5em 1.25em;
	border: 1.5px solid var(--base-ultra-light);
	border-radius: var(--radius-xl);
	background: var(--base-ultra-light);
	color: var(--base-semi-light);
	font-size: var(--text-s);
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.cbw-specialty-card:hover {
	border-color: var(--primary);
	color: var(--primary);
	background: var(--primary-ultra-light);
}

/* --------------------------------------------------------------------------
   Doctors grid
   -------------------------------------------------------------------------- */
.cbw-doctors {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: var(--space-xs);
}

.cbw-doctor-card {
	display: grid;
	grid-template-columns: 1fr;
	grid-template-rows: 1fr;
	border-radius: var(--radius-m);
	overflow: clip;
	position: relative;
	aspect-ratio: 455 / 605;
}

.cbw-doctor-card:hover .cbw-doctor-card__photo {
	transform: scale(1.05);
	transition: transform 0.3s ease-in-out;
}

.cbw-doctor-card__photo {
	grid-column: 1;
	grid-row: 1;
	z-index: 1;
	width: 100%;
	height: auto;
	object-fit: cover;
	aspect-ratio: 455 / 605;
}

.cbw-doctor-card__info {
	position: absolute;
	z-index: 2;
	bottom: var(--space-xs);
	left: var(--space-xs);
	right: var(--space-xs);
	width: calc(100% - var(--space-xs) * 2);
	background: var(--white);
	padding: var(--space-xs);
	border-radius: var(--radius-m);
	display: flex;
	flex-direction: column;
}

.cbw-doctor-card__name {
	font-size: var(--text-xs);
	font-weight: 700;
	color: var(--base);
	line-height: 1.1;
}

.cbw-doctor-card__spec {
	font-size: calc(var(--text-xs) * 0.9);
	color: var(--base-semi-light);
}

/* --------------------------------------------------------------------------
   Calendar / Carousel
   -------------------------------------------------------------------------- */
.cbw__calendar {
	padding: 20px 28px 0;
	display: flex;
	align-items: center;
	gap: 8px;
}

.cbw-carousel {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scroll-behavior: smooth;
	-ms-overflow-style: none;
	scrollbar-width: none;
	flex: 1;
	padding: 4px 0;
}

.cbw-carousel::-webkit-scrollbar {
	display: none;
}

.cbw-day {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 10px 14px;
	border: 1.5px solid #e5e7eb;
	border-radius: 10px;
	background: var(--white);
	cursor: pointer;
	min-width: 60px;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
	flex-shrink: 0;
}

.cbw-day:hover {
	border-color: var(--primary);
}

.cbw-day--active {
	background: var(--primary);
	border-color: var(--primary);
	color: var(--white);
}

.cbw-day__name {
	font-size: 0.7rem;
	text-transform: capitalize;
	opacity: 0.7;
}

.cbw-day__num {
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.2;
}

.cbw-day__month {
	font-size: 0.7rem;
	opacity: 0.7;
}

/* --------------------------------------------------------------------------
   Time slots
   -------------------------------------------------------------------------- */
.cbw-slots {
	padding: 16px 28px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	min-height: 56px;
	align-items: flex-start;
}

.cbw-slot {
	padding: 8px 16px;
	border: 1.5px solid #e5e7eb;
	border-radius: var(--radius-m);
	background: var(--white);
	font-size: 0.9rem;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.cbw-slot:hover:not(.cbw-slot--active) {
	border-color: var(--primary);
	color: var(--primary);
}

.cbw-slot--active {
	background: var(--primary);
	border-color: var(--primary);
	color: var(--white);
}

.cbw-no-slots {
	color: #9ca3af;
	font-size: 0.9rem;
	margin: 0;
}

/* --------------------------------------------------------------------------
   Doctor groups (specialty mode — slots grouped by doctor)
   -------------------------------------------------------------------------- */
.cbw-doc-group {
	width: 100%;
	border: 1.5px solid #e5e7eb;
	border-radius: 10px;
	overflow: hidden;
}

.cbw-doc-group+.cbw-doc-group {
	margin-top: 10px;
}

.cbw-doc-group__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: #f9fafb;
	border-bottom: 1px solid #e5e7eb;
}

.cbw-doc-group__photo {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.cbw-doc-group__photo--placeholder {
	background: #e5e7eb;
}

.cbw-doc-group__info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

.cbw-doc-group__name {
	font-size: 0.92rem;
	font-weight: 700;
	color: var(--base);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cbw-doc-group__spec {
	font-size: 0.78rem;
	color: #6b7280;
}

.cbw-doc-group__price {
	font-size: 0.88rem;
	font-weight: 700;
	color: var(--primary);
	white-space: nowrap;
	margin-left: auto;
}

.cbw-doc-group__slots {
	padding: 12px 16px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* --------------------------------------------------------------------------
   Step 3 — Form
   -------------------------------------------------------------------------- */
.cbw--step3 .cbw-summary {
	margin: 16px 28px;
	padding: 14px 16px;
	background: #f9fafb;
	border-radius: var(--radius-m);
	border: 1px solid #e5e7eb;
}

.cbw-summary__row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	font-size: 0.9rem;
	padding: 4px 0;
}

.cbw-summary__row span {
	color: #6b7280;
}

.cbw-form {
	position: relative;
	padding: 8px 28px 12px;
}

/* Honeypot: не display:none — часть ботов его игнорируют; видимый оффскрин-клап. */
.cbw-honeypot {
	position: absolute;
	left: 0;
	top: 0;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
	pointer-events: none;
}

.cbw-field {
	margin-bottom: 16px;
}

.cbw-label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.88rem;
	font-weight: 400;
	color: #374151;
}

.cbw-required {
	color: #ef4444;
}

.cbw-input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 10px 14px;
	border: 1.5px solid #e5e7eb;
	border-radius: var(--radius-m);
	font-size: var(--text-s);
	font-family: inherit;
	outline: none;
	transition: border-color 0.15s;
}

.cbw-input:focus {
	border-color: var(--primary);
}

.cbw-field--checkbox {
	margin-top: 8px;
}

.cbw-checkbox {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: var(--text-s);
	color: #374151;
	cursor: pointer;
}

.cbw-checkbox__text {
	flex: 1;
	min-width: 0;
	line-height: 1.4;
}

.cbw-checkbox input[type="checkbox"] {
	margin-top: 3px;
	flex-shrink: 0;
	accent-color: var(--primary);
}

.cbw-checkbox a {
	color: var(--primary);
}

.cbw-error {
	display: none;
	margin-top: 4px;
	font-size: 0.8rem;
	color: #ef4444;
}

.cbw-form-error {
	display: none;
	margin-top: 12px;
	padding: 10px 14px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: var(--radius-m);
	color: #b91c1c;
	font-size: 0.88rem;
}

.cbw-submit {
	width: 100%;
	justify-content: center;
	padding: 12px;
	margin-top: 20px;
	font-size: 1rem;
}

.cbw__footer .cbw-submit {
	width: auto;
	margin-top: 0;
}

/* --------------------------------------------------------------------------
   Success
   -------------------------------------------------------------------------- */
.cbw-success {
	padding: 48px 28px;
	text-align: center;
}

.cbw-success__icon {
	width: 56px;
	height: 56px;
	margin: 0 auto 16px;
	background: #d1fae5;
	color: #059669;
	border-radius: 50%;
	font-size: 1.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
}

.cbw-success__title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--base);
	margin: 0 0 8px;
}

.cbw-success__text {
	color: #6b7280;
	margin: 0;
}

/* --------------------------------------------------------------------------
   Test mode result
   -------------------------------------------------------------------------- */
.cbw-test-result {
	padding: 24px 28px;
}

.cbw-test-result__title {
	margin: 0 0 8px;
	font-size: 1rem;
	font-weight: 700;
	color: #92400e;
}

.cbw-test-result__note {
	font-size: 0.88rem;
	color: #78350f;
	margin: 0 0 12px;
}

.cbw-test-result__json {
	background: var(--white)beb;
	border: 1px solid #fcd34d;
	border-radius: var(--radius-m);
	padding: 14px;
	font-size: 0.8rem;
	line-height: 1.6;
	overflow: auto;
	white-space: pre-wrap;
	word-break: break-word;
	color: var(--base);
	max-height: 400px;
}

/* --------------------------------------------------------------------------
   Loading & Error states
   -------------------------------------------------------------------------- */
.cbw--loading,
.cbw--error {
	padding: 48px 28px;
	text-align: center;
}

.cbw-spinner {
	width: 36px;
	height: 36px;
	margin: 0 auto 12px;
	border: 3px solid #e5e7eb;
	border-top-color: var(--primary);
	border-radius: 50%;
	animation: cbw-spin 0.7s linear infinite;
}

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

.cbw-error-msg {
	color: #b91c1c;
	margin-bottom: 16px;
}

.cbw-empty {
	padding: var(--space-m);
	color: var(--base-semi-light);
	font-size: var(--text-s);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 560px) {

	.cbw__header,
	.cbw__section,
	.cbw__search-wrap,
	.cbw__calendar,
	.cbw-slots,
	.cbw-doctor-badge,
	.cbw__footer,
	.cbw-form,
	.cbw--step3 .cbw-summary {
		padding-left: 16px;
		padding-right: 16px;
	}

	.cbw-doctors {
		grid-template-columns: 1fr;
	}
}