/* Shipping method branding: media icon + description under the title. */

.wcser-ship-method {
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	max-width: 100%;
	text-align: start;
	vertical-align: middle;
}

.wcser-ship-icon-wrap {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	line-height: 0;
}

.wcser-ship-icon-wrap:empty {
	display: none;
}

/*
 * Sized relative to the label font so it always matches the method title.
 * One fixed box for every state, so the logo never resizes when the
 * description is revealed on selection.
 */
.wcser-ship-method .wcser-ship-icon {
	display: block;
	width: auto;
	height: auto;
	max-width: 2.6em;
	max-height: 2.6em;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 3px;
	background: transparent;
	box-shadow: none;
	object-fit: contain;
}

.wcser-ship-method .wcser-ship-icon--svg {
	height: 2.4em;
}

.wcser-ship-text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.15em;
	min-width: 0;
}

.wcser-ship-title {
	display: block;
	font-size: 1.02em;
	line-height: 1.45;
}

.wcser-ship-desc {
	display: block;
	font-size: 0.8em;
	font-weight: 400 !important;
	font-style: normal;
	line-height: 1.6;
	color: inherit;
	opacity: 0.68;
	white-space: normal;
	overflow-wrap: anywhere;
}

.wcser-ship-desc:empty {
	display: none;
}

/* Keep the price chunk WooCommerce appends on the title line. */
.wcser-ship-title .woocommerce-Price-amount,
.wcser-ship-title .tax_label {
	white-space: nowrap;
}

/*
 * Themes usually float the radio and stretch the label across the cell,
 * which leaves a wide gap in RTL. Pack radio + branding as one tight group
 * at the inline-start edge (right in RTL).
 */
.woocommerce-shipping-methods li:has(.wcser-ship-method) {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	flex-wrap: nowrap;
	gap: 0.4em;
	width: fit-content;
	max-width: 100%;
}

.woocommerce-shipping-methods li:has(.wcser-ship-method) input.shipping_method {
	float: none !important;
	position: static;
	top: auto;
	margin: 0 !important;
	flex: 0 0 auto;
}

.woocommerce-shipping-methods li:has(.wcser-ship-method) > label {
	flex: 0 1 auto;
	width: auto;
	max-width: 100%;
	min-width: 0;
	margin: 0;
	text-align: start;
}

/*
 * The description belongs to the chosen method only.
 * Both the hiding and the revealing rule depend on :has(), so a browser without
 * :has() support simply keeps every description visible instead of losing them.
 */
.woocommerce-shipping-methods li:has(input.shipping_method) .wcser-ship-desc {
	display: none;
}

/* Selected method, or the single method WooCommerce renders as a hidden input. */
.woocommerce-shipping-methods li:has(input.shipping_method:checked) .wcser-ship-desc,
.woocommerce-shipping-methods li:has(input.shipping_method[type="hidden"]) .wcser-ship-desc {
	display: block;
}

@media (max-width: 600px) {
	.wcser-ship-method {
		gap: 0.5em;
	}
}

/* ---------- Admin: rules screen ---------- */

.wcser-branding {
	margin: 4px 0 14px;
	padding: 12px 14px;
	background: #f6f7f7;
	border: 1px solid #e0e0e1;
	border-radius: 6px;
}

.wcser-branding-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 18px 28px;
	align-items: flex-start;
}

.wcser-branding-field {
	flex: 1 1 320px;
	min-width: 280px;
	max-width: 520px;
}

.wcser-branding-field .description {
	margin: 6px 0 0;
	font-size: 12px;
	line-height: 1.6;
}

.wcser-branding-label {
	display: block;
	margin: 0 0 6px;
	font-weight: 600;
	font-size: 13px;
	color: #1d2327;
}

.wcser-media-picker {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.wcser-media-thumb {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 68px;
	height: 68px;
	padding: 4px;
	box-sizing: border-box;
	background: #fff;
	border: 1px dashed #c3c4c7;
	border-radius: 6px;
	overflow: hidden;
}

.wcser-media-thumb img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.wcser-media-thumb.is-empty::after {
	content: "—";
	color: #a7aaad;
	font-size: 18px;
	line-height: 1;
}

.wcser-media-buttons {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
}

.wcser-media-buttons .wcser-media-remove[hidden] {
	display: none;
}

.wcser-branding-description {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	resize: vertical;
	line-height: 1.7;
}

.wcser-branding-preview {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px dashed #dcdcde;
}

.wcser-branding-preview-caption {
	display: block;
	margin-bottom: 8px;
	font-size: 11px;
	font-weight: 600;
	color: #646970;
	text-transform: none;
}

.wcser-branding-preview .wcser-ship-method {
	padding: 10px 12px;
	background: #fff;
	border: 1px solid #e0e0e1;
	border-radius: 6px;
	font-size: 15px;
	color: #1d2327;
}

.wcser-branding-preview .wcser-ship-title {
	font-weight: 600;
}
