/*
 * [wbs_reviews] — styling matches the reviews section on the live site
 * (outlined course pills with a purple active state, white cards with a
 * soft shadow, right-aligned purple "Read the full review →"); layout
 * follows the Figma (sidebar left, sticky on desktop, stacked on mobile).
 * Everything is scoped under .wbs-reviews; tweak the custom properties
 * below rather than individual rules.
 */

.wbs-reviews {
	--wbs-reviews-accent: #6054e8;
	--wbs-reviews-accent-soft: #edebfd;
	--wbs-reviews-text: #1f1f1f;
	--wbs-reviews-muted: #6b6b6b;
	--wbs-reviews-border: #e8e6ec;
	--wbs-reviews-pill-border: #3a3a3a;
	--wbs-reviews-verified: #1d9bf0;
	--wbs-reviews-card-bg: #fff;
	--wbs-reviews-card-shadow: 0 2px 8px rgba(17, 12, 46, 0.08);
	--wbs-reviews-radius: 16px;
	--wbs-reviews-sidebar-width: 280px;
	--wbs-reviews-sticky-top: 100px; /* clears the sticky site header */

	display: grid;
	grid-template-columns: var(--wbs-reviews-sidebar-width) minmax(0, 1fr);
	gap: 24px;
	align-items: start;
	color: var(--wbs-reviews-text);
}

/* ---- Sidebar ---- */

.wbs-reviews__sidebar {
	position: sticky;
	top: var(--wbs-reviews-sticky-top);
}

.wbs-reviews__sidebar-card {
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 24px;
	background: var(--wbs-reviews-card-bg);
	border-radius: var(--wbs-reviews-radius);
}

.wbs-reviews__sort {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.wbs-reviews__sort-label {
	font-size: 13px;
	color: var(--wbs-reviews-muted);
}

.wbs-reviews .wbs-reviews__sort-select {
	width: 100%;
	padding: 8px 32px 8px 12px;
	font: inherit;
	font-size: 15px;
	color: var(--wbs-reviews-text);
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%236b6b6b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
	border: 1px solid var(--wbs-reviews-accent);
	border-radius: 4px;
	appearance: none;
	cursor: pointer;
}

.wbs-reviews__pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* Out-ranks Elementor/theme global `button` styles. */
.wbs-reviews .wbs-reviews__pill {
	padding: 4px 10px;
	font: inherit;
	font-size: 16px;
	line-height: 1.4;
	color: var(--wbs-reviews-text);
	background: #fff;
	border: 1px solid var(--wbs-reviews-pill-border);
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/*
 * The Elementor kit styles `button:focus` (and `:active`) dark with white
 * text, at a higher specificity than the plain rule above, and the
 * theme/browser adds a heavier focus ring — a button keeps focus after a
 * click, so a pill just toggled off turned black, then kept a dark ring.
 * Restating the plain look for those states (before :hover / pressed,
 * which must still win) shuts that out.
 */
.wbs-reviews .wbs-reviews__pill:focus,
.wbs-reviews .wbs-reviews__pill:active {
	color: var(--wbs-reviews-text);
	background: #fff;
	border: 1px solid var(--wbs-reviews-pill-border);
	box-shadow: none;
}

/* No focus ring after a mouse click (theme/browser `:focus` ring); keyboard focus keeps the purple :focus-visible ring below. */
.wbs-reviews .wbs-reviews__pill:focus:not(:focus-visible) {
	outline: none;
}

.wbs-reviews .wbs-reviews__pill:hover {
	border-color: var(--wbs-reviews-accent);
	color: var(--wbs-reviews-accent);
	background: #fff;
}

.wbs-reviews .wbs-reviews__pill[aria-pressed="true"] {
	color: var(--wbs-reviews-accent);
	background: var(--wbs-reviews-accent-soft);
	border-color: var(--wbs-reviews-accent);
}

.wbs-reviews .wbs-reviews__pill:focus-visible,
.wbs-reviews .wbs-reviews__sort-select:focus-visible,
.wbs-reviews .wbs-reviews__source:focus-visible,
.wbs-reviews .wbs-reviews__edit:focus-visible {
	outline: 2px solid var(--wbs-reviews-accent);
	outline-offset: 2px;
}

/* ---- List ---- */

/* Page changes scroll back to here; keep it clear of the sticky site header. */
.wbs-reviews__main {
	scroll-margin-top: var(--wbs-reviews-sticky-top);
}

/* Focused programmatically after a page change, for keyboard/screen-reader users. */
.wbs-reviews__list:focus:not(:focus-visible) {
	outline: none;
}

.wbs-reviews__list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.wbs-reviews__card {
	padding: 24px;
	background: var(--wbs-reviews-card-bg);
	border: 1px solid var(--wbs-reviews-border);
	border-radius: var(--wbs-reviews-radius);
	box-shadow: var(--wbs-reviews-card-shadow);
}

.wbs-reviews__card[hidden] {
	display: none;
}
.wbs-reviews__head {
	display: flex;
	align-items: center;
	gap: 12px;
}

.wbs-reviews__avatar {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	color: var(--wbs-reviews-accent);
	border-radius: 50%;
	box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--wbs-reviews-border);
	overflow: hidden;
}

.wbs-reviews__avatar svg {
	display: block;
}

/* Initials avatar ("BD"): one colour for everyone, the brand purple
   (#6054E8, white text 5.3:1) — marketing's call; the initials give enough
   variety on an already purple page. */
.wbs-reviews__avatar--initials {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--wbs-reviews-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 0.02em;
	user-select: none;
}

.wbs-reviews__who {
	min-width: 0;
}

.wbs-reviews .wbs-reviews__name,
.wbs-reviews .wbs-reviews__course {
	margin: 0;
}

.wbs-reviews__name {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
}

.wbs-reviews__verified {
	display: inline-flex;
	color: var(--wbs-reviews-verified);
}

.wbs-reviews__course {
	font-size: 13px;
	line-height: 1.4;
	color: var(--wbs-reviews-muted);
}

/* Review headline ("Trust the process"), like Course Report's: between the
   reviewer line and the text. Font/size/spacing set explicitly so the
   Elementor kit's global h3 styles don't take over. */
.wbs-reviews .wbs-reviews__title {
	margin: 24px 0 0;
	padding: 0;
	font-family: inherit;
	font-size: 17px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: normal;
	text-transform: none;
	color: var(--wbs-reviews-text);
}

.wbs-reviews__body {
	margin-top: 24px;
	font-size: 16px;
	line-height: 1.5;
}

.wbs-reviews__title + .wbs-reviews__body {
	margin-top: 10px;
}

.wbs-reviews__body p {
	margin: 0 0 1em;
}

.wbs-reviews__body p:last-child {
	margin-bottom: 0;
}

/* Edit shortcut (logged-in editors only) bottom-left, Course Report link right. */
.wbs-reviews__footer {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin-top: 24px;
}

/* Extra .wbs-reviews out-ranks the Elementor kit's global link colour. */
.wbs-reviews .wbs-reviews__source {
	display: inline-flex;
	margin-left: auto;
	align-items: center;
	gap: 8px;
	font-size: 15px;
	font-weight: 600;
	color: var(--wbs-reviews-accent);
	text-decoration: none;
}

.wbs-reviews .wbs-reviews__source:hover,
.wbs-reviews .wbs-reviews__edit:hover {
	text-decoration: underline;
}

/* Count is announced to screen readers on filter changes, not shown. */
.wbs-reviews__count,
.wbs-reviews .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---- Pagination (same look as the course filter buttons) ---- */

.wbs-reviews__pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 6px;
	margin-top: 24px;
}

.wbs-reviews__pagination[hidden] {
	display: none;
}

.wbs-reviews .wbs-reviews__page {
	min-width: 36px;
	height: 36px;
	padding: 0 8px;
	font: inherit;
	font-size: 15px;
	line-height: 1;
	color: var(--wbs-reviews-text);
	background: #fff;
	border: 1px solid var(--wbs-reviews-pill-border);
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Same Elementor kit `button:focus`/`:active` override as on the pills. */
.wbs-reviews .wbs-reviews__page:focus,
.wbs-reviews .wbs-reviews__page:active {
	color: var(--wbs-reviews-text);
	background: #fff;
	border: 1px solid var(--wbs-reviews-pill-border);
	box-shadow: none;
}

/* No focus ring after a mouse click (theme/browser `:focus` ring); keyboard focus keeps the purple :focus-visible ring below. */
.wbs-reviews .wbs-reviews__page:focus:not(:focus-visible) {
	outline: none;
}

.wbs-reviews .wbs-reviews__page:hover:not(:disabled) {
	color: var(--wbs-reviews-accent);
	background: #fff;
	border-color: var(--wbs-reviews-accent);
}

.wbs-reviews .wbs-reviews__page[aria-current="page"] {
	color: var(--wbs-reviews-accent);
	background: var(--wbs-reviews-accent-soft);
	border-color: var(--wbs-reviews-accent);
}

.wbs-reviews .wbs-reviews__page:disabled {
	opacity: 0.35;
	cursor: default;
}

.wbs-reviews .wbs-reviews__page:focus-visible {
	outline: 2px solid var(--wbs-reviews-accent);
	outline-offset: 2px;
}

.wbs-reviews__page-gap {
	padding: 0 2px;
	color: var(--wbs-reviews-muted);
}

/* ---- Compact layout (course pages): grey quote cards side by side ---- */

.wbs-reviews.wbs-reviews--compact {
	--wbs-reviews-quote-bg: #f7f5f7;

	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 40px;
	align-items: stretch;
}

.wbs-reviews .wbs-reviews__quote-card {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 32px;
	background: var(--wbs-reviews-quote-bg);
	border-radius: var(--wbs-reviews-radius);
}

/* Resets theme blockquote styles (borders, quote marks, margins). */
.wbs-reviews .wbs-reviews__quote {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 16px;
	font-style: italic;
	line-height: 1.5;
	color: var(--wbs-reviews-text);
	quotes: none;
}

.wbs-reviews .wbs-reviews__quote::before,
.wbs-reviews .wbs-reviews__quote::after {
	content: none;
}

.wbs-reviews__quote p {
	margin: 0 0 0.75em;
}

.wbs-reviews__quote p:last-child {
	margin-bottom: 0;
}

.wbs-reviews__quote-caption {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-top: 16px;
	font-size: 14px;
	line-height: 1.4;
}

.wbs-reviews__quote-name {
	font-weight: 600;
}

/* Pushed to the bottom so footers line up across cards of different heights. */
.wbs-reviews .wbs-reviews__quote-card .wbs-reviews__footer {
	margin-top: auto;
	padding-top: 16px;
}

.wbs-reviews .wbs-reviews__quote-card .wbs-reviews__source {
	font-size: 14px;
}

.wbs-reviews .wbs-reviews__edit {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--wbs-reviews-muted);
	text-decoration: none;
}

/* Editor-only "why is this card here" label on course-page cards, next to
   "Edit review". Colours match the Labels column on the Course Reviews list. */
/* "Edit review" + its labels: the labels hang just below the link, from the
   bottom-left, taking no space in the footer row. */
.wbs-reviews__edit-wrap {
	position: relative;
	display: inline-flex;
}

.wbs-reviews__edit-wrap .wbs-reviews__why {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
}

/* Room for the hanging labels inside the card (editors only, so :has() is fine). */
.wbs-reviews .wbs-reviews__quote-card:has(.wbs-reviews__why) {
	padding-bottom: 52px;
}

.wbs-reviews__why {
	display: inline-flex;
	gap: 4px;
	cursor: help;
	white-space: nowrap;
}

.wbs-reviews__why:focus-visible {
	outline: 2px solid var(--wbs-reviews-accent);
	outline-offset: 2px;
	border-radius: 10px;
}

/* Tooltip with the explanation, above the labels, on hover and keyboard focus. */
.wbs-reviews__why[data-tip]:hover::after,
.wbs-reviews__why[data-tip]:focus-visible::after {
	content: attr(data-tip);
	position: absolute;
	bottom: calc(100% + 8px);
	left: 0;
	z-index: 20;
	width: 260px;
	max-width: 70vw;
	padding: 8px 10px;
	border-radius: 6px;
	background: #1d2327;
	color: #fff;
	font-size: 12px;
	font-weight: 400;
	font-style: normal;
	line-height: 1.45;
	white-space: normal;
	text-align: left;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
	pointer-events: none;
}

.wbs-reviews__why-tag {
	padding: 1px 8px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	font-style: normal;
	line-height: 18px;
	white-space: nowrap;
	background: #f0f0f1;
	color: #50575e;
}

.wbs-reviews__why-tag--featured { background: #e7f0fb; color: #0a4b8f; }
.wbs-reviews__why-tag--top_rated { background: #e6f4ea; color: #1e6b34; }
.wbs-reviews__why-tag--fallback { background: #efeafd; color: #4b3aa8; }
.wbs-reviews__why-tag--any_course { background: #f0f0f1; color: #50575e; }
.wbs-reviews__why-tag--quote { background: #fff; color: #50575e; box-shadow: inset 0 0 0 1px #dcdcde; }

/* ---- Mobile (Elementor's mobile breakpoint) ---- */

@media (max-width: 767px) {
	.wbs-reviews,
	.wbs-reviews.wbs-reviews--compact {
		grid-template-columns: minmax(0, 1fr);
	}

	.wbs-reviews.wbs-reviews--compact {
		gap: 16px;
	}

	.wbs-reviews .wbs-reviews__quote-card {
		padding: 24px;
	}

	.wbs-reviews__sidebar {
		position: static;
	}

	.wbs-reviews__card {
		padding: 20px;
	}
}
