/* Tradeviser Quick Checkout — front-end styles.
   Visual tokens (--tvqc-*) are injected inline by TVQC_Assets from the Style
   settings; this file only ever reads them, never hardcodes brand colors. */

.tvqc-checkout-wrap,
.tvqc-thankyou {
	font-family: var( --tvqc-font, sans-serif );
	color: var( --tvqc-text, #1a2333 );
	background: var( --tvqc-bg, #f5f8ff );
	max-width: 1100px;
	margin: 0 auto;
	padding: 24px 16px 64px;
	box-sizing: border-box;
}
.tvqc-checkout-wrap *,
.tvqc-thankyou * {
	box-sizing: border-box;
}

/* ---------- layout ---------- */
.tvqc-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var( --tvqc-gap, 20px );
}
@media ( min-width: 900px ) {
	.tvqc-grid {
		grid-template-columns: 1.05fr 0.95fr;
		align-items: start;
	}
	.tvqc-summary-col {
		order: 2;
		position: sticky;
		top: 24px;
	}
	.tvqc-form-col {
		order: 1;
	}
}

/* A CSS Grid item's default min-width is `auto`, which resolves to its
   content's min-content size -- for .tvqc-summary-col that means the
   compact order-summary line's un-wrapped product-name text (white-space:
   nowrap, so it can never shrink below its full text width for sizing
   purposes). Without this, a long enough product name forces the whole
   .tvqc-grid track wider than the viewport on mobile, and with it the whole
   page horizontally scrolls -- confirmed live, and with it the ellipsis
   truncation on .tvqc-summary-compact-label never gets a chance to kick in
   either, since the box is never actually forced smaller than the text.
   min-width: 0 lets the grid item (and everything inside it) shrink to fit
   its track instead of dictating the track's size. */
.tvqc-summary-col,
.tvqc-form-col {
	min-width: 0;
}

.tvqc-summary,
.tvqc-form {
	background: var( --tvqc-surface, #fff );
	border-radius: var( --tvqc-radius, 12px );
	padding: 24px;
	box-shadow: 0 1px 2px rgba( 0, 0, 0, 0.04 ), 0 12px 28px rgba( 0, 0, 0, 0.05 );
}

.tvqc-form-heading,
.tvqc-summary-heading {
	font-size: 15px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-weight: 700;
	opacity: 0.65;
	margin: 0 0 16px;
}
.tvqc-form-heading {
	margin-top: 28px;
}
.tvqc-form-heading:first-child {
	margin-top: 0;
}

/* ---------- summary (collapsible on mobile, always open on desktop) ---------- */
.tvqc-summary-details summary {
	list-style: none;
	cursor: pointer;
}
.tvqc-summary-details summary::-webkit-details-marker {
	display: none;
}
.tvqc-summary-details summary::marker {
	content: '';
}
.tvqc-summary-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
}
.tvqc-summary-compact-line {
	display: none;
	flex: 1;
	justify-content: space-between;
	align-items: baseline;
	gap: 10px;
	font-size: 14px;
	font-weight: 600;
	min-width: 0;
}
.tvqc-summary-compact-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.tvqc-summary-compact-price {
	white-space: nowrap;
}
.tvqc-summary-chevron {
	display: none;
	font-size: 13px;
	opacity: 0.5;
	transition: transform var( --tvqc-anim-speed, 0.2s ) ease;
	flex-shrink: 0;
}
.tvqc-summary-details[open] .tvqc-summary-chevron {
	transform: rotate( 180deg );
}

@media ( max-width: 899px ) {
	.tvqc-summary-toggle {
		padding: 4px 0;
	}
	.tvqc-summary-compact-line,
	.tvqc-summary-chevron {
		display: flex;
	}
	.tvqc-summary-heading {
		margin: 0;
		flex-shrink: 0;
	}
	.tvqc-summary-details:not( [open] ) .tvqc-summary-body {
		display: none;
	}
	.tvqc-summary-details:not( [open] ) .tvqc-summary-heading {
		display: none;
	}
	.tvqc-summary-details[open] .tvqc-summary-compact-line {
		display: none;
	}
	.tvqc-summary-body {
		margin-top: 14px;
		animation: tvqc-rise 0.2s ease both;
	}
}

/* Desktop: always fully expanded regardless of the [open] attribute, and the
   summary line isn't interactive — the compact/chevron bits are simply hidden. */
@media ( min-width: 900px ) {
	.tvqc-summary-details summary {
		cursor: default;
		pointer-events: none;
	}
	.tvqc-summary-details .tvqc-summary-body {
		display: block !important;
	}
}

.tvqc-summary-items {
	list-style: none;
	margin: 0 0 16px;
	padding: 0;
}
.tvqc-summary-item {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid rgba( 0, 0, 0, 0.06 );
	font-size: 15px;
}
.tvqc-summary-row {
	display: flex;
	justify-content: space-between;
	padding: 6px 0;
	font-size: 14px;
	opacity: 0.8;
}
.tvqc-summary-discount span:last-child {
	color: var( --tvqc-accent, #16a34a );
}
.tvqc-summary-total {
	margin-top: 8px;
	padding-top: 12px;
	border-top: 2px solid rgba( 0, 0, 0, 0.08 );
	font-size: 19px;
	font-weight: 700;
	opacity: 1;
}
.tvqc-secure-badge,
.tvqc-secure-note {
	margin: 16px 0 0;
	font-size: 13px;
	opacity: 0.65;
	text-align: center;
}
.tvqc-terms-note {
	margin: 8px 0 0;
	font-size: 12.5px;
	opacity: 0.7;
	text-align: center;
}
.tvqc-terms-note a {
	color: inherit;
	text-decoration: underline;
}

.tvqc-payment-logos {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 12px;
	margin-top: 12px;
}
.tvqc-payment-logos img {
	height: 22px;
	width: auto;
	max-width: 64px;
	object-fit: contain;
	opacity: 0.85;
}

/* ---------- fields ---------- */
.tvqc-field {
	margin-bottom: 16px;
}
.tvqc-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}
@media ( max-width: 480px ) {
	.tvqc-field-row {
		grid-template-columns: 1fr;
	}
}
.tvqc-field-row .tvqc-field {
	margin-bottom: 0;
}
.tvqc-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 6px;
	opacity: 0.8;
}
.tvqc-required {
	color: #e11d48;
}
.tvqc-field input[type="text"],
.tvqc-field input[type="email"],
.tvqc-field input[type="tel"],
.tvqc-field textarea,
#tvqc-coupon-code {
	width: 100%;
	padding: var( --tvqc-field-pad, 14px 16px );
	border-radius: var( --tvqc-radius-input, 10px );
	border: 1.5px solid #e2e8f0;
	background: #fff;
	font-size: 15px;
	font-family: inherit;
	color: inherit;
	transition: border-color var( --tvqc-anim-speed, 0.2s ) ease, box-shadow var( --tvqc-anim-speed, 0.2s ) ease;
}
.tvqc-field input:focus,
.tvqc-field textarea:focus,
#tvqc-coupon-code:focus {
	outline: none;
	border-color: var( --tvqc-primary, #4c89ff );
	box-shadow: 0 0 0 4px color-mix( in srgb, var( --tvqc-primary, #4c89ff ) 16%, transparent );
}
.tvqc-field textarea {
	resize: vertical;
	min-height: 80px;
}

/* ---------- payment method ---------- */
.tvqc-payment-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border: 1.5px solid #e2e8f0;
	border-radius: var( --tvqc-radius-input, 10px );
	margin-bottom: 8px;
	font-weight: 500;
	cursor: pointer;
}

/* ---------- coupon ---------- */
.tvqc-coupon-block {
	margin-bottom: 16px;
}
.tvqc-coupon-toggle {
	background: none;
	border: none;
	padding: 0;
	color: var( --tvqc-primary, #4c89ff );
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
}
.tvqc-coupon-row {
	display: flex;
	gap: 8px;
	margin-top: 10px;
}
.tvqc-coupon-row #tvqc-coupon-code {
	flex: 1;
}
.tvqc-btn-secondary {
	padding: 0 18px;
	border-radius: var( --tvqc-radius-input, 10px );
	border: 1.5px solid var( --tvqc-primary, #4c89ff );
	background: #fff;
	color: var( --tvqc-primary, #4c89ff );
	font-weight: 600;
	cursor: pointer;
	transition: background var( --tvqc-anim-speed, 0.2s ) ease;
}
.tvqc-btn-secondary:hover {
	background: color-mix( in srgb, var( --tvqc-primary, #4c89ff ) 8%, transparent );
}
.tvqc-coupon-message {
	font-size: 13px;
	margin-top: 6px;
}
.tvqc-coupon-message.tvqc-success {
	color: var( --tvqc-accent, #16a34a );
}
.tvqc-coupon-message.tvqc-error {
	color: #e11d48;
}
.tvqc-applied-coupons {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.tvqc-applied-coupons li {
	background: color-mix( in srgb, var( --tvqc-accent, #16a34a ) 12%, transparent );
	color: var( --tvqc-accent, #16a34a );
	padding: 4px 8px 4px 12px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	display: flex;
	align-items: center;
	gap: 6px;
}
.tvqc-remove-coupon {
	background: none;
	border: none;
	color: inherit;
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
	padding: 0 2px;
}

/* ---------- notices ---------- */
.tvqc-notice {
	padding: 12px 14px;
	border-radius: var( --tvqc-radius-input, 10px );
	font-size: 14px;
	margin-bottom: 16px;
}
.tvqc-notice-error {
	background: #fef2f2;
	color: #b91c1c;
	border: 1px solid #fecaca;
}

/* ---------- pay button ---------- */
.tvqc-pay-btn {
	width: 100%;
	margin-top: 8px;
	padding: 17px 20px;
	background: var( --tvqc-primary, #4c89ff );
	color: #fff;
	border: none;
	border-radius: var( --tvqc-radius, 12px );
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	box-shadow: 0 6px 18px color-mix( in srgb, var( --tvqc-primary, #4c89ff ) 35%, transparent );
	transition: transform var( --tvqc-anim-speed, 0.2s ) ease, filter var( --tvqc-anim-speed, 0.2s ) ease, box-shadow var( --tvqc-anim-speed, 0.2s ) ease;
	/* A slow, gentle "click me" bump while the button is just sitting there
	   idle -- draws the eye without being a distracting flashing animation.
	   Duration is derived from --tvqc-anim-speed (see TVQC_Assets::
	   build_style_variables_css()) so it automatically goes to 0s -- i.e. off
	   -- when Settings -> Style -> Animations is turned off, the same switch
	   every other animation in this file already respects. */
	animation: tvqc-pay-btn-bump calc( var( --tvqc-anim-speed, 0.25s ) * 10 ) ease-in-out infinite;
}
.tvqc-pay-btn:hover,
.tvqc-pay-btn:focus-visible,
.tvqc-pay-btn:active,
.tvqc-pay-btn:disabled {
	/* The idle bump is for an untouched button -- once someone's actually
	   interacting with it (or it's mid-submit), stop competing with hover/
	   press feedback or the disabled state. */
	animation: none;
}
@keyframes tvqc-pay-btn-bump {
	0%, 76%, 100% {
		transform: scale( 1 );
	}
	88% {
		transform: scale( 1.035 );
	}
}
@media ( prefers-reduced-motion: reduce ) {
	.tvqc-pay-btn {
		animation: none;
	}
}
.tvqc-pay-btn:hover {
	filter: brightness( 1.06 );
	transform: translateY( -1px );
}
.tvqc-pay-btn:active {
	/* A quick, slightly bouncy press -- snaps down further than a plain
	   scale-down would, then the transition above eases it back out on
	   release, so a tap/click feels more like a tactile "bump" than a flat
	   dimmer switch. */
	transition-timing-function: cubic-bezier( 0.34, 1.56, 0.64, 1 );
	transform: translateY( 1px ) scale( 0.94 );
}
.tvqc-pay-btn:disabled {
	opacity: 0.75;
	cursor: not-allowed;
	transform: none;
}
.tvqc-spinner {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 2.5px solid rgba( 255, 255, 255, 0.4 );
	border-top-color: #fff;
	animation: tvqc-spin 0.7s linear infinite;
}
@keyframes tvqc-spin {
	to {
		transform: rotate( 360deg );
	}
}

@media ( max-width: 899px ) {
	.tvqc-pay-btn {
		position: sticky;
		bottom: 12px;
		z-index: 5;
		padding-bottom: calc( 17px + env( safe-area-inset-bottom, 0px ) );
	}
}

/* ---------- buy now button (on service pages) ---------- */
.tvqc-product-buy-now {
	margin: 18px 0;
}
.tvqc-buy-now-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* Without an explicit gap, a flex container collapses the trailing space of
	   a text-only flex item that sits right before another flex item -- here
	   that's the literal space between the "Pay " text node and the price
	   <span> injected for the {price} token (see TVQC_Shortcodes::
	   resolve_button_label()), which otherwise renders as "Pay₹1,499" with no
	   visible gap at all. Confirmed live: the space character is genuinely
	   present in the markup, but flexbox trims it since it's the whitespace at
	   the end of that anonymous flex item's box. gap re-adds the spacing
	   directly, regardless of how many words/tokens the configured button text
	   template ends up producing. */
	gap: 0.35em;
	padding: 14px 28px;
	background: var( --tvqc-primary, #4c89ff );
	color: #fff !important;
	border-radius: var( --tvqc-radius, 12px );
	font-weight: 700;
	text-decoration: none !important;
	transition: transform 0.2s ease, filter 0.2s ease;
}
.tvqc-buy-now-btn:hover {
	filter: brightness( 1.06 );
	transform: translateY( -1px );
}

/* ---------- empty state ---------- */
.tvqc-empty-state {
	text-align: center;
	padding: 60px 20px;
}
.tvqc-empty-state p {
	font-size: 16px;
	margin-bottom: 20px;
	opacity: 0.75;
}

/* ---------- thank you ---------- */
.tvqc-thankyou {
	text-align: center;
	padding-top: 48px;
	max-width: 560px;
}
.tvqc-thankyou h1 {
	font-size: 26px;
	margin: 20px 0 8px;
}
.tvqc-thankyou-sub {
	opacity: 0.75;
	margin-bottom: 28px;
}
.tvqc-thankyou-summary {
	text-align: left;
}
.tvqc-check-badge svg {
	width: 84px;
	height: 84px;
}
.tvqc-check-circle {
	stroke: var( --tvqc-accent, #16a34a );
	stroke-width: 3;
	stroke-miterlimit: 10;
	stroke-dasharray: 166;
	stroke-dashoffset: 166;
}
.tvqc-check-mark {
	stroke: var( --tvqc-accent, #16a34a );
	stroke-width: 4;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 48;
	stroke-dashoffset: 48;
}
.tvqc-animate .tvqc-check-circle {
	animation: tvqc-draw 0.5s ease forwards;
}
.tvqc-animate .tvqc-check-mark {
	animation: tvqc-draw 0.35s 0.45s ease forwards;
}
@keyframes tvqc-draw {
	to {
		stroke-dashoffset: 0;
	}
}

/* ---------- entrance animation ---------- */
.tvqc-animate .tvqc-summary-col,
.tvqc-animate .tvqc-form-col {
	animation: tvqc-rise 0.45s ease both;
}
.tvqc-animate .tvqc-form-col {
	animation-delay: 0.08s;
}
@keyframes tvqc-rise {
	from {
		opacity: 0;
		transform: translateY( 12px );
	}
	to {
		opacity: 1;
		transform: translateY( 0 );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.tvqc-checkout-wrap *,
	.tvqc-thankyou * {
		animation: none !important;
		transition: none !important;
	}
}
