/*
 * WooCommerce Reviews Slider — stylesheet.
 *
 * Every selector is scoped under .wc-rs. No selector in this file targets
 * body, html, .container, .row, .card, .slider, .review, .item, img, or a
 * outside that scope (spec §3, §28). Logical properties (margin-inline-*,
 * inset-inline-*, border-inline-*) are used throughout instead of left/right
 * so RTL (is_rtl()) is handled automatically without a second stylesheet;
 * the few rules that still need an explicit RTL branch (mirrored nav arrow
 * shape) are grouped at the bottom under [dir="rtl"].
 */

.wc-rs,
.wc-rs * {
	box-sizing: border-box;
}

.wc-rs {
	max-width: 100%;
	min-width: 0;
	overflow: hidden;
	font-family: inherit; /* Never forces a font — inherits Woodmart/Elementor typography (spec §31). */
	color: inherit;
}

.wc-rs-title {
	margin: 0 0 20px;
	font-size: 1.5em;
	font-weight: 600;
	line-height: 1.3;
}

/* ---------------------------------------------------------------------
 * Slider frame
 * ------------------------------------------------------------------- */

.wc-rs-swiper {
	position: relative;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	overflow: hidden;
	padding-inline: 4px; /* small gutter so shadows/focus rings on edge cards are never clipped */
}

.wc-rs-swiper-wrapper {
	display: flex;
	align-items: stretch; /* Equal Card Height default (on). */
	width: 100%;
	min-width: 0;
}

/* Equal Card Height = off: let each card size to its own content instead of
 * stretching to match its tallest neighbor. Set on the root by JS from the
 * server-rendered config, so it is correct on first paint. */
.wc-rs-slider[data-wc-rs-equal-height="0"] .wc-rs-swiper-wrapper {
	align-items: flex-start;
}

.wc-rs-slide {
	flex-shrink: 0;
	min-width: 0;
	height: auto;
}

/* ---------------------------------------------------------------------
 * Card
 * ------------------------------------------------------------------- */

.wc-rs-card {
	display: flex;
	flex-direction: column;
	gap: 14px;
	height: 100%;
	min-width: 0;
	background-color: #ffffff;
	border: 1px solid #e7e7e7;
	border-radius: 14px;
	padding: 22px;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.wc-rs-card:hover {
	box-shadow: 0 6px 20px rgba( 0, 0, 0, 0.06 );
}

/* ---------------------------------------------------------------------
 * Rating
 * ------------------------------------------------------------------- */

.wc-rs-rating {
	display: flex;
	line-height: 1;
}

.wc-rs-star {
	font-size: 16px;
	margin-inline-end: 2px;
}

.wc-rs-star:last-child {
	margin-inline-end: 0;
}

.wc-rs-star--filled {
	color: #f5a623;
}

.wc-rs-star--empty {
	color: #dcdcdc;
}

/* ---------------------------------------------------------------------
 * Review text
 * ------------------------------------------------------------------- */

.wc-rs-review-text {
	font-size: 0.95em;
	line-height: 1.65;
	overflow-wrap: anywhere; /* Arabic and English both wrap safely; never break-all (spec §31). */
	word-break: normal;
	flex-grow: 1;
}

.wc-rs-review-text-full[hidden] {
	display: none;
}

.wc-rs-read-more {
	display: inline;
	background: none;
	border: none;
	padding: 0;
	margin-inline-start: 4px;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
}

.wc-rs-read-more:focus-visible,
.wc-rs-nav:focus-visible,
.wc-rs-product:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------
 * Customer
 * ------------------------------------------------------------------- */

.wc-rs-customer {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.wc-rs-avatar {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	max-width: 100%;
	border-radius: 50%;
	object-fit: cover;
}

.wc-rs-customer-meta {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.wc-rs-author {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.wc-rs-verified-badge {
	display: inline-flex;
	align-items: center;
	font-size: 0.75em;
	font-weight: 600;
	color: #2e7d32;
	width: fit-content;
}

.wc-rs-verified-badge::before {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-inline-end: 5px;
	border-radius: 50%;
	background-color: currentColor;
}

.wc-rs-date {
	font-size: 0.75em;
	opacity: 0.65;
}

/* ---------------------------------------------------------------------
 * Product
 * ------------------------------------------------------------------- */

.wc-rs-product {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	margin-top: auto; /* pins to the card bottom regardless of review-text length */
	padding-top: 14px;
	border-top: 1px solid #f1f1f1;
	text-decoration: none;
	color: inherit;
}

.wc-rs-product-image {
	flex-shrink: 0;
	line-height: 0;
}

.wc-rs-product img {
	display: block;
	max-width: 100%;
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: 8px;
}

.wc-rs-product-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
}

/* ---------------------------------------------------------------------
 * Navigation
 * ------------------------------------------------------------------- */

.wc-rs-nav {
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid #e7e7e7;
	border-radius: 50%;
	background-color: #ffffff;
	color: #333333;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.wc-rs-nav:hover {
	background-color: #f5f5f5;
}

.wc-rs-nav.swiper-button-disabled {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

/* Swiper adds this class when there are not enough slides to need
 * navigation at all (e.g. the number of reviews fits within one view).
 * Without this rule the button stays visible as an empty, arrow-less
 * circle since we deliberately don't load Swiper's own bundled CSS. */
.wc-rs-nav.swiper-button-lock {
	display: none;
}

.wc-rs-nav::before {
	content: '';
	display: block;
	width: 8px;
	height: 8px;
	border-inline-start: 2px solid currentColor;
	border-block-start: 2px solid currentColor;
}

.wc-rs-nav-prev {
	inset-inline-start: 4px;
}

.wc-rs-nav-prev::before {
	transform: rotate( -45deg );
	margin-inline-start: 3px;
}

.wc-rs-nav-next {
	inset-inline-end: 4px;
}

.wc-rs-nav-next::before {
	transform: rotate( 135deg );
	margin-inline-end: 3px;
}

/* ---------------------------------------------------------------------
 * Pagination
 *
 * The bullet elements themselves (.swiper-pagination-bullet) are created at
 * runtime by Swiper inside our own .wc-rs-pagination container, so these
 * rules stay effectively scoped to this plugin even though the bullet class
 * name is Swiper's, not ours.
 * ------------------------------------------------------------------- */

.wc-rs-pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 18px;
}

.wc-rs-pagination .swiper-pagination-bullet {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background-color: #dcdcdc;
	opacity: 1;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

.wc-rs-pagination .swiper-pagination-bullet-active {
	background-color: #111111;
	transform: scale( 1.2 );
}

/* Same lock behavior as navigation, above: hide the pagination row entirely
 * when there is nothing to page through. */
.wc-rs-pagination.swiper-pagination-lock {
	display: none;
}

/* ---------------------------------------------------------------------
 * Empty / notice states
 * ------------------------------------------------------------------- */

.wc-rs-empty,
.wc-rs-notice {
	padding: 24px 16px;
	text-align: center;
	opacity: 0.75;
}

/* ---------------------------------------------------------------------
 * Mobile safety net — explicit checks against 320–414px per spec §6/§47
 * ------------------------------------------------------------------- */

@media ( max-width: 480px ) {
	.wc-rs-card {
		padding: 16px;
		gap: 10px;
	}

	.wc-rs-swiper {
		padding-inline: 2px;
	}

	.wc-rs-nav {
		width: 32px;
		height: 32px;
	}
}

/* ---------------------------------------------------------------------
 * Reduced motion
 * ------------------------------------------------------------------- */

@media ( prefers-reduced-motion: reduce ) {
	.wc-rs-card,
	.wc-rs-nav,
	.wc-rs-pagination .swiper-pagination-bullet {
		transition: none !important;
	}

	.wc-rs-swiper-wrapper {
		transition: none !important;
	}
}

/* ---------------------------------------------------------------------
 * RTL
 *
 * Logical properties above already flip padding/margin/border/inset
 * automatically under dir="rtl" (set on .wc-rs-slider from is_rtl() at
 * render time — spec §13). The only rule that still needs an explicit
 * branch is the chevron rotation for the nav arrows, since `transform:
 * rotate()` has no logical equivalent.
 * ------------------------------------------------------------------- */

[dir="rtl"].wc-rs-slider .wc-rs-nav-prev::before,
[dir="rtl"] .wc-rs-nav-prev::before {
	transform: rotate( 135deg );
}

[dir="rtl"].wc-rs-slider .wc-rs-nav-next::before,
[dir="rtl"] .wc-rs-nav-next::before {
	transform: rotate( -45deg );
}
