/**
 * Village Map — Styles
 *
 * Leaflet overrides, custom markers, sidebar, filters, responsive.
 *
 * @package Greyton_Marketplace
 * @since   1.2.0
 */

/* === ASTRA FULL-WIDTH OVERRIDE === */

body.page-village-map .site-content .ast-container {
	display: block !important;
	max-width: 100% !important;
	padding: 0 !important;
}

body.page-village-map .entry-content {
	margin: 0 !important;
}

body.page-village-map #secondary {
	display: none !important;
}

body.page-village-map #primary {
	width: 100% !important;
	max-width: 100% !important;
	padding: 0 !important;
	margin: 0 !important;
	float: none !important;
}

body.page-village-map .ast-article-single,
body.page-village-map .ast-article-post {
	padding: 0 !important;
	margin: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
}

body.page-village-map .ast-separate-container #primary {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}

body.page-village-map .ast-separate-container #content .ast-container {
	padding-left: 0 !important;
	padding-right: 0 !important;
}

body.page-village-map .entry-header,
body.page-village-map .entry-title {
	display: none !important;
}

/* === HERO === */
.greyton-map-hero {
	background: var(--greyton-primary);
	padding: var(--space-xl) var(--space-md);
	text-align: center;
	position: relative;
	overflow: hidden;
}
.greyton-map-hero::before {
	content: '';
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse at 20% 80%, rgba(123, 160, 91, 0.15) 0%, transparent 60%),
		radial-gradient(ellipse at 80% 20%, rgba(212, 160, 62, 0.1) 0%, transparent 50%);
	pointer-events: none;
}
.greyton-map-hero-inner {
	max-width: var(--container-narrow);
	margin: 0 auto;
	position: relative;
	z-index: 1;
}
.greyton-map-hero-eyebrow {
	font-family: var(--font-accent);
	font-size: 1.25rem;
	color: var(--greyton-secondary-light);
	margin: 0 0 var(--space-xs);
}
.greyton-map-hero-title {
	font-family: var(--font-heading);
	font-size: clamp(1.75rem, 4vw, 2.75rem);
	font-weight: 700;
	color: #fff;
	margin: 0 0 var(--space-xs);
	letter-spacing: -0.01em;
}
.greyton-map-hero-subtitle {
	font-family: var(--font-body);
	font-size: 1rem;
	color: rgba(255, 255, 255, 0.75);
	margin: 0;
}

/* === FILTER BAR === */
.greyton-map-filters {
	background: var(--greyton-white);
	border-bottom: 1px solid var(--greyton-border);
	padding: var(--space-sm) var(--space-md);
	position: sticky;
	top: 0;
	z-index: 1000;
}
.greyton-map-filters-inner {
	max-width: var(--container-max);
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: var(--space-md);
	flex-wrap: wrap;
}
.greyton-map-filter-pills {
	display: flex;
	gap: var(--space-xs);
	flex-wrap: wrap;
}
.greyton-map-pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 18px;
	border: 1.5px solid var(--greyton-border);
	border-radius: var(--radius-pill);
	background: transparent;
	font-family: var(--font-body);
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--greyton-medium);
	cursor: pointer;
	transition: all var(--transition-fast);
	white-space: nowrap;
}
.greyton-map-pill:hover {
	border-color: var(--greyton-primary-light);
	color: var(--greyton-primary);
}
.greyton-map-pill.is-active {
	background: var(--greyton-primary);
	border-color: var(--greyton-primary);
	color: #fff;
}
.greyton-map-pill-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
}
.greyton-map-pill-dot--vendor {
	background: var(--greyton-secondary);
}
.greyton-map-pill-dot--guide {
	background: var(--greyton-primary);
}
.greyton-map-pill-dot--community {
	background: var(--greyton-accent);
}
.greyton-map-pill.is-active .greyton-map-pill-dot {
	background: rgba(255, 255, 255, 0.8);
}

/* Search */
.greyton-map-search-wrap {
	position: relative;
	flex: 1;
	min-width: 180px;
	max-width: 320px;
}
.greyton-map-search-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--greyton-light);
	pointer-events: none;
}
.greyton-map-search {
	width: 100%;
	padding: 9px 14px 9px 40px;
	border: 1.5px solid var(--greyton-border);
	border-radius: var(--radius-pill);
	background: var(--greyton-parchment);
	font-family: var(--font-body);
	font-size: 0.9rem;
	color: var(--greyton-dark);
	transition: border-color var(--transition-fast);
}
.greyton-map-search:focus {
	outline: none;
	border-color: var(--greyton-primary-light);
	box-shadow: 0 0 0 3px rgba(123, 160, 91, 0.15);
}
.greyton-map-search::placeholder {
	color: var(--greyton-light);
}

/* === MAP BODY LAYOUT === */
.greyton-map-body {
	padding: 0;
	background: var(--greyton-parchment);
	position: relative;
}
.greyton-map-body-inner {
	position: relative;
}

/* === MAP CONTAINER === */
.greyton-map-container {
	position: relative;
	overflow: hidden;
	background: var(--greyton-parchment);
}
.greyton-map-canvas {
	width: 100%;
	height: 75vh;
	min-height: 450px;
}

/* Parchment vignette overlay */
.greyton-map-vignette {
	position: absolute;
	inset: 0;
	pointer-events: none;
	box-shadow: inset 0 0 60px rgba(44, 36, 22, 0.1);
	z-index: 400;
}

/* === LEAFLET OVERRIDES === */

/* Zoom controls */
.greyton-map-canvas .leaflet-control-zoom {
	border: none !important;
	box-shadow: var(--shadow-md) !important;
	border-radius: var(--radius-md) !important;
	overflow: hidden;
}
.greyton-map-canvas .leaflet-control-zoom a {
	background: var(--greyton-white) !important;
	color: var(--greyton-primary) !important;
	width: 36px !important;
	height: 36px !important;
	line-height: 36px !important;
	font-size: 18px !important;
	font-weight: 700;
	border-bottom: 1px solid var(--greyton-border-light) !important;
	transition: background var(--transition-fast), color var(--transition-fast);
}
.greyton-map-canvas .leaflet-control-zoom a:hover {
	background: var(--greyton-primary) !important;
	color: #fff !important;
}
.greyton-map-canvas .leaflet-control-zoom a:last-child {
	border-bottom: none !important;
}

/* Attribution */
.greyton-map-canvas .leaflet-control-attribution {
	background: rgba(250, 250, 247, 0.85) !important;
	font-family: var(--font-body) !important;
	font-size: 0.65rem !important;
	color: var(--greyton-light) !important;
	padding: 2px 8px !important;
	border-radius: var(--radius-sm) 0 0 0 !important;
}
.greyton-map-canvas .leaflet-control-attribution a {
	color: var(--greyton-medium) !important;
}

/* Remove Leaflet default popup styling — we use sidebar instead */
.greyton-map-canvas .leaflet-popup {
	display: none !important;
}

/* === CUSTOM MARKERS === */
.greyton-marker {
	position: relative;
	cursor: pointer;
	transition: transform 0.2s ease;
}
.greyton-marker:hover {
	transform: scale(1.15);
	z-index: 999 !important;
}
.greyton-marker.is-active {
	transform: scale(1.3);
	z-index: 1000 !important;
}
.greyton-marker-pin {
	width: 32px;
	height: 40px;
	filter: drop-shadow(0 3px 4px rgba(44, 36, 22, 0.25));
}
.greyton-marker-icon {
	position: absolute;
	top: 7px;
	left: 50%;
	transform: translateX(-50%);
	width: 18px;
	height: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	line-height: 1;
	color: #fff;
}

/* Marker type colors */
.greyton-marker--vendor .greyton-marker-pin path {
	fill: var(--greyton-secondary);
}
.greyton-marker--guide .greyton-marker-pin path {
	fill: var(--greyton-primary);
}
.greyton-marker--community .greyton-marker-pin path {
	fill: var(--greyton-accent);
}

/* Pulse animation for active marker */
@media (prefers-reduced-motion: no-preference) {
	.greyton-marker.is-active::after {
		content: '';
		position: absolute;
		bottom: 0;
		left: 50%;
		transform: translateX(-50%);
		width: 12px;
		height: 12px;
		border-radius: 50%;
		background: rgba(196, 101, 43, 0.3);
		animation: greyton-marker-pulse 1.5s ease-out infinite;
	}
}
@keyframes greyton-marker-pulse {
	0% { transform: translateX(-50%) scale(1); opacity: 1; }
	100% { transform: translateX(-50%) scale(3.5); opacity: 0; }
}

/* === CLUSTER ICONS === */
.greyton-cluster {
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	font-family: var(--font-heading);
	font-weight: 700;
	color: var(--greyton-dark);
	box-shadow: var(--shadow-md);
	transition: transform 0.2s ease;
}
.greyton-cluster:hover {
	transform: scale(1.1);
}
.greyton-cluster-small {
	width: 36px;
	height: 36px;
	font-size: 0.8rem;
	background: rgba(232, 201, 122, 0.9);
	border: 2px solid var(--greyton-accent);
}
.greyton-cluster-medium {
	width: 44px;
	height: 44px;
	font-size: 0.9rem;
	background: rgba(232, 168, 124, 0.9);
	border: 2px solid var(--greyton-secondary-light);
}
.greyton-cluster-large {
	width: 52px;
	height: 52px;
	font-size: 1rem;
	background: rgba(196, 101, 43, 0.85);
	border: 2px solid var(--greyton-secondary);
	color: #fff;
}

/* === SIDEBAR — Floating Overlay === */
.greyton-map-sidebar {
	position: absolute;
	top: var(--space-md);
	right: var(--space-md);
	width: 360px;
	max-height: calc(75vh - 2 * var(--space-md));
	overflow-y: auto;
	z-index: 500;
	background: var(--greyton-white);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	border: 1px solid var(--greyton-border);
	transition: transform var(--transition-base), opacity var(--transition-base);
}
.greyton-map-sidebar-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: var(--space-xl) var(--space-lg);
	text-align: center;
	color: var(--greyton-light);
}
.greyton-map-sidebar-empty svg {
	margin-bottom: var(--space-sm);
	opacity: 0.35;
	width: 36px;
	height: 36px;
}
.greyton-map-sidebar-empty p {
	font-family: var(--font-body);
	font-size: 0.85rem;
	margin: 0;
}

/* Detail Card */
.greyton-map-detail {
	background: var(--greyton-white);
	border-radius: var(--radius-md);
	border: 1px solid var(--greyton-border);
	box-shadow: var(--shadow-md);
	overflow: hidden;
	position: relative;
}
.greyton-map-detail-close {
	position: absolute;
	top: var(--space-sm);
	right: var(--space-sm);
	width: 32px;
	height: 32px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	font-size: 1.25rem;
	line-height: 1;
	color: var(--greyton-medium);
	cursor: pointer;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--transition-fast), color var(--transition-fast);
}
.greyton-map-detail-close:hover {
	background: var(--greyton-secondary);
	color: #fff;
}
.greyton-map-detail-cover {
	height: 0;
	background-size: cover;
	background-position: center;
	transition: height var(--transition-base);
}
.greyton-map-detail-cover.has-image {
	height: 160px;
}
.greyton-map-detail-body {
	padding: var(--space-md) var(--space-md) var(--space-sm);
}
.greyton-map-detail-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: var(--radius-pill);
	font-family: var(--font-body);
	font-size: 0.65rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
}
/* Badge type colors */
.greyton-map-detail-badge--vendor {
	background: rgba(196, 101, 43, 0.12);
	color: var(--greyton-secondary);
}
.greyton-map-detail-badge--guide {
	background: rgba(45, 80, 22, 0.1);
	color: var(--greyton-primary);
}
.greyton-map-detail-badge--community {
	background: rgba(212, 160, 62, 0.15);
	color: #9A7520;
}
.greyton-map-detail-name {
	font-family: var(--font-heading);
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--greyton-dark);
	margin: 0 0 4px;
	line-height: 1.3;
}
.greyton-map-detail-desc {
	font-family: var(--font-body);
	font-size: 0.85rem;
	color: var(--greyton-medium);
	line-height: 1.5;
	margin: 0 0 var(--space-sm);
}

/* Meta items */
.greyton-map-detail-meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: var(--space-sm);
}
.greyton-map-detail-meta-item {
	display: flex;
	align-items: flex-start;
	gap: var(--space-sm);
	font-family: var(--font-body);
	font-size: 0.85rem;
	color: var(--greyton-medium);
}
.greyton-map-detail-meta-item svg {
	flex-shrink: 0;
	margin-top: 2px;
}
.greyton-map-detail-meta-item a {
	color: var(--greyton-primary);
	text-decoration: none;
	transition: color var(--transition-fast);
}
.greyton-map-detail-meta-item a:hover {
	color: var(--greyton-secondary);
}

/* CTA Actions */
.greyton-map-detail-actions {
	display: flex;
	gap: var(--space-sm);
	flex-wrap: wrap;
}
.greyton-map-detail-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border-radius: var(--radius-sm);
	font-family: var(--font-body);
	font-size: 0.8rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: all var(--transition-fast);
	border: none;
}
.greyton-map-detail-btn--primary {
	background: var(--greyton-secondary);
	color: #fff;
}
.greyton-map-detail-btn--primary:hover {
	background: var(--greyton-accent);
	transform: translateY(-1px);
	box-shadow: var(--shadow-sm);
}
.greyton-map-detail-btn--secondary {
	background: transparent;
	border: 1.5px solid var(--greyton-primary);
	color: var(--greyton-primary);
}
.greyton-map-detail-btn--secondary:hover {
	background: var(--greyton-primary);
	color: #fff;
}

/* === LOCATION LIST === */
.greyton-map-list {
	margin-top: var(--space-lg);
}
.greyton-map-list-title {
	font-family: var(--font-heading);
	font-size: 1rem;
	font-weight: 700;
	color: var(--greyton-dark);
	margin: 0 0 var(--space-sm);
	padding-bottom: var(--space-xs);
	border-bottom: 2px solid var(--greyton-secondary);
}
.greyton-map-list-items {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 300px;
	overflow-y: auto;
}
.greyton-map-list-item {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	padding: var(--space-sm) var(--space-sm);
	border-bottom: 1px solid var(--greyton-border-light);
	cursor: pointer;
	transition: background var(--transition-fast);
	border-radius: var(--radius-sm);
}
.greyton-map-list-item:hover {
	background: rgba(45, 80, 22, 0.04);
}
.greyton-map-list-item.is-active {
	background: rgba(196, 101, 43, 0.06);
	border-color: var(--greyton-secondary-light);
}
.greyton-map-list-item:last-child {
	border-bottom: none;
}
.greyton-map-list-dot {
	flex-shrink: 0;
	width: 8px;
	height: 8px;
	border-radius: 50%;
}
.greyton-map-list-dot--vendor { background: var(--greyton-secondary); }
.greyton-map-list-dot--guide { background: var(--greyton-primary); }
.greyton-map-list-dot--community { background: var(--greyton-accent); }
.greyton-map-list-name {
	font-family: var(--font-body);
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--greyton-dark);
	flex: 1;
}
.greyton-map-list-cat {
	font-family: var(--font-body);
	font-size: 0.7rem;
	color: var(--greyton-light);
	white-space: nowrap;
}

/* Count badge on filter pills */
.greyton-map-pill-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	font-size: 0.7rem;
	font-weight: 700;
	background: rgba(0, 0, 0, 0.1);
	margin-left: 2px;
}
.greyton-map-pill.is-active .greyton-map-pill-count {
	background: rgba(255, 255, 255, 0.25);
}

/* === TABLET (768px — 1023px) === */
@media (min-width: 768px) and (max-width: 1023px) {
	.greyton-map-sidebar {
		width: 300px;
	}
}

/* === MOBILE (< 768px) === */
@media (max-width: 767px) {
	.greyton-map-hero {
		padding: var(--space-lg) var(--space-md);
	}
	.greyton-map-hero-title {
		font-size: 1.5rem;
	}
	.greyton-map-hero-subtitle {
		font-size: 0.85rem;
	}
	.greyton-map-filters-inner {
		flex-direction: column;
		gap: var(--space-sm);
	}
	.greyton-map-filter-pills {
		width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		padding-bottom: 2px;
	}
	.greyton-map-filter-pills::-webkit-scrollbar {
		display: none;
	}
	.greyton-map-search-wrap {
		max-width: none;
		width: 100%;
	}
	.greyton-map-canvas {
		height: 60vh;
		min-height: 350px;
	}

	/* Bottom sheet overlay */
	.greyton-map-sidebar {
		position: fixed;
		top: auto;
		bottom: 0;
		left: 0;
		right: 0;
		width: 100%;
		max-height: 55vh;
		border-radius: var(--radius-lg) var(--radius-lg) 0 0;
		box-shadow: 0 -4px 24px rgba(44, 36, 22, 0.15);
	}
	/* Drag handle */
	.greyton-map-sidebar::before {
		content: '';
		display: block;
		width: 40px;
		height: 4px;
		border-radius: 2px;
		background: var(--greyton-border);
		margin: var(--space-sm) auto var(--space-sm);
	}
	.greyton-map-detail-cover.has-image {
		height: 120px;
	}
}

/* === SCROLLBAR STYLING === */
.greyton-map-sidebar::-webkit-scrollbar,
.greyton-map-list-items::-webkit-scrollbar {
	width: 4px;
}
.greyton-map-sidebar::-webkit-scrollbar-track,
.greyton-map-list-items::-webkit-scrollbar-track {
	background: transparent;
}
.greyton-map-sidebar::-webkit-scrollbar-thumb,
.greyton-map-list-items::-webkit-scrollbar-thumb {
	background: var(--greyton-border);
	border-radius: 2px;
}

/* === LOADING STATE === */
.greyton-map-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	font-family: var(--font-body);
	font-size: 0.9rem;
	color: var(--greyton-light);
}
.greyton-map-loading::after {
	content: '';
	display: inline-block;
	width: 20px;
	height: 20px;
	margin-left: 10px;
	border: 2px solid var(--greyton-border);
	border-top-color: var(--greyton-secondary);
	border-radius: 50%;
	animation: greyton-map-spin 0.6s linear infinite;
}
@keyframes greyton-map-spin {
	to { transform: rotate(360deg); }
}

/* === NO RESULTS STATE === */
.greyton-map-no-results {
	text-align: center;
	padding: var(--space-xl);
	color: var(--greyton-light);
	font-family: var(--font-body);
	font-size: 0.9rem;
}

/* === PRINT === */
@media print {
	.greyton-map-filters,
	.greyton-map-sidebar,
	.greyton-map-vignette {
		display: none;
	}
	.greyton-map-canvas {
		height: 400px;
	}
}
