/**
 * Elementor Advanced Phone Field – Styles
 *
 * All selectors use classes (no IDs) to support multiple fields per form.
 */

/* ── Wrapper ─────────────────────────────────────────────── */
.eap-advanced-phone-wrapper {
	position: relative;
	width: 100%;
	display: block !important;
}

/* ── Phone Container (prefix + input side-by-side) ──────── */
.eap-phone-container {
	display: flex;
	align-items: stretch;
	width: 100%;
	border: 1px solid #bbb;
	border-radius: 4px;
	overflow: visible;
	background: #fff;
	transition: border-color 0.2s;
}

.eap-phone-container:focus-within {
	border-color: #6ec1e4;
	box-shadow: 0 0 0 1px #6ec1e4;
}

.eap-error .eap-phone-container {
	border-color: #d9534f;
}

.eap-error .eap-phone-container:focus-within {
	box-shadow: 0 0 0 1px #d9534f;
}

/* ── Country Select Trigger ─────────────────────────────── */
.eap-country-select-wrapper {
	position: relative;
	flex-shrink: 0;
}

.eap-country-select-trigger {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 10px 10px 10px 14px;
	background: #f7f7f7;
	border: none;
	border-right: 1px solid #ddd;
	cursor: pointer;
	font-size: 14px;
	line-height: 1.4;
	color: #333;
	white-space: nowrap;
	height: 100%;
	border-radius: 4px 0 0 4px;
	transition: background-color 0.15s;
}

.eap-country-select-trigger:hover {
	background: #eee;
}

.eap-country-select-trigger:focus {
	outline: 2px solid #6ec1e4;
	outline-offset: -2px;
}

.eap-country-flag {
	font-size: 20px;
	line-height: 1;
}

.eap-dial-code {
	font-weight: 500;
	font-size: 14px;
	color: #333;
}

.eap-select-arrow {
	font-size: 10px;
	color: #888;
	margin-left: 2px;
}

/* ── Phone Number Input ─────────────────────────────────── */
.eap-phone-input {
	flex: 1;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	min-width: 0;
	background: transparent;
	border-radius: 0 4px 4px 0;
}

.eap-phone-input::placeholder {
	color: #aaa;
}

/* ── Size-aware scaling (matches Elementor input_size) ──── */
.eap-advanced-phone-wrapper.elementor-size-xs .eap-country-select-trigger { padding: 4px 4px 4px 8px; font-size: 12px; }
.eap-advanced-phone-wrapper.elementor-size-xs .eap-country-flag { font-size: 14px; }
.eap-advanced-phone-wrapper.elementor-size-xs .eap-dial-code { font-size: 12px; }

.eap-advanced-phone-wrapper.elementor-size-sm .eap-country-select-trigger { padding: 6px 6px 6px 10px; font-size: 13px; }
.eap-advanced-phone-wrapper.elementor-size-sm .eap-country-flag { font-size: 16px; }
.eap-advanced-phone-wrapper.elementor-size-sm .eap-dial-code { font-size: 13px; }

.eap-advanced-phone-wrapper.elementor-size-md .eap-country-select-trigger { padding: 10px 10px 10px 14px; font-size: 14px; }
.eap-advanced-phone-wrapper.elementor-size-md .eap-country-flag { font-size: 20px; }
.eap-advanced-phone-wrapper.elementor-size-md .eap-dial-code { font-size: 14px; }

.eap-advanced-phone-wrapper.elementor-size-lg .eap-country-select-trigger { padding: 14px 12px 14px 16px; font-size: 16px; }
.eap-advanced-phone-wrapper.elementor-size-lg .eap-country-flag { font-size: 22px; }
.eap-advanced-phone-wrapper.elementor-size-lg .eap-dial-code { font-size: 16px; }

.eap-advanced-phone-wrapper.elementor-size-xl .eap-country-select-trigger { padding: 18px 14px 18px 20px; font-size: 18px; }
.eap-advanced-phone-wrapper.elementor-size-xl .eap-country-flag { font-size: 24px; }
.eap-advanced-phone-wrapper.elementor-size-xl .eap-dial-code { font-size: 18px; }

/* ── Country Dropdown ───────────────────────────────────── */
.eap-country-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 10000;
	min-width: 280px;
	max-width: 360px;
	max-height: 300px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 4px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	display: none;
	flex-direction: column;
	margin-top: 2px;
}

.eap-country-dropdown.eap-open {
	display: flex;
}

/* ── Search ─────────────────────────────────────────────── */
.eap-country-search-wrapper {
	padding: 8px;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}

.eap-country-search {
	width: 100%;
	padding: 6px 10px;
	border: 1px solid #ddd;
	border-radius: 3px;
	font-size: 13px;
	outline: none;
	box-sizing: border-box;
}

.eap-country-search:focus {
	border-color: #6ec1e4;
}

/* ── Country List ───────────────────────────────────────── */
.eap-country-list {
	overflow-y: auto;
	flex: 1;
	overscroll-behavior: contain;
}

.eap-country-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	cursor: pointer;
	font-size: 13px;
	line-height: 1.4;
	transition: background-color 0.1s;
}

.eap-country-option:hover,
.eap-country-option:focus {
	background: #f0f6fc;
	outline: none;
}

.eap-country-option--selected {
	background: #e8f4fd;
	font-weight: 500;
}

.eap-country-flag-option {
	font-size: 18px;
	line-height: 1;
	flex-shrink: 0;
}

.eap-country-name {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.eap-country-dial {
	color: #888;
	font-size: 12px;
	flex-shrink: 0;
}

/* ── Separator between priority and other countries ────── */
.eap-country-separator {
	height: 1px;
	background: #e0e0e0;
	margin: 4px 0;
}

/* ── No results ─────────────────────────────────────────── */
.eap-country-no-results {
	padding: 16px 12px;
	text-align: center;
	color: #999;
	font-size: 13px;
}

/* ── Error Message ──────────────────────────────────────── */
.eap-error-message {
	display: block;
	margin-top: 4px;
	font-size: 12px;
	color: #d9534f;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 480px) {
	.eap-country-dropdown {
		min-width: 240px;
		max-width: calc(100vw - 32px);
	}

	.eap-country-select-trigger {
		padding: 8px 6px 8px 8px;
	}
}

/* ── Elementor editor preview adjustments ───────────────── */
.elementor-editor-active .eap-country-dropdown {
	z-index: 100000;
}
