/**
 * MPL pénztári picker — inline summary + gomb + modál.
 * A modál HTML <dialog> alapú, natívan támogatott minden modern böngészőben.
 */

/* ===== Top summary (GLS stílusban) ===== */
.mpl-pickup-top-summary {
	background: #fff3e0;
	border: 1px solid #ffb74d;
	border-radius: 6px;
	padding: 12px 16px;
	margin-bottom: 14px;
	font-size: 13px;
	line-height: 1.5;
}
.mpl-pickup-top-label {
	margin-bottom: 4px;
	font-weight: 600;
	color: #e65100;
}
.mpl-pickup-top-name {
	font-weight: 600;
}
.mpl-pickup-top-addr {
	color: #555;
}

/* ===== Inline (shipping rate alatt) =====
 * Default hidden — a JS (updateVisibility) mutatja csak a kiválasztott
 * MPL radio alatt. Modern böngészőkben a :has() is segít CSS szinten.
 */
.mpl-picker-wrap {
	display: none;
	margin: 8px 0 12px 0;
	padding-left: 2px;
	font-size: 13px;
}

/* Ha a szülő <li>-ben a radio checked → megjelenik (modern böngészők) */
li:has(> input[type="radio"]:checked) .mpl-picker-wrap,
li:has(input.shipping_method:checked) .mpl-picker-wrap {
	display: block;
}

/* Fallback JS-vezérelt show */
.mpl-picker-wrap.is-active {
	display: block;
}

.mpl-picker-summary {
	display: inline-block;
	padding: 8px 12px;
	border-radius: 4px;
	background: #f7f7f7;
	border-left: 3px solid #ccc;
	margin-bottom: 6px;
	min-width: 240px;
	max-width: 480px;
	line-height: 1.4;
}

.mpl-picker-summary.selected {
	background: #e8f5e9;
	border-left-color: #4caf50;
}

.mpl-picker-summary.empty em {
	color: #c62828;
	font-style: normal;
}

.mpl-picker-open {
	display: inline-block;
	margin-left: 8px;
	vertical-align: middle;
}

/* ===== Modal ===== */
.mpl-picker-modal {
	padding: 0;
	border: none;
	border-radius: 8px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
	width: min(1100px, 96vw);
	max-width: none;
	height: min(800px, 88vh);
	max-height: 88vh;
	overflow: hidden;
	background: #fff;
	color: #222;
	/* NINCS display: flex itt — a native <dialog> default display:none-ját csak
	   nyitott állapotban (modal[open]) írjuk felül, különben bezárás után is látható marad. */
}
.mpl-picker-modal[open] {
	display: flex;
	flex-direction: column;
}
.mpl-picker-modal::backdrop {
	background: rgba(0, 0, 0, 0.5);
}

.mpl-picker-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	border-bottom: 1px solid #e0e0e0;
	background: #fafafa;
}

.mpl-picker-header h3 {
	margin: 0;
	font-size: 17px;
	line-height: 1.3;
}

.mpl-picker-close {
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #666;
	padding: 0 8px;
}
.mpl-picker-close:hover { color: #000; }

.mpl-picker-search {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 18px;
	border-bottom: 1px solid #eee;
	background: #fff;
}

.mpl-picker-search-input {
	flex: 1;
	padding: 8px 12px;
	border: 1px solid #ccc;
	border-radius: 4px;
	/* 16px hogy iOS Safari ne zoomoljon fókuszra */
	font-size: 16px;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}
.mpl-picker-search-input:focus {
	border-color: #2196f3;
	box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.15);
}

.mpl-picker-count {
	color: #666;
	font-size: 12px;
	white-space: nowrap;
}

.mpl-picker-body {
	display: flex;
	flex: 1;
	min-height: 0; /* fix Firefox flex-overflow bug-ot */
	overflow: hidden;
}

.mpl-picker-list {
	width: 340px;
	min-width: 260px;
	overflow-y: auto;
	border-right: 1px solid #e0e0e0;
	background: #fafafa;
}

.mpl-picker-item {
	padding: 10px 14px;
	border-bottom: 1px solid #eee;
	cursor: pointer;
	transition: background 0.12s;
}

.mpl-picker-item:hover {
	background: #e3f2fd;
}

.mpl-picker-item.previewed {
	background: #fff3e0;
	border-left: 3px solid #ff6b00;
	padding-left: 11px;
}
.mpl-picker-item.previewed:hover {
	background: #ffe0b2;
}

.mpl-picker-item-name {
	font-weight: 600;
	font-size: 13px;
	margin-bottom: 2px;
	line-height: 1.3;
}

.mpl-picker-item-addr {
	font-size: 12px;
	color: #555;
	line-height: 1.3;
}

.mpl-picker-empty,
.mpl-picker-more {
	padding: 16px;
	text-align: center;
	color: #888;
	font-size: 12px;
	font-style: italic;
}

.mpl-picker-map-wrap {
	flex: 1;
	position: relative;
}

.mpl-picker-map {
	width: 100%;
	height: 100%;
}

.mpl-picker-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: rgba(255, 255, 255, 0.95);
	padding: 16px 24px;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	font-size: 14px;
	z-index: 1000;
}

/* Leaflet popup style */
.mpl-popup strong {
	display: block;
	margin-bottom: 2px;
	font-size: 13px;
}

.mpl-popup-select {
	margin-top: 4px;
}

/* ===== Custom map marker (MPL logo) ===== */
.mpl-map-marker {
	background: transparent;
	border: none;
}
.mpl-map-marker-box {
	width: 28px;
	height: 12px;
	background: #fff;
	border: 1px solid #cc251f;
	border-radius: 2px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1px;
	box-sizing: border-box;
	transition: transform 0.15s, box-shadow 0.15s;
}
.mpl-map-marker:hover .mpl-map-marker-box {
	transform: scale(1.3);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
	z-index: 1000;
}
.mpl-map-marker-box img {
	max-width: 100%;
	max-height: 100%;
	display: block;
}

/* ===== Cluster customization ===== */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
	background-clip: padding-box;
}
.marker-cluster-small {
	background-color: rgba(204, 37, 31, 0.5);
}
.marker-cluster-small div {
	background-color: rgba(204, 37, 31, 0.85);
	color: #fff;
	font-weight: 600;
}
.marker-cluster-medium {
	background-color: rgba(204, 37, 31, 0.55);
}
.marker-cluster-medium div {
	background-color: rgba(204, 37, 31, 0.9);
	color: #fff;
	font-weight: 600;
}
.marker-cluster-large {
	background-color: rgba(204, 37, 31, 0.6);
}
.marker-cluster-large div {
	background-color: rgba(204, 37, 31, 0.95);
	color: #fff;
	font-weight: 600;
}

/* ===== Footer: preview + confirm button ===== */
.mpl-picker-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 18px;
	border-top: 1px solid #e0e0e0;
	background: #fafafa;
}

.mpl-picker-footer-preview {
	flex: 1;
	min-width: 0;
	font-size: 13px;
	line-height: 1.4;
	color: #333;
}

.mpl-picker-footer-preview em {
	color: #888;
	font-style: italic;
}

.mpl-picker-footer-preview strong {
	display: block;
	font-size: 13px;
	margin-bottom: 2px;
	color: #222;
}

.mpl-picker-footer-preview span {
	color: #666;
	font-size: 12px;
}

.mpl-picker-footer-select {
	padding: 12px 28px;
	font-size: 15px;
	font-weight: 600;
	background: #ff6b00;
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	min-width: 200px;
	transition: background 0.15s;
}

.mpl-picker-footer-select:hover:not(:disabled) {
	background: #e65100;
}

.mpl-picker-footer-select:disabled {
	background: #bbb;
	cursor: not-allowed;
	opacity: 0.7;
}

/* ===== Tab switcher (mobil only) — desktop-on rejtve ===== */
.mpl-picker-tabs {
	display: none;
}

/* ===== Responsive — phone és kisebb tablet ===== */
@media (max-width: 768px) {
	.mpl-picker-modal {
		width: 100vw;
		/* Fallback statikus 100vh-ra, modern böngészőkben dvh-ra (iOS Safari URL bar fix) */
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
		border-radius: 0;
	}

	.mpl-picker-header {
		padding: 12px 14px;
	}

	.mpl-picker-header h3 {
		font-size: 15px;
		line-height: 1.25;
		padding-right: 8px;
	}

	.mpl-picker-close {
		font-size: 32px;
		padding: 4px 10px;
		min-width: 44px;
		min-height: 44px;
	}

	.mpl-picker-search {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 6px;
		padding: 8px 12px;
	}

	.mpl-picker-search-input {
		min-width: 100%;
		padding: 12px 14px;
	}

	.mpl-picker-count {
		flex: 1;
		text-align: right;
		font-size: 11px;
	}

	/* Tab switcher: csak mobilon látszik, két full-width gomb */
	.mpl-picker-tabs {
		display: flex;
		border-bottom: 1px solid #e0e0e0;
		background: #fafafa;
	}
	.mpl-picker-tab {
		flex: 1;
		padding: 12px 8px;
		min-height: 44px;
		background: transparent;
		border: none;
		border-bottom: 3px solid transparent;
		font-size: 14px;
		font-weight: 600;
		color: #666;
		cursor: pointer;
		transition: color 0.15s, border-color 0.15s;
	}
	.mpl-picker-tab.is-active {
		color: #ff6b00;
		border-bottom-color: #ff6b00;
	}

	/* A body mobilon NEM oszlik kétfelé — csak az aktív pane látszik */
	.mpl-picker-body {
		flex-direction: column;
		position: relative;
	}
	.mpl-picker-body[data-active-pane="list"] .mpl-picker-list {
		display: block;
	}
	.mpl-picker-body[data-active-pane="list"] .mpl-picker-map-wrap {
		display: none;
	}
	.mpl-picker-body[data-active-pane="map"] .mpl-picker-list {
		display: none;
	}
	.mpl-picker-body[data-active-pane="map"] .mpl-picker-map-wrap {
		display: block;
	}

	.mpl-picker-list {
		width: 100%;
		min-width: 0;
		flex: 1;
		border-right: none;
		border-bottom: none;
	}

	/* Lista elemek: nagyobb touch target */
	.mpl-picker-item {
		padding: 14px 16px;
		min-height: 56px;
	}
	.mpl-picker-item-name {
		font-size: 14px;
	}
	.mpl-picker-item-addr {
		font-size: 13px;
	}

	.mpl-picker-map-wrap {
		flex: 1;
	}

	/* Marker mobilon kissé nagyobb (touch friendly) — a JS méretezi az iconSize-ot,
	   de a divIcon "doboz" CSS-ben is reagál a hover-re */
	.mpl-map-marker:hover .mpl-map-marker-box {
		transform: scale(1.15);
	}

	/* Footer: stack, full-width gomb, kompakt preview */
	.mpl-picker-footer {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
		padding: 10px 14px;
	}

	.mpl-picker-footer-preview {
		font-size: 13px;
		max-height: 50px;
		overflow: hidden;
	}

	.mpl-picker-footer-select {
		min-width: 0;
		width: 100%;
		min-height: 48px;
		padding: 14px 28px;
		font-size: 16px;
	}

	/* Pickup wrap: open gomb full-width, summary teljes szélesen alatta */
	.mpl-picker-summary {
		display: block;
		max-width: none;
		min-width: 0;
		font-size: 14px;
	}
	.mpl-picker-open {
		display: block;
		width: 100%;
		margin-left: 0;
		margin-top: 6px;
		padding: 12px;
		min-height: 44px;
		font-size: 14px;
	}
}

/* Top summary mobilon kompakt */
@media (max-width: 768px) {
	.mpl-pickup-top-summary {
		padding: 10px 12px;
		font-size: 12px;
		margin-bottom: 10px;
	}
	.mpl-pickup-top-name {
		font-size: 13px;
	}
}

/* Extra szűk kijelző (régi iPhone SE, ~360px) */
@media (max-width: 380px) {
	.mpl-picker-header h3 {
		font-size: 13px;
	}
	.mpl-picker-tab {
		font-size: 13px;
		padding: 10px 4px;
	}
	.mpl-picker-item {
		padding: 12px 14px;
	}
}

/* ===== Típus badge a listában és popup-ban (PP+PM mergelt módban) ===== */
.mpl-picker-item-badge,
.mpl-popup-type-badge {
	display: inline-block;
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	padding: 2px 6px;
	border-radius: 3px;
	margin-right: 6px;
	vertical-align: middle;
}
.mpl-picker-item-badge-pp,
.mpl-popup-type-pp {
	background: #fff;
	color: #E30613;
	border: 1px solid #E30613;
}
.mpl-picker-item-badge-pm,
.mpl-popup-type-pm {
	background: #1976d2;
	color: #fff;
}
.mpl-picker-item-badge-cs,
.mpl-popup-type-cs {
	background: #f0f0f0;
	color: #333;
	border: 1px solid #ccc;
}
.mpl-popup-type-badge {
	display: block;
	margin: 0 0 6px 0;
	padding: 3px 8px;
	font-size: 10px;
}

