/*
 * Trustpilot Reviews — Frontend Shortcode Styles
 * Matches the official Trustpilot widget aesthetic.
 *
 * Every rule is scoped under `.tp-reviews-wrapper` to raise specificity above
 * common theme rules (e.g. `.entry-content h3`, `button`) that would otherwise
 * bleed into the carousel buttons and review titles.
 */

/* ── Wrapper ── */
.tp-reviews-wrapper {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	box-sizing: border-box;
	width: 100%;
}

/* Override block-theme .is-layout-constrained constraint.
   Theme uses !important on margins so we must too. */
.tp-reviews-wrapper {
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

/* ── Carousel container ── */
.tp-reviews-wrapper .tp-carousel {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;

	/* Visible card count per breakpoint — overridden below */
	--tp-cards-visible: 4;
	--tp-card-gap: 16px;
}

.tp-reviews-wrapper .tp-carousel-track {
	display: flex;
	gap: var( --tp-card-gap );
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-ms-overflow-style: none;
	padding: 12px 4px;
	flex: 1;
	min-width: 0;
}

.tp-reviews-wrapper .tp-carousel-track::-webkit-scrollbar {
	display: none;
}

/* ── Arrow buttons ──
   Aggressive reset: themes commonly style `button` with green pill backgrounds
   (WooCommerce / Astra / Hello Elementor). Scoping plus explicit resets stops
   that bleed. */
.tp-reviews-wrapper .tp-carousel-btn {
	flex-shrink: 0;
	position: relative;
	width: 24px;
	height: 24px;
	min-width: 0;
	min-height: 0;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	background-color: transparent;
	background-image: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: 1;
	text-transform: none;
	letter-spacing: normal;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	-webkit-appearance: none;
	appearance: none;
}

.tp-reviews-wrapper .tp-carousel-btn:hover,
.tp-reviews-wrapper .tp-carousel-btn:focus,
.tp-reviews-wrapper .tp-carousel-btn:active {
	background: transparent;
	background-color: transparent;
	background-image: none;
	box-shadow: none;
	color: inherit;
	border: 0;
	transform: none;
}

.tp-reviews-wrapper .tp-carousel-btn::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: transparent;
	transition: width 0.15s, height 0.15s, background 0.15s;
	z-index: 0;
}

.tp-reviews-wrapper .tp-carousel-btn svg {
	position: relative;
	z-index: 1;
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	display: block;
}

.tp-reviews-wrapper .tp-carousel-btn:hover:not( :disabled )::before {
	background: #c2d5f7;
	width: 44px;
	height: 44px;
}

.tp-reviews-wrapper .tp-carousel-btn:active:not( :disabled )::before {
	background: #a8c4f5;
}

.tp-reviews-wrapper .tp-carousel-btn:disabled {
	opacity: 0.2;
	cursor: default;
}

/* ── Review card ── */
.tp-reviews-wrapper .tp-review-card {
	/* Auto-fit: card width fills track exactly so no card is cut off.
	   Width = (track - total gaps) / visible count. */
	flex: 0 0 calc(
		( 100% - ( var( --tp-cards-visible ) - 1 ) * var( --tp-card-gap ) )
		/ var( --tp-cards-visible )
	);
	min-width: 0;
	scroll-snap-align: start;
	background: #f8f9fa;
	border: none;
	border-radius: 2px;
	box-shadow: 0 1px 0 rgba( 182, 196, 210, 0.4 );
	padding: 15px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

/* ── Top row: stars + verified ── */
.tp-reviews-wrapper .tp-review-top {
	display: flex;
	align-items: center;
	gap: 8px;
}

.tp-reviews-wrapper .tp-review-stars svg {
	display: block;
	width: 100px;
	height: auto;
}

.tp-reviews-wrapper .tp-review-verified {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	color: #636363;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-decoration: underline;
}

.tp-reviews-wrapper .tp-review-verified:hover {
	text-decoration: none;
	color: #636363;
}

.tp-reviews-wrapper .tp-verified-icon {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	width: 14px;
	height: 14px;
	color: #636363;
}

/* ── Review link wrapper ── */
.tp-reviews-wrapper .tp-review-link {
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 6px;
	text-decoration: none;
	color: inherit;
	min-width: 0;
}

.tp-reviews-wrapper .tp-review-card:hover .tp-stars--1 .tp-star--filled .tp-star__canvas { fill: #cc1300; }
.tp-reviews-wrapper .tp-review-card:hover .tp-stars--2 .tp-star--filled .tp-star__canvas { fill: #cc5c00; }
.tp-reviews-wrapper .tp-review-card:hover .tp-stars--3 .tp-star--filled .tp-star__canvas { fill: #b29000; }
.tp-reviews-wrapper .tp-review-card:hover .tp-stars--4 .tp-star--filled .tp-star__canvas { fill: #56a700; }
.tp-reviews-wrapper .tp-review-card:hover .tp-stars--5 .tp-star--filled .tp-star__canvas { fill: #007a52; }
.tp-reviews-wrapper .tp-review-card:hover .tp-stars--2 .tp-star--filled .tp-star__canvas--half { fill: #cc5c00; }
.tp-reviews-wrapper .tp-review-card:hover .tp-stars--3 .tp-star--filled .tp-star__canvas--half { fill: #b29000; }
.tp-reviews-wrapper .tp-review-card:hover .tp-stars--4 .tp-star--filled .tp-star__canvas--half { fill: #56a700; }
.tp-reviews-wrapper .tp-review-card:hover .tp-stars--5 .tp-star--filled .tp-star__canvas--half { fill: #007a52; }

/* ── Title ──
   Locked size: themes commonly set `.entry-content h3 { font-size: 24px }`
   which would otherwise blow the card titles up. */
.tp-reviews-wrapper .tp-review-title {
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0 0 6px;
	padding: 0;
	line-height: 16px;
	letter-spacing: normal;
	text-transform: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── Body ── */
.tp-reviews-wrapper .tp-review-body {
	font-family: inherit;
	font-size: 13px;
	color: #555;
	margin: 0;
	padding: 0;
	line-height: 16px;
	flex: 1;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* ── Footer: author + date ── */
.tp-reviews-wrapper .tp-review-footer {
	font-size: 13px;
	color: #636363;
	margin-top: auto;
	padding-top: 20px;
	display: flex;
	overflow: hidden;
}

.tp-reviews-wrapper .tp-review-author {
	font-weight: 700;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex-shrink: 1;
}

.tp-reviews-wrapper .tp-review-date {
	white-space: nowrap;
	flex-shrink: 0;
	margin-left: 3px;
}

/* ── Compliance block ── */
.tp-reviews-wrapper .tp-compliance-block {
	text-align: center;
	padding: 10px 0 2px;
	font-size: 13px;
	color: #444;
}

.tp-reviews-wrapper .tp-compliance-text {
	margin: 0 0 8px;
	line-height: 1.5;
}

.tp-reviews-wrapper .tp-compliance-text a {
	color: #333;
}

.tp-reviews-wrapper .tp-compliance-logo-link {
	display: inline-block;
}

.tp-reviews-wrapper .tp-compliance-logo-link svg {
	display: block;
	margin: 0 auto;
	height: 20px;
	width: auto;
}

/* ── Empty state ── */
.tp-reviews-wrapper .tp-no-reviews {
	padding: 24px;
	color: #777;
	font-style: italic;
	text-align: center;
}

/* Auto-adjust visible card count — last card never cut off.
   Tweak breakpoints to taste. */
@media ( max-width: 1200px ) {
	.tp-reviews-wrapper .tp-carousel { --tp-cards-visible: 3; }
}
@media ( max-width: 800px ) {
	.tp-reviews-wrapper .tp-carousel { --tp-cards-visible: 2; }
}
@media ( max-width: 480px ) {
	.tp-reviews-wrapper .tp-carousel { --tp-cards-visible: 1; }
	.tp-reviews-wrapper .tp-carousel-btn {
		width: 24px;
		height: 24px;
		font-size: 14px;
	}
}

/* --- TrustScore badge widget ([tp_score_badge]) -------------------- */
/* Defensive: theme/Elementor often override img sizing and link decoration,
   so badge rules use higher specificity + !important on visual essentials.
   Three size variants — small (for headers), medium (default), large. */
.tp-score-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.4;
    width: 100%;
    text-align: center;
}
.tp-score-badge .tp-score-badge__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 2px 6px;
    text-decoration: none !important;
    border: 0;
    box-shadow: none;
    color: #1c1c1c;
    overflow: visible;
}
.tp-score-badge .tp-score-badge__score {
    font-weight: 400;
    color: inherit;
    white-space: nowrap;
}
.tp-score-badge .tp-score-badge__logo {
    display: block !important;
    width: auto !important;
    flex-shrink: 0;
}
.tp-score-badge .tp-score-badge__caption {
    margin: 0;
    color: #3a3a3a;
}

/* Size variants — control score font, logo height, caption font, and the
   vertical gap between the score row and the caption together. */
.tp-score-badge--small  { gap: 0; }
.tp-score-badge--medium { gap: 4px; }
.tp-score-badge--large  { gap: 6px; }

.tp-score-badge--small .tp-score-badge__score   { font-size: 13px; }
.tp-score-badge--small .tp-score-badge__logo    { height: 18px !important; }
.tp-score-badge--small .tp-score-badge__caption { font-size: 11px; }

.tp-score-badge--medium .tp-score-badge__score   { font-size: 16px; }
.tp-score-badge--medium .tp-score-badge__logo    { height: 24px !important; }
.tp-score-badge--medium .tp-score-badge__caption { font-size: 12px; }

.tp-score-badge--large .tp-score-badge__score   { font-size: 20px; }
.tp-score-badge--large .tp-score-badge__logo    { height: 32px !important; }
.tp-score-badge--large .tp-score-badge__caption { font-size: 14px; }
