/*
 * Shreeja Product Reviews — Front-end Styles
 *
 * Uses the design tokens defined in the theme's main.css :root block.
 * Never hard-codes colours: everything reads from CSS custom properties.
 *
 * @package ShreejaProductReviews
 */

/* ==========================================================================
   0. Resets & Base
   ========================================================================== */

.srev-section *,
.srev-section *::before,
.srev-section *::after {
	box-sizing: border-box;
}

.srev-section {
	font-family: var(--font-body, 'Outfit', system-ui, sans-serif);
	color: var(--text, #55403E);
	margin-top: clamp(1.5rem, 4vw, 3rem);
}

/* ==========================================================================
   1. Rating Summary + Histogram
   ========================================================================== */

.srev-summary {
	display: flex;
	gap: clamp(1.5rem, 4vw, 3rem);
	align-items: flex-start;
	background: var(--background-blush, #FDF3F4);
	border: 1px solid var(--border, #E6D2D0);
	border-radius: var(--radius, 16px);
	padding: clamp(1.25rem, 3vw, 2rem);
	margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

/* Big score block */
.srev-summary__score {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35rem;
	flex: 0 0 auto;
	min-width: 100px;
}

.srev-big-rating {
	font-family: var(--font-heading, 'Cormorant Garamond', Georgia, serif);
	font-size: clamp(3.5rem, 8vw, 5rem);
	font-weight: 700;
	line-height: 1;
	color: var(--heading, #3B2928);
}

.srev-summary__count {
	font-size: var(--fs-xs, 0.78rem);
	color: var(--text-muted, #6E5957);
	text-align: center;
}

/* Histogram */
.srev-histogram {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
}

.srev-histogram__row {
	display: grid;
	grid-template-columns: 3rem 1fr 2rem;
	align-items: center;
	gap: 0.6rem;
}

.srev-histogram__label {
	display: flex;
	align-items: center;
	gap: 0.15rem;
	font-size: var(--fs-xs, 0.78rem);
	color: var(--text-muted, #6E5957);
	white-space: nowrap;
}

.srev-histogram__label .dashicons {
	color: var(--secondary, #C9A46C);
	font-size: 0.85rem;
	width: 0.85rem;
	height: 0.85rem;
}

.srev-histogram__bar-wrap {
	height: 8px;
	background: var(--border, #E6D2D0);
	border-radius: 999px;
	overflow: hidden;
}

.srev-histogram__bar {
	height: 100%;
	width: var(--pct, 0%);
	background: var(--secondary, #C9A46C);
	border-radius: 999px;
	transition: width 0.7s var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.srev-histogram__count {
	font-size: var(--fs-xs, 0.78rem);
	color: var(--text-muted, #6E5957);
	text-align: right;
}

/* ==========================================================================
   2. Star Display
   ========================================================================== */

.srev-stars {
	display: flex;
	gap: 2px;
	align-items: center;
}

.srev-stars--lg { gap: 4px; }

.srev-star {
	display: inline-flex;
	width: 1em;
	height: 1em;
	flex: 0 0 auto;
}

.srev-star svg {
	width: 100%;
	height: 100%;
}

.srev-star--full svg { fill: var(--secondary, #C9A46C); }
.srev-star--half svg { fill: url(#srev-half-grad); }
.srev-star--empty svg { fill: var(--border, #E6D2D0); }

.srev-stars--lg .srev-star { width: 1.3em; height: 1.3em; }

/* ==========================================================================
   3. Review Cards
   ========================================================================== */

.srev-list {
	display: grid;
	gap: clamp(1rem, 2.5vw, 1.5rem);
}

.srev-card {
	background: var(--white, #fff);
	border: 1px solid var(--border, #E6D2D0);
	border-radius: var(--radius-sm, 10px);
	padding: clamp(1rem, 2.5vw, 1.5rem);
	box-shadow: var(--shadow-xs, 0 1px 2px rgba(59,41,40,0.05));
	transition: box-shadow var(--t-fast, 0.22s) var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
	animation: srev-fade-in 0.4s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.srev-card:hover {
	box-shadow: var(--shadow-sm, 0 4px 14px rgba(59,41,40,0.06));
}

@keyframes srev-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* Card head: avatar + meta + stars */
.srev-card__head {
	display: flex;
	align-items: flex-start;
	gap: 0.85rem;
	margin-bottom: 0.85rem;
}

.srev-card__meta {
	flex: 1;
	min-width: 0;
}

.srev-card__stars {
	flex: 0 0 auto;
	margin-left: auto;
}

/* Avatar */
.srev-avatar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--primary, #C9828E), var(--primary-dark, #86414F));
	color: var(--white, #fff);
	font-weight: 700;
	font-size: 0.9rem;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	flex-shrink: 0;
}

.srev-avatar--lg {
	width: 52px;
	height: 52px;
	font-size: 1.1rem;
}

/* Author name + date */
.srev-card__author {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.4rem;
	font-weight: 600;
	font-size: var(--fs-sm, 0.9rem);
	color: var(--heading, #3B2928);
}

.srev-card__date {
	font-size: var(--fs-xs, 0.78rem);
	color: var(--text-muted, #6E5957);
}

/* Review title */
.srev-card__title {
	font-weight: 600;
	font-size: var(--fs-sm, 0.9rem);
	color: var(--heading, #3B2928);
	margin: 0 0 0.4rem;
}

/* Review body */
.srev-card__body {
	font-size: var(--fs-body, 1rem);
	line-height: 1.65;
	color: var(--text, #55403E);
}

/* Card footer: helpful votes */
.srev-card__footer {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 1rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--border, #E6D2D0);
}

.srev-helpful-label {
	font-size: var(--fs-xs, 0.78rem);
	color: var(--text-muted, #6E5957);
	margin-right: 0.2rem;
}

/* ==========================================================================
   4. Helpful Vote Buttons
   ========================================================================== */

.srev-vote-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	background: none;
	border: 1px solid var(--border, #E6D2D0);
	border-radius: var(--radius-pill, 999px);
	padding: 0.2rem 0.65rem;
	font-family: inherit;
	font-size: var(--fs-xs, 0.78rem);
	color: var(--text-muted, #6E5957);
	cursor: pointer;
	transition: all var(--t-fast, 0.22s) var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.srev-vote-btn .dashicons {
	font-size: 1rem;
	width: 1rem;
	height: 1rem;
}

.srev-vote-btn--yes:hover,
.srev-vote-btn--yes.is-voted {
	background: #e8f5e9;
	border-color: #a5d6a7;
	color: #2e7d32;
}

.srev-vote-btn--no:hover,
.srev-vote-btn--no.is-voted {
	background: var(--background-blush, #FDF3F4);
	border-color: var(--primary, #C9828E);
	color: var(--primary-dark, #86414F);
}

.srev-vote-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ==========================================================================
   5. Verified Badge
   ========================================================================== */

.srev-verified-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
	background: #e8f5e9;
	color: #2e7d32;
	border: 1px solid #a5d6a7;
	border-radius: var(--radius-pill, 999px);
	font-size: var(--fs-xs, 0.78rem);
	padding: 0.1rem 0.55rem;
	font-weight: 600;
	flex-shrink: 0;
}

.srev-verified-badge .dashicons {
	font-size: 0.85rem;
	width: 0.85rem;
	height: 0.85rem;
}

/* ==========================================================================
   6. Load More Button
   ========================================================================== */

.srev-load-more-wrap {
	display: flex;
	justify-content: center;
	margin: clamp(1rem, 3vw, 2rem) 0;
}

.srev-load-more-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background: var(--white, #fff);
	border: 1px solid var(--primary, #C9828E);
	border-radius: var(--radius-pill, 999px);
	color: var(--primary-dark, #86414F);
	font-family: inherit;
	font-size: var(--fs-sm, 0.9rem);
	font-weight: 600;
	padding: 0.65rem 1.75rem;
	cursor: pointer;
	transition: all var(--t-fast, 0.22s) var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.srev-load-more-btn:hover {
	background: var(--primary, #C9828E);
	color: var(--white, #fff);
}

.srev-load-more-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* ==========================================================================
   7. Empty State
   ========================================================================== */

.srev-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	padding: clamp(2rem, 5vw, 3rem) 1rem;
	text-align: center;
	color: var(--text-muted, #6E5957);
}

.srev-empty .dashicons {
	font-size: 3rem;
	width: 3rem;
	height: 3rem;
	color: var(--border, #E6D2D0);
}

.srev-empty p {
	margin: 0;
	font-size: var(--fs-sm, 0.9rem);
}

/* ==========================================================================
   8. Review Form
   ========================================================================== */

.srev-form-wrap {
	background: var(--background-blush, #FDF3F4);
	border: 1px solid var(--border, #E6D2D0);
	border-radius: var(--radius, 16px);
	padding: clamp(1.25rem, 3vw, 2rem);
	margin-top: clamp(1.5rem, 4vw, 2.5rem);
}

.srev-form-wrap--locked {
	text-align: center;
	color: var(--text-muted, #6E5957);
}

.srev-form-title {
	font-family: var(--font-heading, 'Cormorant Garamond', Georgia, serif);
	font-size: clamp(1.4rem, 3vw, 1.85rem);
	font-weight: 700;
	color: var(--heading, #3B2928);
	margin: 0 0 1.5rem;
}

/* Form notice (success / error) */
.srev-form-notice {
	padding: 0.85rem 1.1rem;
	border-radius: var(--radius-xs, 6px);
	margin-bottom: 1.25rem;
	font-size: var(--fs-sm, 0.9rem);
	border-inline-start: 3px solid;
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
}

.srev-form-notice--success {
	background: #e8f5e9;
	border-color: #4caf50;
	color: #1b5e20;
}

.srev-form-notice--error {
	background: var(--background-blush, #FDF3F4);
	border-color: var(--primary, #C9828E);
	color: var(--primary-dark, #86414F);
}

/* Logged-in message */
.srev-logged-in-as {
	font-size: var(--fs-xs, 0.78rem);
	color: var(--text-muted, #6E5957);
	margin-bottom: 1rem;
}

/* Already reviewed */
.srev-already-reviewed {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	color: #2e7d32;
	font-size: var(--fs-sm, 0.9rem);
	padding: 0.85rem 1.1rem;
	background: #e8f5e9;
	border-radius: var(--radius-xs, 6px);
	border-left: 3px solid #4caf50;
	margin-top: 1.5rem;
}

.srev-already-reviewed .dashicons {
	font-size: 1.2rem;
	width: 1.2rem;
	height: 1.2rem;
}

/* ==========================================================================
   9. Form Fields
   ========================================================================== */

.srev-field {
	margin-bottom: 1.1rem;
}

.srev-field:last-child { margin-bottom: 0; }

.srev-label {
	display: block;
	font-weight: 600;
	font-size: var(--fs-sm, 0.9rem);
	color: var(--heading, #3B2928);
	margin-bottom: 0.4rem;
}

.srev-label--required::after {
	content: ' *';
	color: var(--primary, #C9828E);
}

.srev-form input[type="text"],
.srev-form input[type="email"],
.srev-form textarea {
	width: 100%;
	padding: 0.65rem 0.9rem;
	border: 1px solid var(--border, #E6D2D0);
	border-radius: var(--radius-xs, 6px);
	background: var(--white, #fff);
	font-family: var(--font-body, 'Outfit', sans-serif);
	font-size: var(--fs-body, 1rem);
	color: var(--text, #55403E);
	transition: border-color var(--t-fast, 0.22s), box-shadow var(--t-fast, 0.22s);
	-webkit-appearance: none;
	appearance: none;
}

.srev-form input:focus,
.srev-form textarea:focus {
	outline: none;
	border-color: var(--primary, #C9828E);
	box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 158,82,97), 0.14);
}

.srev-form textarea {
	resize: vertical;
	min-height: 130px;
}

.srev-grid-2 {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1rem;
}

/* Character counter */
.srev-char-counter {
	font-size: var(--fs-xs, 0.78rem);
	color: var(--text-muted, #6E5957);
	text-align: right;
	margin-top: 0.3rem;
}

.srev-char-current.is-satisfied { color: #2e7d32; }

/* ==========================================================================
   10. Star Picker (Form)
   ========================================================================== */

.srev-field--stars {
	margin-bottom: 1.3rem;
}

/* RTL-friendly CSS star picker: input radio buttons are invisible,
   labels render the SVG stars in reverse order so clicking any label
   highlights it and everything to its left (lower numbered) via
   the general sibling combinator. */
.srev-star-picker {
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
	gap: 4px;
}

.srev-star-input { display: none; }

.srev-star-label {
	cursor: pointer;
	width: 2rem;
	height: 2rem;
	display: block;
	color: var(--border, #E6D2D0);
	transition: color var(--t-fast, 0.22s), transform var(--t-fast, 0.22s);
}

.srev-star-label svg {
	width: 100%;
	height: 100%;
	fill: currentColor;
}

/* Hover: highlight hovered star and all stars to its right (higher values) */
.srev-star-picker .srev-star-label:hover,
.srev-star-picker .srev-star-label:hover ~ .srev-star-label {
	color: var(--secondary, #C9A46C);
	transform: scale(1.1);
}

/* Checked: highlight checked star and all stars to its right */
.srev-star-picker .srev-star-input:checked ~ .srev-star-label {
	color: var(--secondary, #C9A46C);
}

.srev-star-label-text {
	font-size: var(--fs-xs, 0.78rem);
	color: var(--text-muted, #6E5957);
	margin-top: 0.35rem;
	min-height: 1.2em;
}

/* Honeypot (invisible) */
.srev-hp {
	position: absolute;
	left: -9999px;
	height: 0;
	overflow: hidden;
}

/* ==========================================================================
   11. Submit Button
   ========================================================================== */

.srev-form-actions {
	margin-top: 1.5rem;
}

/*
 * Match theme's .btn--primary:
 * Solid rose button with white text, rounded pill, arrow icon on hover.
 */
.srev-submit-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.8rem 2rem;
	border: none;
	border-radius: var(--radius-pill, 999px);
	background: var(--primary, #C9828E);
	color: var(--white, #fff);
	font-family: var(--font-body, 'Outfit', sans-serif);
	font-size: var(--fs-sm, 0.9rem);
	font-weight: 700;
	letter-spacing: 0.3px;
	cursor: pointer;
	transition: background-color var(--t-fast, 0.22s), transform var(--t-fast, 0.22s), box-shadow var(--t-fast, 0.22s);
	-webkit-appearance: none;
	appearance: none;
}

.srev-submit-btn:hover {
	background: var(--primary-dark, #86414F);
	box-shadow: var(--shadow-sm, 0 4px 14px rgba(59,41,40,0.06));
	transform: translateY(-1px);
}

.srev-submit-btn:active {
	transform: translateY(0);
}

.srev-submit-btn:disabled {
	opacity: 0.65;
	cursor: not-allowed;
	transform: none;
}

.srev-submit-btn__loader {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255,255,255,0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: srev-spin 0.65s linear infinite;
}

.srev-submit-btn.is-loading .srev-submit-btn__text { display: none; }
.srev-submit-btn.is-loading .srev-submit-btn__loader { display: block; }

@keyframes srev-spin {
	to { transform: rotate(360deg); }
}

/* ==========================================================================
   12. Responsive
   ========================================================================== */

@media ( max-width: 680px ) {
	.srev-summary {
		flex-direction: column;
		align-items: center;
	}

	.srev-histogram {
		width: 100%;
	}

	.srev-grid-2 {
		grid-template-columns: 1fr;
	}

	.srev-card__head {
		flex-wrap: wrap;
	}

	.srev-card__stars {
		margin-left: 0;
		width: 100%;
	}
}
