/**
 * Checkout – Phone Country Code: fit intl-tel-input into the LMB Checkout
 * field style (checkout-layout.css: 46px fields, 8px radius, floating labels).
 *
 * --lmb-iti-pad is copied by checkout-phone-country.js from the inline
 * padding-left intl-tel-input reserves for the flag + dial code (the layout
 * stylesheet's `padding: 12px !important` would otherwise override it).
 */

:is(#billing_phone_field, #shipping_phone_field) .iti {
	display: block;
	width: 100%;
	--iti-border-color: var(--lmb-line, #dcd8d0);
	--iti-hover-color: rgba(40, 40, 40, .05);
	--iti-icon-color: var(--lmb-muted, #6f6d69);
	--iti-spacer-horizontal: 10px;
}

/* Two ids: outranks checkout-layout.css's field padding rule. */
.elementor-widget-lmb-checkout .woocommerce #customer_details :is(#billing_phone_field, #shipping_phone_field) .iti input.input-text,
:is(#billing_phone_field, #shipping_phone_field) .iti input:is(#billing_phone, #shipping_phone) {
	padding-left: var(--lmb-iti-pad, 92px) !important;
}

/* Floating label starts where the number does, after "+234". */
.elementor-widget-lmb-checkout .woocommerce #customer_details :is(#billing_phone_field, #shipping_phone_field).lmb-float > label {
	left: calc(var(--lmb-iti-pad, 92px) + 1px);
}

/* Country button: full field height, rounded like the field, subtle divider. */
:is(#billing_phone_field, #shipping_phone_field) .iti__country-container {
	top: 1px;
	bottom: 1px;
	left: 1px;
}

/*
 * The country selector is a <button>, so the Elementor kit's global button
 * styles and the checkout widget's button settings (border, 8px radius,
 * padding, Sackersgothic letter-spaced type, charcoal hover) all hit it.
 * Reset them with selectors that outrank those rules so it reads as part
 * of the field: flag + chevron + dial code, a hairline divider, no box.
 */
body .elementor-widget-lmb-checkout :is(#billing_phone_field, #shipping_phone_field) .iti button.iti__selected-country,
body .elementor-widget-lmb-checkout :is(#billing_phone_field, #shipping_phone_field) .iti button.iti__selected-country:hover,
body .elementor-widget-lmb-checkout :is(#billing_phone_field, #shipping_phone_field) .iti button.iti__selected-country:focus,
body .elementor-widget-lmb-checkout :is(#billing_phone_field, #shipping_phone_field) .iti button.iti__selected-country:active {
	display: flex !important;
	align-items: center !important;
	gap: 0 !important;
	width: auto !important;
	height: 100% !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 10px 0 12px !important;
	border: 0 !important;
	border-right: 1px solid var(--lmb-line, #dcd8d0) !important;
	border-radius: 7px 0 0 7px !important;
	background: transparent !important;
	box-shadow: none !important;
	outline: none !important;
	color: var(--lmb-ink, #282828) !important;
	font-family: var(--lmb-font, "Satoshi", sans-serif) !important;
	font-size: 14px !important;
	font-weight: 400 !important;
	line-height: 1.3 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-decoration: none !important;
	transition: background-color .15s ease !important;
}

body .elementor-widget-lmb-checkout :is(#billing_phone_field, #shipping_phone_field) .iti button.iti__selected-country:hover {
	background: rgba(40, 40, 40, .04) !important;
}

body .elementor-widget-lmb-checkout :is(#billing_phone_field, #shipping_phone_field) .iti button.iti__selected-country:focus-visible {
	background: rgba(40, 40, 40, .06) !important;
}

:is(#billing_phone_field, #shipping_phone_field) .iti__selected-country-primary {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 0 !important;
}

:is(#billing_phone_field, #shipping_phone_field) .iti__selected-dial-code {
	margin: 0 0 0 6px !important;
	font-family: var(--lmb-font, "Satoshi", sans-serif) !important;
	font-size: 14px !important;
	letter-spacing: normal !important;
	color: var(--lmb-ink, #282828) !important;
}


/* Library's own hover/open tint sits on the inner flag+chevron box only;
   the whole button gets the tint instead (rules above). */
body :is(#billing_phone_field, #shipping_phone_field) .iti .iti__selected-country-primary,
body :is(#billing_phone_field, #shipping_phone_field) .iti .iti__selected-country:hover .iti__selected-country-primary,
body :is(#billing_phone_field, #shipping_phone_field) .iti .iti__selected-country[aria-expanded="true"] .iti__selected-country-primary {
	background: transparent !important;
}

body .elementor-widget-lmb-checkout :is(#billing_phone_field, #shipping_phone_field) .iti button.iti__selected-country[aria-expanded="true"] {
	background: rgba(40, 40, 40, .05) !important;
}

/* ── Country list (inline dropdown on desktop; the library may open it as
   a full-screen popup on small screens – both use .iti__country-selector) ── */

body .iti__country-selector {
	z-index: 60 !important; /* above the floating labels (z-index 2) below the field */
	margin-top: 4px;
	overflow: hidden;
	border: 1px solid var(--lmb-line, #dcd8d0) !important;
	border-radius: var(--lmb-radius, 8px) !important;
	background: #fff !important;
	box-shadow: 0 12px 32px rgba(40, 40, 40, .14) !important;
	font-family: var(--lmb-font, "Satoshi", sans-serif) !important;
	color: var(--lmb-ink, #282828);
}

body .iti__country-selector .iti__search-input-wrapper {
	position: relative;
	padding: 8px !important;
	border-bottom: 1px solid var(--lmb-line, #dcd8d0) !important;
}

body .iti__country-selector .iti__search-icon {
	left: 20px !important;
	color: var(--lmb-muted, #6f6d69);
}

body .iti__country-selector input.iti__search-input {
	width: 100% !important;
	height: 40px !important;
	margin: 0 !important;
	padding: 8px 36px 8px 36px !important;
	border: 1px solid var(--lmb-line, #dcd8d0) !important;
	border-radius: 6px !important;
	outline: none !important;
	box-shadow: none !important;
	background: #fff !important;
	color: var(--lmb-ink, #282828) !important;
	font-family: var(--lmb-font, "Satoshi", sans-serif) !important;
	font-size: 14px !important;
}

body .iti__country-selector input.iti__search-input:focus {
	border-color: var(--lmb-ink, #282828) !important;
	box-shadow: 0 0 0 1px var(--lmb-ink, #282828) !important;
}

/* Clear-search "×" is a <button>: strip the theme's button styling. */
body .iti__country-selector button.iti__search-clear,
body .iti__country-selector button.iti__search-clear:hover,
body .iti__country-selector button.iti__search-clear:focus {
	right: 16px !important;
	width: 24px !important;
	height: 24px !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--lmb-muted, #6f6d69) !important;
}

body .iti__country-selector .iti__country-list {
	max-height: 264px;
	margin: 0 !important;
	padding: 4px 0 !important;
}

/* `body … li.iti__country` outranks the widget's custom CSS
   (`selector li { margin-bottom: 10px !important }`). */
body .iti__country-selector .iti__country-list > li.iti__country {
	display: flex !important;
	align-items: center;
	gap: 10px;
	margin: 0 !important;
	padding: 9px 14px !important;
	border: 0 !important;
	font-family: var(--lmb-font, "Satoshi", sans-serif) !important;
	font-size: 14px !important;
	line-height: 1.3 !important;
	color: var(--lmb-ink, #282828) !important;
	cursor: pointer;
}

body .iti__country-selector .iti__country-list > li.iti__country.iti__highlight {
	background: var(--lmb-selected, #fbf3f3) !important;
}

body .iti__country-selector .iti__country-list > li.iti__country[aria-selected="true"] {
	font-weight: 600 !important;
}

body .iti__country-selector .iti__country-name {
	margin: 0 !important;
	color: var(--lmb-ink, #282828) !important;
}

body .iti__country-selector .iti__dial-code {
	margin-left: 4px;
	font-weight: 400;
	color: var(--lmb-muted, #6f6d69) !important;
}

body .iti__country-selector .iti__country-check {
	margin-left: auto !important;
	color: var(--lmb-ink, #282828);
}

body .iti__country-selector .iti__no-results {
	padding: 14px !important;
	font-size: 14px;
	color: var(--lmb-muted, #6f6d69);
	text-align: center;
}

/* Phones: the library opens a full-screen popup. Use the whole width and
   let the list grow to the space above the on-screen keyboard (the library
   keeps --iti-virtual-keyboard-height up to date while searching). */
body .iti.iti--fullscreen-popup {
	z-index: 2147483000 !important; /* above the cookie banner and chat bubble */
	padding: 12px !important;
	background-color: rgba(40, 40, 40, .45) !important;
}

body .iti--fullscreen-popup .iti__country-selector {
	width: 100% !important;
	max-width: none !important;
	margin-top: 0;
}

body .iti--fullscreen-popup .iti__country-list {
	max-height: calc(100dvh - 24px - 58px - var(--iti-virtual-keyboard-height, 0px)) !important;
}

body .iti--fullscreen-popup .iti__country-list > li.iti__country {
	padding: 12px 14px !important; /* comfortable tap targets */
	font-size: 15px !important;
}

/* Validation message. */
:is(#billing_phone_field, #shipping_phone_field) .lmb-phone-error {
	margin: 6px 0 0 !important;
	padding: 0 !important;
	font-family: var(--lmb-font, "Satoshi", sans-serif);
	font-size: 13px;
	line-height: 1.35;
	color: var(--lmb-error, #b42318);
}

.elementor-widget-lmb-checkout .woocommerce #customer_details :is(#billing_phone_field, #shipping_phone_field).lmb-phone-invalid .iti input.input-text {
	border-color: var(--lmb-error, #b42318) !important;
	box-shadow: 0 0 0 1px var(--lmb-error, #b42318) !important;
}

/* Shown while "Pay now" waits for the phone-number data to finish loading. */
:is(#billing_phone_field, #shipping_phone_field) .lmb-phone-checking {
	margin: 6px 0 0 !important;
	padding: 0 !important;
	font-family: var(--lmb-font, "Satoshi", sans-serif);
	font-size: 13px;
	color: var(--lmb-muted, #6f6d69);
}
