/*
 * JRLF-UI-03: Elementor es la fuente de verdad del diseño.
 *
 * Toda declaración que representa un VALOR DE DISEÑO (padding, margin, gap,
 * radius, altura, ancho, color...) va envuelta en :where(), que tiene
 * especificidad CERO. Cualquier regla de Elementor sobre el mismo elemento
 * (sus selectores siempre cargan como {{WRAPPER}} .clase, especificidad >0)
 * gana SIEMPRE, sin importar el orden de carga. Fuera de :where() solo queda
 * estructura (display/flex/grid, box-sizing, accesibilidad, anti-spam) que
 * nunca debe ser anulable.
 */

.jrlf-reviews {
	box-sizing: border-box;
}

:where(.jrlf-reviews) {
	padding: 72px 24px;
}

.jrlf-reviews *,
.jrlf-reviews *::before,
.jrlf-reviews *::after {
	box-sizing: inherit;
}

.jrlf-reviews__inner {
	width: 100%;
}

:where(.jrlf-reviews__inner) {
	max-width: 1180px;
	margin: 0 auto;
}

/* --- Zona superior: intro + card de formulario --- */

.jrlf-reviews__head {
	display: grid;
	grid-template-columns: var(--jrlf-intro-width, 40%) 1fr;
	align-items: start;
}

:where(.jrlf-reviews__head) {
	gap: 48px;
	margin: 0 0 56px;
}

.jrlf-reviews__head--no-form {
	grid-template-columns: 1fr;
}

.jrlf-reviews__intro {
	display: flex;
	flex-direction: column;
	align-self: center;
}

:where(.jrlf-reviews__title) {
	margin: 0 0 14px;
	line-height: 1.2;
}

:where(.jrlf-reviews__text) {
	margin: 0 0 14px;
	opacity: 0.9;
}

:where(.jrlf-reviews__text p) {
	margin: 0 0 12px;
}

:where(.jrlf-reviews__text p:last-child) {
	margin-bottom: 0;
}

:where(.jrlf-reviews__highlight) {
	font-weight: 600;
	margin: 0 0 20px;
}

:where(.jrlf-reviews__stars-deco) {
	color: var(--jrlf-star-color, #d4af6a);
	font-size: 24px;
	letter-spacing: 6px;
	margin: 0 0 20px;
}

:where(.jrlf-reviews__final) {
	font-weight: 600;
	margin: 0;
	opacity: 0.95;
}

/* --- Card del formulario --- */

:where(.jrlf-reviews__form-card) {
	background: #f7f2ea;
	border: 1px solid rgba(20, 20, 20, 0.06);
	border-radius: 18px;
	box-shadow: 0 12px 32px rgba(20, 20, 20, 0.06);
	padding: 32px;
}

/* --- Grid de reseñas aprobadas --- */

.jrlf-reviews__grid {
	display: grid;
	grid-template-columns: repeat(var(--jrlf-cols, 3), minmax(0, 1fr));
	align-items: stretch;
}

:where(.jrlf-reviews__grid) {
	gap: 24px;
}

@media (max-width: 1024px) {
	:where(.jrlf-reviews__grid) {
		--jrlf-cols: 2;
	}
}

@media (max-width: 600px) {
	:where(.jrlf-reviews__grid) {
		--jrlf-cols: 1;
	}
}

.jrlf-review-card {
	display: flex;
	flex-direction: column;
	height: 100%;
}

:where(.jrlf-review-card) {
	gap: 10px;
	padding: 24px;
	border: 1px solid rgba(20, 20, 20, 0.06);
	border-radius: 16px;
	background: #f7f2ea;
}

.jrlf-review-card__avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
	object-fit: cover;
}

:where(.jrlf-review-card__stars) {
	color: var(--jrlf-star-color, #d4af6a);
	font-size: 16px;
	letter-spacing: 2px;
}

.jrlf-review-card__text {
	margin: 0;
	flex-grow: 1;
}

:where(.jrlf-review-card__text) {
	line-height: 1.55;
}

.jrlf-review-card__meta {
	display: flex;
	flex-wrap: wrap;
}

:where(.jrlf-review-card__meta) {
	gap: 4px 10px;
	font-size: 0.85em;
	opacity: 0.75;
}

:where(.jrlf-review-card__name) {
	font-weight: 600;
}

/* --- Formulario público de envío --- */

.jrlf-review-form {
	display: flex;
	flex-direction: column;
}

:where(.jrlf-review-form) {
	gap: 16px;
}

.jrlf-review-form__field {
	display: flex;
	flex-direction: column;
	border: 0;
	padding: 0;
	margin: 0;
}

:where(.jrlf-review-form__field) {
	gap: 6px;
}

:where(.jrlf-review-form__label) {
	font-weight: 600;
	font-size: 0.9em;
	letter-spacing: 0.01em;
}

.jrlf-review-form__input,
.jrlf-review-form__textarea {
	width: 100%;
	font: inherit;
}

:where(.jrlf-review-form__input, .jrlf-review-form__textarea) {
	height: 46px;
	padding: 0 16px;
	border: 1px solid rgba(20, 20, 20, 0.16);
	border-radius: 9px;
	background: #fff;
	font-size: 0.95em;
}

.jrlf-review-form__input:focus-visible,
.jrlf-review-form__textarea:focus-visible {
	outline: 2px solid #1a2b49;
	outline-offset: 1px;
}

.jrlf-review-form__textarea {
	height: auto;
	resize: vertical;
}

:where(.jrlf-review-form__textarea) {
	min-height: 116px;
	padding: 12px 16px;
}

/* Rating accesible: radios reales, visualmente ocultos pero enfocables.
   Estructura de accesibilidad: no se envuelve en :where(). */

.jrlf-star-rating {
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
}

:where(.jrlf-star-rating) {
	gap: 5px;
	font-size: 28px;
}

.jrlf-star-rating input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
}

.jrlf-star-rating label {
	cursor: pointer;
	line-height: 1;
	transition: color 0.15s ease;
}

:where(.jrlf-star-rating label) {
	color: #d8d2c4;
}

.jrlf-star-rating input:checked ~ label,
.jrlf-star-rating label:hover,
.jrlf-star-rating label:hover ~ label {
	color: var(--jrlf-star-color, #d4af6a);
}

.jrlf-star-rating input:focus-visible + label {
	outline: 2px solid #1a2b49;
	outline-offset: 3px;
	border-radius: 3px;
}

:where(.jrlf-review-form__rating-feedback) {
	margin: 0;
	font-size: 0.85em;
	opacity: 0.75;
	min-height: 1.2em;
}

.jrlf-review-form__consent {
	display: flex;
	align-items: flex-start;
}

:where(.jrlf-review-form__consent) {
	gap: 8px;
	font-size: 0.85em;
	line-height: 1.4;
}

/* Honeypot anti-spam: posicionamiento fuera de pantalla, nunca anulable. */
.jrlf-review-form__honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.jrlf-review-form__button {
	align-self: flex-start;
	cursor: pointer;
	font: inherit;
}

:where(.jrlf-review-form__button) {
	height: 46px;
	padding: 0 22px;
	border: 0;
	border-radius: 9px;
	background: #1a2b49;
	color: #fff;
	font-weight: 600;
	transition: background-color 0.2s ease, opacity 0.2s ease;
}

.jrlf-review-form__button:hover:not(:disabled) {
	opacity: 0.88;
}

.jrlf-review-form__button:focus-visible {
	outline: 2px solid #1a2b49;
	outline-offset: 2px;
}

.jrlf-review-form__button:disabled {
	cursor: not-allowed;
	opacity: 0.7;
}

:where(.jrlf-review-form__message) {
	min-height: 1.2em;
	font-size: 0.85em;
}

:where(.jrlf-review-form__message--success) {
	color: #1e7e34;
}

:where(.jrlf-review-form__message--error) {
	color: #b3261e;
}

/* --- Responsive (fallback de shortcode; Elementor gobierna sus propios
   breakpoints vía sus controles responsive) --- */

@media (max-width: 1024px) {
	:where(.jrlf-reviews) {
		padding: 56px 24px;
	}

	:where(.jrlf-reviews__head) {
		gap: 32px;
	}

	:where(.jrlf-reviews__form-card) {
		padding: 24px;
	}
}

@media (max-width: 782px) {
	.jrlf-reviews__head,
	.jrlf-reviews__head--no-form {
		grid-template-columns: 1fr;
	}

	:where(.jrlf-reviews__intro) {
		margin: 0 0 28px;
	}
}

@media (max-width: 600px) {
	:where(.jrlf-reviews) {
		padding: 40px 18px;
	}

	:where(.jrlf-reviews__head) {
		margin: 0 0 32px;
	}

	:where(.jrlf-reviews__form-card) {
		padding: 20px;
	}

	.jrlf-review-form__button {
		align-self: stretch;
	}

	:where(.jrlf-review-form__button) {
		width: 100%;
	}
}
