/**
 * Еконт доставка – checkout block.
 * Inherits the theme's fonts, inputs and colours; adds structure and contrast.
 * Change --ecd-accent to match the shop (e.g. Kraft red).
 */

.ecd {
	--ecd-accent: #1a4fa0;
	--ecd-text: #1d2327;
	--ecd-muted: #5c6670;
	--ecd-line: #c9ced4;
	--ecd-bg: #ffffff;
	--ecd-soft: #f3f5f8;
	--ecd-radius: 6px;
	--ecd-field-h: 50px;

	margin: 2rem 0 0;
	color: var(--ecd-text);
}

.ecd__title {
	margin: 0 0 1rem;
}

.ecd__notice {
	margin: 0 0 1rem;
	padding: 0.75rem 1rem;
	border-left: 3px solid #dba617;
	background: #fcf9e8;
}

/* ---------- Delivery type cards ---------- */

.ecd__types {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 0.75rem;
	margin: 0 0 1.25rem;
}

.ecd-type {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 0 !important;
	padding: 0.9rem 1rem;
	border: 1px solid var(--ecd-line);
	border-radius: var(--ecd-radius);
	background: var(--ecd-bg);
	cursor: pointer;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.ecd-type:hover {
	border-color: var(--ecd-muted);
}

.ecd-type input[type="radio"] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.ecd-type__icon {
	display: flex;
	flex: 0 0 38px;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--ecd-soft);
	color: var(--ecd-muted);
	transition: background-color 0.15s ease, color 0.15s ease;
}

.ecd-type__icon svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
}

.ecd-type__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	line-height: 1.3;
}

.ecd-type__text strong {
	font-weight: 600;
}

.ecd-type__text small {
	color: var(--ecd-muted);
	font-size: 0.85em;
}

.ecd-type:has(input:checked) {
	border-color: var(--ecd-accent);
	box-shadow: inset 0 0 0 1px var(--ecd-accent);
}

.ecd-type:has(input:checked) .ecd-type__icon {
	background: var(--ecd-accent);
	color: #fff;
}

.ecd-type:has(input:focus-visible) {
	outline: 2px solid var(--ecd-accent);
	outline-offset: 2px;
}

/* ---------- Fields ---------- */

.ecd__fields {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
}

.ecd__fields .form-row {
	flex: 0 0 100%;
	width: 100%;
	margin: 0 0 1rem;
	float: none;
}

@media (min-width: 600px) {
	.ecd__fields .form-row-first,
	.ecd__fields .form-row-last {
		flex: 0 0 calc(50% - 0.5rem);
		width: auto;
	}
}

.ecd__fields label {
	display: block;
	margin: 0 0 0.35rem;
	color: var(--ecd-text);
	font-weight: 500;
}

.ecd__fields .input-text {
	height: var(--ecd-field-h);
	border-color: var(--ecd-line);
	color: var(--ecd-text);
}

/* selectWoo in our block: same height and contrast as the inputs. */
.ecd .select2-container .select2-selection--single {
	height: var(--ecd-field-h);
	border: 1px solid var(--ecd-line);
	border-radius: var(--ecd-radius);
	background: var(--ecd-bg);
}

.ecd .select2-container .select2-selection--single .select2-selection__rendered {
	padding-right: 36px;
	padding-left: 14px;
	color: var(--ecd-text);
	line-height: calc(var(--ecd-field-h) - 2px);
}

.ecd .select2-container .select2-selection--single .select2-selection__placeholder {
	color: var(--ecd-muted);
}

.ecd .select2-container .select2-selection--single .select2-selection__arrow {
	height: calc(var(--ecd-field-h) - 2px);
	right: 8px;
}

.ecd .select2-container--focus .select2-selection--single,
.ecd .select2-container--open .select2-selection--single {
	border-color: var(--ecd-accent);
	box-shadow: 0 0 0 1px var(--ecd-accent);
}

/* Dropdown (rendered at the end of <body>). */
.select2-dropdown .ecd-opt {
	display: flex;
	flex-direction: column;
	gap: 2px;
	line-height: 1.3;
}

.select2-dropdown .ecd-opt small {
	opacity: 0.75;
}

/* Mobile office badge + hint. */
.ecd-badge {
	display: inline-block;
	margin-right: 0.4rem;
	padding: 1px 6px;
	border-radius: 3px;
	background: #fff4d6;
	color: #7a5300;
	font-size: 0.75em;
	font-weight: 600;
	vertical-align: middle;
}

.ecd .select2-selection__rendered .ecd-opt small {
	display: none; /* Closed field: name only, one line. */
}

.ecd-hint {
	display: block;
	margin-top: 0.4rem;
	color: #7a5300;
}

/* ---------- Type card price ---------- */

.ecd-type__price {
	margin-left: auto;
	font-weight: 600;
	white-space: nowrap;
}

/* ---------- Invoice ---------- */

.woocommerce-js .ecd-invoice-field {
	display: none;
}

.ecd-invoice-toggle .optional,
.ecd-invoice-field.validate-required .optional {
	display: none;
}

/* ---------- Price ---------- */

.ecd__price {
	margin: 0.25rem 0 0;
	padding: 0.85rem 1rem;
	border-radius: var(--ecd-radius);
	background: var(--ecd-soft);
	font-weight: 600;
}

.ecd__price:empty {
	display: none;
}

.ecd__price.is-free {
	background: #edf7ee;
	color: #1e6b2a;
}

.ecd__price.is-error {
	background: #fcf0f1;
	color: #8a2424;
	font-weight: 400;
}

/* Order summary label ("изберете офис или адрес"). */
.ecd-muted {
	color: #5c6670;
	font-weight: 400;
}

@media (prefers-reduced-motion: reduce) {
	.ecd-type,
	.ecd-type__icon {
		transition: none;
	}
}
