/**
 * Client Testimonial Showcase — two-column testimonial widget.
 *
 * Namespace: every class is prefixed `cts-` (Client Testimonial Showcase),
 * deliberately avoiding generic names (.card/.active/.container) that could
 * collide with theme/plugin CSS on this site. State is expressed only via
 * `.cts-logo-card.is-active` / `.cts-testimonial-item.is-active`, never a
 * bare `.is-active` or `.active` alone.
 *
 * Layout uses CSS custom properties (--cts-*) set per-instance by the
 * widget's Elementor controls (see class-wappbiz-client-testimonial-
 * showcase.php selectors), so this stylesheet only needs to read them —
 * no per-instance <style> block is generated, keeping multiple instances
 * on one page cheap and conflict-free (each Elementor {{WRAPPER}} scopes
 * its own custom property values to its own wrapper element).
 */

.cts-widget {
	--cts-logo-panel-width: 225px;
	--cts-panel-gap: 20px;
	--cts-logo-gap: 7px;
	--cts-logo-card-height: 64px;
	--cts-animation-duration: 350ms;
	--cts-logo-width: 110px;
	--cts-logo-height: 60px;
	--cts-logo-fit: contain;
	--cts-testimonial-align: left;
	--cts-hover-x: 0px;
	--cts-hover-y: -2px;
	--cts-hover-scale: 1;

	position: relative;
	box-sizing: border-box;
	display: flex;
	align-items: stretch;
	gap: var( --cts-panel-gap );
	/*
	 * width: 100% is the documented default of the "Width" Style control
	 * (Style -> Main Container), baselined here too so the widget fills
	 * its column correctly even before Elementor's own per-instance CSS
	 * has generated/loaded — a block-level flex container is otherwise
	 * `width: auto`, which shrinks to its content's max-content size
	 * rather than the available column width.
	 */
	width: 100%;
	/*
	 * max-width: 100% (not just width) plus min-width: 0 on every flex
	 * item in the chain below (.cts-testimonial-panel, .cts-testimonial-
	 * content, .cts-testimonial) is what actually stops a long testimonial
	 * or company name from pushing the widget — and the page — wider than
	 * its container. Flex items default to min-width: auto, which lets
	 * their content's intrinsic width win over the flex layout; without
	 * these the testimonial text overflowed the viewport horizontally on
	 * narrow screens instead of wrapping.
	 */
	max-width: 100%;
}

.cts-widget,
.cts-widget * {
	box-sizing: border-box;
}

.cts-widget.cts-layout-vertical {
	flex-direction: column;
}

/*
 * Baseline look-and-feel — matches the documented defaults (see the
 * widget's own control defaults in class-wappbiz-client-testimonial-
 * showcase.php) so the widget renders correctly the instant it's placed,
 * before any Style-tab customization. Every property here is also exposed
 * as an Elementor control targeting the exact same selector, and Elementor
 * always emits its own per-instance CSS after this stylesheet, so any
 * Style-tab change wins over these fallbacks with no !important needed
 * anywhere in this file.
 */
.cts-logo-panel {
	background-color: #f7f7f7;
	padding: 12px;
	border-radius: 16px;
}

.cts-logo-card {
	background-color: #ffffff;
	border: 1px solid #ececec;
	border-radius: 12px;
	height: 64px;
	padding: 8px 12px;
}

.cts-logo-card.is-active {
	border-color: #25b06a;
}

.cts-testimonial-panel {
	background-color: #ffffff;
	padding: 32px;
	border-radius: 16px;
	box-shadow: 0 6px 24px rgba( 16, 24, 32, 0.06 );
}

.cts-divider {
	border-left: 1px solid #e5e7eb;
}

/* ------------------------------------------------------------------------
 * Logo panel
 * --------------------------------------------------------------------- */

.cts-logo-panel {
	flex: 0 0 var( --cts-logo-panel-width );
	width: var( --cts-logo-panel-width );
	max-width: 100%;
	min-width: 0;
	/*
	 * align-self: flex-start (not the .cts-widget parent's default
	 * align-items: stretch) — the panel must NOT stretch to match the
	 * testimonial panel's height. It sizes to its own content (the logo
	 * list, capped below), so adding more logos than fit scrolls inside a
	 * FIXED-height window instead of growing the whole card taller.
	 */
	align-self: flex-start;
}

.cts-widget.cts-layout-vertical .cts-logo-panel {
	flex: 0 0 auto;
	width: 100%;
}

.cts-logo-list {
	display: flex;
	flex-direction: column;
	gap: var( --cts-logo-gap );
	/*
	 * Fixed scroll-window height = N cards + (N-1) gaps, matching the
	 * "Visible Logos" Style control's default (5) — see that control's
	 * selector in class-wappbiz-client-testimonial-showcase.php for the
	 * per-instance version of this same calc(). This baseline exists so
	 * the cap is correct even before Elementor's generated CSS loads.
	 * Adding a 6th+ logo never grows this panel; the list scrolls inside
	 * this fixed height instead — that's the whole point of the control.
	 */
	max-height: calc( ( var( --cts-logo-card-height ) * 5 ) + ( var( --cts-logo-gap ) * 4 ) );
	overflow-y: auto;
	overscroll-behavior: contain;
	/*
	 * Scrolling still works (wheel/touch/drag) — only the visible
	 * scrollbar track/thumb is hidden, so a 6th+ logo is still reachable,
	 * just without a visible scrollbar UI cluttering the card.
	 */
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.cts-logo-list::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}

.cts-widget.cts-layout-vertical .cts-logo-list {
	max-height: none;
}

.cts-logo-card {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 100%;
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
	font: inherit;
	color: inherit;
	transform: translate( 0, 0 ) scale( 1 );
	transition: transform var( --cts-animation-duration, 350ms ) ease,
		background-color 0.2s ease,
		border-color 0.2s ease,
		box-shadow 0.2s ease,
		opacity 0.2s ease;
}

.cts-logo-card:hover {
	transform: translate( var( --cts-hover-x ), var( --cts-hover-y ) ) scale( var( --cts-hover-scale ) );
}

.cts-logo-card:disabled {
	cursor: default;
}

.cts-logo-card:focus-visible {
	outline: 2px solid #25b06a;
	outline-offset: 2px;
}

.cts-logo-card img {
	display: block;
	width: var( --cts-logo-width );
	height: var( --cts-logo-height );
	max-width: 100%;
	max-height: 100%;
	object-fit: var( --cts-logo-fit );
}

.cts-logo-fallback {
	overflow: hidden;
	max-width: 100%;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Mobile-only pagination dots below the logo carousel — hidden by default,
 * shown inside the max-width: 767px block below. */
.cts-logo-dots {
	display: none;
}

/* ------------------------------------------------------------------------
 * Testimonial panel
 * --------------------------------------------------------------------- */

.cts-testimonial-panel {
	position: relative;
	flex: 1 1 0%;
	min-width: 0;
	max-width: 100%;
	overflow: hidden;
}

.cts-testimonial-item {
	display: flex;
	align-items: flex-start;
	height: 100%;
	min-width: 0;
}

.cts-testimonial-item[hidden] {
	display: none;
}

.cts-testimonial-content {
	display: flex;
	/*
	 * Row (horizontal) matches the reference: statistic block beside the
	 * testimonial block, divider between them. The widget's own "Content
	 * Layout" control (default: Horizontal) sets this per-instance via
	 * {{WRAPPER}} .cts-testimonial-content { flex-direction }, this is
	 * only the pre-Elementor-CSS fallback.
	 *
	 * height: 100% + align-items default (stretch) here is what lets
	 * .cts-quote-column actually become as tall as the card — needed so
	 * margin-top: auto on .cts-author (below) has real leftover space to
	 * push into and sit flush with the card's bottom edge, instead of
	 * sitting right under the testimonial text with a gap below it.
	 * (internal_vertical_align control overrides align-items per-instance
	 * when the user wants top/center/bottom alignment of the columns
	 * against each other instead of a full-height stretch.)
	 */
	flex-direction: row;
	height: 100%;
	gap: 28px;
	width: 100%;
	min-width: 0;
	text-align: var( --cts-testimonial-align );
}

.cts-stat-column {
	flex: 0 0 140px;
	width: 140px;
	min-width: 0;
}

.cts-quote-column {
	display: flex;
	flex-direction: column;
	gap: 20px;
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
}

/* Fade-in transition applied to the item becoming active. */
.cts-testimonial-item.is-active .cts-testimonial-content {
	animation: cts-fade var( --cts-animation-duration, 350ms ) ease both;
}

.cts-anim-slide-up .cts-testimonial-item.is-active .cts-testimonial-content {
	animation-name: cts-fade-slide-up;
}

.cts-anim-slide-down .cts-testimonial-item.is-active .cts-testimonial-content {
	animation-name: cts-fade-slide-down;
}

.cts-anim-slide-left .cts-testimonial-item.is-active .cts-testimonial-content {
	animation-name: cts-fade-slide-left;
}

.cts-anim-slide-right .cts-testimonial-item.is-active .cts-testimonial-content {
	animation-name: cts-fade-slide-right;
}

.cts-anim-fade-scale .cts-testimonial-item.is-active .cts-testimonial-content {
	animation-name: cts-fade-scale;
}

.cts-anim-none .cts-testimonial-item.is-active .cts-testimonial-content {
	animation: none;
}

@keyframes cts-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes cts-fade-slide-up {
	from { opacity: 0; transform: translateY( 12px ); }
	to { opacity: 1; transform: translateY( 0 ); }
}

@keyframes cts-fade-slide-down {
	from { opacity: 0; transform: translateY( -12px ); }
	to { opacity: 1; transform: translateY( 0 ); }
}

@keyframes cts-fade-slide-left {
	from { opacity: 0; transform: translateX( 12px ); }
	to { opacity: 1; transform: translateX( 0 ); }
}

@keyframes cts-fade-slide-right {
	from { opacity: 0; transform: translateX( -12px ); }
	to { opacity: 1; transform: translateX( 0 ); }
}

@keyframes cts-fade-scale {
	from { opacity: 0; transform: scale( 0.96 ); }
	to { opacity: 1; transform: scale( 1 ); }
}

/* ---------------- Statistic ---------------- */

.cts-statistic-wrapper {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.cts-statistic {
	font-size: 36px;
	font-weight: 700;
	line-height: 1.1;
}

.cts-statistic-description {
	font-size: 13px;
	line-height: 1.4;
	color: #6b7280;
}

/* ---------------- Divider ---------------- */

.cts-divider {
	align-self: stretch;
	flex-shrink: 0;
	width: 0;
	height: auto;
	min-height: 60px;
	border-left: 1px solid #e5e7eb;
	background-color: transparent;
}

.cts-widget.cts-content-layout-vertical .cts-divider {
	align-self: flex-start;
	width: 60px;
	height: 0;
	min-height: 0;
	border-left: none;
	border-top: 1px solid #e5e7eb;
}

.cts-widget.cts-content-layout-vertical .cts-testimonial-content {
	flex-direction: column;
}

.cts-widget.cts-content-layout-vertical .cts-stat-column {
	flex: 0 0 auto;
	width: 100%;
}

/* ---------------- Testimonial text ---------------- */

.cts-testimonial {
	flex-shrink: 0;
	font-size: 22px;
	line-height: 1.5;
	color: #171717;
	word-break: break-word;
	overflow-wrap: anywhere;
}

.cts-testimonial p {
	margin: 0 0 0.6em;
}

.cts-testimonial p:last-child {
	margin-bottom: 0;
}

.cts-testimonial strong,
.cts-testimonial b {
	font-weight: 700;
}

.cts-testimonial a {
	text-decoration: underline;
}

/* ---------------- Author ---------------- */

.cts-author {
	display: flex;
	flex-direction: row;
	align-items: center;
	flex-shrink: 0;
	gap: 12px;
	/*
	 * Pushes the author block to the bottom of .cts-quote-column, flush
	 * with the card's own bottom edge, instead of sitting directly under
	 * the testimonial text with empty space left below it — matches the
	 * reference, where the quote mark and author both anchor to the card's
	 * bottom regardless of how short the testimonial text is.
	 */
	margin-top: auto;
	text-decoration: none;
	color: inherit;
}

.cts-author-avatar {
	flex-shrink: 0;
	display: block;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	object-fit: cover;
}

.cts-author-details {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.cts-author-name {
	font-size: 14px;
	font-weight: 700;
	color: #111111;
}

.cts-author-designation {
	font-size: 13px;
	color: #6b7280;
}

/* ---------------- Quote icon ---------------- */

.cts-quote-icon {
	position: absolute;
	right: 24px;
	bottom: 16px;
	z-index: 0;
	display: inline-flex;
	color: #d9f3e9;
	font-size: 80px;
	line-height: 1;
	opacity: 0.7;
	pointer-events: none;
	user-select: none;
}

.cts-quote-icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.cts-testimonial-content {
	position: relative;
	z-index: 1;
}

/* ---------------- Empty state (editor only) ---------------- */

.cts-empty-state {
	padding: 40px;
	border: 1px dashed #d1d5db;
	border-radius: 8px;
	color: #6b7280;
	font-size: 14px;
	text-align: center;
}

/* ------------------------------------------------------------------------
 * Reduced motion
 * --------------------------------------------------------------------- */

@media ( prefers-reduced-motion: reduce ) {
	.cts-logo-card,
	.cts-testimonial-item.is-active .cts-testimonial-content {
		animation: none !important;
		transition: none !important;
	}

	.cts-logo-card:hover {
		transform: none;
	}
}

/* ------------------------------------------------------------------------
 * RTL
 * --------------------------------------------------------------------- */

[dir='rtl'] .cts-quote-icon {
	right: auto;
	left: 24px;
}

[dir='rtl'] .cts-divider {
	border-left: none;
	border-right: 1px solid #e5e7eb;
}

/* ------------------------------------------------------------------------
 * Responsive
 * --------------------------------------------------------------------- */

@media ( max-width: 1024px ) {
	.cts-widget:not( .cts-layout-vertical ) {
		--cts-logo-panel-width: 30%;
	}
}

@media ( max-width: 767px ) {
	/*
	 * Mobile rebuild — deliberately does NOT touch any rule outside this
	 * media query, so the desktop two-column layout is completely
	 * unaffected. Per spec: full-width stacked card, statistic/testimonial
	 * sized down (not the desktop columns just shrunk into narrow tracks —
	 * that reads cramped), logo list becomes a horizontal
	 * scroll/carousel showing ~2-2.5 cards at a time with pagination dots,
	 * 16px page-side padding throughout.
	 */
	.cts-widget:not( .cts-layout-vertical ) {
		flex-direction: column;
	}

	.cts-widget.cts-mobile-order-testimonial-first .cts-testimonial-panel,
	.cts-widget.cts-mobile-order-testimonial_first .cts-testimonial-panel {
		order: 1;
	}

	.cts-widget.cts-mobile-order-testimonial-first .cts-logo-panel,
	.cts-widget.cts-mobile-order-testimonial_first .cts-logo-panel {
		order: 2;
	}

	.cts-widget.cts-mobile-order-logo-first .cts-logo-panel,
	.cts-widget.cts-mobile-order-logo_first .cts-logo-panel {
		order: 1;
	}

	.cts-widget.cts-mobile-order-logo-first .cts-testimonial-panel,
	.cts-widget.cts-mobile-order-logo_first .cts-testimonial-panel {
		order: 2;
	}

	/* Full-width stacked panels, 16px page-side padding on the card itself. */
	.cts-testimonial-panel {
		width: 100%;
		padding: 20px 16px !important;
	}

	.cts-logo-panel {
		width: 100%;
		flex: 0 0 auto;
		padding: 12px 16px;
	}

	/*
	 * Statistic column goes back to full-width above the testimonial on
	 * mobile — a fixed 140px side column reads cramped at this width,
	 * matches the "don't shrink the desktop columns" requirement by not
	 * trying to preserve the side-by-side proportions at all.
	 *
	 * !important is required here: the widget's "Content Layout" control
	 * (Style -> Testimonial Panel) is a plain, non-responsive control that
	 * emits a single `flex-direction` value with no breakpoints at all
	 * (Elementor has no per-breakpoint variant of a plain SELECT control).
	 * Its generated CSS loads after this theme stylesheet, so without
	 * !important it always wins here regardless of viewport — this was a
	 * real bug (statistic/testimonial stayed side-by-side, squeezed, on
	 * mobile) until this was added.
	 */
	.cts-testimonial-content {
		flex-direction: column !important;
		height: auto;
		gap: 16px;
	}

	.cts-stat-column {
		/* !important for the same reason as .cts-testimonial-content above:
		 * the "Statistic Column Width" control is non-responsive and would
		 * otherwise pin this to its fixed px/% width at every viewport. */
		flex: 0 0 auto !important;
		width: 100% !important;
	}

	.cts-quote-column {
		height: auto;
	}

	.cts-divider {
		display: none;
	}

	.cts-statistic {
		font-size: 32px;
	}

	.cts-testimonial {
		font-size: 17px;
		line-height: 1.55;
	}

	.cts-author {
		margin-top: 16px;
	}

	.cts-quote-icon {
		font-size: 44px;
		right: 16px;
		bottom: 12px;
	}

	/* Logo carousel: horizontal scroll showing ~2-2.5 cards at a time so
	 * it's visually obvious there's more to scroll to. */
	.cts-logo-list {
		flex-direction: row;
		max-height: none;
		gap: 10px;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scroll-snap-type: x proximity;
		scrollbar-width: none;
	}

	.cts-logo-list::-webkit-scrollbar {
		display: none;
	}

	.cts-logo-card {
		flex: 0 0 auto;
		/* ~2.5 cards visible: each card is roughly 38% of the row width
		 * minus gaps, so the trailing edge of a 3rd card peeks in as a
		 * "there's more" affordance. */
		width: 38%;
		min-width: 108px;
		height: 56px;
		scroll-snap-align: start;
	}

	.cts-logo-card.is-active {
		border-width: 2px;
	}

	.cts-logo-dots {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 6px;
		margin-top: 10px;
	}

	.cts-logo-dot {
		width: 6px;
		height: 6px;
		border-radius: 50%;
		background-color: #d1d5db;
		transition: background-color 0.2s ease, transform 0.2s ease;
		cursor: pointer;
	}

	.cts-logo-dot.is-active {
		background-color: #25b06a;
		transform: scale( 1.3 );
	}
}
