/**
 * Avy Currency Switcher — .avy-currency scope, avy- prefixed classes only.
 *
 * The switcher renders as a header action button (globe icon + currency code)
 * opening a custom listbox dropdown. Styling mirrors the theme's icon
 * buttons (.avy-header__icon hover treatment) and the mini-cart card
 * (.avy-mini-cart panel language). Theme design tokens are consumed with
 * literal fallbacks so the widget stays presentable outside the theme.
 */

.avy-currency {
	position: relative;
	display: inline-flex;
	align-items: center;
}

/* Trigger — borderless pill that matches the neighboring icon buttons. */
.avy-currency__trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 38px;
	padding: 8px 12px;
	border: none;
	border-radius: 999px;
	background: none;
	cursor: pointer;
	color: var(--avy-gray-800, #343a40);
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.02em;
	transition:
		background 0.2s ease,
		color 0.2s ease;
}

.avy-currency__trigger:hover,
.avy-currency__trigger:focus-visible,
.avy-currency__trigger[aria-expanded="true"] {
	background: var(--avy-gray-200, #e9ecef);
	color: var(--avy-blue, #0033a0);
	outline: none;
}

.avy-currency__globe {
	flex: none;
}

.avy-currency__caret {
	flex: none;
	color: var(--avy-gray-600, #6c757d);
	transition: transform 0.2s ease;
}

.avy-currency__trigger[aria-expanded="true"] .avy-currency__caret {
	transform: rotate(180deg);
}

/* Dropdown panel — card language shared with .avy-mini-cart. */
.avy-currency__menu {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 176px;
	padding: 6px;
	background: var(--avy-white, #fff);
	border: 1px solid var(--avy-gray-200, #e9ecef);
	border-radius: var(--avy-radius-lg, 12px);
	box-shadow: var(--avy-shadow-lg, 0 4px 24px rgba(0, 0, 0, 0.12));
	display: none;
	z-index: 120;
}

.avy-currency__menu--open {
	display: block;
}

.avy-currency__option {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 9px 10px;
	border: none;
	border-radius: 8px;
	background: none;
	cursor: pointer;
	text-align: left;
	color: var(--avy-gray-800, #343a40);
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
}

.avy-currency__option:hover,
.avy-currency__option:focus-visible {
	background: var(--avy-gray-100, #f8f9fa);
	color: var(--avy-blue, #0033a0);
	outline: none;
}

.avy-currency__symbol {
	min-width: 36px;
	font-weight: 700;
}

.avy-currency__check {
	margin-left: auto;
	color: var(--avy-blue, #0033a0);
	visibility: hidden;
}

.avy-currency__option.is-active .avy-currency__check {
	visibility: visible;
}

/* Fallback pill (position = bottom-left, theme anchor absent). */
.avy-currency-pill {
	position: fixed;
	left: 16px;
	bottom: 16px;
	z-index: 9999;
	background: var(--avy-white, #fff);
	border-radius: 999px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
	padding: 4px;
}

.avy-currency-pill .avy-currency__menu {
	left: 0;
	right: auto;
}

/* Inside the mobile slide-in menu the switcher sits in the header row next
   to the "Menu" title; margin-right:auto keeps the close button far right. */
.avy-mobile-menu .avy-currency {
	margin-left: 45px;
	margin-right: auto;
}

/* Compact trigger so the header row stays close to the title's own height. */
.avy-mobile-menu .avy-currency__trigger {
	min-height: 32px;
	padding: 6px 10px;
}

/* The 300px slide-in panel clips horizontal overflow, so anchor the listbox
   to the trigger's left edge; it drops over the nav list below. */
.avy-mobile-menu .avy-currency__menu {
	left: 0;
	right: auto;
	top: calc(100% + 6px);
}

/* Mobile header: the mobile menu already carries a switcher instance. */
@media (max-width: 768px) {
	.avy-header__actions .avy-currency {
		display: none;
	}
}
