/**
 * Scoped to .usap-* so GeneratePress and WPBakery styles cannot reach in.
 * Colours follow the usapermits.com brand: navy for structure, red for the
 * one figure that matters. Override the variables in the theme if it changes.
 */
.usap-estimator {
	--usap-accent: #040a51;
	--usap-accent-dark: #02063a;
	--usap-accent-soft: #eef0fa;
	--usap-highlight: #f22629;
	--usap-text: #1c1f2e;
	--usap-muted: #667085;
	--usap-border: #dfe3ea;
	--usap-surface: #f6f7fa;
	--usap-radius: 14px;
	--usap-shadow: 0 10px 30px rgba(4, 10, 81, 0.08);

	max-width: 780px;
	margin: 0 auto;
	color: var(--usap-text);
	font-size: 16px;
	line-height: 1.5;
	counter-reset: usap-step;
}

.usap-estimator *,
.usap-estimator *::before,
.usap-estimator *::after {
	box-sizing: border-box;
}

/* ---------- the card and its panels ---------- */

.usap-card {
	padding: 28px 28px 26px;
	border: 1px solid var(--usap-border);
	border-radius: var(--usap-radius);
	background: #ffffff;
	box-shadow: var(--usap-shadow);
}

.usap-step {
	margin: 0;
	padding: 0;
	border: 0;
	animation: usap-fade 0.25s ease-out;
}

@keyframes usap-fade {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: none; }
}

/* ---------- stepper ---------- */

.usap-stepper {
	display: flex;
	margin: 0 0 26px;
	padding: 0;
	list-style: none;
	counter-reset: none;
}

.usap-stepper-item {
	position: relative;
	display: flex;
	flex: 1;
	align-items: center;
	gap: 10px;
	min-width: 0;
	color: var(--usap-muted);
	font-size: 14px;
	font-weight: 600;
}

/* Connector to the next step. */
.usap-stepper-item:not(:last-child)::after {
	content: "";
	flex: 1;
	height: 2px;
	margin: 0 14px;
	border-radius: 2px;
	background: var(--usap-border);
}

.usap-stepper-item.is-done:not(:last-child)::after {
	background: var(--usap-accent);
}

.usap-stepper-dot {
	flex: none;
	width: 30px;
	height: 30px;
	border: 2px solid var(--usap-border);
	border-radius: 50%;
	background: #ffffff;
	color: var(--usap-muted);
	font-size: 13px;
	font-weight: 700;
	line-height: 26px;
	text-align: center;
	transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.usap-stepper-item.is-current {
	color: var(--usap-accent);
}

.usap-stepper-item.is-current .usap-stepper-dot {
	border-color: var(--usap-accent);
	background: var(--usap-accent);
	color: #ffffff;
	box-shadow: 0 0 0 4px var(--usap-accent-soft);
}

.usap-stepper-item.is-done .usap-stepper-dot {
	border-color: var(--usap-accent);
	background: var(--usap-accent);
	color: #ffffff;
	font-size: 0;
}

.usap-stepper-item.is-done .usap-stepper-dot::before {
	content: "✓";
	font-size: 14px;
}

.usap-stepper-label {
	white-space: nowrap;
}

.usap-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.usap-title {
	margin: 0 0 22px;
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.usap-subtitle {
	margin: 0 0 6px;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
}

.usap-hint {
	margin: 0 0 18px;
	color: var(--usap-muted);
	font-size: 14px;
}

.usap-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px 20px;
}

/* ---------- fields ---------- */

.usap-field {
	margin: 0 0 16px;
}

.usap-field label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--usap-muted);
}

.usap-field input[type="text"],
.usap-field input[type="email"],
.usap-field input[type="tel"],
.usap-field select {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--usap-border);
	border-radius: 8px;
	background: #ffffff;
	color: var(--usap-text);
	font-size: 16px; /* Below 16px iOS Safari zooms the page on focus. */
	line-height: 1.4;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.usap-field input:hover,
.usap-field select:hover {
	border-color: #b9c0cc;
}

.usap-field input:focus,
.usap-field select:focus {
	outline: 0;
	border-color: var(--usap-accent);
	box-shadow: 0 0 0 3px rgba(4, 10, 81, 0.12);
}

.usap-field select {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 40px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}

.usap-field-inline {
	max-width: 280px;
}

.usap-field-checks {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 10px;
	padding-bottom: 4px;
}

.usap-fieldset {
	margin: 0 0 22px;
	padding: 0;
	border: 0;
}

.usap-fieldset legend {
	padding: 0;
	margin-bottom: 10px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--usap-muted);
}

/* ---------- checkboxes as pills ---------- */

.usap-checks {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.usap-check {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	padding: 9px 16px 9px 13px;
	border: 1px solid var(--usap-border);
	border-radius: 999px;
	background: #ffffff;
	font-size: 15px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.usap-check:hover {
	border-color: var(--usap-accent);
}

.usap-check input {
	width: 17px;
	height: 17px;
	margin: 0;
	accent-color: var(--usap-accent);
}

.usap-check:has(input:checked) {
	background: var(--usap-accent);
	border-color: var(--usap-accent);
	color: #ffffff;
}

.usap-check:has(input:checked) input {
	accent-color: #ffffff;
}

/* The plate checkboxes stay plain: they are qualifiers, not products. */
.usap-field-checks .usap-check {
	display: inline-flex;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--usap-text);
	font-size: 15px;
	font-weight: 400;
	letter-spacing: 0;
	text-transform: none;
}

.usap-field-checks .usap-check:has(input:checked) {
	background: transparent;
	color: var(--usap-text);
}

.usap-field-checks .usap-check:has(input:checked) input {
	accent-color: var(--usap-accent);
}

/* ---------- buttons ---------- */

.usap-button {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 26px;
	border: 0;
	border-radius: 8px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.usap-button-primary {
	background: var(--usap-accent);
	color: #ffffff;
	box-shadow: 0 6px 16px rgba(4, 10, 81, 0.22);
}

.usap-button-primary::after {
	content: "→";
	font-size: 18px;
	line-height: 1;
	transition: transform 0.15s;
}

.usap-button-primary:hover:not(:disabled),
.usap-button-primary:focus:not(:disabled) {
	background: var(--usap-accent-dark);
	color: #ffffff;
	transform: translateY(-1px);
	box-shadow: 0 8px 20px rgba(4, 10, 81, 0.28);
}

.usap-button-primary:hover:not(:disabled)::after {
	transform: translateX(3px);
}

.usap-button-ghost {
	padding-left: 14px;
	padding-right: 14px;
	background: transparent;
	color: var(--usap-muted);
	font-weight: 600;
}

.usap-button-ghost::before {
	content: "←";
	font-size: 18px;
	line-height: 1;
}

.usap-button-ghost:hover,
.usap-button-ghost:focus {
	background: var(--usap-surface);
	color: var(--usap-text);
}

.usap-button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	box-shadow: none;
}

/* ---------- state chips ---------- */

.usap-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 18px;
	padding: 0;
	list-style: none;
}

.usap-chip {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 8px 8px 8px 14px;
	border: 1px solid var(--usap-border);
	border-radius: 10px;
	background: #ffffff;
	font-size: 15px;
	font-weight: 600;
	box-shadow: 0 2px 8px rgba(4, 10, 81, 0.06);
}

.usap-chip::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--usap-accent);
}

.usap-chip small {
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--usap-accent-soft);
	color: var(--usap-accent);
	font-size: 12px;
	font-weight: 600;
}

.usap-chip-remove {
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--usap-muted);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.usap-chip-remove:hover,
.usap-chip-remove:focus {
	background: #fdeceb;
	color: var(--usap-highlight);
}

.usap-distance {
	display: block;
	width: fit-content;
	margin: 0 0 20px;
	padding: 8px 14px;
	border-radius: 8px;
	background: var(--usap-surface);
	color: var(--usap-text);
	font-size: 14px;
	font-weight: 600;
}

/* ---------- result ---------- */

.usap-total {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 24px;
	margin: 14px 0 22px;
	padding: 22px 26px;
	border-radius: 12px;
	background: linear-gradient(135deg, var(--usap-accent) 0%, #101a7a 100%);
	color: #ffffff;
}

.usap-total-label {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.85;
}

.usap-total-amount {
	font-size: 34px;
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.usap-total-amount small {
	margin-left: 6px;
	font-size: 14px;
	font-weight: 600;
	opacity: 0.8;
}

.usap-table {
	width: 100%;
	margin: 0 0 6px;
	border-collapse: collapse;
	font-size: 15px;
}

.usap-table td,
.usap-table th {
	padding: 11px 12px 11px 0;
	border-bottom: 1px solid var(--usap-border);
	text-align: left;
	vertical-align: middle;
}

.usap-table tr:last-child td {
	border-bottom: 0;
}

.usap-table td:first-child {
	width: 40%;
	font-weight: 600;
}

.usap-badge {
	display: inline-block;
	margin-left: 8px;
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--usap-surface);
	color: var(--usap-muted);
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

.usap-row-unpriced td {
	color: var(--usap-muted);
}

.usap-approx {
	margin: 0 0 16px;
	color: var(--usap-muted);
	font-size: 13px;
}

/* ---------- messages ---------- */

.usap-error,
.usap-notice {
	margin: 16px 0 0;
	padding: 13px 16px;
	border-left: 4px solid var(--usap-accent);
	border-radius: 8px;
	background: var(--usap-accent-soft);
	font-size: 14px;
}

.usap-error,
.usap-notice-error {
	border-left-color: var(--usap-highlight);
	background: #fdeceb;
	color: #8c1d18;
}

.usap-disclaimer {
	margin: 18px 0 0;
	font-size: 13px;
}

/* ---------- utilities ---------- */

.usap-estimator [hidden] {
	display: none !important;
}

.usap-estimator .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* ---------- small screens ---------- */

@media (max-width: 600px) {
	.usap-grid {
		grid-template-columns: minmax(0, 1fr);
	}
	.usap-card {
		padding: 22px 18px 20px;
	}
	.usap-stepper-item:not(.is-current) .usap-stepper-label {
		display: none;
	}
	.usap-stepper-item:not(:last-child)::after {
		margin: 0 8px;
	}
	.usap-button-ghost {
		width: auto;
	}
	.usap-title {
		font-size: 22px;
	}
	.usap-button {
		width: 100%;
		justify-content: center;
	}
	.usap-total-amount {
		font-size: 28px;
	}
	.usap-table td:first-child {
		width: auto;
	}
}
