/**
 * Wanatop Doctoralia Reviews - Frontend styles.
 *
 * - Scoped to .wdr-container (no global resets).
 * - Mobile-first. Breakpoints: 480, 768, 1024, 1280.
 * - No external dependencies.
 * - Respects prefers-reduced-motion.
 */

/* ===== Container & base ===== */

.wdr-container {
	--wdr-color-bg: #ffffff;
	--wdr-color-card-bg: #ffffff;
	--wdr-color-border: #e5e7eb;
	--wdr-color-text: #1f2937;
	--wdr-color-muted: #6b7280;
	--wdr-color-accent: #1d4ed8;
	--wdr-color-star: #f59e0b;
	--wdr-color-verified: #16a34a;
	--wdr-color-reply-bg: #f9fafb;
	--wdr-radius: 12px;
	--wdr-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);

	color: var(--wdr-color-text);
	font-family: inherit;
	line-height: 1.5;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

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

.wdr-container .wdr-intro {
	font-size: clamp(1.25rem, 2.5vw + 0.5rem, 1.75rem);
	line-height: 1.3;
	margin: 0 0 1rem;
	font-weight: 600;
}

/* ===== Items wrapper ===== */

.wdr-container .wdr-items {
	display: grid;
	gap: 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Grid layout: mobile first 1 col, scale up */
.wdr-layout-grid .wdr-items {
	grid-template-columns: 1fr;
}

@media (min-width: 480px) {
	.wdr-layout-grid.wdr-cols-2 .wdr-items,
	.wdr-layout-grid.wdr-cols-3 .wdr-items,
	.wdr-layout-grid.wdr-cols-4 .wdr-items {
		grid-template-columns: 1fr;
	}
}

@media (min-width: 768px) {
	.wdr-layout-grid.wdr-cols-2 .wdr-items {
		grid-template-columns: repeat(2, 1fr);
	}
	.wdr-layout-grid.wdr-cols-3 .wdr-items,
	.wdr-layout-grid.wdr-cols-4 .wdr-items {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.wdr-layout-grid.wdr-cols-3 .wdr-items {
		grid-template-columns: repeat(3, 1fr);
	}
	.wdr-layout-grid.wdr-cols-4 .wdr-items {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (min-width: 1280px) {
	.wdr-layout-grid.wdr-cols-4 .wdr-items {
		grid-template-columns: repeat(4, 1fr);
	}
}

/* List layout */
.wdr-layout-list .wdr-items {
	grid-template-columns: 1fr;
}

/* Carousel layout
 * v3.2.0: respects wdr-cols-N, hides native scrollbar (flechas via JS), supports autoplay state.
 * Implementation: native horizontal scroll with scroll-snap (mobile-friendly, accessible) + JS-driven scroll on arrow clicks.
 */
.wdr-layout-carousel {
	position: relative;
}

.wdr-layout-carousel .wdr-items {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	/*
	 * v3.4.2: was `pan-x`, which forced the browser to treat every touch inside the
	 * carousel as a horizontal pan and BLOCKED vertical page scroll (the "stuck
	 * carousel" the client reported on mobile). `pan-y` does the opposite: vertical
	 * page scroll always works; horizontal navigation is driven by the arrows
	 * (and programmatic scroll), never trapping the finger.
	 */
	touch-action: pan-y;
	overscroll-behavior-x: contain;
	gap: 1rem;
	padding: 0.25rem 0 0.5rem;
	scroll-behavior: smooth;
	/* Hide scrollbar across browsers (arrows replace it). */
	scrollbar-width: none;
	-ms-overflow-style: none;
}
.wdr-layout-carousel .wdr-items::-webkit-scrollbar { display: none; height: 0; }

.wdr-layout-carousel .wdr-card {
	scroll-snap-align: start;
	flex: 0 0 calc(100% - 0px);
	min-width: 0;
}

/* Mobile: always 1 card visible regardless of cols-N (readability). */
@media (max-width: 479px) {
	.wdr-layout-carousel .wdr-card { flex-basis: 88%; }
}

/* sm+ : 2 cards by default; cols-1 still 1; cols-3/4 still 2 here. */
@media (min-width: 480px) {
	.wdr-layout-carousel.wdr-cols-1 .wdr-card { flex-basis: calc(100% - 0px); }
	.wdr-layout-carousel.wdr-cols-2 .wdr-card,
	.wdr-layout-carousel.wdr-cols-3 .wdr-card,
	.wdr-layout-carousel.wdr-cols-4 .wdr-card { flex-basis: calc(50% - 0.5rem); }
}

/* md+ : up to 3 cards. */
@media (min-width: 768px) {
	.wdr-layout-carousel.wdr-cols-3 .wdr-card,
	.wdr-layout-carousel.wdr-cols-4 .wdr-card { flex-basis: calc(33.333% - 0.667rem); }
}

/* lg+ : up to 4 cards. */
@media (min-width: 1024px) {
	.wdr-layout-carousel.wdr-cols-4 .wdr-card { flex-basis: calc(25% - 0.75rem); }
}

/* Carousel arrows (injected by JS). */
.wdr-carousel-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid var(--wdr-color-border);
	background: #ffffff;
	color: var(--wdr-color-text);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
	transition: background-color 0.15s ease, color 0.15s ease, opacity 0.2s ease, transform 0.15s ease;
	z-index: 2;
}

.wdr-carousel-arrow:hover,
.wdr-carousel-arrow:focus-visible {
	background: var(--wdr-color-accent);
	color: #ffffff;
	outline: none;
}

.wdr-carousel-arrow[disabled] {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

.wdr-carousel-arrow svg { width: 18px; height: 18px; pointer-events: none; }

.wdr-carousel-arrow-prev { left: 8px; }
.wdr-carousel-arrow-next { right: 8px; }

@media (min-width: 768px) {
	.wdr-carousel-arrow-prev { left: 4px; }
	.wdr-carousel-arrow-next { right: 4px; }
}

/* When autoplay is paused (manual interaction or hover), no visual change needed — it's a state attribute consumed by JS. */
.wdr-layout-carousel[data-wdr-autoplay-active="0"] { /* placeholder for future states */ }

/* ===== Card ===== */

.wdr-container .wdr-card {
	background: var(--wdr-color-card-bg);
	border: 1px solid var(--wdr-color-border);
	border-radius: var(--wdr-radius);
	padding: 1.25rem;
	box-shadow: var(--wdr-shadow);
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	overflow: hidden;
}

.wdr-card-header {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.wdr-avatar {
	width: 48px;
	height: 48px;
	flex: 0 0 48px;
	border-radius: 50%;
	overflow: hidden;
	background: #e5e7eb;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	color: #ffffff;
	font-size: 1.1rem;
}

.wdr-avatar-initial {
	/* v3.2.0: uses accent color from CSS var, with a darker shade on top. */
	background: var(--wdr-color-accent);
	background: linear-gradient(135deg, color-mix(in srgb, var(--wdr-color-accent) 70%, #000), var(--wdr-color-accent));
}

.wdr-avatar-image .wdr-avatar-image {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

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

.wdr-author {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
}

.wdr-author-name {
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--wdr-color-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wdr-verified {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	font-size: 0.75rem;
	color: var(--wdr-color-verified);
	font-weight: 500;
}

.wdr-verified svg { flex-shrink: 0; }

/* Stars */
.wdr-stars {
	display: inline-flex;
	gap: 2px;
	font-size: 1rem;
	color: #d1d5db;
	letter-spacing: 1px;
}

.wdr-star-on { color: var(--wdr-color-star); }

/* Quote */
.wdr-quote {
	margin: 0;
	padding: 0;
	font-size: 0.95rem;
	line-height: 1.55;
	color: var(--wdr-color-text);
	border: none;
	quotes: none;
}

/*
 * v3.3.1: aggressive reset to neutralize theme-default blockquote styles
 * (Elementor, Astra, GeneratePress, Avada and many others apply background,
 * left border, italic, big padding and ::before quote marks to <blockquote>).
 * !important on background/border/shadow because that's where themes most
 * commonly use !important. Padding/margin stay without !important so the
 * scrollbar padding (max-text-height feature) keeps working.
 */
.wdr-container .wdr-card blockquote.wdr-quote,
.wdr-container .wdr-card .wdr-quote {
	background: none !important;
	background-color: transparent !important;
	background-image: none !important;
	border: 0 !important;
	border-left: 0 !important;
	border-right: 0 !important;
	border-top: 0 !important;
	border-bottom: 0 !important;
	box-shadow: none !important;
	padding: 0;
	margin: 0;
	quotes: none;
	color: var(--wdr-color-text);
}

.wdr-container .wdr-card .wdr-quote::before,
.wdr-container .wdr-card .wdr-quote::after {
	content: none !important;
	display: none !important;
}

/* v3.4.2: max text height with internal scroll — applies on ALL viewports (mobile included). */
.wdr-container[style*="--wdr-quote-max-height"] .wdr-card .wdr-quote {
	max-height: var(--wdr-quote-max-height);
	overflow-y: auto;
	padding-right: 0.5rem;
	/* Allow vertical scroll inside the quote without trapping the page scroll.
	 * No overscroll containment: when the text reaches its end, scroll chains to the
	 * page naturally (prevents any "stuck inside the text" feeling on mobile). */
	touch-action: pan-y;
	-webkit-overflow-scrolling: touch;
	/* Firefox */
	scrollbar-width: thin;
	scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}
.wdr-container[style*="--wdr-quote-max-height"] .wdr-card .wdr-quote::-webkit-scrollbar {
	width: 6px;
}
.wdr-container[style*="--wdr-quote-max-height"] .wdr-card .wdr-quote::-webkit-scrollbar-track {
	background: transparent;
}
.wdr-container[style*="--wdr-quote-max-height"] .wdr-card .wdr-quote::-webkit-scrollbar-thumb {
	background-color: rgba(0, 0, 0, 0.25);
	border-radius: 3px;
}
.wdr-container[style*="--wdr-quote-max-height"] .wdr-card .wdr-quote::-webkit-scrollbar-thumb:hover {
	background-color: rgba(0, 0, 0, 0.4);
}

.wdr-readmore {
	display: inline-block;
	margin-top: 0.5rem;
	color: var(--wdr-color-accent);
	text-decoration: underline;
	font-size: 0.85rem;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
}

/* Reply */
.wdr-reply {
	background: var(--wdr-color-reply-bg);
	border-left: 3px solid var(--wdr-color-accent);
	padding: 0.75rem 1rem;
	border-radius: 6px;
	margin-top: 0.5rem;
	font-size: 0.875rem;
}

.wdr-reply-header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 0.5rem;
	margin-bottom: 0.4rem;
	color: var(--wdr-color-accent);
}

.wdr-reply-date {
	font-size: 0.75rem;
	color: var(--wdr-color-muted);
	font-weight: normal;
}

.wdr-reply-body { color: var(--wdr-color-text); line-height: 1.5; }

/* Footer */
.wdr-card-footer {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	align-items: center;
	font-size: 0.8rem;
	color: var(--wdr-color-muted);
	margin-top: auto;
	padding-top: 0.5rem;
	border-top: 1px solid var(--wdr-color-border);
}

.wdr-service { font-style: italic; }

.wdr-source-link {
	margin-left: auto;
	color: var(--wdr-color-accent);
	text-decoration: none;
	font-size: 0.8rem;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
}

.wdr-source-link:hover,
.wdr-source-link:focus { text-decoration: underline; }

/* List variant */
.wdr-layout-list .wdr-card { flex-direction: row; align-items: flex-start; gap: 1rem; }

@media (max-width: 767px) {
	.wdr-layout-list .wdr-card { flex-direction: column; }
}

/* ===== Attribution & footer ===== */

.wdr-attribution {
	margin: 1rem 0 0;
	font-size: 0.85rem;
	color: var(--wdr-color-muted);
	text-align: center;
}

.wdr-attribution a { color: var(--wdr-color-accent); text-decoration: underline; }

.wdr-powered-by {
	margin: 0.5rem 0 0;
	text-align: center;
	font-size: 0.75rem;
	color: var(--wdr-color-muted);
	opacity: 0.7;
}

/* ===== Accessibility: reduced motion ===== */

@media (prefers-reduced-motion: reduce) {
	.wdr-container * {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* ===== Focus visibility ===== */

.wdr-container a:focus-visible,
.wdr-container button:focus-visible {
	outline: 2px solid var(--wdr-color-accent);
	outline-offset: 2px;
}
