/* Exchange Rate Calculator – front end */
:root {
	--erc-accent: #ffcc00;
	--erc-accent-text: #111;
	--erc-top: 35%;
	--erc-ink: #1d1d1f;
	--erc-muted: #5b6474;
	--erc-field: #f2f2f2;
	--erc-line: #e6e6e6;
	--erc-radius: 12px;
}

/* ---------- floating bar ---------- */
.erc-float {
	position: fixed;
	right: 0;
	top: var(--erc-top);
	z-index: 99990;
	font-family: inherit;
}
.erc-float ul {
	list-style: none;
	margin: 0;
	padding: 4px 0;
	background: #fff;
	border-radius: 8px 0 0 8px;
	box-shadow: 0 4px 18px rgba(0, 0, 0, .14);
}
.erc-float li {
	position: relative;
	margin: 0;
	padding: 0;
	width: 50px;
	height: 50px;
}
.erc-float li + li::before {
	content: "";
	position: absolute;
	top: 0;
	left: 9px;
	right: 9px;
	border-top: 1px solid var(--erc-line);
}
.erc-float__item {
	all: unset;
	box-sizing: border-box;
	position: absolute;
	inset: 0;
	cursor: pointer;
	color: var(--erc-ink);
}
.erc-float__inner {
	position: absolute;
	right: 0;
	top: 0;
	height: 100%;
	width: 50px;
	max-width: 50px;
	display: flex;
	align-items: center;
	gap: 14px;
	padding-left: 14px;
	box-sizing: border-box;
	overflow: hidden;
	white-space: nowrap;
	border-radius: 6px 0 0 6px;
	transition: max-width .25s ease, width .25s ease, background-color .2s ease, padding .25s ease;
}
.erc-float__inner .erc-icon { flex: 0 0 22px; }
.erc-float__label {
	font-size: 15px;
	font-weight: 500;
	line-height: 1;
	padding-right: 24px;
	opacity: 0;
	transition: opacity .2s ease;
}
.erc-float__item:hover .erc-float__inner,
.erc-float__item:focus-visible .erc-float__inner {
	width: 200px;
	max-width: 260px;
	padding-left: 28px;
	background: var(--erc-accent);
	color: var(--erc-accent-text);
	box-shadow: -4px 4px 14px rgba(0, 0, 0, .12);
	z-index: 2;
}
.erc-float__item:hover .erc-float__label,
.erc-float__item:focus-visible .erc-float__label { opacity: 1; }
.erc-float__item:focus-visible { outline: none; }

@media (max-width: 600px) {
	.erc-float li { width: 44px; height: 44px; }
	.erc-float__inner { width: 44px; max-width: 44px; padding-left: 11px; }
	.erc-float--hide-mobile { display: none; }
}
@media (hover: none) {
	.erc-float__item:hover .erc-float__inner { width: 44px; max-width: 50px; padding-left: 11px; background: none; box-shadow: none; }
	.erc-float__item:hover .erc-float__label { opacity: 0; }
}

/* ---------- modal ---------- */
html.erc-modal-open { overflow: hidden; }
.erc-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.erc-modal[hidden] { display: none; }
.erc-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(17, 17, 17, .55);
	opacity: 0;
	transition: opacity .18s ease;
}
.erc-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 480px;
	max-height: calc(100vh - 32px);
	overflow: auto;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
	transform: translateY(16px) scale(.98);
	opacity: 0;
	transition: transform .2s ease, opacity .18s ease;
	outline: none;
}
.erc-modal.is-open .erc-modal__backdrop { opacity: 1; }
.erc-modal.is-open .erc-modal__dialog { transform: none; opacity: 1; }
.erc-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 14px 14px 0 24px;
}
.erc-tabs { display: flex; gap: 4px; background: var(--erc-field); border-radius: 999px; padding: 4px; }
.erc-tab {
	all: unset;
	cursor: pointer;
	padding: 8px 16px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	color: var(--erc-muted);
}
.erc-tab.is-active { background: var(--erc-accent); color: var(--erc-accent-text); }
.erc-tab:focus-visible, .erc-modal__close:focus-visible { outline: 2px solid var(--erc-ink); outline-offset: 2px; }
.erc-modal__close {
	all: unset;
	cursor: pointer;
	width: 38px;
	height: 38px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	color: var(--erc-ink);
}
.erc-modal__close:hover { background: var(--erc-field); }

/* ---------- calculator card ---------- */
.erc-card {
	box-sizing: border-box;
	background: #fff;
	color: var(--erc-ink);
	border-radius: var(--erc-radius);
	padding: 24px 28px 28px;
	font-size: 15px;
	line-height: 1.45;
}
.erc-inline .erc-card { max-width: 460px; box-shadow: 0 6px 24px rgba(0, 0, 0, .08); }
.erc-card--modal { padding-top: 16px; box-shadow: none; }
.erc-card *, .erc-card *::before, .erc-card *::after { box-sizing: border-box; }
.erc-calc__title { margin: 0 0 16px; font-size: 20px; font-weight: 700; line-height: 1.25; color: var(--erc-ink); }
.erc-field { display: block; margin: 0 0 14px; }
.erc-label { display: block; margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--erc-ink); }

.erc-input {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--erc-field);
	border-bottom: 2px solid var(--erc-ink);
	padding: 0 16px;
	min-height: 60px;
}
.erc-input__flag { display: flex; }
.erc-input__flag[hidden] { display: none; }
.erc-input__flag .erc-flag { width: 24px; height: 24px; }
.erc-card .erc-input__field {
	all: unset;
	flex: 1;
	min-width: 0;
	width: 100%;
	font-size: 24px;
	font-weight: 700;
	color: var(--erc-ink);
	padding: 14px 0;
	line-height: 1.2;
}
.erc-input:focus-within { border-bottom-color: var(--erc-accent); box-shadow: inset 0 -2px 0 var(--erc-accent); }

.erc-flags { display: inline-flex; align-items: center; }
.erc-flag { width: 20px; height: 20px; object-fit: cover; border-radius: 50%; display: block; }
.erc-flags .erc-flag + .erc-flag { margin-left: -6px; box-shadow: 0 0 0 2px #fff; }

/* pair dropdown */
.erc-select { position: relative; }
.erc-select__btn {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	width: 100%;
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	padding: 0 16px;
	background: var(--erc-field);
	border-bottom: 2px solid var(--erc-ink);
	font-size: 17px;
	font-weight: 700;
	color: var(--erc-ink);
}
.erc-select__btn:focus-visible { box-shadow: inset 0 -2px 0 var(--erc-accent); border-bottom-color: var(--erc-accent); }
.erc-select__chev {
	margin-left: auto;
	width: 9px;
	height: 9px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
}
.erc-select__list {
	position: absolute;
	z-index: 5;
	left: 0;
	right: 0;
	top: calc(100% + 4px);
	margin: 0;
	padding: 6px;
	list-style: none;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
	max-height: 260px;
	overflow: auto;
	outline: none;
}
.erc-select__list[hidden] { display: none; }
.erc-select__list li {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	margin: 0;
	border-radius: 8px;
	cursor: pointer;
	font-weight: 600;
}
.erc-select__list li.is-active, .erc-select__list li:hover { background: var(--erc-field); }
.erc-select__list li[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--erc-accent); }
.erc-select__rate { margin-left: auto; color: var(--erc-muted); font-weight: 500; font-size: 14px; }

/* summary */
.erc-summary { margin-top: 18px; color: var(--erc-muted); font-size: 14px; font-weight: 600; }
.erc-summary p { margin: 0 0 3px; }
.erc-summary p:empty { display: none; }
.erc-summary strong { margin-right: 6px; }
.erc-summary__total { color: var(--erc-ink); font-size: 15px; margin-top: 6px !important; }
.erc-summary__msg { color: #b42318; }
.erc-asof, .erc-disclaimer { margin: 12px 0 0; font-size: 12px; color: var(--erc-muted); }
.erc-cta, .erc-open-button {
	display: inline-block;
	margin-top: 18px;
	padding: 12px 22px;
	border: 0;
	border-radius: 999px;
	background: var(--erc-accent);
	color: var(--erc-accent-text);
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}
.erc-cta:hover, .erc-open-button:hover { filter: brightness(.95); }
.erc-loading, .erc-error { margin: 0; color: var(--erc-muted); }

/* rates table */
.erc-rates-wrap { overflow-x: auto; }
.erc-rates { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; }
.erc-rates th, .erc-rates td { padding: 12px 10px; text-align: left; border: 0; border-bottom: 1px solid var(--erc-line); white-space: nowrap; }
.erc-rates thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--erc-muted); }
.erc-rates tbody th { font-weight: 600; }
.erc-rates tbody th .erc-flags { margin-right: 10px; vertical-align: middle; }
.erc-rates td { font-variant-numeric: tabular-nums; font-weight: 600; }

@media (max-width: 480px) {
	.erc-card { padding: 18px; }
	.erc-modal__head { padding-left: 18px; }
	.erc-card .erc-input__field { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
	.erc-float__inner, .erc-modal__dialog, .erc-modal__backdrop { transition: none; }
}
