/**
 * Hệ thống phân phối — bản đồ + sidebar.
 */

.acc-dist-map {
	--acc-dist-primary: var(--fs-color-primary, var(--primary-color, #446084));
	--acc-dist-accent: var(--acc-dist-primary);
	--acc-dist-dark: #333;
	max-width: 1400px;
	margin: 0 auto;
	padding: 24px 16px 40px;
}

.acc-dist-map__title {
	margin: 0;
	font-size: clamp(1.25rem, 2.2vw, 1.75rem);
	font-weight: 700;
	text-align: center;
	text-transform: uppercase;
	color: var(--acc-dist-dark);
}

.acc-dist-map__title-bar {
	display: block;
	width: 48px;
	height: 3px;
	margin: 10px auto 20px;
	background: var(--acc-dist-primary);
	border-radius: 2px;
}

.acc-dist-map__layout {
	display: grid;
	grid-template-columns: minmax(300px, 380px) 1fr;
	height: clamp(480px, 70vh, 720px);
	min-height: 560px;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 4px;
	overflow: visible;
	background: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.acc-dist-map__layout.is-sidebar-collapsed {
	grid-template-columns: 0 1fr;
}

.acc-dist-map__layout.is-sidebar-collapsed .acc-dist-map__sidebar {
	width: 0;
	min-width: 0;
	padding: 0;
	border: 0;
	opacity: 0;
	pointer-events: none;
}

.acc-dist-map__sidebar {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
	border-right: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 4px 0 0 4px;
	transition: opacity 0.25s ease;
}

.acc-dist-map__search-head {
	flex: 0 0 auto;
	padding: 14px;
	background: var(--acc-dist-accent);
}

.acc-dist-map__list-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.acc-dist-map__search-wrap {
	position: relative;
	margin-bottom: 10px;
}

.acc-dist-map__search {
	width: 100%;
	height: 44px;
	padding: 0 50px 0 14px;
	border: 0;
	border-radius: 4px;
	font-size: 0.9rem;
	line-height: 1.4;
}

.acc-dist-map__search-icon {
	position: absolute;
	top: 0;
	right: 8px;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	color: var(--acc-dist-primary);
	opacity: 0.72;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.acc-dist-map__search-icon svg {
	display: block;
	width: 22px;
	height: 22px;
}

.acc-dist-map__search:focus ~ .acc-dist-map__search-icon {
	opacity: 1;
}

.acc-dist-map__filters {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin-bottom: 10px;
}

.acc-dist-map__select {
	width: 100%;
	height: 38px;
	padding: 0 10px;
	border: 0;
	border-radius: 3px;
	font-size: 0.85rem;
	background: #fff;
}

.acc-dist-map__near-btn {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid rgba(255, 255, 255, 0.35);
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.18);
	color: #fff;
	font-size: 0.82rem;
	font-weight: 600;
	cursor: pointer;
	text-align: left;
}

.acc-dist-map__near-btn:hover {
	background: rgba(255, 255, 255, 0.3);
}

.acc-dist-map__list {
	padding: 8px 0;
}

.acc-dist-map__card {
	padding: 14px 16px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	cursor: pointer;
	transition: background 0.2s ease;
}

.acc-dist-map__card:hover,
.acc-dist-map__card.is-active {
	background: rgba(68, 96, 132, 0.06);
	background: color-mix(in srgb, var(--acc-dist-primary) 8%, transparent);
}

.acc-dist-map__card-title,
.acc-dist-map__popup-title {
	margin: 0 0 8px;
	font-size: 0.92rem;
	font-weight: 700;
	text-transform: uppercase;
	line-height: 1.35;
	color: var(--acc-dist-dark);
}

.acc-dist-map__detail-row {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin: 0 0 8px;
	font-size: 0.82rem;
	line-height: 1.45;
	color: rgba(0, 0, 0, 0.72);
}

.acc-dist-map__detail-icon {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	margin-top: 1px;
	color: var(--acc-dist-primary);
	opacity: 0.88;
}

.acc-dist-map__detail-icon svg {
	display: block;
	width: 18px;
	height: 18px;
}

.acc-dist-map__detail-text a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.acc-dist-map__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.acc-dist-map__btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 12px;
	border-radius: 3px;
	font-size: 0.78rem;
	font-weight: 600;
	text-decoration: none !important;
	line-height: 1.2;
}

.acc-dist-map__btn--more {
	background: var(--acc-dist-primary);
	color: #fff !important;
}

.acc-dist-map__btn--dir {
	background: transparent;
	color: var(--acc-dist-primary) !important;
	padding-left: 0;
}

.acc-dist-map__btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
}

.acc-dist-map__btn-icon svg {
	display: block;
	width: 16px;
	height: 16px;
}

.acc-dist-map__empty {
	margin: 0;
	padding: 20px 16px;
	font-size: 0.9rem;
	color: rgba(0, 0, 0, 0.55);
	text-align: center;
}

.acc-dist-map__map-wrap {
	position: relative;
	height: 100%;
	min-height: 0;
	overflow: hidden;
	border-radius: 0 4px 4px 0;
}

.acc-dist-map__canvas {
	width: 100%;
	height: 100%;
	background: #e8eef3;
}

.acc-dist-map__canvas .leaflet-container {
	font-family: inherit;
}

.acc-dist-map__canvas .leaflet-control-zoom {
	border: 0;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	overflow: hidden;
}

.acc-dist-map__canvas .leaflet-control-zoom a {
	width: 36px;
	height: 36px;
	line-height: 36px;
	color: var(--acc-dist-dark);
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.acc-dist-map__canvas .leaflet-control-zoom a:hover {
	background: rgba(68, 96, 132, 0.08);
}

.acc-dist-map__canvas .leaflet-control-attribution {
	font-size: 10px;
	background: rgba(255, 255, 255, 0.82);
	border-radius: 4px 0 0 0;
	padding: 2px 6px;
}

/* Marker tùy chỉnh */
.acc-dist-marker {
	background: transparent;
	border: 0;
}

.acc-dist-marker__pin {
	position: relative;
	display: block;
	width: 32px;
	height: 32px;
	background: var(--marker-color, var(--acc-dist-primary));
	border-radius: 50% 50% 50% 0;
	transform: rotate(-45deg);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
	transition: transform 0.2s ease, filter 0.2s ease;
}

.acc-dist-marker__dot {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 10px;
	height: 10px;
	margin: -5px 0 0 -5px;
	border-radius: 50%;
	background: #fff;
	transform: rotate(45deg);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.acc-dist-marker.is-active .acc-dist-marker__pin,
.acc-dist-marker:hover .acc-dist-marker__pin {
	transform: rotate(-45deg) translateY(-3px) scale(1.08);
	filter: brightness(1.05);
}

.acc-dist-marker.is-active .acc-dist-marker__pin {
	animation: acc-dist-marker-pulse 1.6s ease infinite;
}

@keyframes acc-dist-marker-pulse {
	0%,
	100% {
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
	}
	50% {
		box-shadow: 0 4px 18px rgba(0, 0, 0, 0.38), 0 0 0 6px rgba(68, 96, 132, 0.15);
	}
}

.acc-dist-map__toggle {
	position: absolute;
	top: 50%;
	left: 0;
	z-index: 500;
	transform: translate(-50%, -50%);
	width: 28px;
	height: 52px;
	border: 0;
	border-radius: 0 4px 4px 0;
	background: var(--acc-dist-primary);
	color: #fff;
	font-size: 1rem;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.acc-dist-map__layout.is-sidebar-collapsed .acc-dist-map__toggle span {
	display: inline-block;
	transform: rotate(180deg);
}

.acc-dist-map__leaflet-popup .leaflet-popup-content-wrapper {
	padding: 0;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.acc-dist-map__leaflet-popup .leaflet-popup-content {
	margin: 0;
	width: 300px !important;
}

.acc-dist-map__leaflet-popup .leaflet-popup-tip {
	box-shadow: none;
}

.acc-dist-map__leaflet-popup .leaflet-popup-close-button {
	top: 6px;
	right: 8px;
	width: 28px;
	height: 28px;
	font-size: 20px;
	color: #fff;
	z-index: 2;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.acc-dist-map__popup-head {
	height: 6px;
}

.acc-dist-map__popup-body {
	padding: 14px 16px 16px;
}

.acc-dist-map__popup .acc-dist-map__popup-title {
	margin-top: 0;
	color: var(--acc-dist-primary);
}

.acc-dist-map__popup .acc-dist-map__actions--popup {
	margin-top: 12px;
}

@media (max-width: 849px) {
	.acc-dist-map__layout,
	.acc-dist-map__layout.is-sidebar-collapsed {
		grid-template-columns: 1fr;
		height: auto;
		min-height: 0;
	}

	.acc-dist-map__layout.is-sidebar-collapsed .acc-dist-map__sidebar {
		display: none;
	}

	.acc-dist-map__sidebar {
		height: auto;
		max-height: none;
	}

	.acc-dist-map__list-body {
		max-height: 360px;
	}

	.acc-dist-map__map-wrap {
		height: 420px;
	}

	.acc-dist-map__canvas {
		height: 100%;
	}

	.acc-dist-map__toggle {
		top: 12px;
		left: 12px;
		transform: none;
		border-radius: 4px;
	}
}

.acc-dist-map__archipelago-label {
	background: transparent;
	border: 0;
}

.acc-dist-map__archipelago-label span {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.92);
	border: 1px solid rgba(0, 0, 0, 0.12);
	color: #1a1a1a;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.35;
	white-space: nowrap;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
	pointer-events: none;
}
