/*
 * EcoFlow Reviews - form windows (review, question).
 *
 * Phones: a sheet over nearly the whole screen, like the theme's cart
 * window. From 768px: a centred window. The body scrolls; the head and the
 * submit row stay put. Inputs follow the checkout fields (52px, 14px
 * radius, the same hairline), with the product page's monochrome focus.
 */

.ef-rv-lock,
.ef-rv-lock body {
	overflow: hidden;
}

.ef-rv-modal {
	--ef-rv-ink: var(--wp--preset--color--contrast, #111);
	--ef-rv-subtle: var(--wp--preset--color--contrast-subtle, #555);
	--ef-rv-muted: var(--wp--preset--color--contrast-muted, #888);
	--ef-rv-line: var(--wp--preset--color--border, #e5e5e5);
	--ef-rv-input-line: rgba(0, 0, 0, 0.13);
	--ef-rv-error: oklch(0.57 0.19 27);
	--ef-rv-radius-control: 12px;

	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	height: calc(100% - 24px);
	max-height: none;
	margin: auto 0 0;
	padding: 0;
	border: 0;
	border-radius: 20px 20px 0 0;
	background: var(--wp--preset--color--base, #fff);
	color: var(--ef-rv-ink);
	font-size: var(--wp--preset--font-size--base);
	overflow: hidden;
}

.ef-rv-modal *,
.ef-rv-modal *::before,
.ef-rv-modal *::after {
	box-sizing: border-box;
}

.ef-rv-modal::backdrop {
	background: rgba(0, 0, 0, 0.5);
}

.ef-rv-modal[open] {
	display: flex;
	animation: ef-rv-up 220ms var(--wp--custom--ease--out, ease-out);
}

@keyframes ef-rv-up {
	from {
		transform: translateY(24px);
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ef-rv-modal[open] {
		animation: none;
	}
}

.ef-rv-modal .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.ef-rv-modal__panel {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
	width: 100%;
}

.ef-rv-modal__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--4);
	padding: 16px 12px 14px 20px;
	border-bottom: 1px solid var(--ef-rv-line);
}

.ef-rv-modal__title {
	margin: 6px 0 2px;
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.2;
}

.ef-rv-modal__sub {
	margin: 0;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--ef-rv-subtle);
}

.ef-rv-modal__close {
	display: grid;
	flex: 0 0 auto;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--ef-rv-ink);
	cursor: pointer;
}

.ef-rv-modal__close:hover {
	background: var(--wp--preset--color--base-subtle, #f3f3f3);
}

.ef-rv-modal__close:focus-visible {
	outline: 2px solid var(--ef-rv-ink);
}

.ef-rv-modal__close svg {
	width: 22px;
	height: 22px;
}

.ef-rv-form {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
}

.ef-rv-form[hidden] {
	display: none;
}

.ef-rv-modal__body {
	display: grid;
	flex: 1;
	align-content: start;
	gap: var(--wp--preset--spacing--5);
	min-height: 0;
	padding: 20px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.ef-rv-modal__foot {
	display: grid;
	gap: var(--wp--preset--spacing--2);
	padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--ef-rv-line);
	background: var(--wp--preset--color--base, #fff);
}

.ef-rv-form__submit {
	width: 100%;
}

.ef-rv-form__note {
	margin: 0;
	font-size: var(--wp--preset--font-size--xs);
	line-height: 1.5;
	text-align: center;
	color: var(--ef-rv-muted);
}

.ef-rv-form__note a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

@media (min-width: 768px) {
	.ef-rv-modal {
		width: min(640px, calc(100% - 48px));
		height: auto;
		max-height: min(860px, calc(100% - 48px));
		margin: auto;
		border-radius: 20px;
	}

	.ef-rv-modal__head {
		padding: 22px 16px 18px 28px;
	}

	.ef-rv-modal__body {
		padding: 24px 28px;
	}

	.ef-rv-modal__foot {
		grid-template-columns: auto 1fr;
		align-items: center;
		gap: var(--wp--preset--spacing--5);
		padding: 16px 28px;
	}

	.ef-rv-form__submit {
		width: auto;
		min-width: 220px;
	}

	.ef-rv-form__note {
		text-align: left;
	}
}

/* --- Fields -------------------------------------------------------------- */

.ef-rv-field {
	display: grid;
	gap: 8px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.ef-rv-field[hidden] {
	display: none;
}

.ef-rv-field__label {
	padding: 0;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 700;
	color: var(--ef-rv-ink);
}

.ef-rv-req {
	color: var(--ef-rv-error);
}

.ef-rv-field__hint {
	margin: 0;
	font-size: var(--wp--preset--font-size--xs);
	line-height: 1.5;
	color: var(--ef-rv-muted);
}

.ef-rv-field__error,
.ef-rv-form__error {
	margin: 0;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--ef-rv-error);
}

.ef-rv-field__error[hidden],
.ef-rv-form__error[hidden] {
	display: none;
}

.ef-rv-form__error {
	padding: 12px 14px;
	border-radius: var(--ef-rv-radius-control);
	background: color-mix(in oklab, var(--ef-rv-error) 8%, transparent);
}

.ef-rv-field input[type="text"],
.ef-rv-field input[type="email"],
.ef-rv-field textarea {
	width: 100%;
	padding: 0 16px;
	border: 1px solid var(--ef-rv-input-line);
	border-radius: 14px;
	background: var(--wp--preset--color--base, #fff);
	font: inherit;
	font-size: 16px; /* 16px keeps iOS from zooming into the field. */
	font-weight: 500;
	color: var(--ef-rv-ink);
	outline: none;
	transition: border-color 0.18s, box-shadow 0.18s;
}

.ef-rv-field input[type="text"],
.ef-rv-field input[type="email"] {
	height: 52px;
}

.ef-rv-field textarea {
	min-height: 64px;
	padding-block: 13px;
	line-height: 1.5;
	resize: vertical;
}

.ef-rv-field textarea[name="comment"],
.ef-rv-field textarea[name="question"] {
	min-height: 112px;
}

.ef-rv-field input:hover,
.ef-rv-field textarea:hover {
	border-color: rgba(0, 0, 0, 0.26);
}

.ef-rv-field input:focus,
.ef-rv-field textarea:focus {
	border-color: var(--ef-rv-ink);
	box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
}

.ef-rv-field.has-error input,
.ef-rv-field.has-error textarea,
.ef-rv-texts.has-error textarea {
	border-color: var(--ef-rv-error);
}

.ef-rv-texts {
	display: grid;
	gap: var(--wp--preset--spacing--4);
}

.ef-rv-row {
	display: grid;
	gap: var(--wp--preset--spacing--5);
}

@media (min-width: 600px) {
	.ef-rv-row {
		grid-template-columns: 1fr 1fr;
		align-items: start;
	}
}

/* Honeypot: out of sight and out of the tab order, still in the DOM. */
.ef-rv-hp {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* --- Star input ---------------------------------------------------------- */

.ef-rv-rate__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--3);
}

.ef-rv-rate__stars {
	display: inline-flex;
	gap: 4px;
}

.ef-rv-rate__star {
	position: relative;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 10px;
	cursor: pointer;
}

.ef-rv-rate__star input {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.ef-rv-rate__star svg {
	width: 34px;
	height: 34px;
	fill: var(--wp--preset--color--border, #e5e5e5);
	transition: fill 0.12s, transform 0.12s;
}

.ef-rv-rate__star.is-on svg {
	fill: var(--ef-rv-ink);
}

.ef-rv-rate__star:hover svg {
	transform: scale(1.08);
}

.ef-rv-rate__star:has(input:focus-visible) {
	outline: 2px solid var(--ef-rv-ink);
}

.ef-rv-rate__word {
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	color: var(--ef-rv-subtle);
}

.ef-rv-rate.has-error .ef-rv-rate__star svg {
	fill: color-mix(in oklab, var(--ef-rv-error) 22%, #e5e5e5);
}

@media (max-width: 359px) {
	.ef-rv-rate__star {
		width: 40px;
		height: 40px;
	}

	.ef-rv-rate__star svg {
		width: 30px;
		height: 30px;
	}
}

/* --- Photo picker -------------------------------------------------------- */

.ef-rv-photos__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ef-rv-photos__list:empty {
	display: none;
}

.ef-rv-photos__list li {
	position: relative;
	width: 76px;
	height: 76px;
	border-radius: 10px;
	overflow: hidden;
	background: #f5f5f5;
}

.ef-rv-photos__list img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ef-rv-photos__del {
	position: absolute;
	top: 4px;
	right: 4px;
	display: grid;
	place-items: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(17, 17, 17, 0.72);
	color: #fff;
	cursor: pointer;
}

.ef-rv-photos__del svg {
	width: 14px;
	height: 14px;
}

.ef-rv-photos__add {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-self: start;
	gap: 8px;
	min-height: 48px;
	padding: 0 18px;
	border: 1px dashed rgba(0, 0, 0, 0.26);
	border-radius: var(--ef-rv-radius-control);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	cursor: pointer;
}

.ef-rv-photos__add[hidden] {
	display: none;
}

.ef-rv-photos__add:hover {
	border-color: var(--ef-rv-ink);
}

.ef-rv-photos__add:has(input:focus-visible) {
	outline: 2px solid var(--ef-rv-ink);
	outline-offset: 2px;
}

.ef-rv-photos__add input {
	position: absolute;
	inset: 0;
	width: 100%;
	opacity: 0;
	cursor: pointer;
}

.ef-rv-photos__add svg {
	width: 18px;
	height: 18px;
}

.ef-rv-captcha[hidden] {
	display: none;
}

/* --- Sent ---------------------------------------------------------------- */

.ef-rv-modal__done {
	display: grid;
	flex: 1;
	align-content: center;
	justify-items: center;
	gap: var(--wp--preset--spacing--4);
	padding: 40px 24px;
	text-align: center;
}

.ef-rv-modal__done[hidden] {
	display: none;
}

.ef-rv-modal__done svg {
	width: 56px;
	height: 56px;
	color: var(--wp--preset--color--success, #5a9b62);
}

.ef-rv-modal__done-text {
	max-width: 400px;
	margin: 0;
	font-size: var(--wp--preset--font-size--lg);
	font-weight: 600;
	line-height: 1.45;
}
