/* SBC — phone field tweaks on top of intl-tel-input.
   Keep this file tiny: layout only, no colours, so the theme stays in charge. */

.iti,
.iti .iti__tel-input {
	width: 100%;
}

/* Elementor popups and sticky headers create stacking contexts; the list must win.
   The dropdown panel itself sits at z-index 2 in intl-tel-input, so any positioned
   theme element painted later covers the list. Raise the panel, not the list:
   z-index on .iti__country-list never applied, that element is not positioned. */
.iti .iti__country-container,
.iti.iti--inline-country-selector .iti__country-selector {
	z-index: 1000;
}

/* The theme pads form inputs with "!important" (padding-left: 10px in the AXA
   popup), which pushed the placeholder under the flag. Pad on our own terms.
   The field now shows the flag and the dial code ("+66"), so the width of that
   button is measured in JS and passed as --sbc-dial-space; the fallback covers
   the moment before the widget reports its size. */
.iti.iti--input-container input.iti__tel-input:not([type="hidden"]) {
	padding-left: var(--sbc-dial-space, 80px) !important;
	/* The theme keeps inputs at content-box and every theme sets width:100%; the
	   dial code padding then pushed the field past its column (visible at 320px). */
	box-sizing: border-box !important;
}

[dir="rtl"] .iti.iti--input-container input.iti__tel-input:not([type="hidden"]) {
	padding-left: 12px !important;
	padding-right: var(--sbc-dial-space, 80px) !important;
}

/* After submit the field holds E.164, which already contains the code: hide the
   badge so "+66" is not printed twice. */
.iti.sbc-e164 .iti__selected-dial-code {
	display: none;
}

/* The footer form (.wpcf7-form .contact_form_footer) is the narrowest one on the
   site: its inputs are 34px tall and the theme gives them line-height 26px. The
   inline-block .iti shell inherits that line-height, so its line box grew to 49px
   while the field stayed 34px: the country button was drawn at the field's bottom
   edge and the arrow hung under it. Collapse the strut in the shell only and give
   the dropdown its own line-height back (the search field has none of its own). */
.wpcf7-form .contact_form_footer .iti {
	display: block;
	line-height: 0;
}

.wpcf7-form .contact_form_footer .iti__country-selector,
.wpcf7-form .contact_form_footer .iti__search-input {
	line-height: normal;
}

/* 16px stops iOS from zooming the page when the search field gets focus.
   The same theme rule hit the search field, leaving the magnifier on the text. */
.iti.iti--input-container input.iti__search-input:not([type="hidden"]) {
	font-size: 16px;
	/* The theme gives every form input margin-bottom:20px!important. The search
	   wrapper is a flex box, so the margin made it 20px taller and the magnifier,
	   which uses its static position (the wrapper's centre), dropped 10px below
	   the text. Drop the margin here, the dropdown does not need the rhythm. */
	margin: 0 !important;
	padding-left: calc(var(--iti-spacer-horizontal, 10px) + var(--iti-globe-icon-size, 17px) + var(--iti-spacer-horizontal, 10px)) !important;
	padding-right: calc(var(--iti-spacer-horizontal, 10px) + var(--iti-clear-icon-size, 15px) + var(--iti-spacer-horizontal, 10px)) !important;
}

/* Centre the magnifier on the wrapper's height instead of its static position,
   so it holds up even if a theme restores padding or a margin somewhere else. */
.iti .iti__search-icon {
	top: 0;
	bottom: 0;
	/* ElementsKit makes every span inside a form label a block: the icon loses
	   its flex box and the magnifier sticks to the top of the search row. */
	display: flex !important;
	align-items: center !important;
}

/* intl-tel-input gives the dropdown panel an inline height from JS, clamped to
   the space it has. A fixed max-height on the list then stuck out of that panel:
   the last rows were painted outside its white surface, straight onto the page
   ("a country row without a background"). Let the list take exactly the height
   the panel got, as intl-tel-input already does in its fullscreen mode.

   Only while the panel is open: the widget hides the closed dropdown with
   .iti__hide{display:none}, and an unconditional display:flex here beat it, so
   the list was painted on page load as a narrow column inside the flag button. */
.iti .iti__country-selector:not(.iti__hide) {
	display: flex;
	flex-direction: column;
}

.iti .iti__search-input-wrapper {
	flex: 0 0 auto;
}

.iti .iti__country-list {
	max-height: 320px;
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	text-align: left;
	/* Rows are transparent and the panel paints the surface. Give the scroll box
	   a surface of its own as well, so a stray row can never end up as text
	   floating over the page. */
	background-color: var(--iti-country-selector-bg, #fff);
}

/* Long native names ("North Macedonia (Македонија)") must wrap. With nowrap the
   widest row grew past the list, a horizontal scrollbar appeared and the check
   mark slid under the vertical one. */
.iti .iti__country-name {
	white-space: normal;
	overflow-wrap: anywhere;
	min-width: 0;
}

/* Belt and braces: keep the check mark off the vertical scrollbar. */
.iti .iti__country-list .iti__country {
	padding-right: 12px;
}

/* Server-side and client-side tips share the Contact Form 7 look. */
.sbc-phone-tip {
	display: block;
}

/* ElementsKit calculator forms ship `.ekit-form form label span{display:block}`.
   The badge parts are spans, so the flag and the arrow stack one under the other
   and the dial code drops to 13px. Put the badge back into one row. */
.iti .iti__selected-country-primary {
	display: flex !important;
	align-items: center !important;
}

.iti .iti__selected-country,
.iti .iti__country-list {
	font-size: var(--sbc-field-font, inherit) !important;
}

.iti .iti__selected-country span,
.iti .iti__country-list span {
	font-size: inherit !important;
}

/* Same rule, in the list: the dial code is a span inside the name cell and went to
   a second line in every row. */
.iti .iti__country-list .iti__dial-code {
	display: inline !important;
}

/* Those calculator forms also zero the vertical padding of the rows, which made the
   list cramped compared to every other form on the site. */
.iti .iti__country-list .iti__country {
	padding-top: 8px !important;
	padding-bottom: 8px !important;
}
