/*
 * "Виж всички отзиви" popup on doctor pages (template-parts/doctor/single-post.php,
 * assets/js/reviews-dialog.js). Plain CSS — no build toolchain in the agent's
 * environment. Shell matches the "Оставете мнение" popup (review-form.css);
 * the cards keep their look from `.doctor-testimonials-section` and are only
 * re-laid out here as a vertical, scrollable list.
 */

/* Action row under the cards: „Виж всички отзиви“ + „Остави мнение“.
 * Desktop: side by side, each as wide as a card (420px), so the arrow lines
 * don't run across a 2000px screen. Mobile: stacked, full width. */
.doctor-testimonials__all {
	margin-top: 2rem;
	display: flex;
	flex-wrap: wrap;
	gap: 1rem 1.5rem;
}

.doctor-testimonials__all > .wp-block-button {
	flex: 0 1 26.25rem;
	min-width: 0;
	margin: 0;
}

@media (max-width: 1023px) {
	.doctor-testimonials__all {
		flex-direction: column;
	}

	.doctor-testimonials__all > .wp-block-button {
		flex: 0 0 auto;
	}
}

/* No page scroll behind the open popup. */
html:has(.zd-reviews-dialog[open]) {
	overflow: hidden;
}

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

.zd-reviews-dialog {
	width: min(44rem, calc(100vw - 2rem));
	max-width: none;
	height: min(48rem, calc(100dvh - 2rem));
	max-height: none;
	padding: 0;
	border: 0;
	border-radius: 1rem;
	background: var(--wp--preset--color--surface-muted);
	color: var(--wp--preset--color--primary);
	box-shadow: var(--wp--preset--shadow--overlay);
	overflow: hidden;
}

.zd-reviews-dialog[open] {
	display: flex;
	flex-direction: column;
	animation: zd-reviews-in 160ms ease-out;
}

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

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

/* ---- Header: title, count, sources, close ---- */

.zd-reviews-dialog__header {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-start;
	gap: 1rem;
	padding: 1.25rem 1.25rem 1rem 1.5rem;
	background: var(--wp--preset--color--white);
	border-bottom: 1px solid var(--wp--preset--color--bg-color-light);
}

.zd-reviews-dialog__heading {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}

.zd-reviews-dialog__title {
	font-size: 1.25rem;
	line-height: 1.75rem;
	font-weight: 700;
}

.zd-reviews-dialog__lead {
	font-size: 0.875rem;
	line-height: 1.25rem;
	color: var(--wp--preset--color--base-dark);
}

.zd-reviews-dialog__sources {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.25rem;
}

.zd-reviews-dialog__source {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
}

.zd-reviews-dialog__source-count {
	font-size: 0.875rem;
	font-weight: 700;
}

.zd-reviews-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-reviews-dialog__close:hover,
.zd-reviews-dialog__close:focus-visible {
	background: var(--wp--preset--color--bg-color-light);
}

/* ---- Scrollable list ---- */

.zd-reviews-dialog__list {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding: 1.25rem 1.5rem 1.5rem;
	outline: none;
}

/* Loads the next page on scroll; the button is the manual fallback. */
.zd-reviews-dialog__more {
	display: flex;
	justify-content: center;
	padding: 0.5rem 0 0.25rem;
}

.zd-reviews-dialog__more-btn {
	padding: 0.625rem 1.25rem;
	border: 1px solid var(--wp--preset--color--footer-border-light);
	border-radius: 999px;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--primary);
	font: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	cursor: pointer;
}

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

.zd-reviews-dialog__more.is-loading .zd-reviews-dialog__more-btn {
	opacity: 0.5;
	pointer-events: none;
}

/* The band's cards are fixed-width carousel items — full width here. */
.doctor-testimonials-section .zd-reviews-dialog .testimonial-card {
	flex: 0 0 auto;
	width: 100%;
	max-width: none;
	background-color: var(--wp--preset--color--white);
}

@media (max-width: 767px) {
	.zd-reviews-dialog {
		width: 100vw;
		height: 100dvh;
		border-radius: 0;
	}

	.zd-reviews-dialog__header {
		padding: 1rem 0.75rem 0.875rem 1.25rem;
	}

	.zd-reviews-dialog__list {
		padding: 1rem;
	}

	.doctor-testimonials-section .zd-reviews-dialog .testimonial-card {
		padding: 1.25rem 1.25rem 1.5rem;
	}
}
