/*
 * Currency switcher (inc/currency.php), as on the reference: a small white
 * button with the currency code at the bottom corner of the page (left; right
 * in Arabic) and, above it, a list of currencies with flags.
 */

.currency-switcher {
	position: fixed;
	bottom: 1.5rem;
	inset-inline-start: 1.5rem;
	z-index: calc(var(--qilaada-z-header) - 2);
	font-family: var(--qilaada-font-body);
	transition: bottom var(--qilaada-duration) var(--qilaada-ease);
}

/* Above the product page's sticky add-to-cart bar while it shows. */
body:has(.sticky-atc.is-visible) .currency-switcher {
	bottom: 5.75rem;
}

.currency-switcher__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	min-height: 2.5rem;
	padding: 0.5rem 0.875rem;
	border: 0;
	border-radius: 0.3125rem;
	background: var(--qilaada-color-white);
	box-shadow: 4px 4px 9px #e8e8e2, -4px -4px 9px #e8e8e2;
	color: #222;
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0;
	cursor: pointer;
}

.currency-switcher__toggle:hover,
.currency-switcher__toggle:focus-visible {
	background: var(--qilaada-color-white);
	color: #222;
}

.currency-switcher__toggle .icon {
	width: 0.75rem;
	height: 0.75rem;
	transform: rotate(180deg);
	transition: transform var(--qilaada-duration) var(--qilaada-ease);
}

.currency-switcher__toggle[aria-expanded="true"] .icon {
	transform: none;
}

.currency-switcher__list {
	position: absolute;
	bottom: calc(100% + 0.5rem);
	inset-inline-start: 0;
	width: max-content;
	max-width: min(17rem, calc(100vw - 3rem));
	max-height: min(19rem, 60vh);
	margin: 0;
	padding: 0;
	overflow-x: hidden;
	overflow-y: auto;
	border-radius: 0.4375rem;
	background: var(--qilaada-color-white);
	box-shadow: 0 0 16px -5px rgb(0 0 0 / 0.15);
	list-style: none;
}

.currency-switcher__list li + li {
	border-top: 1px solid rgb(209 209 209 / 0.39);
}

.currency-switcher__option {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	width: 100%;
	padding: 0.8125rem 0.875rem;
	border: 0;
	background: none;
	color: #222;
	font-size: 0.875rem;
	font-weight: 400;
	letter-spacing: 0;
	text-align: start;
	text-transform: none;
	white-space: nowrap;
	cursor: pointer;
}

.currency-switcher__option:hover,
.currency-switcher__option:focus-visible {
	background: #eceef2;
	color: #222;
}

.currency-switcher__option > span {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

.currency-switcher__option[aria-pressed="true"] {
	font-weight: 700;
}

.currency-flag {
	flex: 0 0 auto;
	width: 1.875rem;
	height: 1.25rem;
	border-radius: 0.125rem;
	box-shadow: 0 0 0 1px rgb(0 0 0 / 0.06);
}

@media (max-width: 767.98px) {
	.currency-switcher {
		bottom: 1.25rem;
		inset-inline-start: auto;
		inset-inline-end: 1.25rem;
	}

	.currency-switcher__list {
		inset-inline-start: auto;
		inset-inline-end: 0;
	}

	body:has(.sticky-atc.is-visible) .currency-switcher {
		bottom: 5rem;
	}
}
