/* ==========================================================
   SQ Review System — Frontend Styles
   ========================================================== */

.sq-reviews-wrap {
	font-family: inherit;
	color: inherit;
	box-sizing: border-box;
	line-height: 1.5;
}

.sq-reviews-wrap *,
.sq-reviews-wrap *::before,
.sq-reviews-wrap *::after {
	box-sizing: inherit;
}

/* ----------------------------------------------------------
   Aggregate summary bar
   ---------------------------------------------------------- */

.sq-reviews-header {
	margin-bottom: 24px;
}

.sq-aggregate {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 18px;
}

.sq-aggregate .sq-stars .sq-star {
	font-size: 1.6rem;
}

.sq-rating-number {
	font-size: 2.2rem;
	font-weight: 700;
	line-height: 1;
}

.sq-review-count {
	font-size: 0.9rem;
	color: #666;
}

/* ----------------------------------------------------------
   Stars
   ---------------------------------------------------------- */

.sq-stars {
	display: inline-flex;
	align-items: center;
	gap: 1px;
	line-height: 1;
}

.sq-star {
	font-size: 1rem;
}

.sq-star-full {
	color: var(--sq-star-color, #f5a623);
}

/* Half-star: base glyph is empty-coloured; a ::before pseudo-element
   overlays the left 50 % in the star colour, creating a true half-fill. */
.sq-star-half {
	position: relative;
	display: inline-block;
	color: var(--sq-star-empty-color, #ddd);
}
.sq-star-half::before {
	content: '★';
	position: absolute;
	inset: 0;
	color: var(--sq-star-color, #f5a623);
	clip-path: inset(0 50% 0 0); /* show only the left half */
	pointer-events: none;
}

.sq-star-empty {
	color: var(--sq-star-empty-color, #ddd);
}

/* ----------------------------------------------------------
   Controls: search + rating filter
   ---------------------------------------------------------- */

.sq-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.sq-search-wrap {
	flex: 1;
	min-width: 180px;
	max-width: 380px;
	display: flex;
	border: 1px solid #ddd;
	border-radius: 6px;
	overflow: hidden;
	transition: border-color 0.15s;
}

.sq-search-wrap:focus-within {
	border-color: #888;
}

.sq-search-input {
	flex: 1;
	min-width: 0;
	padding: 9px 14px;
	font-size: 0.875rem;
	border: none;
	outline: none;
	background: #fff;
	/* Override theme resets */
	-webkit-appearance: none;
	appearance: none;
}

.sq-search-btn {
	padding: 9px 14px;
	font-size: 0.875rem;
	font-weight: 500;
	background: #1a1a1a;
	color: #fff;
	border: none;
	border-left: 1px solid #ddd;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s;
	flex-shrink: 0;
	-webkit-appearance: none;
	appearance: none;
}

.sq-search-btn:hover {
	background: #333;
}

.sq-filter-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}

.sq-filter-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 7px 11px;
	font-size: 0.8rem;
	line-height: 1;
	border: 1px solid #ddd;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
	/* Reset button defaults */
	-webkit-appearance: none;
	appearance: none;
}

.sq-filter-btn:hover:not(.active) {
	border-color: #aaa;
	background: #f5f5f5;
}

.sq-filter-btn.active {
	background: #1a1a1a;
	color: #fff;
	border-color: #1a1a1a;
}

/* Keep stars visible on active dark button */
.sq-filter-btn.active .sq-star-full,
.sq-filter-btn.active .sq-star-half::before {
	color: var(--sq-star-color, #f5a623);
}

.sq-filter-btn.active .sq-star-half {
	color: rgba(255, 255, 255, 0.25); /* empty portion on dark bg */
}

.sq-filter-btn.active .sq-star-empty {
	color: rgba(255, 255, 255, 0.25);
}

/* ----------------------------------------------------------
   Review card grid
   ---------------------------------------------------------- */

.sq-reviews-grid {
	display: grid;
	grid-template-columns: repeat(var(--sq-cols, 3), 1fr);
	gap: 20px;
	margin-bottom: 24px;
}

@media (max-width: 900px) {
	.sq-reviews-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

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

/* ----------------------------------------------------------
   Individual review card
   ---------------------------------------------------------- */

.sq-review-card {
	background: var(--sq-card-bg, #ffffff);
	border: 1px solid #eeeeee;
	border-radius: var(--sq-card-radius, 8px);
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
	transition: box-shadow 0.2s;
}

.sq-review-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.09);
}

.sq-card-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.sq-reviewer-name {
	font-weight: 600;
	font-size: 0.9rem;
	flex: 1;
	min-width: 80px;
}

/* When the reviewer name is a link, keep it looking like the name, not a hyperlink */
a.sq-reviewer-link {
	color: inherit;
	text-decoration: none;
}

a.sq-reviewer-link:hover {
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ----------------------------------------------------------
   Card footer — verified badge + ShopperApproved credit
   ---------------------------------------------------------- */

.sq-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding-top: 10px;
	margin-top: auto;
	border-top: 1px solid #f0f0f0;
}

.sq-verified-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 0.72rem;
	font-weight: 600;
	color: #2e7d32;
	letter-spacing: 0.01em;
	white-space: nowrap;
}

/* Custom uploaded icon */
.sq-verified-badge img.sq-verified-icon {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	object-fit: contain;
}

/* Inline SVG default icon */
.sq-verified-badge svg.sq-verified-icon {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

/* ShopperApproved credit link */
a.sq-sa-credit {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	opacity: 0.55;
	transition: opacity 0.15s;
	text-decoration: none;
}

a.sq-sa-credit:hover {
	opacity: 0.9;
}

/* Uploaded SA logo image */
.sq-sa-logo {
	max-height: 18px;
	max-width: 90px;
	width: auto;
	display: block;
}

/* Fallback text when no logo uploaded */
.sq-sa-text {
	font-size: 0.68rem;
	font-weight: 600;
	color: #444;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.sq-review-date {
	font-size: 0.75rem;
	color: #999;
	margin-left: auto;
}

/* ----------------------------------------------------------
   Review body text
   ---------------------------------------------------------- */

.sq-review-body {
	flex: 1;
}

.sq-review-text {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.65;
	color: #444;
}

.sq-read-more {
	display: inline;
	background: none;
	border: none;
	padding: 0;
	margin-top: 4px;
	font-size: 0.8rem;
	color: #1a1a1a;
	text-decoration: underline;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.sq-read-more:hover {
	text-decoration: none;
}

/* ----------------------------------------------------------
   Load more
   ---------------------------------------------------------- */

.sq-load-more-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 4px 0 20px;
}

.sq-load-more-btn {
	padding: 10px 30px;
	font-size: 0.875rem;
	background: #1a1a1a;
	color: #fff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.15s;
	-webkit-appearance: none;
	appearance: none;
}

.sq-load-more-btn:hover:not(:disabled) {
	background: #333;
}

.sq-load-more-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.sq-showing-count {
	font-size: 0.78rem;
	color: #999;
}

/* ----------------------------------------------------------
   Status / empty states
   ---------------------------------------------------------- */

.sq-reviews-status {
	min-height: 1.4em;
	margin-bottom: 6px;
	font-size: 0.82rem;
	color: #888;
}

.sq-no-reviews {
	grid-column: 1 / -1;
	text-align: center;
	color: #aaa;
	padding: 48px 16px;
	margin: 0;
	font-size: 0.9rem;
}

/* ----------------------------------------------------------
   Filter button count badge
   ---------------------------------------------------------- */

.sq-filter-count {
	font-size: 0.72rem;
	font-weight: 500;
	color: #888;
	line-height: 1;
	margin-left: 2px;
}

.sq-filter-btn.active .sq-filter-count {
	color: rgba(255, 255, 255, 0.7);
}

/* ----------------------------------------------------------
   Rating breakdown widget  [sq_rating_breakdown]
   ---------------------------------------------------------- */

.sq-breakdown-wrap {
	font-family: inherit;
	color: inherit;
	box-sizing: border-box;
	width: 100%;
	max-width: 480px;
}

.sq-breakdown-wrap *,
.sq-breakdown-wrap *::before,
.sq-breakdown-wrap *::after {
	box-sizing: inherit;
}

.sq-breakdown-header {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.sq-breakdown-bars {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sq-breakdown-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.sq-breakdown-label {
	font-size: 0.82rem;
	font-weight: 600;
	min-width: 24px;
	text-align: right;
	white-space: nowrap;
	flex-shrink: 0;
}

.sq-breakdown-star {
	color: var(--sq-star-color, #f5a623);
}

.sq-breakdown-bar-track {
	flex: 1;
	height: 10px;
	background: #eeeeee;
	border-radius: 5px;
	overflow: hidden;
}

.sq-breakdown-bar-fill {
	height: 100%;
	background: var(--sq-star-color, #f5a623);
	border-radius: 5px;
	transition: width 0.3s ease;
}

.sq-breakdown-count {
	font-size: 0.78rem;
	color: #666;
	min-width: 28px;
	text-align: right;
	white-space: nowrap;
	flex-shrink: 0;
}

/* ----------------------------------------------------------
   Interactive breakdown rows ([sq_rating_breakdown show_reviews="true"])
   ---------------------------------------------------------- */

/* When the breakdown widget includes reviews, allow it to fill its container */
.sq-breakdown-reviews-wrap .sq-breakdown-wrap {
	margin-bottom: 20px;
}

.sq-breakdown-row-btn {
	cursor: pointer;
	border-radius: 5px;
	padding: 4px 6px;
	margin: 0 -6px;
	transition: background 0.15s;
	user-select: none;
	outline: none;
}

.sq-breakdown-row-btn:hover {
	background: rgba(0, 0, 0, 0.04);
}

.sq-breakdown-row-btn:focus-visible {
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.sq-breakdown-row-btn.active {
	background: rgba(0, 0, 0, 0.06);
}

.sq-breakdown-row-btn.active .sq-breakdown-all-label {
	color: var(--sq-star-color, #f5a623);
}

.sq-breakdown-row-btn.active .sq-breakdown-count {
	font-weight: 700;
	color: #333;
}

/* "All reviews" reset row */
.sq-breakdown-all-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 6px;
	padding: 4px 6px;
	margin-left: -6px;
	margin-right: -6px;
}

.sq-breakdown-all-label {
	font-size: 0.82rem;
	font-weight: 600;
	color: #555;
}

.sq-breakdown-row-btn.active .sq-breakdown-all-label {
	color: var(--sq-star-color, #f5a623);
}

/* ----------------------------------------------------------
   Loading state overlay
   ---------------------------------------------------------- */

.sq-reviews-wrap.sq-loading .sq-reviews-grid {
	opacity: 0.45;
	pointer-events: none;
	user-select: none;
}

/* ----------------------------------------------------------
   Admin manage button (visible only when logged in as admin)
   ---------------------------------------------------------- */

.sq-admin-manage-btn {
	display: inline-block;
	margin-top: 6px;
	padding: 2px 10px;
	font-size: 11px;
	line-height: 1.8;
	background: #1d2327;
	color: #fff !important;
	border-radius: 3px;
	text-decoration: none;
	opacity: 0.6;
	transition: opacity 0.15s;
}
.sq-admin-manage-btn:hover {
	opacity: 1;
}
