/* ============================================================
   DAPPER Google Maps Reviews — Frontend CSS
   All sizing / color driven by CSS variables set per-instance.
   Scoped under .dgmr-* to avoid leaking into Elementor / theme.
   ============================================================ */

/* ── CSS variables (defaults, overridden by Elementor selectors) ─────── */
.dgmr-widget {
	--dgmr-items: 3;
	--dgmr-gap: 20px;
	--dgmr-card-bg: #ffffff;
	--dgmr-star-filled: #FBBC04;
	--dgmr-star-empty: #E0E0E0;
	--dgmr-arrow-size: 40px;
	--dgmr-lines: 4;

	box-sizing: border-box;
	font-family: inherit;
	color: inherit;
	position: relative;
}

.dgmr-widget *,
.dgmr-widget *::before,
.dgmr-widget *::after {
	box-sizing: border-box;
}

/* ── Notice (error / setup prompt) ─────────────────────────────────────── */
.dgmr-notice {
	padding: 16px 20px;
	background: #fff8e1;
	border: 1px solid #ffe082;
	border-radius: 8px;
	color: #6d4c00;
	font-size: 14px;
	line-height: 1.5;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.dgmr-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 20px;
}

.dgmr-header-left { flex: 1 1 auto; }

.dgmr-header-title {
	font-size: 22px;
	font-weight: 700;
	color: #1a1a2e;
	margin: 0 0 8px;
	line-height: 1.3;
}

.dgmr-overall {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 4px;
}

.dgmr-overall-score {
	font-size: 36px;
	font-weight: 800;
	color: #1a1a2e;
	line-height: 1;
}

/* Header stars — fill overlay technique */
.dgmr-header-stars {
	position: relative;
	display: inline-flex;
	align-items: center;
	line-height: 0;
}

.dgmr-hstars-empty,
.dgmr-hstars-fill {
	display: inline-flex;
	gap: 2px;
}

.dgmr-hstars-fill {
	position: absolute;
	inset: 0;
	overflow: hidden;
	pointer-events: none;
}

.dgmr-hstars-empty .dgmr-star { fill: #E0E0E0; }
.dgmr-hstars-fill  .dgmr-star { fill: #FBBC04; }

.dgmr-header-stars .dgmr-star {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}

.dgmr-overall-meta {
	font-size: 14px;
	color: #666;
}

.dgmr-write-review {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border: 1.5px solid #4285F4;
	border-radius: 24px;
	color: #4285F4;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	transition: background .18s ease, color .18s ease;
	flex-shrink: 0;
}
.dgmr-write-review:hover {
	background: #4285F4;
	color: #fff;
	text-decoration: none;
}

/* ── Card (shared across layouts) ───────────────────────────────────────── */
.dgmr-card {
	background: #ffffff;
	border-radius: 12px;
	padding: 24px;
	box-shadow: 0 2px 16px rgba(0,0,0,.08);
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 10px;
	transition: box-shadow .2s ease, transform .2s ease;
}
.dgmr-card:hover {
	box-shadow: 0 6px 28px rgba(0,0,0,.13);
	transform: translateY(-2px);
}

/* Quote icon */
.dgmr-quote-icon {
	width: 28px;
	height: 20px;
	fill: #e8e8e8;
	flex-shrink: 0;
	align-self: flex-start;
}

/* ── Card head ─────────────────────────────────────────────────────────── */
.dgmr-card-head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.dgmr-avatar-link { flex-shrink: 0; display: block; }

.dgmr-avatar,
.dgmr-avatar-placeholder {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.dgmr-avatar-placeholder {
	background: #4285F4;
	color: #fff;
	font-size: 16px;
	font-weight: 700;
	text-transform: uppercase;
}

.dgmr-card-meta { flex: 1; min-width: 0; }

.dgmr-meta-top {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
}

.dgmr-author-name {
	font-weight: 600;
	font-size: 14px;
	color: #1a1a2e;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 150px;
}
.dgmr-author-name:hover { text-decoration: underline; }

.dgmr-date {
	font-size: 12px;
	color: #888;
	margin-top: 2px;
}

/* ── Stars ───────────────────────────────────────────────────────────────── */
.dgmr-stars {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	line-height: 0;
}

.dgmr-star {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	display: block;
}
.dgmr-star-filled { fill: #FBBC04; }
.dgmr-star-empty  { fill: #E0E0E0; }

/* ── Review text ─────────────────────────────────────────────────────────── */
.dgmr-review-text {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.dgmr-text {
	font-size: 14px;
	line-height: 1.6;
	color: #444;
	margin: 0;
	word-break: break-word;
}

.dgmr-review-text.dgmr-clamped .dgmr-text {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--dgmr-lines, 4);
	overflow: hidden;
}

.dgmr-review-text.dgmr-expanded .dgmr-text {
	display: block;
	-webkit-line-clamp: unset;
	overflow: visible;
}

.dgmr-read-more-btn {
	background: none;
	border: 0;
	padding: 0;
	font-size: 13px;
	font-weight: 500;
	color: #4285F4;
	cursor: pointer;
	text-align: left;
	align-self: flex-start;
	transition: opacity .15s ease;
}
.dgmr-read-more-btn:hover { opacity: .75; }
.dgmr-read-more-btn:focus-visible { outline: 2px solid #4285F4; border-radius: 2px; }

/* Keyword highlight */
.dgmr-text mark {
	background: rgba(251,188,4,.35);
	color: inherit;
	border-radius: 2px;
	padding: 0 1px;
}

/* ── Recent badge ────────────────────────────────────────────────────────── */
.dgmr-badge-recent {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 20px;
	background: #34A853;
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .4px;
	text-transform: uppercase;
	line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════════════
   LAYOUT 1 — SLIDER
   ══════════════════════════════════════════════════════════════════ */
.dgmr-layout-slider .dgmr-slider-outer {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.dgmr-layout-slider .dgmr-track-wrap {
	overflow: hidden;
	width: 100%;
}

.dgmr-layout-slider .dgmr-track {
	display: flex;
	gap: var(--dgmr-gap, 20px);
	transition: transform .38s cubic-bezier(.4,0,.2,1);
	will-change: transform;
}

.dgmr-layout-slider .dgmr-card {
	flex: 0 0 calc((100% - (var(--dgmr-items, 3) - 1) * var(--dgmr-gap, 20px)) / var(--dgmr-items, 3));
	min-width: 0;
}

/* Arrows */
.dgmr-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: #fff;
	border: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(0,0,0,.15);
	color: #333;
	transition: background .18s ease, color .18s ease, box-shadow .18s ease;
	padding: 0;
}
.dgmr-arrow:hover {
	background: #4285F4;
	color: #fff;
	box-shadow: 0 4px 14px rgba(66,133,244,.4);
}
.dgmr-arrow:focus-visible { outline: 2px solid #4285F4; }
.dgmr-arrow svg { width: 20px; height: 20px; }

.dgmr-prev { left: -20px; }
.dgmr-next { right: -20px; }

.dgmr-arrow.dgmr-disabled {
	opacity: .35;
	cursor: default;
	pointer-events: none;
}

/* Arrows inside on small screens */
@media (max-width: 640px) {
	.dgmr-prev { left: 4px; }
	.dgmr-next { right: 4px; }
}

/* Dots */
.dgmr-dots {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 6px;
	padding-top: 4px;
}

.dgmr-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #ccc;
	border: 0;
	padding: 0;
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
}
.dgmr-dot-active {
	background: #4285F4;
	transform: scale(1.3);
}
.dgmr-dot:focus-visible { outline: 2px solid #4285F4; }

/* ══════════════════════════════════════════════════════════════════
   LAYOUT 2 — GRID
   ══════════════════════════════════════════════════════════════════ */
.dgmr-layout-grid .dgmr-grid {
	display: grid;
	grid-template-columns: repeat(var(--dgmr-items, 3), 1fr);
	gap: var(--dgmr-gap, 20px);
}

/* ══════════════════════════════════════════════════════════════════
   LAYOUT 3 — LIST (horizontal rows)
   ══════════════════════════════════════════════════════════════════ */
.dgmr-layout-list .dgmr-list {
	display: flex;
	flex-direction: column;
	gap: var(--dgmr-gap, 16px);
}

.dgmr-layout-list .dgmr-card {
	flex-direction: row;
	align-items: flex-start;
	gap: 20px;
	padding: 20px;
}

.dgmr-layout-list .dgmr-card-head {
	flex-shrink: 0;
	flex-direction: column;
	align-items: center;
	text-align: center;
	width: 72px;
	gap: 6px;
}

.dgmr-layout-list .dgmr-author-name {
	font-size: 12px;
	max-width: 72px;
	white-space: normal;
	text-overflow: clip;
}

.dgmr-layout-list .dgmr-card-body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.dgmr-layout-list .dgmr-card-meta {
	display: none; /* shown in head for list layout */
}

/* ══════════════════════════════════════════════════════════════════
   LAYOUT 4 — COMPACT (minimal one-liner rows)
   ══════════════════════════════════════════════════════════════════ */
.dgmr-layout-compact .dgmr-compact {
	display: flex;
	flex-direction: column;
	gap: 1px;
	border-radius: 10px;
	overflow: hidden;
	border: 1px solid #f0f0f0;
}

.dgmr-layout-compact .dgmr-card {
	flex-direction: row;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border-radius: 0;
	box-shadow: none;
	border-bottom: 1px solid #f0f0f0;
	background: #fff;
	transition: background .15s ease;
}
.dgmr-layout-compact .dgmr-card:last-child { border-bottom: 0; }
.dgmr-layout-compact .dgmr-card:hover { background: #fafbff; transform: none; box-shadow: none; }

.dgmr-layout-compact .dgmr-avatar,
.dgmr-layout-compact .dgmr-avatar-placeholder {
	width: 32px;
	height: 32px;
	font-size: 13px;
}

.dgmr-layout-compact .dgmr-author-name { max-width: 120px; }

.dgmr-layout-compact .dgmr-stars { flex-shrink: 0; }
.dgmr-layout-compact .dgmr-star { width: 13px; height: 13px; }

.dgmr-layout-compact .dgmr-review-text {
	flex: 1;
	min-width: 0;
	--dgmr-lines: 1;
}

.dgmr-layout-compact .dgmr-review-text.dgmr-clamped .dgmr-text {
	-webkit-line-clamp: 1;
}

.dgmr-layout-compact .dgmr-date { display: none; }
.dgmr-layout-compact .dgmr-quote-icon { display: none; }
.dgmr-layout-compact .dgmr-read-more-btn { display: none; }

/* ── Attribution + cache age ─────────────────────────────────────────────── */
.dgmr-attribution {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 14px;
	font-size: 12px;
	color: #888;
}

.dgmr-g-icon { width: 16px; height: 16px; }

.dgmr-cache-age {
	margin-top: 6px;
	font-size: 11px;
	color: #aaa;
	text-align: right;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
	.dgmr-layout-grid .dgmr-grid { grid-template-columns: repeat(var(--dgmr-items, 2), 1fr); }
}

@media (max-width: 767px) {
	.dgmr-layout-grid .dgmr-grid { grid-template-columns: repeat(var(--dgmr-items, 1), 1fr); }
	.dgmr-layout-list .dgmr-card { flex-direction: column; }
	.dgmr-layout-list .dgmr-card-head { flex-direction: row; width: auto; }
	.dgmr-layout-list .dgmr-author-name { max-width: 180px; }
	.dgmr-header { flex-direction: column; }
	.dgmr-overall-score { font-size: 28px; }
}

/* Reduced-motion */
@media (prefers-reduced-motion: reduce) {
	.dgmr-track,
	.dgmr-card,
	.dgmr-arrow,
	.dgmr-read-more-btn,
	.dgmr-write-review,
	.dgmr-dot { transition: none; }
}
