/**
 * WhatsApp Checkout Pro - Premium Checkout Popup styles.
 *
 * Presentation only. No selector here affects validation rules, AJAX
 * calls, or order/invoice creation - those all live in email-capture.js
 * and the PHP AJAX handlers, none of which this file touches.
 */

:root {
	--wacp-ec-green: #25d366;
	--wacp-ec-green-dark: #1faa59;
	--wacp-ec-green-tint: #f0fbf5;
	--wacp-ec-green-border: #cdeed9;
	--wacp-ec-blue: #3b5fe2;
	--wacp-ec-blue-dark: #2b48c4;
	--wacp-ec-blue-tint: #f0f3ff;
	--wacp-ec-blue-border: #d2dbfb;
	--wacp-ec-ink: #1a2129;
	--wacp-ec-muted: #6b7280;
}

.wacp-ec-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(15, 23, 19, 0.6);
	backdrop-filter: blur(2px);
}

body.wacp-ec-open {
	overflow: hidden;
}

.wacp-ec-modal {
	position: relative;
	width: 100%;
	max-width: 460px;
	max-height: 92vh;
	overflow-y: auto;
	background: #ffffff;
	border-radius: 20px;
	padding: 32px 28px 26px;
	box-shadow: 0 24px 60px rgba(16, 24, 39, 0.25), 0 4px 12px rgba(16, 24, 39, 0.08);
	animation: wacp-ec-pop-in 0.22s ease;
}

@keyframes wacp-ec-pop-in {
	from {
		opacity: 0;
		transform: translateY(8px) scale(0.98);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.wacp-ec-close {
	position: absolute;
	top: 14px;
	right: 16px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: #f3f4f6;
	border-radius: 50%;
	font-size: 18px;
	line-height: 1;
	color: #6b7280;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.wacp-ec-close:hover {
	background: #e9ebee;
	color: #1a2129;
	transform: rotate(90deg);
}

/* ---------- Header ---------- */
.wacp-ec-header {
	text-align: center;
	margin: 0 0 22px;
}

.wacp-ec-title {
	margin: 0 0 6px;
	font-size: 22px;
	font-weight: 800;
	color: var(--wacp-ec-ink);
	letter-spacing: -0.01em;
}

.wacp-ec-subtitle {
	margin: 0;
	font-size: 14px;
	color: var(--wacp-ec-muted);
}

/* ---------- Back button ---------- */
.wacp-ec-back {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin: 0 0 14px;
	padding: 6px 4px;
	background: none;
	border: none;
	color: var(--wacp-ec-muted);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: color 0.15s ease;
}

.wacp-ec-back:hover {
	color: var(--wacp-ec-ink);
}

.wacp-ec-back[hidden] {
	display: none !important;
}

/* ---------- Customer Information ---------- */
.wacp-ec-customer-info[hidden] {
	display: none !important;
}

.wacp-ec-customer-info {
	margin: 0 0 22px;
	padding: 18px 18px 6px;
	background: #fafbfb;
	border: 1px solid #eef0f2;
	border-radius: 14px;
}

.wacp-ec-section-label {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 12.5px;
	font-weight: 700;
	color: #50575e;
	margin-bottom: 14px;
}

.wacp-ec-section-label svg {
	color: var(--wacp-ec-green-dark);
	flex-shrink: 0;
}

.wacp-ec-field {
	margin: 0 0 14px;
}

.wacp-ec-field[hidden] {
	display: none !important;
}

.wacp-ec-field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--wacp-ec-ink);
	margin-bottom: 6px;
}

.wacp-ec-field input {
	width: 100%;
	box-sizing: border-box;
	padding: 12px 14px;
	border: 1.5px solid #e2e6ea;
	border-radius: 10px;
	font-size: 14px;
	background: #ffffff;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wacp-ec-field input:focus {
	outline: none;
	border-color: var(--wacp-ec-green);
	box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.13);
}

.wacp-ec-field input.wacp-ec-input-error {
	border-color: #e25555;
	box-shadow: 0 0 0 3px rgba(226, 85, 85, 0.12);
}

@keyframes wacp-ec-shake {
	0%, 100% { transform: translateX(0); }
	20% { transform: translateX(-5px); }
	40% { transform: translateX(4px); }
	60% { transform: translateX(-3px); }
	80% { transform: translateX(2px); }
}

.wacp-ec-shake {
	animation: wacp-ec-shake 0.32s ease;
}

.wacp-ec-error {
	margin: 6px 0 0;
	font-size: 12px;
	font-weight: 600;
	color: #d23c3c;
}

.wacp-ec-error[hidden] {
	display: none !important;
}

/* ---------- Option cards ---------- */
.wacp-ec-options {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.wacp-ec-options[hidden] {
	display: none !important;
}

.wacp-ec-option-card {
	border-radius: 16px;
	padding: 18px;
	border: 1.5px solid transparent;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.wacp-ec-option-card:hover {
	transform: translateY(-2px);
}

.wacp-ec-option-card[hidden] {
	display: none !important;
}

.wacp-ec-option-whatsapp {
	background: var(--wacp-ec-green-tint);
	border-color: var(--wacp-ec-green-border);
}

.wacp-ec-option-whatsapp:hover {
	box-shadow: 0 10px 24px rgba(37, 211, 102, 0.16);
}

.wacp-ec-option-invoice {
	background: var(--wacp-ec-blue-tint);
	border-color: var(--wacp-ec-blue-border);
}

.wacp-ec-option-invoice:hover {
	box-shadow: 0 10px 24px rgba(59, 95, 226, 0.14);
}

/* Feature: Recommended Payment - purely additive emphasis on top of
   whichever card (WhatsApp or any provider) is currently marked
   Recommended in Settings -> Payment Methods. Thickens the card's own
   existing border-color and adds a neutral depth ring - no new color
   is introduced, every card keeps its own established color identity. */
.wacp-ec-is-recommended {
	border-width: 2.5px;
	box-shadow: 0 0 0 3px rgba(15, 23, 19, 0.05);
}

.wacp-ec-option-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 10px;
}

/* ---------- Step 1: compact method-picker rows ---------- */
.wacp-ec-card-compact {
	cursor: pointer;
	padding: 12px 14px;
}

.wacp-ec-card-compact:hover,
.wacp-ec-card-compact:focus-visible {
	box-shadow: 0 4px 14px rgba(16, 24, 39, 0.08);
}

.wacp-ec-card-compact:focus-visible {
	outline: 2px solid var(--wacp-ec-blue);
	outline-offset: 1px;
}

.wacp-ec-card-compact .wacp-ec-option-head {
	margin-bottom: 0;
}

.wacp-ec-card-compact .wacp-ec-option-icon {
	width: 34px;
	height: 34px;
}

.wacp-ec-card-compact .wacp-ec-option-icon svg {
	width: 19px;
	height: 19px;
}

.wacp-ec-card-compact .wacp-ec-option-title {
	font-size: 14px;
}

/* Everything below the header row is part of the expanded (step 2)
   card only - hidden while picking a method. */
.wacp-ec-card-compact .wacp-ec-option-desc,
.wacp-ec-card-compact .wacp-ec-trust-row,
.wacp-ec-card-compact .wacp-ec-option-button {
	display: none;
}

.wacp-ec-row-chevron {
	display: none;
	flex-shrink: 0;
	color: var(--wacp-ec-muted);
	margin-left: auto;
	pointer-events: none;
}

.wacp-ec-card-compact .wacp-ec-row-chevron {
	display: block;
}

/* ---------- Step transition (subtle fade, no heavy animation) ---------- */
@keyframes wacp-ec-step-fade {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.wacp-ec-step-fade {
	animation: wacp-ec-step-fade 0.18s ease;
}

.wacp-ec-option-icon {
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
}

.wacp-ec-option-whatsapp .wacp-ec-option-icon {
	background: #d9f7e4;
	color: var(--wacp-ec-green-dark);
}

.wacp-ec-option-invoice .wacp-ec-option-icon {
	background: #dde4fb;
	color: var(--wacp-ec-blue);
}

.wacp-ec-option-title-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.wacp-ec-option-title {
	font-size: 16px;
	font-weight: 800;
	letter-spacing: -0.005em;
}

.wacp-ec-option-whatsapp .wacp-ec-option-title {
	color: var(--wacp-ec-green-dark);
}

.wacp-ec-option-invoice .wacp-ec-option-title {
	color: var(--wacp-ec-blue-dark);
}

.wacp-ec-option-badge {
	display: inline-block;
	padding: 3px 9px;
	background: var(--wacp-ec-green-dark);
	color: #ffffff;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.04em;
	border-radius: 999px;
	text-transform: uppercase;
}

.wacp-ec-option-desc {
	margin: 0 0 16px;
	font-size: 13.5px;
	line-height: 1.5;
	color: #45524c;
}

.wacp-ec-option-invoice .wacp-ec-option-desc {
	color: #3c4566;
}

/* ---------- Option buttons ---------- */
.wacp-ec-option-button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	padding: 14px 18px;
	border: none;
	border-radius: 11px;
	font-size: 14.5px;
	font-weight: 700;
	color: #ffffff;
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
	-webkit-tap-highlight-color: transparent;
}

.wacp-ec-option-button:disabled {
	cursor: not-allowed;
	filter: saturate(0.85);
}

.wacp-ec-continue:not(.wacp-ec-continue-invoice) {
	background: linear-gradient(135deg, var(--wacp-ec-green-dark) 0%, var(--wacp-ec-green) 100%);
	box-shadow: 0 6px 16px rgba(31, 170, 89, 0.3);
}

.wacp-ec-continue:not(.wacp-ec-continue-invoice):hover {
	transform: translateY(-1px);
	box-shadow: 0 8px 20px rgba(31, 170, 89, 0.38);
}

.wacp-ec-continue-invoice {
	background: linear-gradient(135deg, var(--wacp-ec-blue-dark) 0%, var(--wacp-ec-blue) 100%);
	box-shadow: 0 6px 16px rgba(59, 95, 226, 0.28);
}

.wacp-ec-continue-invoice:hover {
	transform: translateY(-1px);
	box-shadow: 0 8px 20px rgba(59, 95, 226, 0.36);
}

.wacp-ec-chevron {
	flex-shrink: 0;
	pointer-events: none;
	transition: transform 0.15s ease;
}

.wacp-ec-option-button:hover .wacp-ec-chevron {
	transform: translateX(2px);
}

.wacp-ec-trust-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	margin: 0 0 16px;
}

.wacp-ec-trust-item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	font-weight: 600;
}

.wacp-ec-option-whatsapp .wacp-ec-trust-item {
	color: #2c8a55;
}

.wacp-ec-option-whatsapp .wacp-ec-trust-item svg {
	color: var(--wacp-ec-green-dark);
}

.wacp-ec-option-invoice .wacp-ec-trust-item {
	color: #4458c2;
}

.wacp-ec-option-invoice .wacp-ec-trust-item svg {
	color: var(--wacp-ec-blue);
}

.wacp-ec-trust-item svg {
	flex-shrink: 0;
}

/* ---------- Divider ---------- */
.wacp-ec-divider {
	position: relative;
	text-align: center;
	height: 1px;
	background: #ebedf0;
	margin: 2px 0;
}

.wacp-ec-divider[hidden] {
	display: none !important;
}

.wacp-ec-divider span {
	position: relative;
	top: -11px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 22px;
	background: #ffffff;
	border: 1px solid #ebedf0;
	border-radius: 999px;
	font-size: 10px;
	font-weight: 800;
	color: #9aa1ab;
}

/* ---------- Invoice status message ---------- */
.wacp-ec-invoice-status {
	margin: 16px 0 0;
	padding: 14px 16px;
	border-radius: 12px;
	font-size: 13.5px;
	font-weight: 600;
	text-align: center;
}

.wacp-ec-invoice-status[hidden] {
	display: none !important;
}

.wacp-ec-invoice-status.is-success {
	background: #e7f7ed;
	color: #1a7a3c;
}

.wacp-ec-invoice-status.is-error {
	background: #fdecec;
	color: #9b1c1c;
}

/* ---------- Footer trust line ---------- */
.wacp-ec-footer-trust {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 16px;
	margin: 22px 0 0;
	padding-top: 16px;
	border-top: 1px solid #f0f1f3;
}

.wacp-ec-footer-item {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 11.5px;
	font-weight: 600;
	color: #9aa1ab;
}

.wacp-ec-footer-item svg {
	flex-shrink: 0;
	color: #b7bcc4;
}

/* ====================================================================
   Mobile (≤480px) - bottom sheet layout
   ====================================================================
   Desktop/tablet (>480px) keeps the exact centered-modal styles above,
   completely unchanged. Below this width, the same popup becomes a
   bottom sheet instead - anchored to the bottom edge, rounded top
   corners only, slides up - which is what actually solves "can't see
   both options without scrolling": it gives the content more usable
   height than a vertically-centered modal can on a short viewport, on
   top of every spacing/sizing value below being tightened.

   No JavaScript changes anywhere in this file's scope - every existing
   interaction (close button, click-outside, Escape key, the two AJAX
   flows) is the same code, same timing, same behaviour. The drag-handle
   bar is a visual cue only (a ::before pseudo-element - no new markup),
   not a working swipe gesture; adding real drag-to-dismiss would mean
   new touch-event JavaScript, which is exactly the "popup logic" this
   redesign was asked not to touch.
*/
@media (max-width: 480px) {
	.wacp-ec-overlay {
		align-items: flex-end;
		padding: 0;
	}

	.wacp-ec-modal {
		max-width: 100%;
		max-height: 88vh;
		border-radius: 20px 20px 0 0;
		padding: 22px 16px 14px;
		animation: wacp-ec-slide-up 0.22s ease;
	}

	.wacp-ec-modal::before {
		content: "";
		position: absolute;
		top: 9px;
		left: 50%;
		width: 36px;
		height: 4px;
		margin-left: -18px;
		border-radius: 999px;
		background: #dadde1;
		pointer-events: none;
	}

	@keyframes wacp-ec-slide-up {
		from {
			opacity: 0.4;
			transform: translateY(60px);
		}
		to {
			opacity: 1;
			transform: translateY(0);
		}
	}

	/* Header */
	.wacp-ec-close {
		top: 10px;
		right: 10px;
		width: 40px;
		height: 40px;
		font-size: 16px;
	}

	.wacp-ec-header {
		margin: 2px 30px 12px 0;
		text-align: left;
	}

	.wacp-ec-title {
		font-size: 18px;
		margin-bottom: 2px;
	}

	.wacp-ec-subtitle {
		font-size: 12.5px;
	}

	/* Customer info - compact */
	.wacp-ec-customer-info {
		padding: 12px 12px 2px;
		margin-bottom: 12px;
		border-radius: 12px;
	}

	.wacp-ec-section-label {
		font-size: 11.5px;
		margin-bottom: 10px;
	}

	.wacp-ec-field {
		margin-bottom: 10px;
	}

	.wacp-ec-field label {
		font-size: 12px;
		margin-bottom: 4px;
	}

	.wacp-ec-field input {
		box-sizing: border-box;
		min-height: 46px;
		padding: 10px 12px;
		font-size: 14px;
	}

	/* Option cards */
	.wacp-ec-options {
		gap: 10px;
	}

	.wacp-ec-option-card {
		padding: 13px 14px;
		border-radius: 14px;
	}

	.wacp-ec-option-card:hover {
		/* Hover-lift is a mouse affordance; on touch it can stick after a
		   tap and looks like a glitch, so it's switched off below this
		   width rather than fighting :hover state on touchscreens. */
		transform: none;
	}

	.wacp-ec-option-head {
		gap: 9px;
		margin-bottom: 6px;
	}

	.wacp-ec-option-icon {
		width: 32px;
		height: 32px;
	}

	.wacp-ec-option-icon svg {
		width: 17px;
		height: 17px;
	}

	.wacp-ec-option-title {
		font-size: 13.5px;
	}

	.wacp-ec-option-badge {
		font-size: 9px;
		padding: 2px 7px;
	}

	/* Visually shortened to roughly one sentence without touching the
	   underlying text (which is shared with desktop) - line-clamp trims
	   the rendered text, not the string itself. */
	.wacp-ec-option-desc {
		margin-bottom: 8px;
		font-size: 12px;
		line-height: 1.4;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 1;
		line-clamp: 1;
		overflow: hidden;
	}

	.wacp-ec-trust-row {
		gap: 4px 8px;
		margin-bottom: 10px;
	}

	.wacp-ec-trust-item {
		font-size: 10.5px;
	}

	.wacp-ec-option-button {
		min-height: 52px;
		padding: 10px 14px;
		font-size: 13.5px;
		border-radius: 12px;
	}

	.wacp-ec-chevron {
		width: 14px;
		height: 14px;
	}

	.wacp-ec-divider {
		margin: 0;
	}

	.wacp-ec-divider span {
		width: 24px;
		height: 20px;
		font-size: 9px;
	}

	.wacp-ec-invoice-status {
		margin-top: 10px;
		padding: 10px 12px;
		font-size: 12.5px;
	}

	/* Bottom area: one short trust line instead of the full four-item
	   row - the others stay in the DOM (so desktop is unaffected) and
	   are simply hidden at this width. */
	.wacp-ec-footer-trust {
		margin-top: 14px;
		padding-top: 12px;
		gap: 6px;
	}

	.wacp-ec-footer-item:not(:first-child) {
		display: none;
	}

	.wacp-ec-footer-item {
		font-size: 11px;
	}
}

/* Extra-narrow phones (iPhone SE / small Android, ~320-360px) */
@media (max-width: 360px) {
	.wacp-ec-modal {
		padding: 20px 13px 12px;
	}

	.wacp-ec-title {
		font-size: 17px;
	}

	.wacp-ec-option-card {
		padding: 11px 12px;
	}

	.wacp-ec-customer-info {
		padding: 10px 10px 2px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wacp-ec-modal,
	.wacp-ec-option-card,
	.wacp-ec-option-button,
	.wacp-ec-close,
	.wacp-ec-chevron {
		animation: none !important;
		transition: none !important;
	}
}
