/**
 * Recipe Reviews — front-end styles
 * Accent color is injected via the --rr-accent custom property (PHP).
 */

.rr-block {
	--rr-radius: 14px;
	--rr-shadow: 0 2px 10px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
	--rr-border: #ececf1;
	--rr-text: #1f2430;
	--rr-muted: #6b7280;
	--rr-star-empty: #d9dde3;
	font-family: inherit;
	color: var(--rr-text);
	margin: 48px 0 8px;
	max-width: 760px;
}

.rr-block *,
.rr-modal * {
	box-sizing: border-box;
}

/* ---------- Summary header ---------- */

.rr-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	flex-wrap: wrap;
	padding: 24px 28px;
	background: #fff;
	border: 1px solid var(--rr-border);
	border-radius: var(--rr-radius);
	box-shadow: var(--rr-shadow);
}

.rr-summary__score {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: wrap;
}

.rr-summary__average {
	font-size: 40px;
	font-weight: 800;
	line-height: 1;
	letter-spacing: -.02em;
}

.rr-summary__count {
	color: var(--rr-muted);
	font-size: 14px;
	width: 100%;
}

/* ---------- Stars (display) ---------- */

.rr-stars {
	display: inline-flex;
	gap: 2px;
	font-size: 22px;
	line-height: 1;
}

.rr-summary__stars { font-size: 26px; }

.rr-star { color: var(--rr-star-empty); position: relative; }
.rr-star--full { color: var(--rr-accent); }
.rr-star--half {
	color: var(--rr-star-empty);
	background: linear-gradient(90deg, var(--rr-accent) 50%, var(--rr-star-empty) 50%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

/* ---------- Buttons ---------- */

.rr-write-btn {
	appearance: none;
	border: 0;
	cursor: pointer;
	background: var(--rr-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	padding: 12px 22px;
	border-radius: 8px;
	transition: background .2s ease, transform .1s ease;
	font-family: inherit;
}
.rr-write-btn:hover { background: var(--rr-accent-hover); }
.rr-write-btn:active { transform: translateY(1px); }

/* ---------- Review cards ---------- */

.rr-list {
	margin-top: 22px;
	display: grid;
	gap: 16px;
}

.rr-empty {
	color: var(--rr-muted);
	font-size: 15px;
	padding: 8px 2px;
}

.rr-card {
	background: #fff;
	border: 1px solid var(--rr-border);
	border-radius: var(--rr-radius);
	box-shadow: var(--rr-shadow);
	padding: 20px 22px;
	animation: rr-fade .35s ease both;
}

.rr-card__head {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 8px;
}

.rr-card__name {
	font-weight: 700;
	font-size: 15px;
}

.rr-badge {
	display: inline-block;
	margin-left: 8px;
	font-size: 11px;
	font-weight: 600;
	color: var(--rr-accent);
	background: color-mix(in srgb, var(--rr-accent) 12%, #fff);
	padding: 2px 9px;
	border-radius: 999px;
	vertical-align: middle;
}

.rr-card__date {
	color: var(--rr-muted);
	font-size: 13px;
	white-space: nowrap;
}

.rr-card__stars { font-size: 18px; margin-bottom: 10px; }

.rr-card__text {
	font-size: 15px;
	line-height: 1.6;
	color: #374151;
}
.rr-card__text p { margin: 0 0 8px; }
.rr-card__text p:last-child { margin-bottom: 0; }

/* ---------- Modal ---------- */

.rr-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}
.rr-modal.is-open { display: flex; }

.rr-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, .55);
	backdrop-filter: blur(2px);
	animation: rr-fade .2s ease both;
}

.rr-modal__dialog {
	position: relative;
	background: #fff;
	border-radius: 18px;
	width: 100%;
	max-width: 480px;
	max-height: 92vh;
	overflow-y: auto;
	padding: 30px 28px 28px;
	box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
	animation: rr-pop .25s cubic-bezier(.2, .9, .3, 1.2) both;
	font-family: inherit;
	color: var(--rr-text, #1f2430);
}

.rr-modal__close {
	position: absolute;
	top: 12px;
	right: 14px;
	border: 0;
	background: transparent;
	font-size: 30px;
	line-height: 1;
	color: #9ca3af;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 8px;
	transition: color .15s ease, background .15s ease;
}
.rr-modal__close:hover { color: #374151; background: #f3f4f6; }

.rr-modal__title {
	margin: 0 0 20px;
	font-size: 22px;
	font-weight: 800;
	letter-spacing: -.01em;
}

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

.rr-field { margin-bottom: 18px; }

.rr-label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 7px;
}
.rr-req { color: var(--rr-accent); }

.rr-input,
.rr-textarea {
	width: 100%;
	border: 1.5px solid #e3e6eb;
	border-radius: 10px;
	padding: 11px 13px;
	font-size: 15px;
	font-family: inherit;
	color: var(--rr-text, #1f2430);
	background: #fff;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.rr-textarea { resize: vertical; min-height: 110px; }

.rr-input:focus,
.rr-textarea:focus {
	outline: none;
	border-color: var(--rr-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--rr-accent) 18%, transparent);
}

.rr-hint { display: block; margin-top: 6px; font-size: 12px; color: #9ca3af; }

.rr-counter { text-align: right; font-size: 12px; color: #9ca3af; margin-top: 6px; }
.rr-counter.is-max { color: var(--rr-accent); font-weight: 600; }

/* Interactive star input */
.rr-rating-input {
	display: flex;
	align-items: center;
	gap: 4px;
}
.rr-rating-star {
	background: transparent;
	border: 0;
	cursor: pointer;
	font-size: 34px;
	line-height: 1;
	color: var(--rr-star-empty, #d9dde3);
	padding: 0 2px;
	transition: color .12s ease, transform .12s ease;
}
.rr-rating-star:hover { transform: scale(1.12); }
.rr-rating-star.is-active { color: var(--rr-accent); }
.rr-rating-label {
	margin-left: 12px;
	font-size: 14px;
	font-weight: 600;
	color: var(--rr-accent);
	min-height: 18px;
}

.rr-check {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	font-size: 14px;
	cursor: pointer;
	user-select: none;
}
.rr-check input { width: 17px; height: 17px; accent-color: var(--rr-accent); cursor: pointer; }

.rr-error {
	color: #b32424;
	font-size: 14px;
	margin: 4px 0 14px;
	min-height: 0;
}
.rr-error:empty { margin: 0; }

/* Submit + spinner */
.rr-submit {
	position: relative;
	width: 100%;
	border: 0;
	cursor: pointer;
	background: var(--rr-accent);
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	padding: 14px 20px;
	border-radius: 8px;
	font-family: inherit;
	transition: background .2s ease;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
}
.rr-submit:hover { background: var(--rr-accent-hover); }
.rr-submit:disabled { opacity: .75; cursor: progress; }

.rr-spinner {
	display: none;
	width: 17px;
	height: 17px;
	border: 2.5px solid rgba(255, 255, 255, .55);
	border-top-color: #fff;
	border-radius: 50%;
	animation: rr-spin .7s linear infinite;
}
.rr-submit.is-loading .rr-spinner { display: inline-block; }

/* Success state */
.rr-success { text-align: center; padding: 18px 8px 8px; animation: rr-fade .3s ease both; }
.rr-success__icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 18px;
	border-radius: 50%;
	background: color-mix(in srgb, var(--rr-accent) 14%, #fff);
	color: var(--rr-accent);
	font-size: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.rr-success__title { margin: 0 0 8px; font-size: 22px; font-weight: 800; }
.rr-success__msg { color: var(--rr-muted, #6b7280); font-size: 15px; line-height: 1.55; margin: 0 0 22px; }

/* ---------- Animations ---------- */

@keyframes rr-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rr-pop { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes rr-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
	.rr-card, .rr-modal__overlay, .rr-modal__dialog, .rr-success { animation: none; }
	.rr-rating-star, .rr-write-btn, .rr-submit { transition: none; }
}

/* ---------- Mobile: full-screen modal ---------- */

@media (max-width: 600px) {
	.rr-modal { padding: 0; }
	.rr-modal__dialog {
		max-width: 100%;
		width: 100%;
		height: 100%;
		max-height: 100%;
		border-radius: 0;
		padding: 56px 20px 28px;
		animation: rr-slide .28s ease both;
	}
	.rr-summary { padding: 20px; }
	.rr-summary__average { font-size: 34px; }
	.rr-write-btn { width: 100%; text-align: center; }
	.rr-summary { flex-direction: column; align-items: flex-start; }
}

@keyframes rr-slide { from { transform: translateY(100%); } to { transform: none; } }
