/* Pratka – доставка в Checkout. Наследява шрифта на темата; адаптивен. */

/* ---------- Марки на куриерите ---------- */
.pratka-brand { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 74px; height: 30px; padding: 0 10px; border-radius: 8px; font-weight: 800; font-size: 14px; line-height: 1; letter-spacing: -.01em; white-space: nowrap; font-family: inherit; }
.pratka-brand--img { min-width: 0; height: 28px; width: auto; max-width: 110px; padding: 0; object-fit: contain; border-radius: 0; }
.pratka-brand--econt { color: #234183; background: #eef2fb; font-style: italic; font-weight: 900; letter-spacing: .02em; }
.pratka-brand--speedy { color: #fff; background: #dc0032; text-transform: lowercase; font-size: 15px; }
.pratka-brand--boxnow { color: #111; background: #44d62c; font-size: 12.5px; letter-spacing: .04em; }
.pratka-brand--sameday { color: #fff; background: #ff6a13; text-transform: lowercase; }
.pratka-brand--pigeon { color: #fff; background: #5b2a86; }
.pratka-brand--cvc { color: #fff; background: #0b5cab; }

/* ---------- Методите за доставка като карти (класически Checkout и количка) ---------- */
.pratka-rate { display: inline-flex; align-items: center; gap: 10px; vertical-align: middle; }
.pratka-rate__text { display: inline-flex; flex-direction: column; line-height: 1.25; }
.pratka-rate__title { font-weight: 600; }
.pratka-rate__title .amount, .pratka-rate__title bdi { font-weight: 700; }
.pratka-rate__hint { font-size: 12px; opacity: .65; }
#shipping_method li:has(.pratka-rate) {
	position: relative; display: flex; align-items: center; gap: 10px; margin: 0 0 8px !important; padding: 10px 12px !important;
	border: 1.5px solid #e5e7eb; border-radius: 12px; background: #fff; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
#shipping_method li:has(.pratka-rate):hover { border-color: #cbd5e1; }
#shipping_method li:has(.pratka-rate):has(input:checked) { border-color: var(--pk-brand, #2563eb); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pk-brand, #2563eb) 14%, transparent); }
#shipping_method li:has(.pratka-rate:not([style*="--pk-brand"])) { --pk-brand: #2563eb; }
#shipping_method li:has(.pratka-rate) input[type=radio] { margin: 0 !important; accent-color: #0f172a; flex: none; }
#shipping_method li:has(.pratka-rate) label { display: flex !important; flex: 1; margin: 0 !important; cursor: pointer; }
#shipping_method li:has(.pratka-rate) .pratka-picker { display: none; }

.pratka-rate__price { margin-left: auto; padding-left: 10px; font-weight: 700; white-space: nowrap; }
.pratka-rate__price.is-free { color: #15803d; }

/* ---------- Картата „Доставка“ – всичко на едно място ---------- */
.pratka-checkout { margin: 24px 0 8px; padding: 20px; border: 1.5px solid #e5e7eb; border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); color: #0f172a; }
.pratka-checkout[hidden], .pratka-checkout__body[hidden], .pratka-methods[hidden] { display: none !important; }
.pratka-checkout.is-loading .pratka-checkout__body { opacity: .5; pointer-events: none; }
.pratka-checkout .pratka-checkout__title { margin: 0 0 14px !important; padding: 0 !important; font-size: 18px !important; font-weight: 700 !important; line-height: 1.3; letter-spacing: 0; text-transform: none; color: inherit; }
.pratka-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-bottom: 18px; }
/* Бутоните на куриерите: логото и цената; избраният се оцветява в цвета на куриера. */
.pratka-checkout .pratka-method {
	--m-bg: #2563eb; --m-fg: #fff;
	position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; margin: 0; padding: 8px 18px 8px 8px;
	border: 2px solid var(--m-bg); border-radius: var(--pk-radius, 40px); background: #fff; color: #0f172a;
	font: inherit; font-size: 14px; line-height: 1.3; text-align: left; text-transform: none; letter-spacing: 0;
	cursor: pointer; box-shadow: none; transition: background .15s, color .15s, box-shadow .15s, transform .1s;
}
.pratka-checkout .pratka-method:hover { background: color-mix(in srgb, var(--m-bg) 8%, #fff); color: #0f172a; }
.pratka-checkout .pratka-method:active { transform: scale(.99); }
.pratka-checkout .pratka-method:focus-visible { outline: 0; box-shadow: 0 0 0 4px color-mix(in srgb, var(--m-bg) 30%, transparent); }
/* Избран: целият бутон в цвета на куриера – без отметка. */
.pratka-checkout .pratka-method.is-on, .pratka-checkout .pratka-method.is-on:hover { background: var(--m-bg); color: var(--m-fg); box-shadow: 0 6px 16px color-mix(in srgb, var(--m-bg) 35%, transparent); }
.pratka-method .pratka-rate { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.pratka-method .pratka-rate__title { font-size: 15px; font-weight: 700; color: inherit; overflow-wrap: anywhere; }
.pratka-method .pratka-rate__price, .pratka-method .amount, .pratka-method bdi { color: inherit; font-weight: 800; }
.pratka-method .pratka-rate__price.is-free { color: inherit; }
/* Логото (или името на марката) стои в бяло поле – вижда се и върху цветния фон. */
.pratka-method .pratka-brand { flex: none; display: inline-flex; align-items: center; justify-content: center; height: 42px; min-width: 64px; padding: 0 12px; border-radius: calc(var(--pk-radius, 40px) * .8); background: #fff; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08); }
.pratka-method .pratka-brand--img { width: auto; max-width: 120px; object-fit: contain; padding: 6px 12px; box-sizing: border-box; }

/* Обобщението вдясно показва само избрания метод – без втори избор на друго място. */
body.pratka-one-place .woocommerce-checkout-review-order-table #shipping_method li:not(:has(input:checked)):not(:has(input[type=hidden])) { display: none !important; }
body.pratka-one-place .woocommerce-checkout-review-order-table #shipping_method li { margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: none !important; }
body.pratka-one-place .woocommerce-checkout-review-order-table #shipping_method input { display: none !important; }
body.pratka-one-place .woocommerce-checkout-review-order-table .pratka-rate__hint,
body.pratka-one-place .woocommerce-checkout-review-order-table .pratka-brand { display: none; }
.pratka-blocks.pratka-checkout { margin: 14px 0 0; padding: 16px; }

/* Blocks: при офис/автомат улицата се скрива (попълва се автоматично с обекта). */
body.pratka-pickup .wc-block-components-address-form__address_1,
body.pratka-pickup .wc-block-components-address-form__address_2,
body.pratka-pickup .wc-block-components-address-form__address_2-toggle { display: none !important; }

/* ---------- Компонент ---------- */
.pk {
	--pk-accent: #2563eb; --pk-fg: #0f172a; --pk-muted: #64748b; --pk-line: #e2e8f0; --pk-soft: #f8fafc; --pk-locker: #0f766e;
	display: grid; gap: 12px; color: var(--pk-fg); font-size: 14px; line-height: 1.4; text-align: left; transition: opacity .2s;
}
.pk.is-saving { opacity: .75; }
.pk svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.pk-step { display: grid; gap: 6px; }
.pk-label { font-size: 13px; font-weight: 600; color: var(--pk-fg); }

.pk-combo { position: relative; }
.pk, .pk-step, .pk-combo { min-width: 0; }
.pk { grid-template-columns: minmax(0, 1fr); }
.pk .pk-combo__btn { box-sizing: border-box; max-width: 100%; }
.pk-addr { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; align-items: end; }
.pk-addr__num[hidden] { display: none; }
.pk-addr__num[hidden] + .pk-addr__extra { grid-column: 1 / -1; }
.pk-opt-note { color: var(--pk-muted); font-weight: 400; }
.pk-opt-note[hidden] { display: none; }
/* Същият вид като полетата с падащ списък; !important, защото темите стилизират input силно. */
.pk input.pk-input[type="text"] {
	display: block !important; width: 100% !important; height: 54px !important; min-height: 54px !important; margin: 0 !important; padding: 0 14px !important; box-sizing: border-box !important;
	border: 1.5px solid var(--pk-line) !important; border-radius: var(--pk-field-radius, 12px) !important; outline: 0 !important; background: #fff !important; color: var(--pk-fg) !important;
	font: inherit !important; font-size: 15px !important; line-height: 1.3 !important; box-shadow: none !important; transition: border-color .15s, box-shadow .15s;
}
.pk-step:has(.pk-combo--street.is-disabled) + .pk-addr input.pk-input[type="text"] { background: var(--pk-soft) !important; }
.pk input.pk-input[type="text"]:hover { border-color: #cbd5e1 !important; }
.pk input.pk-input[type="text"]:not(:placeholder-shown) { border-color: color-mix(in srgb, var(--pk-accent) 55%, var(--pk-line)) !important; }
.pk input.pk-input[type="text"]:focus { border-color: var(--pk-accent) !important; box-shadow: 0 0 0 4px color-mix(in srgb, var(--pk-accent) 15%, transparent) !important; }
.pk .pk-combo__btn {
	display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; margin: 0; padding: 8px 12px 8px 14px;
	border: 1.5px solid var(--pk-line); border-radius: var(--pk-field-radius, 12px); background: #fff; color: var(--pk-fg);
	font: inherit; font-size: 15px; text-align: left; text-transform: none; letter-spacing: 0; line-height: 1.3; cursor: pointer; box-shadow: none;
	transition: border-color .15s, box-shadow .15s;
}
.pk .pk-combo__btn:hover { border-color: #cbd5e1; background: #fff; color: var(--pk-fg); }
.pk .pk-combo__btn:focus-visible, .pk-combo.is-open .pk-combo__btn { outline: 0; border-color: var(--pk-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--pk-accent) 15%, transparent); }
.pk-combo.has-value .pk-combo__btn { border-color: color-mix(in srgb, var(--pk-accent) 55%, var(--pk-line)); }
.pk-combo.is-disabled .pk-combo__btn { background: var(--pk-soft); color: var(--pk-muted); cursor: not-allowed; }
.pk-combo__icon { display: grid; place-items: center; color: var(--pk-muted); }
.pk-combo__icon:empty { display: none; }
.pk-combo__value { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.pk-combo__ph { color: var(--pk-muted); }
.pk-combo__text { display: flex; flex-direction: column; min-width: 0; }
.pk-combo__text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-combo__text small { color: var(--pk-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-combo__chev { color: var(--pk-muted); transition: transform .15s; }
.pk-combo.is-open .pk-combo__chev { transform: rotate(180deg); }

.pk-combo__pop {
	position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 6px);
	background: #fff; border: 1px solid var(--pk-line); border-radius: 14px; box-shadow: 0 16px 40px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .06); overflow: hidden;
}
.pk-combo__pop[hidden] { display: none; }
.pk-combo__head { display: none; }
.pk .pk-combo__search { display: flex !important; align-items: center; gap: 8px; margin: 0 !important; padding: 0 14px !important; border-bottom: 1px solid var(--pk-line); color: var(--pk-muted); font-weight: 400; }
.pk .pk-combo__search input {
	flex: 1; min-width: 0; height: 48px; margin: 0; padding: 0 !important; border: 0 !important; outline: 0; box-shadow: none !important;
	background: transparent !important; color: var(--pk-fg); font: inherit; font-size: 16px;
}
.pk-combo__status { padding: 14px; color: var(--pk-muted); font-size: 13.5px; }
.pk-combo__status[hidden] { display: none; }
.pk .pk-combo__list { list-style: none !important; margin: 0 !important; padding: 6px !important; max-height: 340px; overflow-y: auto; overscroll-behavior: contain; }
.pk .pk-opt { display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px; border-radius: 10px; cursor: pointer; list-style: none; }
.pk .pk-opt.is-active { background: color-mix(in srgb, var(--pk-accent) 8%, #fff); }
.pk .pk-opt.is-selected { background: color-mix(in srgb, var(--pk-accent) 12%, #fff); }
.pk .pk-opt--extra { border-top: 1px dashed var(--pk-line); border-radius: 0 0 10px 10px; color: var(--pk-accent); }
.pk-opt__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pk-opt__main strong { font-weight: 600; overflow-wrap: anywhere; }
.pk-opt__main small { color: var(--pk-muted); font-size: 12.5px; overflow-wrap: anywhere; }
.pk-opt__main .pk-hours { font-size: 12px; }
.pk-opt__side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pk-opt__side em { font-style: normal; font-size: 12px; color: var(--pk-muted); white-space: nowrap; }
.pk-count { min-width: 28px; padding: 2px 8px; border-radius: 99px; background: var(--pk-soft); color: var(--pk-muted); font-size: 12px; font-weight: 600; text-align: center; }

.pk-ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none; background: color-mix(in srgb, var(--pk-accent) 12%, #fff); color: var(--pk-accent); }
.pk-ico--locker { background: color-mix(in srgb, var(--pk-locker) 14%, #fff); color: var(--pk-locker); }
.pk-combo__btn .pk-ico { width: 34px; height: 34px; }
.pk-pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: color-mix(in srgb, var(--pk-accent) 12%, #fff); color: var(--pk-accent); }
.pk-pill--locker { background: color-mix(in srgb, var(--pk-locker) 14%, #fff); color: var(--pk-locker); }

.pk-details { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--pk-soft); color: var(--pk-muted); font-size: 13px; }
.pk-details[hidden] { display: none; }
.pk-details p { display: flex; gap: 6px; align-items: flex-start; margin: 0; }
.pk-details p svg { width: 16px; height: 16px; margin-top: 1px; }
.pk-details .pk-note { margin-top: 4px; }
.pk-check { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #16a34a; color: #fff; flex: none; }
.pk-check svg { width: 15px; height: 15px; }

.pk-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.pk .pk-link {
	display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 4px 0; border: 0; background: none; box-shadow: none;
	color: var(--pk-accent); font: inherit; font-size: 13.5px; font-weight: 600; text-transform: none; letter-spacing: 0; cursor: pointer;
}
.pk .pk-link:hover { background: none; color: var(--pk-accent); text-decoration: underline; }
.pk .pk-link svg { width: 16px; height: 16px; }
.pk .pk-link.is-busy { opacity: .6; pointer-events: none; }
.pk-map { height: 320px; border-radius: 12px; overflow: hidden; border: 1px solid var(--pk-line); }
.pk-map[hidden] { display: none; }
.pk-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fef2f2; color: #b91c1c; font-size: 13.5px; font-weight: 500; }
.pk-error[hidden] { display: none; }
.pk .pk-error:not([hidden]) { border: 1px solid #fca5a5; border-left: 4px solid #dc2626; font-size: 14px; font-weight: 600; }
.pk-combo.is-invalid .pk-combo__btn, .pk input.pk-input.is-invalid[type="text"] { border-color: #dc2626 !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, .15) !important; }

@media (max-width: 600px) {
	.pratka-checkout { padding: 14px; border-radius: 14px; margin-top: 18px; }
	.pk .pk-combo__btn { min-height: 56px; }
	.pk input.pk-input[type="text"] { height: 56px !important; min-height: 56px !important; }
	/* На телефон списъкът се отваря като лист отдолу – лесен избор с палец. */
	.pk-combo.is-open::before { content: ""; position: fixed; inset: 0; z-index: 9998; background: rgba(15, 23, 42, .45); }
	.pk-combo.is-open .pk-combo__pop {
		position: fixed; z-index: 9999; left: 0; right: 0; top: auto; bottom: 0; max-height: 82vh; margin: 0;
		border: 0; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; box-shadow: 0 -10px 40px rgba(15, 23, 42, .25);
		padding-bottom: env(safe-area-inset-bottom);
	}
	.pk-combo.is-open .pk-combo__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 16px 10px; position: relative; }
	.pk-combo.is-open .pk-combo__head::before { content: ""; position: absolute; top: 7px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: #cbd5e1; }
	.pk-combo__head strong { font-size: 17px; font-weight: 700; }
	.pk .pk-combo__close { display: grid; place-items: center; width: 36px; height: 36px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: var(--pk-soft); color: var(--pk-fg); font-size: 22px; line-height: 1; cursor: pointer; }
	.pk .pk-combo.is-open .pk-combo__search { margin: 0 14px 6px !important; padding: 0 12px !important; border: 1.5px solid var(--pk-line); border-radius: 12px; }
	.pk-combo.is-open .pk-combo__list { max-height: none; flex: 1; padding: 6px 10px 14px !important; }
	.pk-map { height: 260px; }
	#shipping_method li:has(.pratka-rate) { padding: 10px !important; }
	/* Картата на куриера на два реда: марка и цена горе, името на доставката отдолу. */
	.pratka-checkout { padding: 16px; }
	/* Един ред: логото, името (може на два реда) и цената вдясно. */
	.pratka-checkout .pratka-method { padding: 6px 14px 6px 6px; min-height: 56px; gap: 10px; }
	.pratka-method .pratka-rate { gap: 10px; }
	.pratka-method .pratka-brand { height: 40px; min-width: 56px; padding: 0 8px; }
	.pratka-method .pratka-brand--img { max-width: 92px; padding: 5px 8px; }
	.pratka-method .pratka-rate__title { font-size: 15px; }
	.pratka-method .pratka-rate__price { font-size: 15px; }
	.pratka-brand { min-width: 64px; font-size: 13px; }
}
