/* RM Comunas - Mapa Interactivo - Estilos frontend */

.rmcm-widget {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 700px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	overflow: hidden;
	font-family: inherit;
	box-sizing: border-box;
}

.rmcm-widget * {
	box-sizing: border-box;
}

.rmcm-widget.rmcm-fullscreen {
	position: fixed;
	inset: 0;
	z-index: 100000;
	height: 100vh !important;
	border-radius: 0;
}

/* Header */
.rmcm-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 20px;
	background: #fff;
	border-bottom: 1px solid #e5e7eb;
	flex-shrink: 0;
	flex-wrap: wrap;
}

.rmcm-header-left {
	display: flex;
	align-items: center;
	gap: 12px;
}

.rmcm-logo-img {
	max-height: 32px;
	width: auto;
}

.rmcm-heading {
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
	color: #101418;
	margin: 0;
}

.rmcm-subheading {
	font-size: 13px;
	color: #6b7280;
	margin-top: 2px;
}

.rmcm-counter {
	background: #eef2f6;
	color: #334155;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.04em;
	padding: 6px 14px;
	border-radius: 999px;
	white-space: nowrap;
}

/* Body layout */
.rmcm-body {
	display: flex;
	flex: 1;
	min-height: 0;
}

/* Map area */
.rmcm-map-area {
	position: relative;
	flex: 1;
	background: #16324a;
	overflow: hidden;
	min-width: 0;
}

.rmcm-svg {
	width: 100%;
	height: 100%;
	display: block;
	cursor: grab;
}

.rmcm-svg.is-panning {
	cursor: grabbing;
}

.rmcm-comuna-path {
	fill: #9fc3dc;
	stroke: #16324a;
	stroke-width: 1px;
	vector-effect: non-scaling-stroke;
	cursor: pointer;
	transition: fill 0.15s ease;
}

.rmcm-comuna-path:hover {
	fill: #f4a35c;
}

.rmcm-comuna-path.is-active {
	fill: #ff6a13;
}

.rmcm-comuna-path.is-hidden-provincia {
	fill-opacity: 0.12;
	stroke-opacity: 0.25;
	pointer-events: none;
}

.rmcm-labels-group {
	pointer-events: none;
}

.rmcm-comuna-label {
	fill: #eaf2f8;
	font-size: 11px;
	opacity: 0;
	transition: opacity 0.15s ease;
	paint-order: stroke;
	stroke: #16324a;
	stroke-width: 0.6px;
}

.rmcm-comuna-label.is-visible-label {
	opacity: 1;
}

/* Map brand box */
.rmcm-map-brand {
	position: absolute;
	top: 16px;
	left: 16px;
	display: flex;
	align-items: center;
	gap: 10px;
	background: rgba(15, 30, 45, 0.55);
	backdrop-filter: blur(2px);
	padding: 10px 14px;
	border-radius: 8px;
	z-index: 3;
}

.rmcm-map-brand img {
	max-height: 34px;
	width: auto;
}

.rmcm-map-brand-text {
	display: flex;
	flex-direction: column;
	color: #fff;
	line-height: 1.3;
}

.rmcm-map-brand-text strong {
	font-size: 15px;
}

.rmcm-map-brand-text span {
	font-size: 11px;
	opacity: 0.8;
}

/* Zoom controls */
.rmcm-zoom-controls {
	position: absolute;
	top: 16px;
	right: 16px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	z-index: 3;
}

.rmcm-zoom-controls button {
	width: 34px;
	height: 34px;
	border: none;
	border-radius: 8px;
	background: #fff;
	color: #16324a;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.rmcm-zoom-controls button:hover {
	background: #f1f5f9;
}

.rmcm-zoom-indicator {
	position: absolute;
	bottom: 14px;
	left: 14px;
	background: rgba(255, 255, 255, 0.9);
	color: #16324a;
	font-size: 12px;
	padding: 5px 10px;
	border-radius: 999px;
	z-index: 3;
}

/* Popup */
.rmcm-popup {
	position: absolute;
	top: 16px;
	left: 16px;
	width: 300px;
	max-width: calc(100% - 32px);
	max-height: calc(100% - 32px);
	overflow-y: auto;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
	z-index: 5;
}

.rmcm-popup[hidden] {
	display: none;
}

.rmcm-popup-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
	background: #16324a;
	color: #fff;
	padding: 14px 16px;
	border-radius: 10px 10px 0 0;
}

.rmcm-popup-title {
	font-size: 16px;
	font-weight: 700;
}

.rmcm-popup-provincia {
	font-size: 12px;
	opacity: 0.8;
	margin-top: 2px;
}

.rmcm-popup-close {
	background: rgba(255, 255, 255, 0.15);
	border: none;
	color: #fff;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
	flex-shrink: 0;
}

.rmcm-popup-body {
	padding: 16px;
	color: #374151;
	font-size: 13px;
}

.rmcm-popup-social {
	display: flex;
	gap: 8px;
	margin-bottom: 12px;
}

.rmcm-popup-social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #ff6a13;
	color: #fff;
	text-decoration: none;
	font-size: 14px;
}

.rmcm-popup-field {
	margin-bottom: 12px;
}

.rmcm-popup-field:last-child {
	margin-bottom: 0;
}

.rmcm-popup-label {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.05em;
	color: #ff6a13;
	margin-bottom: 3px;
}

.rmcm-popup-value {
	font-size: 13px;
	color: #374151;
	line-height: 1.4;
}

.rmcm-popup-value a {
	color: #ff6a13;
	text-decoration: none;
}

.rmcm-popup-field.is-empty {
	display: none;
}

/* Sidebar */
.rmcm-sidebar {
	width: 260px;
	flex: 0 0 260px;
	background: #fff;
	border-left: 1px solid #e5e7eb;
	padding: 16px;
	overflow-y: auto;
	color: #1f2937;
	font-size: 13px;
}

.rmcm-search input {
	width: 100%;
	padding: 9px 12px;
	border-radius: 999px;
	border: 1px solid #e5e7eb;
	background: #f3f4f6;
	font-size: 13px;
	outline: none;
}

.rmcm-search input:focus {
	border-color: #ff6a13;
}

.rmcm-sidebar-current {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 14px;
	font-weight: 600;
	font-size: 13px;
	line-height: 1.4;
}

.rmcm-pin {
	flex-shrink: 0;
}

.rmcm-sponsor {
	display: block;
	margin-top: 14px;
	border-radius: 10px;
	overflow: hidden;
}

.rmcm-sponsor img {
	width: 100%;
	display: block;
}

.rmcm-secondary-btn {
	display: block;
	margin-top: 10px;
	padding: 10px 14px;
	background: #f3f4f6;
	border-radius: 8px;
	color: #1f2937;
	text-decoration: none;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
}

.rmcm-secondary-btn:hover {
	background: #e5e7eb;
}

/* Legend */
.rmcm-legend {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px 12px;
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid #e5e7eb;
}

.rmcm-legend-item {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	cursor: pointer;
	user-select: none;
}

.rmcm-legend-checkbox {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.rmcm-legend-swatch {
	width: 12px;
	height: 12px;
	border-radius: 3px;
	background: #9fc3dc;
	flex-shrink: 0;
}

.rmcm-legend-checkbox:not(:checked) + .rmcm-legend-swatch {
	background: #e5e7eb;
}

/* Comuna list / accordion */
.rmcm-comuna-list {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid #e5e7eb;
}

.rmcm-comuna-group + .rmcm-comuna-group {
	margin-top: 4px;
}

.rmcm-comuna-group-toggle {
	display: flex;
	align-items: center;
	gap: 6px;
	width: 100%;
	background: none;
	border: none;
	text-align: left;
	padding: 6px 0;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.03em;
	color: #374151;
	cursor: pointer;
}

.rmcm-caret {
	display: inline-block;
	transition: transform 0.15s ease;
	font-size: 10px;
}

.rmcm-comuna-group.is-open .rmcm-caret {
	transform: rotate(90deg);
}

.rmcm-comuna-group-list {
	list-style: none;
	margin: 0;
	padding: 0 0 6px 18px;
	display: none;
}

.rmcm-comuna-group.is-open .rmcm-comuna-group-list {
	display: block;
}

.rmcm-comuna-list-item {
	padding: 4px 0;
	font-size: 12.5px;
	color: #4b5563;
	cursor: pointer;
	border-radius: 4px;
}

.rmcm-comuna-list-item:hover {
	color: #ff6a13;
}

.rmcm-comuna-list-item.is-active {
	color: #ff6a13;
	font-weight: 700;
}

.rmcm-comuna-list-item.is-search-hidden {
	display: none;
}

/* Responsive */
@media (max-width: 782px) {
	.rmcm-body {
		flex-direction: column;
	}

	.rmcm-sidebar {
		width: 100% !important;
		flex-basis: auto !important;
		border-left: none;
		border-top: 1px solid #e5e7eb;
		max-height: 320px;
	}

	.rmcm-map-area {
		min-height: 320px;
	}
}
