/**
 * Paripoorn Product Reviews widget.
 *
 * Two columns: existing WooCommerce reviews (left) and the review form
 * (right). Uses theme design tokens (--pp-*) so it follows the active
 * Paripoorn Settings brand colors/fonts; Elementor style controls (see
 * ProductReviews.php) override these per-instance.
 *
 * Several rules carry !important. That is deliberate and narrow: the
 * Elementor Kit stylesheet (uploads/elementor/css/post-*.css) styles every
 * bare `button`, `input`, and `textarea` on the site and loads AFTER
 * widget CSS, so without it the submit button renders as the Kit's global
 * pill and the fields lose their radius. Scoped to .pp-pr only.
 */

.pp-pr {
	--pp-pr-star-on: #D89B32;
	--pp-pr-star-off: #C9B48A;
	--pp-pr-star-size: 18px;
}

/* ---------- Header ---------- */

.pp-pr__header {
	margin-bottom: var(--pp-space-10, 40px);
}

.pp-pr__title {
	font-family: var(--pp-font-heading, "Libre Caslon Text", Georgia, serif);
	font-weight: 400;
	font-size: var(--pp-fs-h2, clamp(1.875rem, 1.3rem + 2.2vw, 3rem));
	line-height: 1.15;
	color: var(--pp-heading, #222222);
	margin: 0 0 var(--pp-space-2, 8px);
}

.pp-pr__subtitle {
	font-family: var(--pp-font-body, "Manrope", sans-serif);
	font-size: var(--pp-fs-small, 0.875rem);
	line-height: 1.6;
	color: #6B6B6B;
	margin: 0;
}

/* ---------- Two-column layout ---------- */

.pp-pr__layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--pp-space-16, 64px);
	align-items: start;
}

/* Reviews always sit in column 1 of the source order; when the form is
   placed left we swap the rendered order without touching the markup, so
   screen readers still meet the reviews first. */
.pp-pr--form-left .pp-pr__col--reviews {
	order: 2;
}

.pp-pr--form-left .pp-pr__col--form {
	order: 1;
}

/* With no form there is only one column, so let the reviews use the full
   width rather than leaving a dead half. */
.pp-pr--no-form .pp-pr__layout {
	grid-template-columns: 1fr;
}

.pp-pr__col {
	min-width: 0;
}

/* ---------- Reviews list ---------- */

.pp-pr__list {
	display: flex;
	flex-direction: column;
	gap: var(--pp-space-4, 16px);
}

/* When a max-height is set in the widget's Layout controls this column
   scrolls; keep the scrollbar off the card edge. */
.pp-pr__list {
	padding-right: 2px;
	scrollbar-width: thin;
}

.pp-pr__card {
	background: var(--pp-bg, #FFFFFF);
	border-radius: var(--pp-radius-lg, 20px);
	padding: var(--pp-space-6, 24px);
}

.pp-pr__stars {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	margin-bottom: var(--pp-space-3, 12px);
}

.pp-pr__star {
	display: inline-flex;
}

.pp-pr__star svg {
	fill: var(--pp-pr-star-on, #D89B32);
}

.pp-pr__star--empty svg {
	fill: #E5DCC8;
}

.pp-pr__quote {
	font-family: var(--pp-font-heading, "Libre Caslon Text", Georgia, serif);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.65;
	color: var(--pp-heading, #222222);
	margin: 0 0 var(--pp-space-5, 20px);
}

/* get_comment_text() returns wrapped <p> elements — flatten their default
   margins so the quote reads as one block inside the card. */
.pp-pr__quote p {
	margin: 0 0 0.6em;
}

.pp-pr__quote p:last-child {
	margin-bottom: 0;
}

.pp-pr__author {
	display: flex;
	align-items: center;
	gap: var(--pp-space-3, 12px);
}

.pp-pr__avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.pp-pr__author-text {
	min-width: 0;
}

.pp-pr__name {
	font-family: var(--pp-font-body, "Manrope", sans-serif);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--pp-heading, #222222);
}

.pp-pr__meta {
	font-family: var(--pp-font-body, "Manrope", sans-serif);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #8A8A8A;
	margin-top: 2px;
}

.pp-pr__empty {
	font-family: var(--pp-font-body, "Manrope", sans-serif);
	font-size: var(--pp-fs-small, 0.875rem);
	color: #6B6B6B;
	background: var(--pp-bg, #FFFFFF);
	border-radius: var(--pp-radius-lg, 20px);
	padding: var(--pp-space-6, 24px);
	margin: 0;
}

/* ---------- Form ---------- */

/* Deliberately smaller than --pp-fs-h3: in the reference the form title
   sits just under the section title in weight, not level with it. The h3
   clamp tops out at 2.125rem which reads as a competing headline. */
.pp-pr__form-title {
	font-family: var(--pp-font-heading, "Libre Caslon Text", Georgia, serif);
	font-weight: 400;
	font-size: clamp(1.375rem, 1.15rem + 0.9vw, 1.75rem);
	line-height: 1.2;
	color: var(--pp-heading, #222222);
	margin: 0 0 var(--pp-space-5, 20px);
}

/* Two-up field grid: name + email share a row, everything marked --full
   (rating row, textarea, submit) spans both. */
.pp-pr__form {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--pp-space-3, 12px);
}

/* A little more air above the submit than between fields. */
.pp-pr__form .form-submit {
	margin-top: var(--pp-space-2, 8px);
}

.pp-pr__field-wrap {
	margin: 0;
	min-width: 0;
}

.pp-pr__field-wrap--full,
.pp-pr__form .pp-pr__row,
.pp-pr__form .form-submit,
.pp-pr__form .comment-form-cookies-consent,
.pp-pr__form .pp-pr__must-log-in {
	grid-column: 1 / -1;
}

.pp-pr__field {
	width: 100%;
	box-sizing: border-box;
	font-family: var(--pp-font-body, "Manrope", sans-serif);
	font-size: 13px;
	line-height: 1.5;
	color: var(--pp-heading, #222222);
	background-color: var(--pp-bg, #FFFFFF);
	border: 1px solid #E7DCC8 !important;
	border-radius: 10px !important;
	padding: 12px 16px !important;
	/* The Kit stylesheet sets a global input height/min-height on some
	   setups; pin it here so name/email/textarea share one rhythm. */
	height: auto !important;
	min-height: 0;
	box-shadow: none;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

textarea.pp-pr__field {
	min-height: 90px;
	resize: vertical;
	display: block;
}

.pp-pr__field::placeholder {
	color: #A79C88;
	opacity: 1;
}

/* Logged-in users get their name/email prefilled and disabled (WordPress
   takes both from the account and ignores posted values). Style them as
   settled/confirmed rather than greyed-out-broken. */
.pp-pr__field:disabled {
	background-color: #FBF7EE;
	color: #6B6B6B;
	cursor: default;
	opacity: 1;
	-webkit-text-fill-color: #6B6B6B;
}

.pp-pr__field:focus {
	outline: none;
	border-color: var(--pp-primary, #F20D16);
	box-shadow: 0 0 0 3px rgba(242, 13, 22, 0.08);
}

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

.pp-pr__row {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.pp-pr__label {
	font-family: var(--pp-font-body, "Manrope", sans-serif);
	font-size: 11px;
	font-weight: 500;
	color: #8A8A8A;
	line-height: 1;
}

.pp-pr__required {
	color: var(--pp-primary, #F20D16);
}

/* The radios are rendered 5→1 so `:checked ~ label` can reach every star
   that should light up. Reversing the row visually with row-reverse puts
   them back in 1→5 reading order, which keeps the whole control CSS-only
   — it works with JavaScript disabled. */
.pp-pr__rating-input {
	display: inline-flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
	align-items: center;
	gap: 4px;
}

.pp-pr__rating-radio {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
	margin: 0;
}

.pp-pr__rating-star {
	display: inline-flex;
	cursor: pointer;
	line-height: 0;
	margin: 0;
}

.pp-pr__rating-star svg {
	width: var(--pp-pr-star-size, 18px);
	height: var(--pp-pr-star-size, 18px);
	fill: none;
	stroke: var(--pp-pr-star-off, #C9B48A);
	stroke-width: 1.6px;
	transition: fill 0.15s ease, stroke 0.15s ease;
}

/* Checked star and every star before it (later in DOM order). */
.pp-pr__rating-radio:checked ~ .pp-pr__rating-star svg,
.pp-pr__rating-radio:checked + .pp-pr__rating-star svg {
	fill: var(--pp-pr-star-on, #D89B32);
	stroke: var(--pp-pr-star-on, #D89B32);
}

/* Hover preview, same sibling trick. */
.pp-pr__rating-input:hover .pp-pr__rating-star:hover svg,
.pp-pr__rating-input:hover .pp-pr__rating-star:hover ~ .pp-pr__rating-star svg {
	fill: var(--pp-pr-star-on, #D89B32);
	stroke: var(--pp-pr-star-on, #D89B32);
}

/* Keyboard focus must stay visible even though the radio itself is
   visually hidden. */
.pp-pr__rating-radio:focus-visible + .pp-pr__rating-star svg {
	outline: 2px solid var(--pp-primary, #F20D16);
	outline-offset: 2px;
	border-radius: 2px;
}

/* ---------- Submit ---------- */

.pp-pr .pp-pr__submit {
	font-family: var(--pp-font-button, var(--pp-font-body, "Manrope", sans-serif));
	font-size: var(--pp-fs-small, 0.875rem) !important;
	font-weight: 600;
	line-height: 1.2;
	color: #FFFFFF;
	background-color: var(--pp-primary, #F20D16);
	border: none !important;
	border-radius: 999px !important;
	padding: 14px 28px !important;
	cursor: pointer;
	transition: background-color 0.18s ease, transform 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}

.pp-pr .pp-pr__submit:hover {
	background-color: var(--pp-primary-dark, #C90A12);
}

.pp-pr .pp-pr__submit:active {
	transform: translateY(1px);
}

.pp-pr .pp-pr__submit:focus-visible {
	outline: 2px solid var(--pp-heading, #222222);
	outline-offset: 2px;
}

/* ---------- Cookie consent + logged-out notice ---------- */

.pp-pr__form .comment-form-cookies-consent {
	display: flex;
	align-items: flex-start;
	gap: var(--pp-space-2, 8px);
	font-family: var(--pp-font-body, "Manrope", sans-serif);
	font-size: 12px;
	color: #6B6B6B;
	margin: 0;
}

.pp-pr__form .comment-form-cookies-consent input {
	margin-top: 3px;
	flex-shrink: 0;
	width: auto !important;
	padding: 0 !important;
}

.pp-pr__must-log-in,
.pp-pr__notice {
	font-family: var(--pp-font-body, "Manrope", sans-serif);
	font-size: var(--pp-fs-small, 0.875rem);
	color: #6B6B6B;
	background: var(--pp-bg, #FFFFFF);
	border-radius: var(--pp-radius-md, 14px);
	padding: var(--pp-space-4, 16px);
	margin: 0;
}

.pp-pr__must-log-in a,
.pp-pr__notice a {
	color: var(--pp-primary, #F20D16);
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
	.pp-pr__layout {
		grid-template-columns: 1fr;
		gap: var(--pp-space-10, 40px);
	}

	/* Order swapping only makes sense side by side; stacked, reviews first. */
	.pp-pr--form-left .pp-pr__col--reviews,
	.pp-pr--form-left .pp-pr__col--form {
		order: 0;
	}
}

@media (max-width: 600px) {
	.pp-pr__form {
		grid-template-columns: 1fr;
	}

	.pp-pr__card {
		padding: var(--pp-space-5, 20px);
	}
}
