/**
 * Jeevi IQ Test — country dial-code picker.
 *
 * A custom listbox replacing the native <select> on the lead form. It exists
 * for one reason: Chromium will not render colour emoji inside a <select>, so
 * flag emoji collapse to their regional-indicator letters ("IN", "RO") in
 * Chrome and Edge while rendering correctly in Firefox, macOS, iOS and
 * Android. Adding Twemoji/Noto/Segoe emoji fonts to the control's font stack
 * does not help — Chrome ignores the font stack for emoji in form controls.
 * Real <img> flags in markup we own render identically everywhere.
 *
 * Geometry deliberately matches the select it replaces: an 84px trigger with a
 * 12px right margin, so .jiqs-phone-wrap::after (the divider at left:86px)
 * still lands where the design puts it.
 *
 * Everything is scoped under body.jiq-test-active and uses !important on the
 * properties the theme and Elementor otherwise win, exactly as the rest of the
 * test CSS does.
 */

body.jiq-test-active .jiq-dialpick {
	position: relative !important;
	flex: 0 0 84px !important;
	width: 84px !important;
	min-width: 84px !important;
	max-width: 84px !important;
	margin-right: 12px !important;
	display: block !important;
}

/* ---------------------------------------------------------------- trigger */

body.jiq-test-active .jiq-dialpick .jiq-dialpick-btn {
	display: flex !important;
	align-items: center !important;
	gap: 5px !important;
	width: 100% !important;
	min-height: 28px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	cursor: pointer !important;
	font: inherit !important;
	font-size: 16px !important;   /* never below 16px — iOS zooms the page */
	font-weight: 600 !important;
	line-height: 1.2 !important;
	color: inherit !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	appearance: none !important;
	-webkit-appearance: none !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-btn:hover,
body.jiq-test-active .jiq-dialpick .jiq-dialpick-btn:focus {
	background: transparent !important;
	box-shadow: none !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-btn:focus-visible {
	outline: 2px solid #EA580C !important;
	outline-offset: 2px !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-code {
	white-space: nowrap !important;
}

/* Flags run from 1:1 (Switzerland) to 2:1 (UK) — a fixed box plus contain
 * keeps the row rhythm without stretching any of them. */
body.jiq-test-active .jiq-dialpick .jiq-dialpick-flag {
	width: 20px !important;
	height: 15px !important;
	flex: 0 0 20px !important;
	object-fit: contain !important;
	display: block !important;
	border-radius: 2px !important;
	background: #F3F7FC;
	margin: 0 !important;
	max-width: none !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-caret {
	width: 0 !important;
	height: 0 !important;
	margin-left: auto !important;
	border-left: 5px solid transparent !important;
	border-right: 5px solid transparent !important;
	border-top: 6px solid #EA580C !important;
	flex: 0 0 auto !important;
	transition: transform .15s ease !important;
}

body.jiq-test-active .jiq-dialpick.is-open .jiq-dialpick-caret {
	transform: rotate(180deg) !important;
}

/* ----------------------------------------------------------------- popup */

body.jiq-test-active .jiq-dialpick .jiq-dialpick-pop {
	position: absolute !important;
	z-index: 60 !important;
	top: calc(100% + 8px) !important;
	left: 0 !important;
	width: 290px !important;
	max-width: calc(100vw - 40px) !important;
	background: #FFFFFF !important;
	border: 1px solid #FED7AA !important;
	border-radius: 10px !important;
	box-shadow: 0 12px 34px rgba(17, 24, 39, .16) !important;
	padding: 8px !important;
	overflow: hidden !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-search {
	display: block !important;
	width: 100% !important;
	box-sizing: border-box !important;
	margin: 0 0 8px 0 !important;
	padding: 8px 10px !important;
	border: 1px solid #FED7AA !important;
	border-radius: 7px !important;
	background: #FFF !important;
	font-size: 16px !important;   /* keep at 16px: smaller re-triggers iOS zoom */
	line-height: 1.3 !important;
	color: #1F2937 !important;
	box-shadow: none !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-search:focus {
	outline: none !important;
	border-color: #EA580C !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-list {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	max-height: 246px !important;
	overflow-y: auto !important;
	-webkit-overflow-scrolling: touch;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-opt {
	display: flex !important;
	align-items: center !important;
	gap: 9px !important;
	margin: 0 !important;
	padding: 7px 9px !important;
	border-radius: 6px !important;
	cursor: pointer !important;
	font-size: 14px !important;
	line-height: 1.25 !important;
	color: #1F2937 !important;
	list-style: none !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-opt::marker,
body.jiq-test-active .jiq-dialpick .jiq-dialpick-opt::before {
	content: none !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-name {
	flex: 1 1 auto !important;
	min-width: 0 !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	white-space: nowrap !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-dial {
	flex: 0 0 auto !important;
	color: #6B7280 !important;
	font-variant-numeric: tabular-nums !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-opt.is-active,
body.jiq-test-active .jiq-dialpick .jiq-dialpick-opt:hover {
	background: #FFF3EA !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-opt.is-selected {
	background: #FFE9D9 !important;
	font-weight: 600 !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-opt[hidden] {
	display: none !important;
}

body.jiq-test-active .jiq-dialpick .jiq-dialpick-empty {
	margin: 0 !important;
	padding: 12px 9px !important;
	font-size: 13px !important;
	color: #6B7280 !important;
	text-align: center !important;
}

/* ------------------------------------------------------- classic skin box */

/* The classic skin gives the control 148px and a bordered field, so the
 * trigger has to fill that box rather than sit flush like the signature one. */
body.jiq-test-active .jiq-dialpick.jiq-dialpick-classic {
	flex: 0 0 148px !important;
	width: 148px !important;
	min-width: 148px !important;
	max-width: 148px !important;
	margin-right: 0 !important;
}

body.jiq-test-active .jiq-dialpick.jiq-dialpick-classic .jiq-dialpick-btn {
	min-height: 44px !important;
	padding: 0 10px !important;
	border: 1px solid #FED7AA !important;
	border-radius: 8px !important;
	background: #FFF !important;
	font-size: 14px !important;
}

@media (max-width: 480px) {
	body.jiq-test-active .jiq-dialpick.jiq-dialpick-classic {
		flex-basis: 118px !important;
		width: 118px !important;
		min-width: 118px !important;
		max-width: 118px !important;
	}
}

/* Narrower phones: the trigger shrinks with the design, the popup does not —
 * it stays wide enough to read a country name. */
@media (max-width: 420px) {
	body.jiq-test-active .jiq-dialpick {
		flex-basis: 80px !important;
		width: 80px !important;
		min-width: 80px !important;
		max-width: 80px !important;
		margin-right: 10px !important;
	}
	body.jiq-test-active .jiq-dialpick .jiq-dialpick-pop {
		width: min(290px, calc(100vw - 48px)) !important;
	}
}

/* Flipped above the trigger when there is not enough room below it. The class
 * is set in JS after measuring, because the field sits near the bottom of the
 * card on short viewports and a 310px popup would otherwise run off-screen. */
body.jiq-test-active .jiq-dialpick.is-up .jiq-dialpick-pop {
	top: auto !important;
	bottom: calc(100% + 8px) !important;
}
