/**
 * Manta Google Reviews — Frontend Core Styles
 * RTL-ready with logical CSS properties.
 * BEM naming: .grw-{block}__{element}--{modifier}
 */

/* ─── Variables (defaults, overridable per widget via inline CSS vars) ─── */
.grw-widget {
	--grw-star-color: #FBBC04;
	--grw-bg-color: #ffffff;
	--grw-text-color: #1a1a2e;
	--grw-author-color: #0f172a;
	--grw-date-color: #64748b;
	--grw-header-bg: transparent;
	--grw-card-radius: 12px;
	--grw-card-padding: 24px;
	--grw-gap: 16px;

	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	line-height: 1.5;
	color: var(--grw-text-color);
}

[dir="rtl"] .grw-widget,
.grw-widget:lang(he),
.grw-widget:lang(ar) {
	font-family: 'Heebo', 'Assistant', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── Screen Reader Only ─── */
.grw-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.grw-skip-link:focus {
	position: static;
	width: auto;
	height: auto;
	margin: 0;
	overflow: visible;
	clip: auto;
	white-space: normal;
	padding: 8px 16px;
	background: var(--grw-star-color);
	color: #0f172a;
	font-weight: 600;
	font-size: 14px;
	border-radius: 6px;
	display: inline-block;
	margin-block-end: 8px;
}

/* ─── Business Header ─── */
.grw-header {
	background: var(--grw-header-bg);
	border-radius: var(--grw-card-radius);
	margin-block-end: var(--grw-gap);
}

.grw-header__inner {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 20px 24px;
	flex-wrap: wrap;
}

.grw-header__photo {
	width: 56px;
	height: 56px;
	border-radius: 50% !important;
	object-fit: cover;
	flex-shrink: 0;
	overflow: hidden;
}

.grw-header__info {
	flex: 1;
	min-width: 0;
}

.grw-header__title {
	font-size: 18px;
	font-weight: 700;
	letter-spacing: -0.02em;
	margin: 0 0 4px;
	color: var(--grw-author-color);
}

.grw-header__rating {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.grw-header__score {
	font-size: 20px;
	font-weight: 700;
	color: var(--grw-star-color);
}

.grw-header__count {
	font-size: 14px;
	color: var(--grw-date-color);
}

.grw-header__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 20px;
	background: #ffffff;
	border: 1.5px solid #e2e8f0;
	border-radius: 8px;
	color: #1a1a2e;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: all 200ms ease;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	white-space: nowrap;
}

.grw-header__btn:hover {
	border-color: #4285F4;
	color: #4285F4;
	box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06);
	transform: translateY(-1px);
}

.grw-header__btn:focus-visible {
	outline: 2px solid #4285F4;
	outline-offset: 2px;
}

/* ─── Stars ─── */
.grw-stars {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	direction: ltr; /* Always LTR for star fill direction */
}

.grw-star {
	flex-shrink: 0;
}

.grw-star--filled {
	color: var(--grw-star-color, #FBBC04);
}

.grw-star--empty {
	color: #cbd5e1;
}

/* ─── Review Card ─── */
.grw-card {
	background: var(--grw-bg-color);
	border-radius: var(--grw-card-radius);
	padding: var(--grw-card-padding);
	border: 1px solid rgba(0, 0, 0, 0.06);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
	transition: box-shadow 300ms ease, transform 300ms ease;
}

.grw-card:hover {
	box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05), 0 4px 6px rgba(0, 0, 0, 0.05);
	transform: translateY(-2px);
}

.grw-card__top {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-block-end: 12px;
}

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

.grw-card__avatar--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #e2e8f0;
	color: #64748b;
	font-size: 16px;
	font-weight: 600;
}

.grw-card__author-info {
	min-width: 0;
	flex: 1;
}

.grw-card__author {
	display: block;
	font-size: 15px;
	font-weight: 600;
	color: var(--grw-author-color);
}

.grw-card__author a {
	color: inherit;
	text-decoration: none;
}

.grw-card__author a:hover {
	text-decoration: underline;
}

.grw-card__date {
	display: block;
	font-size: 13px;
	color: var(--grw-date-color);
	margin-block-start: 2px;
}

.grw-card__rating {
	margin-block-end: 10px;
}

.grw-card__text {
	font-size: 15px;
	line-height: 1.6;
	color: var(--grw-text-color);
}

.grw-card__excerpt {
	margin: 0;
}

/* ─── Read More ─── */
.grw-read-more {
	display: inline;
	background: none;
	border: none;
	color: #2563eb;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	padding: 0;
	margin-inline-start: 4px;
	text-decoration: none;
	transition: color 200ms ease;
}

.grw-read-more:hover {
	color: #1d4ed8;
	text-decoration: underline;
}

.grw-read-more:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 2px;
	border-radius: 2px;
}

/* ─── Header Responsive ─── */
@media (max-width: 640px) {
	.grw-header__inner {
		flex-direction: column;
		align-items: center;
		text-align: center;
		padding: 16px;
		gap: 12px;
	}

	.grw-header__title {
		font-size: 16px;
		word-break: break-word;
		overflow-wrap: break-word;
	}

	.grw-header__rating {
		justify-content: center;
	}

	.grw-header__btn {
		width: 100%;
		justify-content: center;
		padding: 10px 16px;
		font-size: 13px;
	}

	.grw-header__photo {
		width: 48px;
		height: 48px;
	}
}

/* ─── Grid Layout ─── */
.grw-reviews--grid {
	display: grid;
	grid-template-columns: repeat(var(--grw-columns, 3), 1fr);
	gap: var(--grw-gap);
}

@media (max-width: 1024px) {
	.grw-reviews--grid {
		grid-template-columns: repeat(min(var(--grw-columns, 3), 2), 1fr);
	}
}

@media (max-width: 640px) {
	.grw-reviews--grid {
		grid-template-columns: 1fr;
	}
}

/* ─── List Layout ─── */
.grw-reviews--list {
	display: flex;
	flex-direction: column;
	gap: var(--grw-gap);
	max-width: 700px;
}

.grw-reviews--list .grw-card {
	display: flex;
	flex-direction: column;
}

/* ─── Badge Layout ─── */
.grw-reviews--badge {
	display: inline-block;
}

.grw-badge {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 14px 24px;
	background: var(--grw-bg-color);
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 12px;
	text-decoration: none;
	color: var(--grw-text-color);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	transition: box-shadow 200ms ease, transform 200ms ease;
}

.grw-badge:hover {
	box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

.grw-badge:focus-visible {
	outline: 2px solid #4285F4;
	outline-offset: 2px;
}

.grw-badge__content {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.grw-badge__score {
	font-size: 22px;
	font-weight: 700;
	color: var(--grw-star-color);
}

.grw-badge__count {
	font-size: 13px;
	color: var(--grw-date-color);
}

/* ─── Google Icon ─── */
.grw-google-icon {
	flex-shrink: 0;
}

/* ─── Animation: Fade In on Scroll ─── */
.grw-card {
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.5s ease-out, transform 0.5s ease-out, box-shadow 300ms ease;
}

.grw-card.grw-visible {
	opacity: 1;
	transform: translateY(0);
}

/* Stagger children */
.grw-reviews--grid .grw-card:nth-child(1) { transition-delay: 0ms; }
.grw-reviews--grid .grw-card:nth-child(2) { transition-delay: 60ms; }
.grw-reviews--grid .grw-card:nth-child(3) { transition-delay: 120ms; }
.grw-reviews--grid .grw-card:nth-child(4) { transition-delay: 180ms; }
.grw-reviews--grid .grw-card:nth-child(5) { transition-delay: 240ms; }
.grw-reviews--grid .grw-card:nth-child(6) { transition-delay: 300ms; }

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
	.grw-card,
	.grw-header__btn,
	.grw-badge {
		transition: none !important;
		transform: none !important;
		opacity: 1 !important;
	}

	.grw-card.grw-visible {
		transform: none;
	}
}

/* ─── Print ─── */
@media print {
	.grw-slider__arrow,
	.grw-slider__dots,
	.grw-slider__pause,
	.grw-read-more,
	.grw-header__btn,
	.grw-skip-link {
		display: none !important;
	}

	.grw-card {
		opacity: 1;
		transform: none;
		box-shadow: none;
		border: 1px solid #ccc;
		break-inside: avoid;
	}
}
