/* ======================================================
   CDEK Delivery Calculator
   ====================================================== */

#cdek-delivery-calc [hidden],
.cdek-delivery-calc [hidden] { display: none !important; }

.cdek-delivery-calc {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	max-width: 840px;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
	overflow: hidden;
	color: #1a1a2e;
}

/* ---- Form ---- */
.cdek-delivery-calc form {
	padding: 24px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.cdc-section {}

.cdc-section-title {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #9ca3af;
	margin-bottom: 12px;
}

.cdc-fields-row {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.cdc-field {
	flex: 1;
	min-width: 140px;
}

/* ---- Labels ---- */
.cdc-label {
	display: block;
	font-size: 13px;
	font-weight: 500;
	color: #374151;
	margin-bottom: 6px;
}

/* ---- Inputs with unit suffix ---- */
.cdc-input-wrap {
	position: relative;
	display: flex;
	align-items: center;
}

.cdc-input {
	width: 100%;
	padding: 10px 36px 10px 12px;
	border: 1.5px solid #d1d5db;
	border-radius: 8px;
	font-size: 15px;
	color: #111827;
	background: #fff;
	transition: border-color 0.15s, box-shadow 0.15s;
	box-sizing: border-box;
	font-family: inherit;
}

/* City inputs don't have unit suffix */
.cdek_calc-input-wrapper .cdc-input {
	padding-right: 12px;
}

.cdc-input:focus {
	outline: none;
	border-color: #009b4f;
	box-shadow: 0 0 0 3px rgba(0, 155, 79, 0.12);
}

.cdc-unit {
	position: absolute;
	right: 10px;
	font-size: 12px;
	color: #9ca3af;
	pointer-events: none;
}

/* ---- City autocomplete ---- */
.cdek_calc-input-wrapper {
	position: relative;
}

.cdek_calc-input-suggestions {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 100;
	background: #fff;
	border: 1.5px solid #009b4f;
	border-top: none;
	border-radius: 0 0 8px 8px;
	list-style: none;
	margin: 0;
	padding: 4px 0;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cdek_calc-input-suggestions.empty {
	display: none;
}

.cdek_calc-input-suggestions li a {
	display: block;
	padding: 8px 12px;
	font-size: 13px;
	color: #1f2937;
	text-decoration: none;
	transition: background 0.1s;
}

.cdek_calc-input-suggestions li a:hover {
	background: #f0fdf4;
	color: #009b4f;
}

/* ---- Presets grid ---- */
.cdc-presets-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 8px;
}

.cdc-preset-card {
	position: relative;
	background: #fff;
	border: 1.5px solid #e5e7eb;
	border-radius: 10px;
	padding: 12px 10px 10px;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	text-align: center;
	transition: border-color 0.15s, box-shadow 0.15s;
	user-select: none;
	outline: none;
}

.cdc-preset-card:hover {
	border-color: #009b4f;
	box-shadow: 0 0 0 2px rgba(0, 155, 79, 0.12);
}

.cdc-preset-card:focus-visible {
	border-color: #009b4f;
	box-shadow: 0 0 0 3px rgba(0, 155, 79, 0.25);
}

.cdc-preset-card.cdc-preset--active {
	border-color: #009b4f;
	background: #f0fdf4;
}

.cdc-preset-img {
	width: 56px;
	height: 56px;
	object-fit: contain;
}

.cdc-preset-no-img {
	font-size: 36px;
	line-height: 1;
	width: 56px;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cdc-preset-name {
	font-size: 13px;
	font-weight: 700;
	color: #1f2937;
	line-height: 1.2;
}

.cdc-preset-dims {
	font-size: 11px;
	color: #009b4f;
	line-height: 1.3;
}

.cdc-preset-info {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 18px;
	height: 18px;
	border: none;
	background: none;
	cursor: default;
	color: #9ca3af;
	font-size: 14px;
	line-height: 18px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cdc-preset-info::after {
	content: attr(data-tooltip);
	display: none;
	position: absolute;
	right: -4px;
	top: 22px;
	background: #1f2937;
	color: #fff;
	font-size: 11px;
	font-weight: 400;
	line-height: 1.4;
	padding: 6px 8px;
	border-radius: 6px;
	white-space: normal;
	width: 160px;
	z-index: 20;
	pointer-events: none;
	text-align: left;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cdc-preset-info:hover::after {
	display: block;
}

/* ---- Direction selector ---- */
.cdc-direction-group {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	border: 1.5px solid #d1d5db;
	border-radius: 8px;
	overflow: hidden;
	width: fit-content;
}

.cdc-direction-btn {
	position: relative;
	cursor: pointer;
}

.cdc-direction-btn input[type="radio"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	pointer-events: none;
}

.cdc-direction-btn span {
	display: block;
	padding: 9px 18px;
	font-size: 13px;
	font-weight: 500;
	color: #374151;
	background: #fff;
	border-right: 1.5px solid #d1d5db;
	transition: background 0.15s, color 0.15s;
	white-space: nowrap;
	user-select: none;
	cursor: pointer;
}

.cdc-direction-btn:last-child span {
	border-right: none;
}

.cdc-direction-btn input[type="radio"]:checked + span {
	background: #009b4f;
	color: #fff;
}

.cdc-direction-btn:not(:has(input:checked)) span:hover {
	background: #f0fdf4;
	color: #009b4f;
}

/* ---- Submit button ---- */
.cdc-btn-primary {
	align-self: flex-start;
	padding: 12px 32px;
	background: #009b4f;
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, transform 0.1s;
	font-family: inherit;
}

.cdc-btn-primary:hover { background: #007d3f; }
.cdc-btn-primary:active { transform: scale(0.98); }

/* ---- Loading ---- */
.cdc-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 32px;
	color: #6b7280;
}

.cdc-spinner {
	width: 24px;
	height: 24px;
	border: 3px solid #e5e7eb;
	border-top-color: #009b4f;
	border-radius: 50%;
	animation: cdc-spin 0.7s linear infinite;
	flex-shrink: 0;
}

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

/* ---- Results ---- */
.cdek_calc-step-result {}

.cdc-results {
	border-top: 1px solid #e5e7eb;
	padding: 24px;
	background: #f9fafb;
}

.cdc-results-title {
	margin: 0 0 16px;
	font-size: 17px;
	font-weight: 700;
	color: #111827;
}

.cdc-tariffs {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-bottom: 16px;
}

.cdc-tariff-card {
	background: #fff;
	border-radius: 8px;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.cdc-tariff-name {
	font-size: 14px;
	font-weight: 600;
	color: #1f2937;
}

.cdc-tariff-meta {
	display: flex;
	align-items: center;
	gap: 16px;
	flex-shrink: 0;
}

.cdc-tariff-days {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	color: #6b7280;
}

.cdc-tariff-price {
	font-size: 17px;
	font-weight: 800;
	color: #009b4f;
	white-space: nowrap;
}

.cdc-disclaimer {
	font-size: 12px;
	color: #9ca3af;
	margin: 0;
	line-height: 1.5;
}

/* ---- Error ---- */
.cdc-error {
	margin: 0 24px 24px;
	padding: 14px 16px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	color: #dc2626;
	font-size: 14px;
}

/* ---- Responsive ---- */
@media (max-width: 700px) {
	.cdc-presets-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
	.cdek-delivery-calc form { padding: 16px; }
	.cdc-fields-row { gap: 10px; }
	.cdc-field { min-width: 100px; }
	.cdc-btn-primary { width: 100%; text-align: center; align-self: stretch; }
	.cdc-results { padding: 16px; }
	.cdc-tariff-card { flex-direction: column; align-items: flex-start; }
	.cdc-tariff-meta { width: 100%; justify-content: space-between; }
	.cdc-direction-group { width: 100%; }
	.cdc-direction-btn { flex: 1; }
	.cdc-direction-btn span { text-align: center; padding: 9px 8px; }
	.cdc-presets-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
}
