body.woocommerce-checkout #billing_phone_field,
body.woocommerce-account .woocommerce-EditAccountForm .form-row:has(.iti) {
	overflow: visible;
	position: relative;
	z-index: 20;
}

body.woocommerce-checkout #billing_phone_field.iti-open,
body.woocommerce-checkout #billing_phone_field:has(.iti__country-list:not(.iti__hide)) {
	z-index: 100;
}

/* ==========================================================================
   intl-tel-input — match .digi-auth-phone-row on login
   ========================================================================== */

body.woocommerce-checkout .iti,
body.woocommerce-account .iti {
	display: block !important;
	width: 100%;
	border: 1px solid var(--digi-checkout-field-border, rgba(255, 255, 255, 0.12));
	border-radius: 12px;
	background: var(--digi-checkout-field-bg, rgba(255, 255, 255, 0.06));
	overflow: visible;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	min-height: 42px;
	box-shadow: var(--digi-checkout-field-inset, none) !important;
}

body.woocommerce-checkout .iti:focus-within,
body.woocommerce-account .iti:focus-within {
	border-color: rgba(157, 56, 214, 0.55);
	box-shadow: 0 0 0 4px rgba(157, 56, 214, 0.12) !important;
}

body.woocommerce-checkout .iti input[type="tel"],
body.woocommerce-checkout .iti input[type="text"],
body.woocommerce-account .iti input[type="tel"],
body.woocommerce-account .iti input[type="text"] {
	width: 100% !important;
	box-sizing: border-box;
	min-height: 42px !important;
	padding: 0.5rem 0.85rem !important;
	border: 0 !important;
	background: transparent !important;
	color: var(--digi-ink, rgba(246, 242, 251, 0.9)) !important;
	font-size: 0.95rem;
	font-family: var(--digi-font, "Cairo", "Almarai", system-ui, sans-serif);
	outline: none;
	box-shadow: none !important;
	border-radius: 0 12px 12px 0 !important;
	direction: ltr;
	text-align: start;
}

body.woocommerce-checkout .iti input[type="tel"]:focus,
body.woocommerce-checkout .iti input[type="text"]:focus,
body.woocommerce-account .iti input[type="tel"]:focus,
body.woocommerce-account .iti input[type="text"]:focus {
	border: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
}

body.woocommerce-checkout .iti--separate-dial-code input[type="tel"],
body.woocommerce-checkout .iti--separate-dial-code input[type="text"],
body.woocommerce-account .iti--separate-dial-code input[type="tel"],
body.woocommerce-account .iti--separate-dial-code input[type="text"] {
	padding-left: 100px !important;
	padding-right: 0.875rem !important;
}

body.woocommerce-checkout .iti__flag-container,
body.woocommerce-account .iti__flag-container {
	bottom: 0 !important;
	left: 0 !important;
	right: auto !important;
}

body.woocommerce-checkout .iti__selected-flag,
body.woocommerce-account .iti__selected-flag {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	background: transparent !important;
	border: 0 !important;
	border-inline-end: 1px solid rgba(255, 255, 255, 0.1) !important;
	border-radius: 12px 0 0 12px !important;
	padding: 0 0.65rem !important;
	min-height: 42px;
	transition: background 0.15s ease;
}

body.woocommerce-checkout .iti__selected-flag:hover,
body.woocommerce-account .iti__selected-flag:hover {
	background: rgba(255, 255, 255, 0.1) !important;
}

body.woocommerce-checkout .iti__selected-dial-code,
body.woocommerce-account .iti__selected-dial-code {
	color: var(--digi-checkout-ink, rgba(246, 242, 251, 0.9));
	font-size: 0.88rem;
	font-weight: 700;
	font-family: var(--digi-font, "Cairo", "Almarai", system-ui, sans-serif);
	opacity: 0.9;
}

body.woocommerce-checkout .iti__arrow,
body.woocommerce-account .iti__arrow {
	border-top-color: rgba(246, 242, 251, 0.55) !important;
}

body.woocommerce-checkout .iti__arrow--up,
body.woocommerce-account .iti__arrow--up {
	border-bottom-color: rgba(246, 242, 251, 0.55) !important;
	border-top: 0 !important;
}

body.woocommerce-checkout .iti__country-list,
body.woocommerce-account .iti__country-list {
	z-index: 99999 !important;
	font-family: var(--digi-font, "Cairo", "Almarai", system-ui, sans-serif);
	font-size: 0.85rem;
	width: min(280px, calc(100vw - 32px)) !important;
	min-width: min(280px, calc(100vw - 32px));
	max-width: calc(100vw - 32px);
	max-height: 240px;
	border-radius: 16px !important;
	border: 1px solid rgba(255, 255, 255, 0.1) !important;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55) !important;
	overflow-y: auto;
	background: #1a1228 !important;
	padding: 0.35rem !important;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
	pointer-events: auto;
}

body.woocommerce-checkout .iti__country,
body.woocommerce-account .iti__country {
	padding: 0.45rem 0.75rem !important;
	border-radius: 10px !important;
	color: rgba(246, 242, 251, 0.8) !important;
	transition: background 0.13s ease;
}

body.woocommerce-checkout .iti__country.iti__highlight,
body.woocommerce-checkout .iti__country:hover,
body.woocommerce-account .iti__country.iti__highlight,
body.woocommerce-account .iti__country:hover {
	background: rgba(120, 27, 175, 0.18) !important;
	color: #c07dff !important;
}

body.woocommerce-checkout .iti__divider,
body.woocommerce-account .iti__divider {
	border-color: rgba(255, 255, 255, 0.08) !important;
	margin: 0.35rem !important;
}

/* Country search — match login dropdown */
body.woocommerce-checkout .digi-iti-country-search-wrap,
body.woocommerce-account .digi-iti-country-search-wrap {
	padding: 0.45rem !important;
	margin: 0 !important;
	border-radius: 0 !important;
	background: #1a1228 !important;
	border-bottom: 1px solid rgba(255, 255, 255, 0.07);
	cursor: default;
	position: sticky;
	top: 0;
	z-index: 2;
}

body.woocommerce-checkout .digi-iti-country-search-wrap:hover,
body.woocommerce-account .digi-iti-country-search-wrap:hover,
body.woocommerce-checkout .digi-iti-country-search-wrap.iti__highlight,
body.woocommerce-account .digi-iti-country-search-wrap.iti__highlight {
	background: #1a1228 !important;
	color: inherit !important;
}

body.woocommerce-checkout .digi-iti-country-search,
body.woocommerce-account .digi-iti-country-search {
	display: block;
	width: 100%;
	box-sizing: border-box;
	min-height: 36px;
	padding: 0.42rem 0.7rem !important;
	border: 1px solid rgba(255, 255, 255, 0.12) !important;
	border-radius: 8px !important;
	background: rgba(255, 255, 255, 0.07) !important;
	color: #fff !important;
	font-size: 0.84rem;
	font-family: var(--digi-font, "Cairo", "Almarai", system-ui, sans-serif);
	outline: none;
	box-shadow: none !important;
	transition: border-color 0.15s ease;
	pointer-events: auto;
	-webkit-appearance: none;
	appearance: none;
}

body.woocommerce-checkout .digi-iti-country-search:focus,
body.woocommerce-account .digi-iti-country-search:focus {
	border-color: rgba(152, 41, 214, 0.55) !important;
	background: rgba(255, 255, 255, 0.07) !important;
	box-shadow: none !important;
}

body.woocommerce-checkout .digi-iti-country-search::placeholder,
body.woocommerce-account .digi-iti-country-search::placeholder {
	color: rgba(246, 242, 251, 0.38);
}

body.woocommerce-checkout .iti__country.digi-iti-country-hidden,
body.woocommerce-account .iti__country.digi-iti-country-hidden,
body.woocommerce-checkout .iti__divider.digi-iti-country-hidden,
body.woocommerce-account .iti__divider.digi-iti-country-hidden {
	display: none !important;
}

/* RTL: flag on the right, same as login */
[dir="rtl"] body.woocommerce-checkout .iti__flag-container,
[dir="rtl"] body.woocommerce-account .iti__flag-container {
	left: auto !important;
	right: 0 !important;
}

[dir="rtl"] body.woocommerce-checkout .iti--separate-dial-code input[type="tel"],
[dir="rtl"] body.woocommerce-checkout .iti--separate-dial-code input[type="text"],
[dir="rtl"] body.woocommerce-account .iti--separate-dial-code input[type="tel"],
[dir="rtl"] body.woocommerce-account .iti--separate-dial-code input[type="text"] {
	padding-left: 0.875rem !important;
	padding-right: 100px !important;
}

[dir="rtl"] body.woocommerce-checkout .iti input[type="tel"],
[dir="rtl"] body.woocommerce-account .iti input[type="tel"] {
	border-radius: 12px 0 0 12px !important;
}

[dir="rtl"] body.woocommerce-checkout .iti__selected-flag,
[dir="rtl"] body.woocommerce-account .iti__selected-flag {
	border-radius: 0 12px 12px 0 !important;
	border-inline-end: 0 !important;
	border-inline-start: 1px solid rgba(255, 255, 255, 0.1) !important;
}

[dir="rtl"] body.woocommerce-checkout .iti__country-list,
[dir="rtl"] body.woocommerce-account .iti__country-list {
	text-align: right;
	left: auto !important;
	right: 0 !important;
}

[dir="rtl"] body.woocommerce-checkout .iti__flag-box,
[dir="rtl"] body.woocommerce-account .iti__flag-box {
	margin-left: 6px;
	margin-right: 0;
}

[dir="rtl"] body.woocommerce-checkout .iti__country-name,
[dir="rtl"] body.woocommerce-account .iti__country-name {
	margin-right: 6px;
}

/* Light theme — match login light overrides */
[data-theme="light"] body.woocommerce-checkout .iti,
[data-theme="light"] body.woocommerce-account .iti {
	border-color: var(--digi-checkout-field-border, rgba(120, 27, 175, 0.14));
	background: var(--digi-checkout-field-bg, #fff);
}

[data-theme="light"] body.woocommerce-checkout .iti:focus-within,
[data-theme="light"] body.woocommerce-account .iti:focus-within {
	border-color: rgba(157, 56, 214, 0.55);
	box-shadow: 0 0 0 4px rgba(157, 56, 214, 0.12) !important;
}

[data-theme="light"] body.woocommerce-checkout .iti input[type="tel"],
[data-theme="light"] body.woocommerce-account .iti input[type="tel"] {
	color: var(--digi-ink, #1f1630) !important;
}

[data-theme="light"] body.woocommerce-checkout .iti__selected-flag,
[data-theme="light"] body.woocommerce-account .iti__selected-flag {
	background: transparent !important;
	border-inline-end-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] body.woocommerce-checkout .iti__selected-flag:hover,
[data-theme="light"] body.woocommerce-account .iti__selected-flag:hover {
	background: rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] body.woocommerce-checkout .iti__selected-dial-code,
[data-theme="light"] body.woocommerce-account .iti__selected-dial-code {
	color: var(--digi-ink, #1f1630);
}

[data-theme="light"] body.woocommerce-checkout .iti__arrow,
[data-theme="light"] body.woocommerce-account .iti__arrow {
	border-top-color: rgba(42, 32, 56, 0.5) !important;
}

[data-theme="light"] body.woocommerce-checkout .iti__arrow--up,
[data-theme="light"] body.woocommerce-account .iti__arrow--up {
	border-bottom-color: rgba(42, 32, 56, 0.5) !important;
}

[data-theme="light"] body.woocommerce-checkout .iti__country-list,
[data-theme="light"] body.woocommerce-account .iti__country-list {
	background: #fff !important;
	border-color: rgba(0, 0, 0, 0.1) !important;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14) !important;
	border-radius: 10px !important;
	padding: 0.25rem 0 !important;
}

[data-theme="light"] body.woocommerce-checkout .iti__country,
[data-theme="light"] body.woocommerce-account .iti__country {
	padding: 0.5rem 0.9rem !important;
	border-radius: 0 !important;
	color: var(--digi-ink-dim, #605572) !important;
}

[data-theme="light"] body.woocommerce-checkout .iti__country.iti__highlight,
[data-theme="light"] body.woocommerce-checkout .iti__country:hover,
[data-theme="light"] body.woocommerce-account .iti__country.iti__highlight,
[data-theme="light"] body.woocommerce-account .iti__country:hover {
	background: rgba(120, 27, 175, 0.05) !important;
	color: var(--digi-ink, #1f1630) !important;
}

[data-theme="light"] body.woocommerce-checkout .digi-iti-country-search-wrap,
[data-theme="light"] body.woocommerce-account .digi-iti-country-search-wrap {
	background: #fff !important;
	border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] body.woocommerce-checkout .digi-iti-country-search,
[data-theme="light"] body.woocommerce-account .digi-iti-country-search {
	border-color: rgba(120, 27, 175, 0.14);
	background: #fff;
	color: var(--digi-ink, #1f1630);
}

[data-theme="light"] body.woocommerce-checkout .digi-iti-country-search:focus,
[data-theme="light"] body.woocommerce-account .digi-iti-country-search:focus {
	border-color: rgba(120, 27, 175, 0.45);
}

[data-theme="light"] body.woocommerce-checkout .digi-iti-country-search::placeholder,
[data-theme="light"] body.woocommerce-account .digi-iti-country-search::placeholder {
	color: var(--digi-ink-mute, #8a7f99);
}
