/**
 * Canada Post: tracking box on the customer's order page and the
 * Deliver to Post Office picker at checkout.
 *
 * Kept small and scoped; colours and type are inherited from the theme.
 */

.mwcp-tracking {
	margin: 0 0 2em;
	padding: 20px 24px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
}

.mwcp-tracking__title {
	margin: 0 0 0.5em;
}

.mwcp-tracking p {
	margin: 0 0 0.6em;
}

.mwcp-tracking__status {
	font-size: 1.1em;
}

.mwcp-tracking__office small {
	opacity: 0.8;
}

.mwcp-tracking__events {
	width: 100%;
	margin: 0.8em 0 0;
	font-size: 0.92em;
}

.mwcp-tracking__events th,
.mwcp-tracking__events td {
	padding: 8px 10px;
	text-align: left;
	vertical-align: top;
}

.mwcp-d2po__toggle {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	cursor: pointer;
	font-weight: 400;
	white-space: normal;
	text-align: start;
}

.mwcp-d2po__toggle input {
	margin: 0.2em 0 0;
	flex: none;
}

.mwcp-d2po__select {
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
	margin: 10px 0 0;
}

/*
 * Avada's checkout totals cells are nowrap, and the order box clips overflow.
 * A long shipping name, or a post-office list, stretches the table past the
 * box and the price disappears. Keep the totals table inside the box and let
 * those two rows wrap.
 */
.woocommerce-checkout .woocommerce-checkout-review-order .awb-cart-totals-table {
	width: 100%;
	max-width: 100%;
	table-layout: fixed;
}

.woocommerce-checkout .woocommerce-checkout-review-order .woocommerce-checkout-review-order-table .awb-checkout-totals-wrapper .awb-cart-totals-table th {
	width: 38%;
	padding-inline-end: 16px;
	white-space: normal;
}

.woocommerce-checkout .woocommerce-checkout-review-order .woocommerce-checkout-review-order-table .awb-checkout-totals-wrapper .awb-cart-totals-table td {
	width: auto;
	white-space: normal;
	overflow-wrap: anywhere;
}

.woocommerce-checkout .woocommerce-checkout-review-order #shipping_method,
.woocommerce-checkout .woocommerce-checkout-review-order #shipping_method li,
.woocommerce-checkout .woocommerce-checkout-review-order #shipping_method label {
	white-space: normal;
	text-align: start;
	max-width: 100%;
}

.woocommerce-checkout .woocommerce-checkout-review-order .woocommerce-checkout-review-order-table .awb-checkout-totals-wrapper .awb-cart-totals-table tr.woocommerce-shipping-totals td,
.woocommerce-checkout .woocommerce-checkout-review-order .woocommerce-checkout-review-order-table .awb-checkout-totals-wrapper .awb-cart-totals-table tr.mwcp-d2po td {
	text-align: start;
	vertical-align: top;
}

.mwcp-d2po__heading {
	margin: 0 0 6px;
	font-weight: 700;
}

.mwcp-d2po__note {
	margin: 8px 0 0;
	font-size: 0.9em;
	opacity: 0.85;
}

.mwcp-d2po__note--error {
	opacity: 1;
	color: #b32d2e;
}

/*
 * Address suggestions start after three characters. Until then, say so.
 * While the lookup is running, spin inside the field and leave typing alone.
 */
.woocommerce-checkout .woocommerce-input-wrapper:has(#billing_address_1),
.woocommerce-checkout .woocommerce-input-wrapper:has(#shipping_address_1) {
	display: flex;
	flex-direction: column;
}

.woocommerce-checkout .woocommerce-input-wrapper:has(#billing_address_1) input,
.woocommerce-checkout .woocommerce-input-wrapper:has(#shipping_address_1) input {
	order: 1;
}

.woocommerce-checkout .mwcp-ac-note {
	display: none;
	order: 2;
	margin: 6px 0 0;
	color: #6f6a64;
	font-size: 13px;
	line-height: 1.35;
}

.woocommerce-checkout .woocommerce-input-wrapper.mwcp-ac-waiting .mwcp-ac-note {
	display: block;
}

.woocommerce-checkout .mwcp-ac-spin {
	display: none;
	position: absolute;
	z-index: 2;
	inset-inline-end: 16px;
	top: 12px;
	width: 16px;
	height: 16px;
	box-sizing: border-box;
	border: 2px solid rgba(21, 21, 21, 0.18);
	border-top-color: #151515;
	border-radius: 50%;
	pointer-events: none;
	animation: mwcp-ac-spin 0.7s linear infinite;
}

.woocommerce-checkout .woocommerce-input-wrapper.mwcp-ac-loading .mwcp-ac-spin {
	display: block;
}

.woocommerce-checkout .woocommerce-input-wrapper.mwcp-ac-loading .address-search-icon {
	visibility: hidden;
}

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

@media (prefers-reduced-motion: reduce) {
	.woocommerce-checkout .mwcp-ac-spin {
		animation: none;
	}
}

@media (max-width: 600px) {
	.mwcp-tracking {
		padding: 16px;
	}

	.mwcp-tracking__events th:nth-child(3),
	.mwcp-tracking__events td:nth-child(3) {
		display: none;
	}
}
