/**
 * Atvido shipping calculator.
 *
 * Self-contained: every token has a fallback, so the widget looks right on
 * any page, not just the V3 landing page.
 */

.atv-calc {
	--atvc-green: #4BB64A;
	--atvc-green-dark: #3d9c3c;
	--atvc-navy: #263E56;
	--atvc-muted: #6b7c8d;
	--atvc-line: rgba(38, 62, 86, 0.12);
	--atvc-hairline: rgba(38, 62, 86, 0.07);
	--atvc-radius: 28px;

	position: relative;
	font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--atvc-navy);
}

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

/* Several blocks below set a display value, which would otherwise beat the
   [hidden] attribute we toggle from JS. */
.atv-calc [hidden] {
	display: none;
}

/* --------------------------------------------------------------- heading */

.atv-calc__head {
	text-align: center;
	margin-bottom: 30px;
}

.atv-calc__eyebrow {
	display: block;
	font-size: 12.5px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--atvc-green-dark);
	margin-bottom: 10px;
}

.atv-calc__heading {
	font-size: clamp(28px, 4vw, 44px);
	font-weight: 700;
	letter-spacing: -0.02em;
	margin: 0;
	color: var(--atvc-navy);
}

/* ------------------------------------------------------------------ card */

.atv-calc__card {
	background: #fff;
	border: 1px solid rgba(38, 62, 86, 0.08);
	border-radius: var(--atvc-radius);
	padding: 32px;
	box-shadow: 0 12px 40px rgba(38, 62, 86, 0.07);
}

.atv-calc__fields {
	display: grid;
	grid-template-columns: minmax(200px, 0.9fr) auto minmax(220px, 1.2fr) minmax(240px, 1.1fr);
	align-items: end;
	gap: 18px;
}

.atv-calc__field {
	position: relative;
	min-width: 0;
}

.atv-calc__label {
	display: block;
	font-size: 14.5px;
	font-weight: 600;
	color: var(--atvc-navy);
	margin: 0 0 8px;
}

.atv-calc__label span {
	color: var(--atvc-muted);
	font-weight: 500;
}

/* Sits in its own grid column; the fixed height matches the input boxes the
   columns either side end with, so the arrow lands on their centre line. */
.atv-calc__arrow {
	align-self: end;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 62px;
	color: var(--atvc-navy);
}

.atv-calc__arrow svg {
	width: 26px;
	height: 13px;
}

.atv-calc__input {
	width: 100%;
	min-height: 62px;
	background: #fff;
	border: 1.5px solid var(--atvc-line);
	border-radius: 16px;
	padding: 16px 18px;
	font-family: inherit;
	font-size: 16px;
	line-height: 1.4;
	color: var(--atvc-navy);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	-moz-appearance: textfield;
}

.atv-calc__input::-webkit-outer-spin-button,
.atv-calc__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.atv-calc__input:focus {
	outline: none;
	border-color: var(--atvc-green);
	box-shadow: 0 0 0 4px rgba(75, 182, 74, 0.16);
}

.atv-calc__input.has-error,
.atv-calc__combo.has-error .atv-calc__combo-btn {
	border-color: #e04b4b;
	box-shadow: 0 0 0 4px rgba(224, 75, 75, 0.12);
}

/* ---------------------------------------------------------------- origin */

.atv-calc__origins {
	display: flex;
	gap: 10px;
}

.atv-calc__origin {
	flex: 1 1 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 62px;
	padding: 10px 14px;
	background: #fff;
	border: 1.5px solid var(--atvc-line);
	border-radius: 16px;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	color: var(--atvc-navy);
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.atv-calc__origin:hover {
	border-color: rgba(75, 182, 74, 0.5);
	transform: translateY(-1px);
}

.atv-calc__origin.is-active {
	border-color: var(--atvc-green);
	background: rgba(75, 182, 74, 0.08);
	color: var(--atvc-green-dark);
}

.atv-calc .atv-flag {
	flex: none;
	width: 22px;
	aspect-ratio: 60 / 32;
	border-radius: 3px;
	overflow: hidden;
	box-shadow: 0 0 0 1px rgba(38, 62, 86, 0.14);
}

.atv-calc .atv-flag svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* -------------------------------------------------------------- combobox */

.atv-calc__combo {
	position: relative;
}

.atv-calc__combo-btn {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	min-height: 62px;
	padding: 16px 18px;
	background: #fff;
	border: 1.5px solid var(--atvc-line);
	border-radius: 16px;
	font-family: inherit;
	font-size: 16px;
	color: var(--atvc-muted);
	text-align: left;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.atv-calc__combo-btn.has-value {
	color: var(--atvc-navy);
}

.atv-calc__combo.is-open .atv-calc__combo-btn,
.atv-calc__combo-btn:focus-visible {
	outline: none;
	border-color: var(--atvc-green);
	box-shadow: 0 0 0 4px rgba(75, 182, 74, 0.16);
}

.atv-calc__combo-value {
	flex: 1 1 auto;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.atv-calc__chevron {
	flex: none;
	width: 12px;
	height: 8px;
	color: var(--atvc-navy);
	transition: transform 0.2s ease;
}

.atv-calc__combo.is-open .atv-calc__chevron {
	transform: rotate(180deg);
}

.atv-calc__combo-panel {
	position: absolute;
	z-index: 30;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid var(--atvc-line);
	border-radius: 18px;
	box-shadow: 0 22px 50px rgba(38, 62, 86, 0.18);
	padding: 10px;
	overflow: hidden;
}

.atv-calc__combo-search {
	width: 100%;
	height: 44px;
	border: 1.5px solid var(--atvc-line);
	border-radius: 12px;
	padding: 0 14px;
	font-family: inherit;
	font-size: 15px;
	color: var(--atvc-navy);
	margin-bottom: 8px;
}

.atv-calc__combo-search:focus {
	outline: none;
	border-color: var(--atvc-green);
}

.atv-calc__combo-list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 260px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.atv-calc__combo-list li {
	padding: 10px 14px;
	border-radius: 10px;
	font-size: 15px;
	color: var(--atvc-navy);
	cursor: pointer;
}

.atv-calc__combo-list li.is-active,
.atv-calc__combo-list li:hover {
	background: rgba(75, 182, 74, 0.1);
	color: var(--atvc-green-dark);
}

.atv-calc__combo-list li[aria-selected="true"] {
	font-weight: 600;
}

.atv-calc__combo-empty {
	margin: 10px 14px;
	font-size: 14px;
	color: var(--atvc-muted);
}

/* ---------------------------------------------------------------- weight */

.atv-calc__field--weight .atv-calc__input {
	padding-right: 190px;
}

.atv-calc__weight-controls {
	position: absolute;
	right: 8px;
	bottom: 8px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.atv-calc__step {
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 1px solid var(--atvc-line);
	background: #fff;
	border-radius: 10px;
	font-family: inherit;
	font-size: 18px;
	font-weight: 600;
	line-height: 1;
	color: var(--atvc-navy);
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.atv-calc__step:hover {
	background: rgba(75, 182, 74, 0.09);
	border-color: var(--atvc-green);
	color: var(--atvc-green-dark);
}

.atv-calc__step:active {
	transform: scale(0.94);
}

.atv-calc__units,
.atv-calc__currency {
	display: flex;
	gap: 4px;
	background: rgba(38, 62, 86, 0.07);
	border-radius: 11px;
	padding: 3px;
}

.atv-calc__units button,
.atv-calc__currency button {
	border: 0;
	background: transparent;
	border-radius: 8px;
	padding: 6px 11px;
	min-width: 34px;
	font-family: inherit;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--atvc-muted);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.atv-calc__units button.is-active,
.atv-calc__currency button.is-active {
	background: #fff;
	color: var(--atvc-green-dark);
	box-shadow: 0 2px 8px rgba(38, 62, 86, 0.12);
}

/* ------------------------------------------------------------ dimensions */

.atv-calc__dims-toggle {
	display: block;
	background: none;
	border: 0;
	padding: 0;
	margin: 18px 0 0;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	color: var(--atvc-green-dark);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.atv-calc__dims-toggle:hover {
	color: var(--atvc-green);
}

.atv-calc__dims {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 14px;
	margin-top: 16px;
}

/* ------------------------------------------------------------ submit row */

.atv-calc__error {
	margin: 16px 0 0;
	padding: 12px 16px;
	background: rgba(224, 75, 75, 0.08);
	border: 1px solid rgba(224, 75, 75, 0.25);
	border-radius: 12px;
	font-size: 14px;
	color: #b13030;
}

.atv-calc__switch {
	display: block;
	margin-top: 10px;
	background: #fff;
	border: 1.5px solid var(--atvc-green);
	border-radius: 10px;
	padding: 8px 16px;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 600;
	color: var(--atvc-green-dark);
	cursor: pointer;
	transition: background 0.2s ease;
}

.atv-calc__switch:hover {
	background: rgba(75, 182, 74, 0.1);
}

/* Scoped twice: the theme styles button[type="submit"] as inline-block, which
   would beat a single class and leave the auto margins with nothing to centre. */
.atv-calc .atv-calc__submit {
	display: block;
	margin: 22px auto 0;
	min-width: 260px;
	background: linear-gradient(180deg, #58c257 0%, #41a940 100%);
	color: #fff;
	border: 0;
	border-radius: 14px;
	padding: 15px 32px;
	font-family: inherit;
	font-weight: 600;
	font-size: 16px;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(75, 182, 74, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.atv-calc .atv-calc__submit:hover {
	background: linear-gradient(180deg, #4eb84d 0%, #3a9c39 100%);
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(75, 182, 74, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.atv-calc__badges {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px 22px;
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--atvc-hairline);
}

.atv-calc__badges span {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 500;
	color: var(--atvc-muted);
}

.atv-calc__badges svg {
	width: 15px;
	height: 15px;
	flex: 0 0 auto;
	color: var(--atvc-green-dark);
}

/* --------------------------------------------------------------- loading */

.atv-calc__loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 44px 24px 20px;
}

.atv-calc__dots {
	display: flex;
	gap: 10px;
	margin-bottom: 32px;
}

.atv-calc__dots span {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--atvc-green);
	animation: atv-dot 1.2s ease-in-out infinite;
}

.atv-calc__dots span:nth-child(2) { animation-delay: 0.15s; }
.atv-calc__dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes atv-dot {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
	30% { transform: translateY(-9px); opacity: 1; }
}

.atv-calc__steps {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.atv-calc__steps li {
	display: flex;
	align-items: center;
	gap: 14px;
	font-size: 16.5px;
	color: var(--atvc-navy);
	opacity: 0.3;
	transition: opacity 0.4s ease;
}

.atv-calc__steps li.is-active { opacity: 0.85; }
.atv-calc__steps li.is-done { opacity: 1; }

.atv-calc__check {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	flex: 0 0 auto;
	border-radius: 50%;
	border: 2px solid rgba(75, 182, 74, 0.5);
	color: transparent;
	transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.atv-calc__check svg {
	width: 13px;
	height: 13px;
}

.atv-calc__steps li.is-active .atv-calc__check {
	color: var(--atvc-green);
	animation: atv-check 1.2s ease-in-out infinite;
}

.atv-calc__steps li.is-done .atv-calc__check {
	background: var(--atvc-green);
	border-color: var(--atvc-green);
	color: #fff;
}

@keyframes atv-check {
	0%, 100% { box-shadow: 0 0 0 0 rgba(75, 182, 74, 0.3); }
	50% { box-shadow: 0 0 0 6px rgba(75, 182, 74, 0); }
}

@media (prefers-reduced-motion: reduce) {
	.atv-calc__dots span,
	.atv-calc__steps li.is-active .atv-calc__check {
		animation: none !important;
	}
}

/* --------------------------------------------------------------- results */

.atv-calc__results {
	margin-top: 30px;
}

.atv-calc__currency {
	width: max-content;
	margin: 0 auto 16px;
}

.atv-calc__note {
	text-align: center;
	font-size: 13px;
	color: var(--atvc-muted);
	margin: 0 auto 18px;
	max-width: 860px;
}

.atv-calc__rows {
	max-width: 860px;
	margin: 0 auto;
}

.atv-calc__row {
	display: flex;
	align-items: center;
	gap: 20px;
	background: #fff;
	border: 1px solid var(--atvc-hairline);
	border-radius: 20px;
	padding: 22px 26px;
	margin-bottom: 14px;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.atv-calc__row:hover {
	transform: translateY(-2px);
	border-color: rgba(75, 182, 74, 0.4);
	box-shadow: 0 14px 34px rgba(38, 62, 86, 0.1);
}

.atv-calc__logo {
	flex: 0 0 52px;
	width: 52px;
	height: 52px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(38, 62, 86, 0.04);
	border: 1px solid rgba(38, 62, 86, 0.06);
	border-radius: 14px;
	overflow: hidden;
}

.atv-calc__logo img {
	max-height: 30px;
	max-width: 40px;
	width: auto;
	object-fit: contain;
}

.atv-calc__logo.is-fallback {
	color: rgba(38, 62, 86, 0.35);
}

.atv-calc__logo.is-fallback svg {
	width: 24px;
	height: 24px;
}

.atv-calc__text {
	flex: 1 1 auto;
	min-width: 0;
}

.atv-calc__title {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	font-weight: 600;
	font-size: 16.5px;
	color: var(--atvc-navy);
	margin: 0;
}

.atv-calc__tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11.5px;
	font-weight: 600;
}

.atv-calc__tag::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}

.atv-calc__tag.is-cheap {
	background: rgba(75, 182, 74, 0.12);
	color: var(--atvc-green-dark);
}

.atv-calc__tag.is-fast {
	background: rgba(38, 62, 86, 0.08);
	color: var(--atvc-navy);
}

.atv-calc__meta {
	font-size: 13px;
	color: var(--atvc-muted);
	margin: 4px 0 0;
}

.atv-calc__features {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 8px;
	margin: 10px 0 0;
	padding-top: 10px;
	border-top: 1px solid var(--atvc-hairline);
}

.atv-calc__features span {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 8px 2px 6px;
	background: rgba(38, 62, 86, 0.04);
	border: 1px solid rgba(38, 62, 86, 0.08);
	border-radius: 999px;
	font-weight: 500;
	font-size: 10px;
	color: rgba(38, 62, 86, 0.6);
}

.atv-calc__features svg {
	width: 10px;
	height: 10px;
	flex: 0 0 auto;
	color: rgba(38, 62, 86, 0.45);
}

.atv-calc__price {
	margin: 0 0 0 auto;
	font-size: 22px;
	font-weight: 700;
	color: var(--atvc-green-dark);
	white-space: nowrap;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1024px) {
	.atv-calc__fields {
		grid-template-columns: 1fr 1fr;
	}

	.atv-calc__arrow {
		display: none;
	}

	.atv-calc__field--weight {
		grid-column: 1 / -1;
	}
}

@media (max-width: 700px) {
	.atv-calc__card {
		padding: 22px;
	}

	.atv-calc__fields {
		grid-template-columns: 1fr;
	}

	.atv-calc__dims {
		grid-template-columns: 1fr;
	}

	.atv-calc__submit {
		width: 100%;
		min-width: 0;
	}

	.atv-calc__row {
		flex-wrap: wrap;
		gap: 12px;
		padding: 18px;
	}

	.atv-calc__price {
		width: 100%;
		text-align: right;
	}
}

@media (max-width: 560px) {
	/* Controls drop below the field so the number keeps full width */
	.atv-calc__field--weight .atv-calc__input {
		padding-right: 18px;
	}

	.atv-calc__weight-controls {
		position: static;
		justify-content: flex-end;
		margin-top: 10px;
	}

	.atv-calc__step {
		width: 44px;
		height: 44px;
	}
}
