/**
 * Best Price Popup Styles
 * 
 * Trigger button below price and popup modal with two-column card layout.
 * Desktop: centered modal with close button, side-by-side cards.
 * Mobile: bottom sheet with stacked cards.
 *
 * @package Onviqa
 * @since 1.0.0
 */

/* ==========================================================================
   Trigger Button - "Get it for as low as $X"
   Figma: 250x40 container, 250x35 pill, #F1DFFF flat bg, no border
   ========================================================================== */

.ksq-best-price-trigger {
	position: relative;
	width: 250px;
	height: 40px;
	margin: 8px 0 16px 0;
}

.ksq-best-price-trigger__btn {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 250px;
	height: 35px;
	padding: 0 12px;
	background: #F1DFFF;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	position: absolute;
	left: 0;
	top: 5px;
	box-shadow: none;
	transition: background 0.2s ease;
}

.ksq-best-price-trigger__btn::before {
	content: '';
	position: absolute;
	left: 12px;
	top: -5px;
	width: 0;
	height: 0;
	border-left: 5px solid transparent;
	border-right: 5px solid transparent;
	border-bottom: 5px solid #F1DFFF;
}

.ksq-best-price-trigger__btn:hover {
	background: #E8D0FF;
}

.ksq-best-price-trigger__btn:hover::before {
	border-bottom-color: #E8D0FF;
}

.ksq-best-price-trigger__text {
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 400;
	font-size: 16px;
	line-height: 19px;
	color: #8238BE;
	display: flex;
	align-items: center;
	gap: 4px;
	white-space: nowrap;
}

.ksq-best-price-trigger__text .woocommerce-Price-amount {
	font-weight: 700;
	font-size: 16px;
	color: #8238BE;
	text-shadow: none;
	letter-spacing: normal;
}

.ksq-best-price-trigger__text .woocommerce-Price-currencySymbol {
	font-weight: 700;
	font-size: 16px;
	color: #8238BE;
}

.ksq-best-price-trigger__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	color: #8238BE;
	flex-shrink: 0;
}

.ksq-best-price-trigger__icon svg {
	width: 16px;
	height: 16px;
}

/* ==========================================================================
   Overlay
   ========================================================================== */

.ksq-best-price-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 100010;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ksq-best-price-overlay.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* ==========================================================================
   Popup Modal - Base
   ========================================================================== */

.ksq-best-price-popup {
	position: fixed;
	z-index: 100011;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.ksq-best-price-popup.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* Desktop: Centered modal - wider for two-column layout */
@media (min-width: 769px) {
	.ksq-best-price-popup {
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%) scale(0.95);
		width: 750px;
		max-width: calc(100vw - 48px);
		max-height: calc(100vh - 48px);
	}

	.ksq-best-price-popup.is-active {
		transform: translate(-50%, -50%) scale(1);
	}

	.ksq-best-price-popup__container {
		border-radius: 16px;
		box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
	}

	.ksq-best-price-popup__handle {
		display: none;
	}
}

/* Mobile: Bottom sheet */
@media (max-width: 768px) {
	.ksq-best-price-overlay {
		transition: opacity 0.35s ease, visibility 0.35s ease;
	}
	
	.ksq-best-price-popup {
		bottom: 0;
		left: 0;
		right: 0;
		top: auto;
		width: 100%;
		max-height: 85vh;
		opacity: 1;
		transform: translateY(100%);
		transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1),
		            visibility 0.45s ease;
	}

	.ksq-best-price-popup.is-active {
		transform: translateY(0);
		visibility: visible;
	}

	.ksq-best-price-popup__container {
		border-radius: 20px 20px 0 0;
		box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
	}
}

/* ==========================================================================
   Popup Container
   ========================================================================== */

.ksq-best-price-popup__container {
	background: #FFFFFF;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	max-height: inherit;
	position: relative;
}

.ksq-best-price-popup__container::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 309px;
	background: linear-gradient(180deg, #E4C0FF 0%, #FFFFFF 100%);
	pointer-events: none;
	z-index: 0;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__container::before {
		height: 238px;
	}
}

/* ==========================================================================
   Close Button (Desktop)
   ========================================================================== */

.ksq-best-price-popup__close {
	position: absolute;
	top: 20px;
	right: 20px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #FFFFFF;
	border: 1.5px solid #000000;
	border-radius: 20px;
	cursor: pointer;
	z-index: 10;
	padding: 0;
	transition: background 0.2s ease, transform 0.2s ease;
	color: #000000;
}

.ksq-best-price-popup__close:hover {
	background: #F5F5F5;
	transform: scale(1.05);
}

.ksq-best-price-popup__close svg {
	width: 11px;
	height: 11px;
}

@media (max-width: 768px) {
	.ksq-best-price-popup__close {
		display: none;
	}
}

/* ==========================================================================
   Drag Handle (Mobile)
   ========================================================================== */

.ksq-best-price-popup__handle {
	display: flex;
	justify-content: center;
	padding: 12px 0 8px;
	position: relative;
	z-index: 1;
}

.ksq-best-price-popup__handle-bar {
	width: 120px;
	height: 4px;
	background: #44007A;
	border-radius: 30px;
}

/* ==========================================================================
   Popup Header
   ========================================================================== */

.ksq-best-price-popup__header {
	text-align: center;
	padding: 16px 24px 20px;
	position: relative;
	z-index: 1;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__header {
		padding: 32px 32px 32px;
	}
}

.ksq-best-price-popup__title {
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 600;
	font-size: 32px;
	line-height: 38px;
	color: #44007A;
	margin: 0 0 8px;
}

.ksq-best-price-popup__title .woocommerce-Price-amount {
	font-weight: 600;
	font-size: 32px;
}

.ksq-best-price-popup__subtitle {
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 400;
	font-size: 16px;
	line-height: 19px;
	color: #444444;
	margin: 0;
}

/* Mobile header adjustments */
@media (max-width: 768px) {
	.ksq-best-price-popup__title {
		font-size: 22px;
		line-height: 26px;
	}
	
	.ksq-best-price-popup__title .woocommerce-Price-amount {
		font-size: 22px;
	}

	.ksq-best-price-popup__subtitle {
		font-size: 12px;
		line-height: 14px;
	}
}

/* ==========================================================================
   Popup Content
   ========================================================================== */

.ksq-best-price-popup__content {
	padding: 0 32px;
	overflow-y: auto;
	position: relative;
	z-index: 1;
}

@media (max-width: 768px) {
	.ksq-best-price-popup__content {
		padding: 0 24px;
	}
}

/* ==========================================================================
   Cards Container - Two-column on desktop, stacked on mobile
   ========================================================================== */

.ksq-best-price-popup__cards {
	display: flex;
	align-items: stretch;
	gap: 0;
	position: relative;
}

/* Desktop: side-by-side with 12px gap */
@media (min-width: 769px) {
	.ksq-best-price-popup__cards {
		flex-direction: row;
		gap: 12px;
	}

	.ksq-best-price-popup__cards > .ksq-best-price-popup__card {
		flex: 1;
		min-width: 0;
	}
}

/* Mobile: stacked */
@media (max-width: 768px) {
	.ksq-best-price-popup__cards {
		flex-direction: column;
	}
}

/* ==========================================================================
   Card
   ========================================================================== */

.ksq-best-price-popup__card {
	background: #FFFFFF;
	border: 1px solid #D9D9D9;
	border-radius: 10px;
	padding: 16px;
	margin-bottom: 0;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__card {
		padding: 20px;
	}
}

.ksq-best-price-popup__card-header {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 8px;
}

.ksq-best-price-popup__card-icon {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ksq-best-price-popup__card-icon svg {
	width: 20px;
	height: 20px;
}

.ksq-best-price-popup__card-title-row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1;
}

.ksq-best-price-popup__card-code {
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 600;
	font-size: 16px;
	line-height: 19px;
	color: #222222;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__card-code {
		font-size: 18px;
		line-height: 21px;
	}
}

.ksq-best-price-popup__card-title {
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 600;
	font-size: 16px;
	line-height: 19px;
	color: #222222;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__card-title {
		font-size: 18px;
		line-height: 21px;
	}
}

/* Copy Button */
.ksq-best-price-popup__copy-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	background: transparent;
	border: none;
	cursor: pointer;
	color: #444444;
	padding: 0;
	transition: all 0.2s ease;
}

.ksq-best-price-popup__copy-btn:hover {
	color: #222222;
}

.ksq-best-price-popup__copy-btn.copied {
	color: #2CA003;
}

.ksq-best-price-popup__copy-btn svg {
	width: 16px;
	height: 16px;
}

/* Card Description */
.ksq-best-price-popup__card-desc {
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 400;
	font-size: 12px;
	line-height: 16px;
	color: #444444;
	margin: 0 0 14px;
	padding-left: 32px;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__card-desc {
		font-size: 14px;
		line-height: 18px;
	}
}

/* ==========================================================================
   Details Row
   ========================================================================== */

.ksq-best-price-popup__details-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-top: 14px;
	border-top: 1px dashed #D9D9D9;
}

.ksq-best-price-popup__use-note {
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 500;
	font-size: 14px;
	line-height: 16px;
	color: #8F98AA;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__use-note {
		font-size: 16px;
	}
}

.ksq-best-price-popup__details-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: none;
	border: none;
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 500;
	font-size: 12px;
	line-height: 16px;
	color: #0075BC;
	cursor: pointer;
	padding: 4px;
	transition: opacity 0.2s ease;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__details-btn {
		font-size: 16px;
		gap: 8px;
	}
}

.ksq-best-price-popup__details-btn:hover {
	opacity: 0.8;
}

.ksq-best-price-popup__details-btn svg {
	transition: transform 0.3s ease;
}

.ksq-best-price-popup__details-btn[aria-expanded="true"] svg {
	transform: rotate(180deg);
}

/* ==========================================================================
   Expandable Details
   ========================================================================== */

.ksq-best-price-popup__details {
	overflow: hidden;
	max-height: 200px;
	opacity: 1;
	margin-top: 12px;
	transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}

.ksq-best-price-popup__details[hidden] {
	max-height: 0;
	opacity: 0;
	margin-top: 0;
}

.ksq-best-price-popup__details-list {
	margin: 0;
	padding: 0 0 0 16px;
	list-style: disc;
}

.ksq-best-price-popup__details-list li {
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 400;
	font-size: 12px;
	line-height: 16px;
	color: #8F98AA;
	margin-bottom: 4px;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__details-list li {
		font-size: 14px;
		line-height: 18px;
	}
}

.ksq-best-price-popup__details-list li:last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   Divider with Plus Icon
   ========================================================================== */

.ksq-best-price-popup__divider {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	z-index: 2;
}

/* Desktop: absolutely centered between cards */
@media (min-width: 769px) {
	.ksq-best-price-popup__divider {
		position: absolute;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
		padding: 0;
		margin: 0;
		width: auto;
	}
}

/* Mobile: overlap cards so total gap is 16px with 32px icon */
@media (max-width: 768px) {
	.ksq-best-price-popup__divider {
		padding: 0;
		margin: -8px auto;
	}
}

.ksq-best-price-popup__divider-icon {
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #FFFFFF;
	border: 1px solid #D9D9D9;
	border-radius: 6px;
	box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.12);
	color: #000000;
	flex-shrink: 0;
}

.ksq-best-price-popup__divider-icon svg {
	width: 12px;
	height: 12px;
}

/* ==========================================================================
   Logos Section
   ========================================================================== */

.ksq-best-price-popup__logos {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-left: 32px;
	margin-top: 16px;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__logos {
		gap: 16px;
	}
}

.ksq-best-price-popup__logo {
	display: flex;
	align-items: center;
	height: 20px;
}

.ksq-best-price-popup__logo img {
	height: 20px;
	width: auto;
	object-fit: contain;
}

.ksq-best-price-popup__logo svg {
	height: 20px;
	width: auto;
}

.ksq-best-price-popup__logo--zelle svg {
	color: #6D1ED4;
}

.ksq-best-price-popup__logo--bitpay svg {
	color: #1A3B8B;
}

/* Card Info (payment card note - mirrors left card details row) */
.ksq-best-price-popup__card-info {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px dashed #D9D9D9;
}

.ksq-best-price-popup__card-info-label {
	display: block;
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 500;
	font-size: 14px;
	line-height: 16px;
	color: #8F98AA;
	margin-bottom: 8px;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__card-info-label {
		font-size: 16px;
	}
}

.ksq-best-price-popup__card-info-text {
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 400;
	font-size: 12px;
	line-height: 16px;
	color: #8F98AA;
	margin: 0;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__card-info-text {
		font-size: 14px;
		line-height: 18px;
	}
}

/* ==========================================================================
   Footer: Apply Button + Please Note
   ========================================================================== */

.ksq-best-price-popup__footer {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	padding: 20px 32px 24px;
	position: relative;
	z-index: 1;
}

@media (max-width: 768px) {
	.ksq-best-price-popup__footer {
		padding: 16px 24px 24px;
	}
}

/* ==========================================================================
   Apply Button
   ========================================================================== */

.ksq-best-price-popup__apply {
	display: flex;
	justify-content: center;
}

.ksq-best-price-popup__apply-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 16px 40px;
	background: #8238BE;
	border: none;
	border-radius: 12px;
	cursor: pointer;
	transition: all 0.3s ease;
}

.ksq-best-price-popup__apply-btn:hover {
	background: #6D1ED4;
	transform: translateY(-1px);
}

.ksq-best-price-popup__apply-btn:active {
	transform: translateY(0);
}

.ksq-best-price-popup__apply-btn:disabled {
	opacity: 0.7;
	cursor: not-allowed;
	transform: none;
}

@media (max-width: 768px) {
	.ksq-best-price-popup__apply-btn {
		width: 100%;
		padding: 16px 24px;
		border-radius: 12px;
	}
}

.ksq-best-price-popup__apply-text,
.ksq-best-price-popup__apply-loading,
.ksq-best-price-popup__apply-success {
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 600;
	font-size: 16px;
	line-height: 19px;
	color: #FFFFFF;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	white-space: nowrap;
}

@media (max-width: 768px) {
	.ksq-best-price-popup__apply-text,
	.ksq-best-price-popup__apply-loading,
	.ksq-best-price-popup__apply-success {
		font-size: 16px;
		line-height: 19px;
	}
}

.ksq-best-price-popup__apply-loading svg,
.ksq-best-price-popup__apply-success svg {
	width: 20px;
	height: 20px;
}

/* Spinner animation */
@keyframes ksqSpinner {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.ksq-spinner {
	animation: ksqSpinner 1s linear infinite;
}

/* Success state */
.ksq-best-price-popup__apply-btn.is-success {
	background: #2CA003;
}

/* ==========================================================================
   Please Note Section
   ========================================================================== */

.ksq-best-price-popup__note {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	width: 100%;
}

.ksq-best-price-popup__note-icon {
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ksq-best-price-popup__note-icon svg {
	width: 24px;
	height: 24px;
}

@media (min-width: 769px) {
	.ksq-best-price-popup__note-icon {
		width: 20px;
		height: 20px;
	}

	.ksq-best-price-popup__note-icon svg {
		width: 20px;
		height: 20px;
	}
}

.ksq-best-price-popup__note-text {
	font-family: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
	font-style: normal;
	font-weight: 500;
	font-size: 14px;
	line-height: 16px;
	color: #717987;
	margin: 0;
}

.ksq-best-price-popup__note-text strong {
	font-weight: 700;
	color: #717987;
}

@media (max-width: 768px) {
	.ksq-best-price-popup__note-text {
		font-size: 12px;
		line-height: 16px;
		font-weight: 700;
	}
}

/* ==========================================================================
   Animation - Copy Success
   ========================================================================== */

@keyframes copyPulse {
	0% { transform: scale(1); }
	50% { transform: scale(1.15); }
	100% { transform: scale(1); }
}

.ksq-best-price-popup__copy-btn.copied {
	animation: copyPulse 0.3s ease;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 480px) {
	.ksq-best-price-popup__content {
		padding: 0 24px;
	}
}

/* ==========================================================================
   Accessibility - Focus Styles
   ========================================================================== */

.ksq-best-price-trigger__btn:focus-visible,
.ksq-best-price-popup__close:focus-visible,
.ksq-best-price-popup__copy-btn:focus-visible,
.ksq-best-price-popup__details-btn:focus-visible {
	outline: 2px solid #8238BE;
	outline-offset: 2px;
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.ksq-best-price-overlay,
	.ksq-best-price-popup,
	.ksq-best-price-popup__details,
	.ksq-best-price-popup__details-btn svg,
	.ksq-best-price-popup__copy-btn {
		transition: none;
	}

	.ksq-best-price-popup__copy-btn.copied {
		animation: none;
	}
}
