/**
 * Advanced Shipping - cart / checkout shipping method cards.
 *
 * Self-contained: theme variables (--c-1, --c-4, ...) are used only if the theme defines
 * them, otherwise the fallbacks below apply. Selectors are scoped and specific enough to
 * override common theme styles for the shipping list. Works in RTL and LTR.
 */

html body ul#shipping_method.woocommerce-shipping-methods {
	--was-accent: var(--c-1, #273b09);
	--was-text: var(--c-4, #424750);
	--was-muted: var(--c-7, #81858b);
	--was-line: var(--c-8, #e0e0e2);
	--was-line-strong: var(--c-6, #a1a3a8);
	--was-radius: var(--br-1, 8px);
	--was-danger: #d63638;

	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 10px 0 0 0;
	padding: 0;
	list-style: none;
}

/* Card */
html body ul#shipping_method.woocommerce-shipping-methods li {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 0;
	position: relative;
	margin: 0;
	padding: 12px;
	padding-inline-start: 40px;
	border: 1px solid var(--was-line);
	border-radius: var(--was-radius);
	background-color: #fff;
	list-style: none;
	transition: border-color .2s, background-color .2s;
}
html body ul#shipping_method.woocommerce-shipping-methods li:hover {
	border-color: var(--was-line-strong);
}
html body ul#shipping_method.woocommerce-shipping-methods li:has(input:checked),
html body ul#shipping_method.woocommerce-shipping-methods li:has(input[type=hidden]) {
	border-color: var(--was-accent);
	background-color: color-mix(in srgb, var(--was-accent) 5%, #fff);
}

/* Whole card is clickable (the radio covers it) */
html body ul#shipping_method.woocommerce-shipping-methods li input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	z-index: 2;
	cursor: pointer;
}

/* Title + price on one line */
html body ul#shipping_method.woocommerce-shipping-methods li label {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
	width: 100%;
	padding: 0;
	cursor: pointer;
	text-align: start !important;
	line-height: 1.7 !important;
}
html body ul#shipping_method.woocommerce-shipping-methods .shipping-method-title {
	font-weight: bold;
	color: var(--was-text);
}
html body ul#shipping_method.woocommerce-shipping-methods .shipping-method-price {
	flex-shrink: 0;
	white-space: nowrap;
	font-weight: bold;
	color: var(--was-accent);
	text-align: end;
}
html body ul#shipping_method.woocommerce-shipping-methods .amount {
	position: static;
	transform: none;
}

/* Description */
html body ul#shipping_method.woocommerce-shipping-methods .was-method-description {
	flex: 0 0 100%;
	margin-top: 6px;
	font-size: 12px;
	line-height: 1.9;
	color: var(--was-muted);
	text-align: start;
}

/* "Pay on delivery" heading and delivery-time pill: always aligned to the start edge */
html body ul#shipping_method.woocommerce-shipping-methods .was-cod-title {
	flex: 0 0 100%;
	width: 100%;
	margin-top: 8px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.8;
	color: var(--was-accent);
	text-align: start;
}
html body ul#shipping_method.woocommerce-shipping-methods .was-delivery-time-wrap {
	display: flex;
	justify-content: flex-start;
	flex: 0 0 100%;
	width: 100%;
	margin-top: 10px;
	text-align: start;
}
html body ul#shipping_method.woocommerce-shipping-methods .was-delivery-time {
	display: inline-flex;
	align-items: center;
	padding: 2px 14px;
	border-radius: 20px;
	background: #fff;
	border: 1px solid var(--was-line);
	color: var(--was-text);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.9;
}

/* Radio dot */
html body ul#shipping_method.woocommerce-shipping-methods li label::before {
	content: "";
	position: absolute;
	top: 15px;
	right: auto;
	left: auto;
	inset-inline-start: 12px;
	width: 16px;
	height: 16px;
	box-sizing: border-box;
	border: 2px solid var(--was-text);
	border-radius: 50px;
	transform: none;
}
html body ul#shipping_method.woocommerce-shipping-methods li input:checked + label::before,
html body ul#shipping_method.woocommerce-shipping-methods li input[type=hidden] + label::before {
	border: 5px solid var(--was-accent);
}

/* "No method chosen" error */
html body .was-shipping-error {
	margin-top: 10px;
	color: #d63638;
	font-size: 13px;
	font-weight: bold;
	line-height: 1.8;
}
html body ul#shipping_method.woocommerce-shipping-methods.was-has-error li {
	border-color: #d63638;
}
