/**
 * Country picker on phone fields (see includes/class-ge-phone-field.php).
 *
 * Shared by every GE theme, so the colours read from the design-system
 * variables where a theme defines them and fall back to neutral greys where it
 * does not — the picker must not hardcode one theme's palette.
 */

.ge-phone {
	position: relative;
	/* The room the flag button needs; the input's padding is kept in step with
	   it here rather than in three hand-matched places. */
	--ge-phone-gutter: 92px;
}

/* Room for the flag button, which sits inside the field's own box. */
.ge-phone .ge-phone__input {
	padding-left: var(--ge-phone-gutter);
	width: 100%;
}

.ge-phone__toggle {
	position: absolute;
	top: 50%;
	left: 0px;
	transform: translateY(-50%);
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 6px;
	height: calc(100% - 12px);
	padding: 0 8px;
	border: 0;
	border-right: 1px solid var(--tu-border, #e5e7eb);
	border-radius: 6px 0 0 6px;
	background: transparent;
	cursor: pointer;
	line-height: 1;
}

.ge-phone__flag {
	font-size: 18px;
	line-height: 1;
}

.ge-phone__dial {
	font-size: 14px;
	color: var(--tu-text, #111827);
}

.ge-phone__caret {
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid var(--tu-text-muted, #9ca3af);
}

.ge-phone__panel {
	position: absolute;
	z-index: 20;
	top: calc(100% + 6px);
	left: 0;
	width: 100%;
	min-width: 260px;
	max-height: 300px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--tu-surface, #fff);
	border: 1px solid var(--tu-border, #e5e7eb);
	border-radius: 10px;
	box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.ge-phone__search {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-bottom: 1px solid var(--tu-border, #e5e7eb);
}

/* Drawn rather than shipped, so the picker needs no image asset. */
.ge-phone__search-icon {
	flex: 0 0 auto;
	width: 12px;
	height: 12px;
	border: 1.5px solid var(--tu-text-muted, #9ca3af);
	border-radius: 50%;
	position: relative;
}

.ge-phone__search-icon::after {
	content: "";
	position: absolute;
	right: -4px;
	bottom: -3px;
	width: 5px;
	height: 1.5px;
	background: var(--tu-text-muted, #9ca3af);
	transform: rotate(45deg);
}

.ge-phone__search-input {
	flex: 1 1 auto;
	border: 0;
	outline: none;
	background: transparent;
	font-size: 14px;
	padding: 0;
}

.ge-phone__list {
	margin: 0;
	padding: 4px 0;
	list-style: none;
	overflow-y: auto;
}

.ge-phone__option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	cursor: pointer;
	font-size: 14px;
}

.ge-phone__option:hover,
.ge-phone__option[aria-selected="true"] {
	background: var(--tu-surface-muted, #f3f4f6);
}

.ge-phone__name {
	flex: 1 1 auto;
	color: var(--tu-text, #111827);
}

.ge-phone__dial-code {
	color: var(--tu-text-muted, #6b7280);
	font-variant-numeric: tabular-nums;
}

.ge-phone__empty {
	padding: 12px;
	font-size: 14px;
	text-align: center;
	color: var(--tu-text-muted, #6b7280);
}

/* Arabic and any other RTL locale: the picker moves to the other edge, but the
   number itself stays left-to-right. */
.rtl .ge-phone .ge-phone__input {
	padding-left: 12px;
	padding-right: var(--ge-phone-gutter);
	direction: ltr;
	text-align: right;
}

.rtl .ge-phone__toggle {
	left: auto;
	right: 6px;
	border-right: 0;
	border-left: 1px solid var(--tu-border, #e5e7eb);
	border-radius: 0 6px 6px 0;
}

.rtl .ge-phone__panel {
	left: auto;
	right: 0;
}
