/*
 * Currency calculator card. Every rule is scoped to .cer-calc and sets its own values,
 * so theme and page-builder styles for headings, inputs and buttons do not leak in.
 */

.cer-calc {
	--cer-blue: #1565c0;
	--cer-blue-soft: #eef4fb;
	--cer-green: #50b748;
	--cer-green-dark: #43a03c;
	--cer-text: #111827;
	--cer-muted: #4b5563;
	--cer-soft: #f1f5f9;
	--cer-line: #cbd5e1;
	--cer-error: #b42318;

	box-sizing: border-box;
	width: 100%;
	max-width: 440px;
	margin: 0 auto;
	padding: 28px 22px 22px;
	border-style: solid;
	border-color: transparent;
	border-width: 5px 8px 8px 5px;
	border-radius: 44px;
	background: linear-gradient( #fff, #fff ) padding-box, linear-gradient( 140deg, var( --cer-green ) 0%, var( --cer-green ) 35%, var( --cer-blue ) 65% ) border-box;
	box-shadow: 0 18px 40px rgba( 21, 101, 192, 0.12 );
	color: var( --cer-text );
	font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
}

.cer-calc *,
.cer-calc *::before,
.cer-calc *::after {
	box-sizing: border-box;
}

.cer-calc [hidden] {
	display: none !important;
}

.cer-calc .cer-calc__title {
	margin: 0;
	padding: 0;
	color: var( --cer-text );
	font-family: inherit;
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0;
	text-align: center;
	text-transform: none;
}

.cer-calc .cer-calc__subtitle {
	margin: 6px 0 18px;
	padding: 0;
	color: var( --cer-text );
	font-size: 12px;
	line-height: 1.4;
	text-align: center;
}

.cer-calc .cer-calc__form {
	margin: 0;
	padding: 0;
}

.cer-calc .cer-calc__methods {
	min-width: 0;
	margin: 0 0 16px;
	padding: 0;
	border: 0;
}

.cer-calc .cer-calc__label {
	display: block;
	float: none;
	width: auto;
	margin: 0 0 6px;
	padding: 0;
	color: var( --cer-text );
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: 0;
	text-transform: none;
}

.cer-calc .cer-calc__segments {
	display: flex;
	gap: 4px;
	padding: 4px;
	border-radius: 10px;
	background: var( --cer-soft );
}

.cer-calc .cer-calc__segment {
	position: relative;
	flex: 1 1 auto;
	margin: 0;
	padding: 0;
	cursor: pointer;
}

.cer-calc .cer-calc__segment input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}

.cer-calc .cer-calc__segment span {
	display: block;
	padding: 8px 12px;
	border-radius: 7px;
	color: var( --cer-muted );
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	text-align: center;
	white-space: nowrap;
	transition: background-color 0.15s, color 0.15s;
}

.cer-calc .cer-calc__segment:hover span {
	color: var( --cer-blue );
}

.cer-calc .cer-calc__segment input:checked + span {
	background: var( --cer-blue );
	color: #fff;
}

.cer-calc .cer-calc__segment input:focus-visible + span {
	outline: 2px solid var( --cer-blue );
	outline-offset: 2px;
}

.cer-calc .cer-calc__row {
	display: grid;
	grid-template-columns: 1fr 1.15fr 1.2fr;
	margin: 0 0 18px;
}

.cer-calc .cer-calc__field {
	min-width: 0;
}

.cer-calc .cer-calc__field--to {
	margin-left: 8px;
}

.cer-calc .cer-calc__select {
	position: relative;
}

.cer-calc .cer-calc__input,
.cer-calc .cer-calc__select select {
	display: block;
	width: 100%;
	max-width: none;
	height: 48px;
	min-height: 0;
	margin: 0;
	padding: 0 12px;
	border: 1px solid var( --cer-line );
	border-radius: 8px;
	background-color: #fff;
	box-shadow: none;
	color: var( --cer-text );
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 46px;
	letter-spacing: 0;
	text-transform: none;
	-webkit-appearance: none;
	appearance: none;
}

.cer-calc .cer-calc__field--amount .cer-calc__input {
	margin-left: -1px;
	width: calc( 100% + 1px );
	border-radius: 0 8px 8px 0;
}

.cer-calc .cer-calc__input::placeholder {
	color: #94a3b8;
	font-weight: 400;
	opacity: 1;
}

.cer-calc .cer-calc__select select {
	padding-right: 30px;
	background-image: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23111827' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" );
	background-position: right 10px center;
	background-repeat: no-repeat;
	background-size: 12px 8px;
	text-overflow: ellipsis;
	cursor: pointer;
}

.cer-calc .cer-calc__field--from select {
	border-radius: 8px 0 0 8px;
	background-color: #f8fafc;
}

.cer-calc .cer-calc__select.has-flag select {
	padding-left: 46px;
}

.cer-calc .cer-calc__select.is-static select {
	background-image: none;
	padding-right: 12px;
	opacity: 1;
	color: var( --cer-text );
	-webkit-text-fill-color: var( --cer-text );
	cursor: default;
}

.cer-calc .cer-calc__input:focus,
.cer-calc .cer-calc__select select:focus {
	position: relative;
	z-index: 1;
	border-color: var( --cer-blue );
	outline: none;
	box-shadow: 0 0 0 3px rgba( 21, 101, 192, 0.15 );
}

/* Custom flag menu (see calculator.js): taps go to the wrapper, never the native list. */
.cer-calc .cer-calc__select.is-enhanced {
	cursor: pointer;
}

.cer-calc .cer-calc__select.is-enhanced select {
	pointer-events: none;
}

.cer-calc .cer-calc__select.is-enhanced.is-static {
	cursor: default;
}

.cer-calc .cer-calc__select.is-open select {
	position: relative;
	z-index: 1;
	border-color: var( --cer-blue );
	box-shadow: 0 0 0 3px rgba( 21, 101, 192, 0.15 );
}

.cer-calc .cer-calc__flag {
	position: absolute;
	top: 50%;
	left: 12px;
	z-index: 2;
	width: 26px;
	height: 18px;
	margin: -9px 0 0;
	border-radius: 3px;
	box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.08 );
	object-fit: cover;
	pointer-events: none;
}

.cer-calc .cer-calc__error {
	margin: -8px 0 12px;
	padding: 0;
	color: var( --cer-error );
	font-size: 12px;
	line-height: 1.4;
}

.cer-calc .cer-calc__button {
	display: block;
	width: 100%;
	height: 46px;
	margin: 0;
	padding: 0 16px;
	border: 0;
	border-radius: 8px;
	background: var( --cer-green );
	box-shadow: none;
	color: #fff;
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 46px;
	letter-spacing: 0;
	text-align: center;
	text-transform: none;
	cursor: pointer;
	transition: background-color 0.15s;
}

.cer-calc .cer-calc__button:hover,
.cer-calc .cer-calc__button:focus {
	background: var( --cer-green-dark );
	color: #fff;
}

.cer-calc .cer-calc__button:focus-visible {
	outline: 2px solid var( --cer-blue );
	outline-offset: 2px;
}

.cer-calc .cer-calc__result {
	margin: 18px 0 0;
	padding: 12px 16px;
	border-radius: 10px;
	background: var( --cer-blue-soft );
}

.cer-calc .cer-calc__summary,
.cer-calc .cer-calc__rate {
	margin: 0;
	padding: 0;
	color: var( --cer-text );
	font-size: 11px;
	line-height: 1.4;
}

.cer-calc .cer-calc__updated {
	margin: 6px 0 0;
	padding: 6px 0 0;
	border-top: 1px solid rgba( 21, 101, 192, 0.12 );
	color: var( --cer-muted );
	font-size: 11px;
	line-height: 1.4;
}

.cer-calc .cer-calc__note a {
	color: var( --cer-blue );
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.cer-calc .cer-calc__note a:hover,
.cer-calc .cer-calc__note a:focus {
	color: var( --cer-green-dark );
}

.cer-calc .cer-calc__amount {
	margin: 4px 0;
	padding: 0;
	color: var( --cer-blue );
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
	overflow-wrap: anywhere;
}

.cer-calc .cer-calc__note,
.cer-calc .cer-calc__empty {
	margin: 16px 0 0;
	padding: 0;
	color: var( --cer-text );
	font-size: 11px;
	line-height: 1.4;
	text-align: center;
}

.cer-calc .cer-calc__empty {
	font-size: 14px;
}

.cer-calc .cer-calc__note {
	font-size: 10px;
}

.cer-calc .cer-calc__asterisk {
	color: #d92d20;
	font-weight: 700;
}

/* The menu is appended to <body>, outside .cer-calc, so it carries its own complete styles. */
.cer-calc-menu {
	position: absolute;
	z-index: 100000;
	box-sizing: border-box;
	max-height: 280px;
	margin: 0;
	padding: 4px;
	overflow-y: auto;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 12px 28px rgba( 15, 23, 42, 0.16 );
	color: #111827;
	font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
	list-style: none;
	text-align: left;
	outline: none;
}

.cer-calc-menu .cer-calc-menu__item {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 8px 10px;
	border-radius: 6px;
	list-style: none;
	cursor: pointer;
	white-space: nowrap;
}

.cer-calc-menu .cer-calc-menu__item::before,
.cer-calc-menu .cer-calc-menu__item::marker {
	content: none;
}

.cer-calc-menu .cer-calc-menu__item.is-active {
	background: #f1f5f9;
}

.cer-calc-menu .cer-calc-menu__item[aria-selected="true"] {
	background: #eef4fb;
	color: #1565c0;
	font-weight: 600;
}

.cer-calc-menu .cer-calc-menu__item[aria-selected="true"].is-active {
	background: #dde9f7;
}

.cer-calc-menu .cer-calc-menu__flag {
	display: block;
	flex: 0 0 auto;
	width: 26px;
	height: 18px;
	margin: 0;
	border-radius: 3px;
	box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.08 );
	object-fit: cover;
}

span.cer-calc-menu__flag {
	box-shadow: none;
}

@media ( max-width: 420px ) {
	.cer-calc {
		padding: 24px 16px 18px;
		border-radius: 32px;
	}

	.cer-calc .cer-calc__segment span {
		padding: 8px 6px;
		font-size: 12px;
		white-space: normal;
	}

	.cer-calc .cer-calc__title {
		font-size: 22px;
	}

	.cer-calc .cer-calc__row {
		grid-template-columns: 1fr;
		row-gap: 10px;
	}

	.cer-calc .cer-calc__field--to {
		margin-left: 0;
	}

	.cer-calc .cer-calc__field--amount .cer-calc__input,
	.cer-calc .cer-calc__field--from select {
		margin-left: 0;
		width: 100%;
		border-radius: 8px;
	}
}
