/* Estilos para el mapa interactivo (Premium Modern Layout) */

.mapa-patrimoni-wrapper {
	margin: 2rem 0;
	position: relative;
    font-family: 'Outfit', sans-serif;
	box-shadow: 0 20px 40px rgba(0,0,0,0.08);
	border-radius: 16px;
	overflow: hidden;
	background: #ffffff;
}

.mapa-patrimoni-layout {
	display: flex;
	flex-direction: column;
	height: 700px;
	width: 100%;
}

@media (min-width: 768px) {
	.mapa-patrimoni-layout {
		flex-direction: row;
	}
}

/* Sidebar List */
.mapa-sidebar {
	width: 100%;
	height: 350px;
	background: #f8fbff;
	border-right: 1px solid #e1e8ed;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	flex-shrink: 0;
}

@media (min-width: 768px) {
	.mapa-sidebar {
		width: 400px;
		height: 100%;
	}
}

.mapa-sidebar-header {
	padding: 24px;
	background: linear-gradient(135deg, #2c3e50, #3498db);
	color: white;
	box-sizing: border-box;
}

.mapa-sidebar-header h3 {
	margin: 0 0 16px 0 !important;
	font-size: 22px !important;
	font-weight: 700 !important;
	color: white !important;
}

.mapa-filters {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

#mapa-search, #mapa-muni-filter, #mapa-cat-filter {
	width: 100% !important;
	height: 42px !important;
	padding: 0 12px !important;
	border-radius: 8px !important;
	border: 1px solid rgba(255,255,255,0.2) !important;
	background: rgba(255,255,255,0.95) !important;
	font-family: inherit !important;
	font-size: 13px !important;
	color: #2c3e50 !important;
	box-shadow: 0 4px 6px rgba(0,0,0,0.05) !important;
	outline: none !important;
	transition: all 0.2s ease;
}

#mapa-search:focus, #mapa-muni-filter:focus, #mapa-cat-filter:focus {
	background: #ffffff !important;
	box-shadow: 0 6px 12px rgba(0,0,0,0.1) !important;
}

.mapa-filters-row {
	display: flex;
	gap: 8px;
}

/* Digitalitzat toggle button */
.mapa-digital-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 0 12px;
	height: 42px;
	border-radius: 8px;
	border: 2px solid rgba(255,255,255,0.4);
	background: rgba(255,255,255,0.12);
	color: white;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	box-sizing: border-box;
	text-align: left;
}

.mapa-digital-btn:hover {
	background: rgba(255,255,255,0.22);
	border-color: rgba(255,255,255,0.7);
}

.mapa-digital-btn.active {
	background: white;
	border-color: white;
	color: #2c3e50;
}

.mapa-digital-btn-img {
	height: 22px;
	width: auto;
	border-radius: 3px;
	display: block;
	flex-shrink: 0;
}

/* ==========================================
   CUSTOM MARKERS — Bubble + tail design
   ========================================== */

.custom-marker-icon {
	background: transparent !important;
	border: none !important;
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* Circular bubble containing the SVG icon */
.marker-bubble {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 3px 8px rgba(0,0,0,0.30);
	border: 2.5px solid rgba(255,255,255,0.85);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.marker-bubble svg {
	display: block;
	flex-shrink: 0;
}

/* Downward-pointing triangle tail */
.marker-tail {
	width: 0;
	height: 0;
	border-left: 6px solid transparent;
	border-right: 6px solid transparent;
	border-top-width: 8px;
	border-top-style: solid;
	/* border-top-color set inline via JS to match bubble */
	margin-top: -1px;
	filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15));
}

/* Hover lift effect — apply on the wrapper leaflet sets */
.leaflet-marker-icon:hover .marker-bubble {
	transform: translateY(-3px) scale(1.08);
	box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

/* Map Main Area */
.mapa-main {
	flex-grow: 1;
	height: 350px;
	position: relative;
	background-color: #f1f5f9;
}

@media (min-width: 768px) {
	.mapa-main {
		height: 100%;
	}
}

.mapa-patrimoni {
	position: absolute !important;
	top: 0;
	left: 0;
	width: 100% !important;
	height: 100% !important;
	z-index: 1;
}

/* List styling */
.mapa-list {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	box-sizing: border-box;
}

.map-list-item {
	background: white;
	border-radius: 12px;
	padding: 18px;
	margin-bottom: 12px;
	cursor: pointer;
	border: 1px solid #edf2f7;
}

.map-list-item.active {
	border-color: #3498db;
	background-color: #f0f9ff;
}

/* Popups */
.leaflet-popup-content-wrapper {
	border-radius: 12px !important;
	padding: 0 !important;
}

.leaflet-popup-content {
	margin: 0 !important;
	width: 320px !important;
}

.map-popup-container {
	padding: 20px !important;
}

.map-popup-title {
	font-size: 16px !important;
	font-weight: 700 !important;
	margin-bottom: 10px !important;
	color: #1e293b !important;
}

.map-popup-buttons {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 12px;
}

.map-popup-btn {
	display: block !important;
	background: #3498db !important;
	color: white !important;
	text-align: center !important;
	padding: 10px !important;
	border-radius: 6px !important;
	text-decoration: none !important;
	margin: 0 !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	transition: all 0.2s ease !important;
	border: none !important;
	cursor: pointer !important;
}

.map-popup-btn:hover {
	background: #2980b9 !important;
	box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3) !important;
}

.map-popup-btn-description {
	background: #27ae60 !important;
}

.map-popup-btn-description:hover {
	background: #229954 !important;
	box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3) !important;
}

/* Category Labels in List */
.map-list-item-tipus {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 4px 10px;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 700;
	margin-bottom: 8px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.map-list-item-tipus svg {
	flex-shrink: 0;
	display: block;
}

/* Legend */
.mapa-legend {
	background: white;
	border-radius: 10px;
	padding: 10px 14px;
	box-shadow: 0 2px 12px rgba(0,0,0,0.13);
	font-family: 'Outfit', sans-serif;
	min-width: 175px;
	border: 1px solid #e8edf2;
}

.mapa-legend-title {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	color: #7a8a9a;
	margin-bottom: 8px;
}

.mapa-legend-item {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 6px;
}

.mapa-legend-item:last-child {
	margin-bottom: 0;
}

.mapa-legend-dot {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 1px 4px rgba(0,0,0,0.18);
	border: 2px solid rgba(255,255,255,0.7);
}

.mapa-legend-dot svg {
	display: block;
}

.mapa-legend-label {
	font-size: 12px;
	color: #2c3e50;
	font-weight: 500;
}

/* Digitalitzat badge */
.map-list-item-digitalitzat,
.map-popup-digitalitzat {
	display: flex;
	align-items: center;
	gap: 7px;
	margin-top: 8px;
	padding: 5px 8px;
	background: #f0f7ff;
	border: 1px solid #cce0f5;
	border-radius: 6px;
}

.map-popup-digitalitzat {
	margin: 10px 0 6px 0;
}

.digitalitzat-badge-img {
	height: 28px;
	width: auto;
	display: block;
	flex-shrink: 0;
}

.map-list-item-digitalitzat span,
.map-popup-digitalitzat span {
	font-size: 11px;
	font-weight: 600;
	color: #1a6db5;
	text-transform: uppercase;
	letter-spacing: 0.4px;
}

.label-civil { background: #e3f2fd; color: #1976d2; }
.label-religios { background: #f3e5f5; color: #7b1fa2; }
.label-font { background: #e0f2f1; color: #00796b; }
.label-pont { background: #fff3e0; color: #ef6c00; }
.label-pou { background: #eceff1; color: #455a64; }
.label-natural { background: #e8f5e9; color: #2e7d32; }
.label-defensiu { background: #ffebee; color: #c62828; }
.label-altres { background: #f5f5f5; color: #616161; }
