/* ============================================================
   TWT AEO — Reviews Frontend Styles
   Theme-agnostic, scoped to .twt-review-* and .twt-aggregate-*
   ============================================================ */

:root {
	--twt-rv-star:     #f59e0b;
	--twt-rv-star-off: #d1d5db;
	--twt-rv-text:     #1e293b;
	--twt-rv-muted:    #64748b;
	--twt-rv-border:   #e2e8f0;
	--twt-rv-bg:       #ffffff;
	--twt-rv-radius:   8px;
	--twt-rv-accent:   #2563eb;
	--twt-rv-success:  #16a34a;
	--twt-rv-error:    #dc2626;
}

/* ── Review list ── */

.twt-reviews-list {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin: 0;
	padding: 0;
}

.twt-review-item {
	background: var(--twt-rv-bg);
	border: 1px solid var(--twt-rv-border);
	border-radius: var(--twt-rv-radius);
	padding: 18px 20px;
}

.twt-review-header {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 14px;
	margin-bottom: 10px;
}

.twt-review-author {
	font-weight: 600;
	color: var(--twt-rv-text);
	font-size: 0.95em;
}

.twt-review-date {
	color: var(--twt-rv-muted);
	font-size: 0.85em;
	margin-left: auto;
}

.twt-review-body {
	color: var(--twt-rv-text);
	font-size: 0.95em;
	line-height: 1.65;
}

.twt-review-body p:last-child {
	margin-bottom: 0;
}

.twt-reviews-empty {
	color: var(--twt-rv-muted);
	font-style: italic;
}

/* ── Stars ── */

.twt-stars {
	display: inline-flex;
	gap: 1px;
	line-height: 1;
}

.twt-star {
	color: var(--twt-rv-star-off);
	font-size: 1.1em;
}

.twt-star-full {
	color: var(--twt-rv-star);
}

.twt-star-half {
	color: var(--twt-rv-star);
	opacity: 0.6;
}

/* ── Aggregate rating ── */

.twt-aggregate-rating {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px 20px;
	padding: 16px 20px;
	background: var(--twt-rv-bg);
	border: 1px solid var(--twt-rv-border);
	border-radius: var(--twt-rv-radius);
}

.twt-aggregate-score {
	display: flex;
	align-items: baseline;
	gap: 2px;
}

.twt-aggregate-number {
	font-size: 2.4em;
	font-weight: 700;
	color: var(--twt-rv-text);
	line-height: 1;
}

.twt-aggregate-max {
	font-size: 1em;
	color: var(--twt-rv-muted);
}

.twt-aggregate-bar-wrap {
	flex: 1;
	min-width: 140px;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.twt-aggregate-bar-bg {
	height: 8px;
	background: var(--twt-rv-star-off);
	border-radius: 4px;
	overflow: hidden;
}

.twt-aggregate-bar-fill {
	height: 100%;
	background: var(--twt-rv-star);
	border-radius: 4px;
	transition: width 0.5s ease;
}

.twt-aggregate-stars .twt-star {
	font-size: 1.25em;
}

.twt-aggregate-count {
	color: var(--twt-rv-muted);
	font-size: 0.9em;
	white-space: nowrap;
}

/* ── Review form ── */

.twt-review-form-wrap {
	background: var(--twt-rv-bg);
	border: 1px solid var(--twt-rv-border);
	border-radius: var(--twt-rv-radius);
	padding: 24px;
	max-width: 560px;
}

.twt-review-form-title {
	margin: 0 0 20px;
	font-size: 1.2em;
	color: var(--twt-rv-text);
}

.twt-form-row {
	margin-bottom: 16px;
}

.twt-form-row label {
	display: block;
	margin-bottom: 5px;
	font-size: 0.9em;
	font-weight: 600;
	color: var(--twt-rv-text);
}

.twt-optional {
	font-weight: 400;
	color: var(--twt-rv-muted);
}

.twt-review-form input[type="text"],
.twt-review-form input[type="email"],
.twt-review-form textarea {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid var(--twt-rv-border);
	border-radius: 6px;
	font-size: 0.95em;
	color: var(--twt-rv-text);
	background: #f8fafc;
	box-sizing: border-box;
	transition: border-color 0.15s;
}

.twt-review-form input[type="text"]:focus,
.twt-review-form input[type="email"]:focus,
.twt-review-form textarea:focus {
	outline: none;
	border-color: var(--twt-rv-accent);
	background: #fff;
}

.twt-review-form textarea {
	resize: vertical;
}

/* ── Star picker ── */

.twt-star-picker {
	display: flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
	gap: 2px;
}

.twt-star-picker input[type="radio"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.twt-star-picker label {
	display: inline-block;
	cursor: pointer;
	font-size: 2em;
	color: var(--twt-rv-star-off);
	transition: color 0.1s;
	margin-bottom: 0;
	font-weight: 400;
}

.twt-star-picker input[type="radio"]:checked ~ label,
.twt-star-picker label:hover,
.twt-star-picker label:hover ~ label {
	color: var(--twt-rv-star);
}

/* ── Submit button ── */

.twt-review-submit {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 24px;
	background: var(--twt-rv-accent);
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 0.95em;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, opacity 0.15s;
}

.twt-review-submit:hover {
	background: #1d4ed8;
}

.twt-review-submit:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}

.twt-submit-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255,255,255,.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: twt-spin 0.7s linear infinite;
}

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

/* ── Notice ── */

.twt-review-form-notice {
	padding: 10px 14px;
	border-radius: 6px;
	font-size: 0.9em;
	margin-bottom: 16px;
}

.twt-review-form-notice.is-success {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: var(--twt-rv-success);
}

.twt-review-form-notice.is-error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: var(--twt-rv-error);
}

/* ── Responsive ── */

@media (max-width: 480px) {
	.twt-review-form-wrap {
		padding: 16px;
	}
	.twt-aggregate-rating {
		flex-direction: column;
		align-items: flex-start;
	}
	.twt-review-date {
		margin-left: 0;
	}
}
