/*
 * "Оставете мнение" popup on doctor pages (inc/review-form.php).
 * Plain CSS — no build toolchain in the agent's environment. Colours from
 * theme.json: primary #292521, secondary (star yellow) #FEBE00,
 * bg-color-light #F2EEE9, footer-border-light #D2CCC5.
 */

.zd-review-form-section {
	padding-bottom: 5rem; /* matches the 80px rhythm of the reviews band above */
}

/* ---- Dialog shell ---- */

.zd-review-dialog {
	width: min(36rem, calc(100vw - 2rem));
	max-height: calc(100dvh - 2rem);
	padding: 0;
	border: 0;
	border-radius: 1rem;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary);
	box-shadow: var(--wp--preset--shadow--overlay);
	overflow: auto;
}

.zd-review-dialog::backdrop {
	background: color-mix(in srgb, var(--wp--preset--color--primary) 55%, transparent);
}

.zd-review-dialog[open] {
	animation: zd-review-in 160ms ease-out;
}

@keyframes zd-review-in {
	from { opacity: 0; transform: translateY(12px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

.zd-review-form__form {
	display: flex;
	flex-direction: column;
}

/* ---- Header: photo, doctor, close ---- */

.zd-review-dialog__header {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	padding: 1.25rem 1.25rem 1rem 1.5rem;
	border-bottom: 1px solid var(--wp--preset--color--bg-color-light);
}

.zd-review-dialog__photo {
	width: 3rem;
	height: 3rem;
	border-radius: 50%;
	object-fit: cover;
	flex: 0 0 auto;
}

.zd-review-dialog__heading {
	flex: 1 1 auto;
	min-width: 0;
}

.zd-review-dialog__title {
	font-size: 1.125rem;
	line-height: 1.5rem;
	font-weight: 700;
}

.zd-review-dialog__lead {
	font-size: 0.8125rem;
	line-height: 1.125rem;
	color: var(--wp--preset--color--base-dark);
}

.zd-review-dialog__close {
	flex: 0 0 auto;
	width: 2.5rem;
	height: 2.5rem;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--wp--preset--color--primary);
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}

.zd-review-dialog__close:hover,
.zd-review-dialog__close:focus-visible {
	background: var(--wp--preset--color--bg-color-light);
}

/* ---- Body ---- */

.zd-review-form__body {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	padding: 1.5rem 1.5rem 0.5rem;
}

.zd-review-form__hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Stars — large, centred, Google-like. Radios in reverse order so
   "this one and all before it" is a sibling selector. */
.zd-review-form__rating {
	border: 0;
	margin: 0;
	padding: 0;
	text-align: center;
}

.zd-review-form__stars {
	display: inline-flex;
	flex-direction: row-reverse;
	gap: 0.375rem;
}

.zd-review-form__stars input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.zd-review-form__stars label {
	display: inline-flex;
	cursor: pointer;
	border-radius: 50%;
	padding: 0.125rem;
	transition: transform 120ms;
}

.zd-review-form__stars svg {
	width: 2.5rem;
	height: 2.5rem;
	fill: transparent;
	stroke: var(--wp--preset--color--footer-border-color);
	stroke-width: 1.5;
	stroke-linejoin: round;
	transition: fill 120ms, stroke 120ms;
}

.zd-review-form__stars label:hover {
	transform: scale(1.08);
}

.zd-review-form__stars label:hover svg,
.zd-review-form__stars label:hover ~ label svg,
.zd-review-form__stars input:checked ~ label svg {
	fill: var(--wp--preset--color--secondary);
	stroke: var(--wp--preset--color--secondary);
}

.zd-review-form__stars input:focus-visible + label {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

.zd-review-form__rating-label {
	margin-top: 0.25rem;
	font-size: 0.875rem;
	line-height: 1.25rem;
	color: var(--wp--preset--color--base-dark);
	min-height: 1.25rem;
}

.zd-review-form__field {
	margin: 0;
	display: flex;
	flex-direction: column;
	position: relative;
}

.zd-review-form__field label {
	font-size: 0.8125rem;
	font-weight: 700;
	margin-bottom: 0.125rem;
}

/* Boxed textarea, like Google's — overrides the theme's underline-only field. */
.zd-review-dialog textarea {
	min-height: 8rem;
	padding: 0.75rem 0.875rem 1.5rem;
	border: 1px solid var(--wp--preset--color--footer-border-light);
	border-radius: 0.5rem;
	font-size: 0.9375rem;
	line-height: 1.375rem;
	resize: vertical;
}

.zd-review-dialog textarea:focus {
	border-color: var(--wp--preset--color--primary);
}

.zd-review-form__counter {
	position: absolute;
	right: 0.75rem;
	bottom: 0.375rem;
	font-size: 0.6875rem;
	color: var(--wp--preset--color--footer-border-color);
	pointer-events: none;
}

.zd-review-form__consent {
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.25rem;
	color: var(--wp--preset--color--base-dark);
}

.zd-review-form__consent label {
	display: flex;
	gap: 0.5rem;
	align-items: flex-start;
	cursor: pointer;
}

.zd-review-form__consent input {
	margin-top: 0.1875rem;
	flex: 0 0 auto;
}

.zd-review-form__consent a {
	color: inherit;
	text-decoration: underline;
}

/* ---- Message + footer ---- */

.zd-review-form__message {
	margin: 0;
	padding: 0 1.5rem;
	font-size: 0.875rem;
}

.zd-review-form__message:empty {
	display: none;
}

.zd-review-form__message.is-error {
	color: var(--wp--preset--color--error);
	padding-top: 0.5rem;
}

.zd-review-form__message.is-success {
	color: var(--wp--preset--color--success);
	font-weight: 700;
	font-size: 1rem;
	text-align: center;
	padding: 2.5rem 1.5rem 1.5rem;
}

/* After a successful send: only the thank-you and a Затвори button remain. */
.zd-review-form__form.is-sent .zd-review-form__body {
	display: none;
}

.zd-review-dialog__footer {
	display: flex;
	justify-content: flex-end;
	gap: 0.75rem;
	padding: 1rem 1.5rem 1.5rem;
}

.zd-review-dialog__cancel,
.zd-review-dialog__submit {
	min-height: 2.75rem;
	padding: 0 1.5rem;
	border-radius: 999px;
	font-size: 0.9375rem;
	font-weight: 700;
	cursor: pointer;
	transition: background 120ms, opacity 120ms;
}

.zd-review-dialog__cancel {
	border: 1px solid var(--wp--preset--color--footer-border-light);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary);
}

.zd-review-dialog__cancel:hover {
	background: var(--wp--preset--color--bg-color-light);
}

.zd-review-dialog__submit {
	border: 0;
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--white);
}

.zd-review-dialog__submit:hover:not([disabled]) {
	background: var(--wp--preset--color--black);
}

.zd-review-dialog__submit[disabled] {
	opacity: 0.35;
	cursor: not-allowed;
}

.zd-review-dialog [hidden] {
	display: none !important;
}

/* ---- Phone: bottom sheet ---- */

@media (max-width: 767px) {
	.zd-review-form-section {
		padding-bottom: 3rem;
	}

	.zd-review-dialog {
		width: 100vw;
		max-width: 100vw;
		max-height: 92dvh;
		margin: auto 0 0;
		border-radius: 1rem 1rem 0 0;
	}

	.zd-review-dialog[open] {
		animation-name: zd-review-up;
	}

	@keyframes zd-review-up {
		from { transform: translateY(40px); opacity: 0; }
		to { transform: none; opacity: 1; }
	}

	.zd-review-form__body,
	.zd-review-dialog__footer {
		padding-left: 1.25rem;
		padding-right: 1.25rem;
	}

	.zd-review-dialog__footer {
		padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
	}

	.zd-review-dialog__cancel,
	.zd-review-dialog__submit {
		flex: 1 1 0;
	}
}
