/**
 * WLRE Theme — Shared Dropdown Styles
 *
 * Generic dropdown component used by language selector and city selector.
 * Figma references:
 *   - Language dropdown — 6081-58232 (172px panel, flag + native + checkmark)
 *   - City dropdown — 6199-312810 (278px panel, 12/0 cell padding)
 *   - Owners dropdown — 6165-64107 (227px panel with chevron-right per row)
 * Active rows use NAVY text (not accent) per Figma; the checkmark glyph
 * provides the "selected" affordance without a colour change.
 */

.wlre-dropdown {
	position: relative;
	display: inline-block;
}

.wlre-dropdown__trigger {
	display: inline-flex;
	align-items: center;
	gap: var(--wlre-space-4);
	cursor: pointer;
	background: none;
	border: none;
	font: inherit;
	color: inherit;
}

.wlre-dropdown__menu {
	position: absolute;
	top: calc(100% + var(--wlre-space-8));
	background: var(--wlre-color-white);
	border-radius: var(--wlre-radius-sm);
	box-shadow: var(--wlre-shadow-card);
	padding: var(--wlre-space-8) 0;
	min-width: 200px;
	list-style: none;
	margin: 0;
	/* Above sticky header (100), modal backdrops (2), any 3rd-party map
	 * panes that break stacking context. */
	z-index: 500;
	display: none;
}

.wlre-dropdown__menu--right {
	right: 0;
}

.wlre-dropdown[data-open="true"] .wlre-dropdown__menu {
	display: block;
}

.wlre-dropdown__item {
	display: flex;
	align-items: center;
	gap: var(--wlre-space-8);
	padding: var(--wlre-space-12) var(--wlre-space-20);
	color: var(--wlre-color-text-900);
	text-decoration: none;
	font-size: var(--wlre-font-size-m);
	cursor: pointer;
	border: none;
	background: none;
	width: 100%;
	text-align: start;
	font-family: var(--wlre-font-body);
	line-height: var(--wlre-line-height-body);
}

.wlre-dropdown__item:hover {
	background: var(--wlre-color-surface-50);
}

/* Figma: active row text stays navy, weight goes 700, check-icon appears
 * at the trailing edge. The .wlre-dropdown__item-check element is added
 * by the dropdown PHP/JS when a row is marked active. The check-selected
 * SVG self-draws its tinted teal circle — do not paint a CSS background. */
.wlre-dropdown__item--active {
	color: var(--wlre-color-text-900);
	font-weight: 700;
}

.wlre-dropdown__item-check {
	margin-inline-start: auto;
	display: inline-flex;
	width: var(--wlre-space-20);
	height: var(--wlre-space-20);
	color: var(--wlre-color-teal-700);
	flex-shrink: 0;
	visibility: hidden;
}

.wlre-dropdown__item--active .wlre-dropdown__item-check {
	visibility: visible;
}

.wlre-dropdown__item-check svg {
	width: 100%;
	height: 100%;
}

/* Strip browser list chrome from <ul>/<li> used as dropdown menus. */
.wlre-dropdown__menu li {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* === Language dropdown specifics — Figma 6116-137852 (172×204 panel,
 * 4 rows × 45px with 12px vertical padding, 20px inset from panel edge). === */
.wlre-language-dropdown__menu {
	min-width: 172px;
	width: 172px;
	padding: 0;
}

.wlre-language-dropdown__menu .wlre-dropdown__item {
	padding: var(--wlre-space-12) var(--wlre-space-20);
	gap: var(--wlre-space-8);
	min-height: 45px;
	color: var(--wlre-color-text-900);
}

.wlre-lang__flag {
	font-size: 18px;
	line-height: 1;
	flex-shrink: 0;
	min-width: 22px;
	display: inline-flex;
	align-items: center;
}

.wlre-lang__native {
	flex: 1 1 auto;
	font-weight: 400;
}

.wlre-language-dropdown__menu .wlre-dropdown__item--active .wlre-lang__native {
	font-weight: 700;
}

/* === City dropdown — Figma 6199-312810 (278px desktop panel, 12×0 cells,
 * navy text, teal check on active). === */
.wlre-city-dropdown__menu {
	min-width: 278px;
	width: 278px;
	padding: var(--wlre-space-8) 0;
}

.wlre-city-dropdown__menu .wlre-dropdown__item {
	padding: var(--wlre-space-12) var(--wlre-space-20);
	min-height: 48px;
	color: var(--wlre-color-text-900);
}

.wlre-city-dropdown__label {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
