/**
 * WooCommerce MultiPay - front-end styles.
 *
 * Every selector is prefixed with .wcmp- to avoid theme conflicts.
 * Themes can restyle the switcher by overriding the custom properties:
 *
 *   .wcmp-currency-switcher { --wcmp-accent: #e11d48; --wcmp-radius: 4px; }
 */

.wcmp-currency-switcher {
	--wcmp-accent: #4f46e5;
	--wcmp-accent-soft: rgba( 79, 70, 229, 0.08 );
	--wcmp-text: #1d2133;
	--wcmp-muted: #6b7185;
	--wcmp-surface: #ffffff;
	--wcmp-hover: #f4f5f9;
	--wcmp-border: rgba( 16, 24, 40, 0.12 );
	--wcmp-radius: 10px;
	--wcmp-shadow: 0 12px 32px -8px rgba( 16, 24, 40, 0.22 ), 0 2px 6px rgba( 16, 24, 40, 0.06 );

	display: inline-block;
	position: relative;
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
	vertical-align: middle;
}

.wcmp-currency-switcher *,
.wcmp-currency-switcher *::before,
.wcmp-currency-switcher *::after {
	box-sizing: border-box;
}

.wcmp-currency-switcher.wcmp-is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.wcmp-currency-switcher.wcmp-is-loading .wcmp-dropdown__toggle::after {
	content: "";
	width: 12px;
	height: 12px;
	margin-left: 2px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: wcmp-spin 0.7s linear infinite;
}

@keyframes wcmp-spin {
	to { transform: rotate( 360deg ); }
}

/* Flags */
.wcmp-currency-switcher .wcmp-currency-flag {
	display: inline-block;
	flex-shrink: 0;
	width: 20px;
	height: 14px;
	margin: 0;
	border-radius: 3px;
	box-shadow: 0 0 0 1px rgba( 16, 24, 40, 0.08 );
	object-fit: cover;
}

.wcmp-currency-switcher .wcmp-currency-flag-emoji {
	flex-shrink: 0;
	font-size: 1.15em;
	line-height: 1;
}

/* ---------------------------------------------------------------------
 * Dropdown (custom, works without JavaScript via <details>)
 * ------------------------------------------------------------------ */

.wcmp-dropdown {
	position: relative;
}

.wcmp-dropdown__toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 38px;
	padding: 6px 12px;
	border: 1px solid var( --wcmp-border );
	border-radius: var( --wcmp-radius );
	background: var( --wcmp-surface );
	box-shadow: 0 1px 2px rgba( 16, 24, 40, 0.05 );
	color: var( --wcmp-text );
	font-weight: 600;
	white-space: nowrap;
	list-style: none;
	cursor: pointer;
	user-select: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wcmp-dropdown__toggle::-webkit-details-marker,
.wcmp-dropdown__toggle::marker {
	display: none;
	content: "";
}

.wcmp-dropdown__toggle:hover {
	border-color: rgba( 16, 24, 40, 0.25 );
}

.wcmp-dropdown__toggle:focus-visible {
	outline: none;
	border-color: var( --wcmp-accent );
	box-shadow: 0 0 0 3px var( --wcmp-accent-soft );
}

.wcmp-dropdown__chevron {
	flex-shrink: 0;
	color: var( --wcmp-muted );
	transition: transform 0.2s ease;
}

.wcmp-dropdown[open] .wcmp-dropdown__toggle {
	border-color: var( --wcmp-accent );
	box-shadow: 0 0 0 3px var( --wcmp-accent-soft );
}

.wcmp-dropdown[open] .wcmp-dropdown__chevron {
	transform: rotate( 180deg );
}

.wcmp-dropdown__menu {
	position: absolute;
	top: calc( 100% + 6px );
	left: 0;
	z-index: 99999;
	min-width: 230px;
	max-height: 320px;
	margin: 0;
	padding: 6px;
	overflow-y: auto;
	border: 1px solid var( --wcmp-border );
	border-radius: var( --wcmp-radius );
	background: var( --wcmp-surface );
	box-shadow: var( --wcmp-shadow );
	list-style: none;
	animation: wcmp-pop 0.14s ease-out;
}

/* Movement only - never animate opacity, so the menu cannot be left
   invisible if a browser pauses the animation. */
@keyframes wcmp-pop {
	from {
		transform: translateY( -4px ) scale( 0.98 );
	}
	to {
		transform: none;
	}
}

.wcmp-dropdown__menu .wcmp-currency-option {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wcmp-dropdown__menu .wcmp-currency-option::before,
.wcmp-dropdown__menu .wcmp-currency-option::marker {
	display: none;
	content: none;
}

.wcmp-dropdown__menu .wcmp-currency-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border: 0;
	border-radius: calc( var( --wcmp-radius ) - 4px );
	color: var( --wcmp-text );
	text-decoration: none;
	transition: background 0.12s ease;
}

.wcmp-dropdown__menu .wcmp-currency-link:hover,
.wcmp-dropdown__menu .wcmp-currency-link:focus-visible {
	outline: none;
	background: var( --wcmp-hover );
	color: var( --wcmp-text );
}

.wcmp-dropdown__name {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
	line-height: 1.25;
}

.wcmp-dropdown__code {
	font-weight: 600;
}

.wcmp-dropdown__full {
	overflow: hidden;
	color: var( --wcmp-muted );
	font-size: 12px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wcmp-dropdown__symbol {
	min-width: 28px;
	padding: 2px 6px;
	border-radius: 6px;
	background: var( --wcmp-hover );
	color: var( --wcmp-muted );
	font-size: 12px;
	font-weight: 600;
	text-align: center;
}

.wcmp-dropdown__menu .wcmp-is-active .wcmp-currency-link {
	background: var( --wcmp-accent-soft );
}

.wcmp-dropdown__menu .wcmp-is-active .wcmp-dropdown__code {
	color: var( --wcmp-accent );
}

.wcmp-dropdown__menu .wcmp-is-active .wcmp-dropdown__symbol {
	background: var( --wcmp-accent );
	color: #fff;
}

/* Legacy native select (custom template overrides). */
.wcmp-currency-switcher .wcmp-currency-dropdown {
	max-width: 240px;
	min-height: 38px;
	padding: 6px 30px 6px 12px;
	border: 1px solid var( --wcmp-border );
	border-radius: var( --wcmp-radius );
	background-color: var( --wcmp-surface );
	color: var( --wcmp-text );
	vertical-align: middle;
}

/* ---------------------------------------------------------------------
 * Pill styles (code / symbol + code / flag + currency)
 * ------------------------------------------------------------------ */

.wcmp-currency-switcher .wcmp-currency-list {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 4px;
	border: 1px solid var( --wcmp-border );
	border-radius: calc( var( --wcmp-radius ) + 2px );
	background: var( --wcmp-surface );
	list-style: none;
}

.wcmp-currency-switcher .wcmp-currency-list .wcmp-currency-option {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wcmp-currency-switcher .wcmp-currency-list .wcmp-currency-option::before,
.wcmp-currency-switcher .wcmp-currency-list .wcmp-currency-option::marker {
	display: none;
	content: none;
}

.wcmp-currency-switcher .wcmp-currency-list .wcmp-currency-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border: 0;
	border-radius: calc( var( --wcmp-radius ) - 2px );
	color: var( --wcmp-muted );
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.15s ease, color 0.15s ease;
}

.wcmp-currency-switcher .wcmp-currency-list .wcmp-currency-link:hover {
	background: var( --wcmp-hover );
	color: var( --wcmp-text );
}

.wcmp-currency-switcher .wcmp-currency-list .wcmp-currency-link:focus-visible {
	outline: 2px solid var( --wcmp-accent );
	outline-offset: 1px;
}

.wcmp-currency-switcher .wcmp-currency-list .wcmp-is-active .wcmp-currency-link {
	background: var( --wcmp-accent );
	box-shadow: 0 2px 6px -1px rgba( 79, 70, 229, 0.45 );
	color: #fff;
}

/* ---------------------------------------------------------------------
 * Placements
 * ------------------------------------------------------------------ */

.wcmp-floating-switcher {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 9999;
	padding: 6px;
	border: 1px solid rgba( 16, 24, 40, 0.08 );
	border-radius: 16px;
	background: rgba( 255, 255, 255, 0.92 );
	box-shadow: 0 16px 40px -12px rgba( 16, 24, 40, 0.3 );
	-webkit-backdrop-filter: blur( 10px );
	backdrop-filter: blur( 10px );
}

.wcmp-floating-switcher .wcmp-dropdown__toggle,
.wcmp-floating-switcher .wcmp-currency-list {
	border-color: transparent;
	box-shadow: none;
}

/* Open upwards from the bottom corner. */
.wcmp-floating-switcher .wcmp-dropdown__menu {
	top: auto;
	right: 0;
	bottom: calc( 100% + 12px );
	left: auto;
}

.wcmp-menu-item .wcmp-currency-switcher {
	margin: 0 4px;
}

.wcmp-menu-item .wcmp-dropdown__menu {
	right: 0;
	left: auto;
}

/* ---------------------------------------------------------------------
 * Theme protection
 *
 * Navigation menus (GeneratePress, Astra, Kadence, OceanWP...) style every
 * link inside a menu item - big padding, 55px line-height, uppercase - and
 * hide nested lists until hover. These higher-specificity rules keep the
 * switcher looking and behaving the same wherever it is placed.
 * ------------------------------------------------------------------ */

.wcmp-currency-switcher .wcmp-dropdown[open] > .wcmp-dropdown__menu {
	display: block;
	visibility: visible;
	opacity: 1;
	height: auto;
	pointer-events: auto;
	float: none;
}

.wcmp-currency-switcher .wcmp-dropdown:not( [open] ) > .wcmp-dropdown__menu {
	display: none;
}

.wcmp-currency-switcher .wcmp-dropdown__menu a.wcmp-currency-link,
.wcmp-currency-switcher .wcmp-currency-list a.wcmp-currency-link {
	width: auto;
	height: auto;
	margin: 0;
	font-size: 14px;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
	background-image: none;
}

.wcmp-currency-switcher .wcmp-dropdown__menu a.wcmp-currency-link {
	display: flex;
	padding: 8px 10px;
	background-color: transparent;
	color: var( --wcmp-text );
	font-weight: 400;
}

.wcmp-currency-switcher .wcmp-dropdown__menu a.wcmp-currency-link:hover,
.wcmp-currency-switcher .wcmp-dropdown__menu a.wcmp-currency-link:focus-visible {
	background-color: var( --wcmp-hover );
	color: var( --wcmp-text );
}

.wcmp-currency-switcher .wcmp-dropdown__menu .wcmp-is-active > a.wcmp-currency-link {
	background-color: var( --wcmp-accent-soft );
}

.wcmp-currency-switcher .wcmp-currency-list a.wcmp-currency-link {
	display: inline-flex;
	padding: 6px 12px;
	background-color: transparent;
	color: var( --wcmp-muted );
	font-weight: 600;
}

.wcmp-currency-switcher .wcmp-currency-list a.wcmp-currency-link:hover {
	background-color: var( --wcmp-hover );
	color: var( --wcmp-text );
}

.wcmp-currency-switcher .wcmp-currency-list .wcmp-is-active > a.wcmp-currency-link {
	background-color: var( --wcmp-accent );
	color: #fff;
}

.wcmp-currency-switcher .wcmp-dropdown__menu a.wcmp-currency-link::before,
.wcmp-currency-switcher .wcmp-dropdown__menu a.wcmp-currency-link::after,
.wcmp-currency-switcher .wcmp-currency-list a.wcmp-currency-link::before,
.wcmp-currency-switcher .wcmp-currency-list a.wcmp-currency-link::after {
	display: none;
	content: none;
}

.wcmp-currency-switcher .wcmp-dropdown__toggle {
	font-size: 14px;
	line-height: 1.3;
	text-transform: none;
}

.wcmp-currency-switcher .wcmp-dropdown__menu .wcmp-currency-option,
.wcmp-currency-switcher .wcmp-currency-list .wcmp-currency-option {
	display: block;
	float: none;
	width: auto;
	height: auto;
	border: 0;
}

/* ---------------------------------------------------------------------
 * Checkout notice
 * ------------------------------------------------------------------ */

.wcmp-checkout-currency-notice {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 1em;
	padding: 10px 14px;
	border: 1px solid rgba( 79, 70, 229, 0.2 );
	border-radius: 10px;
	background: rgba( 79, 70, 229, 0.06 );
	color: inherit;
	font-size: 0.95em;
}

.wcmp-checkout-currency-notice::before {
	content: "i";
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #4f46e5;
	color: #fff;
	font-size: 12px;
	font-style: italic;
	font-weight: 700;
	font-family: Georgia, serif;
}

@media ( max-width: 600px ) {
	.wcmp-floating-switcher {
		right: 12px;
		bottom: 12px;
	}

	.wcmp-dropdown__menu {
		min-width: 210px;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.wcmp-currency-switcher *,
	.wcmp-currency-switcher *::before,
	.wcmp-currency-switcher *::after {
		animation: none !important;
		transition: none !important;
	}
}
