/* ==========================================================================
   StA WP Google Reviews — frontend
   Mobile-first, breakpoint 768px e 1200px. Colori da custom properties.
   ========================================================================== */

/* --- Token ---------------------------------------------------------------- */
.stagr {
	--stagr-accent: #1a73e8;
	--stagr-star: #fbbc04;
	--stagr-radius: 12px;
	--stagr-cols-m: 1;
	--stagr-cols-t: 2;
	--stagr-cols-d: 3;
	--stagr-gap: 16px;
	--stagr-bg: #ffffff;
	--stagr-surface: #ffffff;
	--stagr-text: #202124;
	--stagr-muted: #5f6368;
	--stagr-border: #e3e5e8;
	--stagr-star-empty: #dadce0;
	--stagr-shadow-val: 0 1px 2px rgba(60, 64, 67, .12), 0 2px 8px rgba(60, 64, 67, .10);
	--stagr-cols: var(--stagr-cols-m);
	box-sizing: border-box;
	color: var(--stagr-text);
	font-size: 16px;
	line-height: 1.5;
	margin: 0 0 24px;
}
.stagr *, .stagr *::before, .stagr *::after { box-sizing: inherit; }
.stagr p { margin: 0; }
.stagr [hidden] { display: none !important; }
.stagr ul { list-style: none; margin: 0; padding: 0; }
.stagr ul > li { margin: 0; padding: 0; }
.stagr ul > li::before { content: none; }

.stagr--dark {
	--stagr-bg: #17181a;
	--stagr-surface: #26282c;
	--stagr-text: #e8eaed;
	--stagr-muted: #bdc1c6;
	--stagr-border: #3c4043;
	--stagr-star-empty: #5f6368;
	--stagr-shadow-val: 0 1px 3px rgba(0, 0, 0, .5);
}

/* Il tema scuro è un pannello autonomo: leggibile anche su pagine chiare. */
.stagr--dark:not(.stagr--badge):not(.stagr--floating) {
	background: var(--stagr-bg); padding: 20px; border-radius: calc(var(--stagr-radius) + 4px);
}

/* Colonne in base alla larghezza del widget (container query), non della finestra:
   così funziona anche dentro colonne strette dei page builder. */
.stagr--slider, .stagr--grid { container-type: inline-size; }
@container (min-width: 560px) { .stagr-grid, .stagr-track { --stagr-cols: var(--stagr-cols-t); } }
@container (min-width: 880px) { .stagr-grid, .stagr-track { --stagr-cols: var(--stagr-cols-d); } }
@supports not (container-type: inline-size) {
	@media (min-width: 768px) { .stagr { --stagr-cols: var(--stagr-cols-t); } }
	@media (min-width: 1200px) { .stagr { --stagr-cols: var(--stagr-cols-d); } }
}

/* --- Stelle ---------------------------------------------------------------- */
.stagr-stars { position: relative; display: inline-flex; vertical-align: middle; line-height: 0; }
.stagr-stars svg { width: 18px; height: 18px; flex: 0 0 18px; }
.stagr-stars__bg svg { fill: var(--stagr-star-empty); }
.stagr-stars__fg { position: absolute; inset: 0 auto 0 0; overflow: hidden; white-space: nowrap; display: inline-flex; }
.stagr-stars__fg svg { fill: var(--stagr-star); }

.stagr-g { width: 20px; height: 20px; flex: 0 0 20px; }

/* --- Header di riepilogo --------------------------------------------------- */
.stagr-header {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
	gap: 12px 16px; margin-bottom: 16px;
}
.stagr-header__info { display: flex; align-items: center; gap: 12px; }
.stagr-header__info .stagr-g { width: 32px; height: 32px; flex-basis: 32px; }
.stagr-header__name { font-weight: 600; font-size: 1.05em; }
.stagr-header__score { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.stagr-header__rating { font-size: 1.25em; line-height: 1; }
.stagr-header__total { color: var(--stagr-muted); font-size: .9em; }

.stagr-btn {
	display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
	padding: 10px 20px; border-radius: 999px; background: var(--stagr-accent); color: #fff;
	font-weight: 600; font-size: .95em; text-decoration: none; border: 0;
	transition: filter .2s ease, transform .2s ease;
}
.stagr-btn:hover, .stagr-btn:focus-visible { filter: brightness(.92); color: #fff; text-decoration: none; }
.stagr-btn:active { transform: scale(.98); }

/* --- Card ------------------------------------------------------------------ */
.stagr-card {
	height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 20px;
	background: var(--stagr-surface); border: 1px solid var(--stagr-border);
	border-radius: var(--stagr-radius); transition: box-shadow .2s ease, transform .2s ease;
}
.stagr--shadow .stagr-card { box-shadow: var(--stagr-shadow-val); border-color: transparent; }
.stagr--dark.stagr--shadow .stagr-card { border-color: var(--stagr-border); }
.stagr-card:hover { transform: translateY(-2px); }
.stagr-card__head { display: flex; align-items: center; gap: 12px; }
.stagr-card__meta { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.stagr-card__author { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stagr-card__date { display: block; color: var(--stagr-muted); font-size: .85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stagr-card__text { color: var(--stagr-text); overflow-wrap: anywhere; }
.stagr-card__rating { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stagr-card__reply {
	margin-top: auto; padding: 12px 14px; border-left: 3px solid var(--stagr-accent);
	background: color-mix(in srgb, var(--stagr-accent) 7%, transparent); border-radius: 0 8px 8px 0; font-size: .92em;
}
.stagr-card__reply-title { font-weight: 600; margin-bottom: 4px !important; }

.stagr-avatar { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; object-fit: cover; }
.stagr-avatar--initials {
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--stagr-accent); color: #fff; font-weight: 600; font-size: 15px;
}

.stagr-more {
	margin-top: 4px; padding: 0; min-height: 44px; background: none; border: 0;
	color: var(--stagr-accent); font: inherit; font-weight: 600; cursor: pointer;
}
.stagr-more:hover { text-decoration: underline; }

/* --- Griglia e lista ------------------------------------------------------- */
.stagr-grid { display: grid; gap: var(--stagr-gap); grid-template-columns: repeat(var(--stagr-cols), minmax(0, 1fr)); }
.stagr-list { display: flex; flex-direction: column; gap: var(--stagr-gap); }

/* --- Slider ---------------------------------------------------------------- */
.stagr-slider { position: relative; }
.stagr-track {
	display: flex; gap: var(--stagr-gap); overflow-x: auto; scroll-snap-type: x mandatory;
	scroll-behavior: smooth; scrollbar-width: none; padding: 6px 4px 10px; scroll-padding-inline: 4px; overscroll-behavior-x: contain;
}
.stagr-track::-webkit-scrollbar { display: none; }
.stagr-slide {
	flex: 0 0 calc((100% - (var(--stagr-cols) - 1) * var(--stagr-gap)) / var(--stagr-cols));
	min-width: 0;
	scroll-snap-align: start;
}
.stagr-nav {
	position: absolute; top: 50%; z-index: 2; width: 44px; height: 44px; margin-top: -22px;
	display: none; align-items: center; justify-content: center; border-radius: 50%;
	border: 1px solid var(--stagr-border); background: var(--stagr-surface); color: var(--stagr-text);
	box-shadow: var(--stagr-shadow-val); cursor: pointer; transition: opacity .2s ease, background-color .2s ease;
}
.stagr-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.stagr-nav:hover { background: var(--stagr-accent); color: #fff; border-color: var(--stagr-accent); }
.stagr-nav[disabled] { opacity: 0; pointer-events: none; }
.stagr-prev { left: -8px; }
.stagr-next { right: -8px; }


.stagr-dots { display: flex; justify-content: center; gap: 4px; margin-top: 8px; }
.stagr-dot {
	width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center;
}
.stagr-dot::before {
	content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--stagr-star-empty);
	transition: width .2s ease, background-color .2s ease;
}
.stagr-dot[aria-current="true"]::before { width: 20px; border-radius: 4px; background: var(--stagr-accent); }

@media (min-width: 768px) {
	.stagr-js .stagr-nav { display: inline-flex; }
	.stagr-prev { left: -22px; }
	.stagr-next { right: -22px; }
}

/* --- Badge ----------------------------------------------------------------- */
.stagr--badge, .stagr--floating { margin: 0; }
.stagr-badge {
	display: inline-flex; align-items: center; gap: 12px; padding: 12px 18px;
	background: var(--stagr-surface); color: var(--stagr-text); text-decoration: none;
	border: 1px solid var(--stagr-border); border-radius: var(--stagr-radius);
	transition: box-shadow .2s ease, transform .2s ease;
}
.stagr--shadow .stagr-badge { box-shadow: var(--stagr-shadow-val); }
a.stagr-badge:hover { transform: translateY(-1px); color: var(--stagr-text); text-decoration: none; }
.stagr-badge .stagr-g { width: 28px; height: 28px; flex-basis: 28px; }
.stagr-badge__body { display: flex; flex-direction: column; line-height: 1.25; }
.stagr-badge__title { font-weight: 600; font-size: .9em; }
.stagr-badge__score { display: inline-flex; align-items: center; gap: 6px; }
.stagr-badge__score strong { font-size: 1.15em; }
.stagr-badge__total { color: var(--stagr-muted); font-size: .8em; }
.stagr-badge .stagr-stars svg { width: 15px; height: 15px; flex-basis: 15px; }

/* --- Badge flottante ------------------------------------------------------- */
.stagr--floating { position: fixed; bottom: 16px; z-index: 9990; }
.stagr-floating--bottom-left { left: 16px; }
.stagr-floating--bottom-right { right: 16px; }
.stagr-floating__close {
	position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; padding: 0;
	border-radius: 50%; border: 1px solid var(--stagr-border); background: var(--stagr-surface);
	color: var(--stagr-muted); font-size: 18px; line-height: 1; cursor: pointer;
	opacity: 0; transition: opacity .2s ease;
}
.stagr--floating:hover .stagr-floating__close, .stagr-floating__close:focus-visible { opacity: 1; }
@media (hover: none) { .stagr-floating__close { opacity: 1; } }
.stagr--floating[hidden] { display: none; }

/* --- Attribuzione ---------------------------------------------------------- */
.stagr-attrib { margin-top: 12px !important; color: var(--stagr-muted); font-size: .8em; text-align: right; }
.stagr-badge .stagr-attrib { margin: 0 !important; text-align: left; color: inherit; font-size: .9em; }

/* --- Focus e accessibilità ------------------------------------------------- */
.stagr a:focus-visible, .stagr button:focus-visible, .stagr-track:focus-visible {
	outline: 2px solid var(--stagr-accent); outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
	.stagr *, .stagr-track { scroll-behavior: auto !important; transition: none !important; }
	.stagr-card:hover, a.stagr-badge:hover { transform: none; }
}
