/* Yapara Express Checkout — modal & form styling
 * Uses the saved Elementor global color "blue yp" (id a1480d8 = #0047AB)
 * and "blue logo" (id 8252390 = #476FA8) for the hover state.
 */

:root {
	--yec-blue:        var( --e-global-color-a1480d8, #0047AB );
	--yec-blue-hover:  var( --e-global-color-8252390, #003580 );
	--yec-text:        #111;
	--yec-muted:       #6c757d;
	--yec-bg-soft:     #f8f9fa;
	--yec-border:      #d8dde2;
	--yec-error:       #cc0000;
}

.yec-wrap {
	display: block !important;
	width: 100% !important;
	box-sizing: border-box;
	margin: 12px 0;
}

/* Trigger button — sized to match the site's Add-to-Cart button (Rajdhani 20px bold,
 * 12px vertical padding, 1px border, 10px radius), tinted in the brand green. */
.yec-wrap > .yec-open,
button.yec-open {
	display: block !important;
	width: 100% !important;
	box-sizing: border-box !important;
	padding: 12px 0 !important;
	font-family: "Rajdhani", Sans-serif !important;
	font-size: 20px !important;
	font-weight: bold !important;
	line-height: 1.2 !important;
	text-align: center !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	border-style: solid !important;
	border-width: 1px !important;
	border-radius: 10px !important;
	background: var( --e-global-color-238cf3d, #6DA475 ) !important;   /* "green logo" from your Elementor kit */
	background-image: none !important;
	border-color: #3F6E47 !important;                                   /* darker shade of the same green */
	color: #ffffff !important;
	cursor: pointer !important;
	box-shadow: none !important;
	transition: all 0.5s !important;
}
.yec-wrap > .yec-open:hover,
button.yec-open:hover {
	background: #ffffff !important;
	color: #000000 !important;
	border-color: #000000 !important;
}
.yec-wrap > .yec-open:active,
button.yec-open:active { transform: translateY( 1px ) !important; }
.yec-wrap > .yec-open:disabled,
button.yec-open:disabled { opacity: 0.5 !important; cursor: not-allowed !important; transform: none !important; }

/* Modal */
body.yec-no-scroll { overflow: hidden; }

.yec-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: flex-start;
	justify-content: center;
	padding: 24px 12px;
	overflow-y: auto;
}
.yec-modal.is-active { display: flex; }

.yec-backdrop {
	position: fixed;
	inset: 0;
	background: rgba( 0, 0, 0, 0.55 );
	backdrop-filter: blur( 2px );
	cursor: pointer;
}

.yec-card {
	position: relative;
	width: 100%;
	max-width: 480px;
	margin: auto;
	background: #ffffff;
	border-radius: 14px;
	padding: 28px 22px 22px;
	box-shadow: 0 18px 48px rgba( 0, 0, 0, 0.22 );
	font-family: inherit;
	color: var( --yec-text );
	animation: yec-in 0.18s ease-out;
	box-sizing: border-box;
	overflow-x: hidden;        /* anything wide is clipped, never escapes */
}
.yec-card * { box-sizing: border-box; }
.yec-card img { max-width: 100%; height: auto; }
.yec-card .yec-product,
.yec-card .yec-product-info { min-width: 0; }     /* allow flex children to shrink */
.yec-card input,
.yec-card select,
.yec-card textarea,
.yec-card .yec-submit { max-width: 100%; }

@keyframes yec-in {
	from { opacity: 0; transform: translateY( -8px ); }
	to   { opacity: 1; transform: translateY(   0   ); }
}
@media ( prefers-reduced-motion: reduce ) {
	.yec-card { animation: none; }
}

.yec-close {
	position: absolute;
	top: 6px;
	right: 10px;
	width: 36px;
	height: 36px;
	border: none;
	background: transparent;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #555;
}
.yec-close:hover { color: #000; }

.yec-title {
	margin: 0 0 14px;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var( --yec-blue );
}

/* Product info block */
.yec-product {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	margin-bottom: 14px;
	background: var( --yec-bg-soft );
	border: 1px solid var( --yec-border );
	border-radius: 10px;
}
.yec-product-thumb {
	flex: 0 0 60px;
	width: 60px;
	height: 60px;
	object-fit: cover;
	border-radius: 8px;
	background: #fff;
	border: 1px solid var( --yec-border );
}
.yec-product-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1;
}
.yec-product-name {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.25;
	color: var( --yec-text );
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}
.yec-product-attrs {
	font-size: 12px;
	color: var( --yec-muted );
	font-style: italic;
}
.yec-product-attrs:empty { display: none; }
.yec-product-price {
	font-size: 15px;
	font-weight: 700;
	color: var( --yec-blue );
	margin-top: 2px;
}
.yec-product-price del { color: var( --yec-muted ); font-weight: 400; margin-right: 4px; }
.yec-product-price ins { text-decoration: none; }

/* Form fields */
.yec-form { display: flex; flex-direction: column; gap: 12px; }
.yec-row { display: flex; gap: 12px; }
.yec-row > * { flex: 1; min-width: 0; }
@media ( max-width: 480px ) {
	.yec-row-2 { flex-direction: column; gap: 12px; }
}

.yec-field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.yec-field > span {
	color: #333;
	font-weight: 600;
	font-size: 13px;
}
.yec-field-state { display: block; }
.yec-field input,
.yec-field textarea,
.yec-field select {
	width: 100%;
	padding: 10px 12px;
	font-size: 15px;
	font-family: inherit;
	color: var( --yec-text );
	background: #fff;
	border: 1px solid #ccc;
	border-radius: 8px;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.yec-field input:focus,
.yec-field textarea:focus,
.yec-field select:focus {
	outline: none;
	border-color: var( --yec-blue );
	box-shadow: 0 0 0 3px rgba( 0, 71, 171, 0.18 );
}
.yec-field textarea { resize: vertical; min-height: 60px; }

/* Inline error state */
.yec-field.yec-field-error input,
.yec-field.yec-field-error textarea,
.yec-field.yec-field-error select,
.yec-field.yec-field-error .yec-state-btn {
	border-color: var( --yec-error ) !important;
	background: #fff7f7;
}
.yec-inline-error {
	color: var( --yec-error );
	font-size: 12px;
	margin-top: 2px;
	font-weight: 600;
}

/* =====================================================================
 * Custom searchable state picker (replaces both <select> and Choices.js).
 * Same UI on iPhone, Android and desktop.
 * ===================================================================*/
.yec-field-state {
	position: relative;
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box;
}

/* Trigger button — black on white, full width, no theme hover bleed-through. */
.yec-field-state > .yec-state-btn,
button.yec-state-btn {
	display: flex !important;
	align-items: center !important;
	justify-content: space-between !important;
	gap: 8px !important;
	width: 100% !important;
	max-width: 100% !important;
	min-height: 44px !important;
	padding: 10px 14px !important;
	box-sizing: border-box !important;
	background: #ffffff !important;
	background-image: none !important;
	border: 1px solid #ccc !important;
	border-radius: 8px !important;
	font-family: inherit !important;
	font-size: 15px !important;
	font-weight: 400 !important;
	letter-spacing: 0 !important;
	text-transform: none !important;
	color: #111 !important;
	text-align: left !important;
	cursor: pointer !important;
	box-shadow: none !important;
	-webkit-tap-highlight-color: transparent !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}
.yec-field-state > .yec-state-btn:hover,
button.yec-state-btn:hover {
	background: #ffffff !important;
	color: #111 !important;
	border-color: #999 !important;
}
.yec-field-state > .yec-state-btn:active,
button.yec-state-btn:active {
	background: #ffffff !important;
	color: #111 !important;
	transform: none !important;
}
.yec-field-state > .yec-state-btn[aria-expanded="true"],
.yec-field-state > .yec-state-btn:focus,
.yec-field-state > .yec-state-btn:focus-visible,
button.yec-state-btn[aria-expanded="true"],
button.yec-state-btn:focus {
	outline: none !important;
	background: #ffffff !important;
	color: #111 !important;
	border-color: #111 !important;
	box-shadow: none !important;
}
.yec-state-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 1;
	min-width: 0;
	color: inherit;
}

/* Caret — clean two-border chevron, vertically centered next to the label. */
.yec-state-caret {
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	border-right: 2px solid #555;
	border-bottom: 2px solid #555;
	transform: translateY( -2px ) rotate( 45deg );
	transform-origin: center;
	transition: transform 0.15s ease;
}
.yec-field-state.is-open .yec-state-caret {
	transform: translateY( 2px ) rotate( -135deg );
}

.yec-state-pop {
	position: absolute;
	top: calc( 100% + 4px );
	left: 0;
	right: 0;
	z-index: 10;
	background: #fff;
	border: 1px solid var( --yec-border );
	border-radius: 10px;
	box-shadow: 0 12px 28px rgba( 0, 0, 0, 0.18 );
	overflow: hidden;
	display: flex;
	flex-direction: column;
	max-height: 280px;
}
.yec-state-search-wrap {
	padding: 8px 8px 6px;
	border-bottom: 1px solid var( --yec-border );
	background: #fff;
	flex-shrink: 0;
}
.yec-state-search {
	width: 100%;
	padding: 9px 12px !important;
	font-size: 16px !important;       /* prevents iOS auto-zoom */
	line-height: 1.2;
	border: 1px solid #ccc !important;
	border-radius: 6px !important;
	background: #fff;
	box-sizing: border-box;
}
.yec-state-search:focus {
	outline: none;
	border-color: var( --yec-blue ) !important;
	box-shadow: 0 0 0 3px rgba( 0, 71, 171, 0.18 );
}
.yec-state-list {
	margin: 0;
	padding: 4px 0;
	list-style: none;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	flex: 1;
}
.yec-state-list li[data-value] {
	padding: 10px 14px;
	font-size: 15px;
	color: var( --yec-text );
	cursor: pointer;
	user-select: none;
	-webkit-tap-highlight-color: rgba( 0, 71, 171, 0.12 );
	border-bottom: 1px solid #f1f3f5;
}
.yec-state-list li[data-value]:last-child { border-bottom: 0; }
.yec-state-list li[data-value]:hover,
.yec-state-list li[data-value]:focus,
.yec-state-list li[data-value].is-active { background: #f1f5fb; }
.yec-state-empty {
	padding: 14px;
	font-size: 14px;
	color: var( --yec-muted );
	text-align: center;
	font-style: italic;
}

/* Live totals summary */
.yec-totals {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 12px 14px;
	margin-top: 4px;
	background: var( --yec-bg-soft );
	border: 1px solid var( --yec-border );
	border-radius: 10px;
}
.yec-totals-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 14px;
	color: #333;
}
.yec-totals-row strong { color: var( --yec-text ); font-weight: 700; }
.yec-totals-grand {
	border-top: 1px solid var( --yec-border );
	padding-top: 8px;
	margin-top: 4px;
	font-size: 16px;
}
.yec-totals-grand strong {
	color: var( --yec-blue );
	font-size: 18px;
}
.yec-totals-pay {
	font-size: 13px;
	color: var( --yec-muted );
}
.yec-totals-pay strong { color: #333; font-weight: 700; }

/* Errors list (global) */
.yec-errors { display: flex; flex-direction: column; gap: 4px; }
.yec-error-line {
	color: var( --yec-error );
	background: #fff5f5;
	border: 1px solid #f5c2c2;
	border-radius: 8px;
	padding: 8px 12px;
	margin: 0;
	font-size: 14px;
	font-weight: 600;
}

/* Submit button */
.yec-submit {
	margin-top: 6px;
	padding: 14px 18px;
	font-size: 16px;
	font-weight: 700;
	color: #fff;
	background: var( --yec-blue );
	border: none;
	border-radius: 10px;
	cursor: pointer;
	transition: background 0.2s ease, opacity 0.2s ease;
}
.yec-submit:hover { background: var( --yec-blue-hover ); }
.yec-submit:disabled,
.yec-submit.is-disabled {
	opacity: 0.45;
	cursor: not-allowed;
	background: #b0b6bc;
	color: #f3f4f5;
}
.yec-submit.is-submitting {
	opacity: 0.65;
	cursor: progress;
	background: #888;
}

/* Form-wide loading state */
.yec-form.is-submitting input,
.yec-form.is-submitting select,
.yec-form.is-submitting textarea {
	pointer-events: none;
	background: #f6f6f6;
}

/* =====================================================================
 * Brevo (Sendinblue) chat launcher — coexistence with our sticky bar
 * and the Express Checkout popup.
 *
 * Brevo injects its launcher as a fixed-position iframe via the SDK loader.
 * On product pages we want:
 *   1. The launcher pushed up on mobile so it doesn't sit on top of the
 *      sticky Add-to-Cart / Commande Express bar.
 *   2. The launcher hidden entirely when the Express Checkout modal is open
 *      so it can't poke through the popup (avoids any z-index war).
 *
 * Selectors are defensive — Brevo has used several class/id schemes over
 * versions, so we cover them all. CSS scopes itself to single-product pages
 * because this stylesheet is only enqueued on is_product().
 * ===================================================================*/

/* 1) Lift the launcher above the sticky bar on mobile/tablet only. */
@media ( max-width: 1024px ) {
	iframe[ id^="brevo-conversations" ],
	iframe[ src*="brevo.com" ],
	iframe[ src*="sendinblue.com" ],
	#brevo-conversations,
	.brevo-conversations,
	.brevo-conversations-launcher,
	[ id*="brevo-conversations" ] {
		bottom: 90px !important;
		z-index: 90 !important;     /* well below our modal's 99999 */
	}
}

/* 2) Hide the launcher while the Express popup is open (any viewport). */
body.yec-no-scroll iframe[ id^="brevo-conversations" ],
body.yec-no-scroll iframe[ src*="brevo.com" ],
body.yec-no-scroll iframe[ src*="sendinblue.com" ],
body.yec-no-scroll #brevo-conversations,
body.yec-no-scroll .brevo-conversations,
body.yec-no-scroll .brevo-conversations-launcher,
body.yec-no-scroll [ id*="brevo-conversations" ] {
	display: none !important;
}

/* =====================================================================
 * Mobile (≤ 600 px) — make the popup truly fill the viewport
 * ===================================================================*/
@media ( max-width: 600px ) {
	/* Trigger button — smaller on phones */
	.yec-wrap > .yec-open,
	button.yec-open {
		padding: 10px 14px !important;
		font-size: 14px !important;
		font-weight: 700 !important;
		border-radius: 10px !important;
		line-height: 1.2 !important;
		letter-spacing: 0 !important;
	}

	.yec-modal {
		padding: 0;
		align-items: stretch;
		overflow-x: hidden;
	}
	.yec-card {
		max-width: 100vw;
		width: 100vw;
		min-height: 100vh;
		min-height: 100dvh;        /* respects mobile browser chrome */
		margin: 0;
		border-radius: 0;
		padding: 22px 14px 28px;   /* tighter horizontal padding */
		overflow-x: hidden;
	}
	.yec-close {
		top: 8px;
		right: 8px;
		width: 40px;
		height: 40px;
		font-size: 32px;
	}
	.yec-title { font-size: 18px; padding-right: 36px; }

	/* Product info: tighter on small screens */
	.yec-product { padding: 8px 10px; gap: 10px; }
	.yec-product-thumb { flex: 0 0 52px; width: 52px; height: 52px; }
	.yec-product-name { font-size: 13px; }

	/* Stack the row-2 (first/last name) on mobile */
	.yec-row-2 { flex-direction: column; gap: 10px; }

	/* Inputs: bigger tap target, prevent iOS auto-zoom (font ≥16) */
	.yec-field input,
	.yec-field textarea,
	.yec-field select,
	.yec-field .yec-state-btn {
		font-size: 16px;
		padding: 12px 12px;
		min-height: 46px;
	}

	/* Totals: a touch tighter */
	.yec-totals { padding: 10px 12px; gap: 5px; }
	.yec-totals-grand strong { font-size: 17px; }

	/* Submit: full width, generous tap target */
	.yec-submit {
		padding: 16px 18px;
		font-size: 17px;
		border-radius: 10px;
	}

	/* State picker — fill more vertical space on phones */
	.yec-state-pop { max-height: 60vh; }
	.yec-state-list li[data-value] { padding: 12px 14px; font-size: 16px; }
}

/* Very small phones (≤ 360 px) */
@media ( max-width: 360px ) {
	.yec-wrap > .yec-open,
	button.yec-open {
		padding: 9px 12px !important;
		font-size: 13px !important;
		border-radius: 8px !important;
	}
	.yec-card { padding: 18px 12px 24px; }
	.yec-title { font-size: 17px; }
	.yec-product-thumb { flex: 0 0 44px; width: 44px; height: 44px; }
}

/* Landscape phones — let the modal scroll, not cap height */
@media ( max-width: 900px ) and ( orientation: landscape ) {
	.yec-card { min-height: auto; }
}
