/* Hercos Mapa de Sedes */
.hms {
	--hms-accent: #2563eb;
	--hms-dark: #111827;
	--hms-h: 600px;
	font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: #111827;
	width: 100%;
	max-width: 1140px;
	margin: 0 auto 30px;
	padding: 0 20px;
	box-sizing: border-box;
	line-height: 1.45;
}
.hms *, .hms *::before, .hms *::after { box-sizing: border-box; }

/* ---------- Bloque mapa (filtros + mapa) ---------- */
.hms-stage {
	background: #fff;
	border: 1px solid #eef0f3;
	border-radius: 28px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .06);
	overflow: hidden;
	scroll-margin-top: 80px;
}

.hms-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 14px 18px;
	padding: 16px 20px;
	border-bottom: 1px solid #f1f3f5;
	background: #fff;
}
.hms-search { position: relative; flex: 1 1 240px; min-width: 200px; }
.hms-search svg {
	position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
	width: 16px; height: 16px; color: #9ca3af; pointer-events: none;
}
.hms .hms-search input[type="search"] {
	width: 100%; height: 44px; margin: 0; padding: 0 16px 0 40px;
	border: 1px solid #e5e7eb; border-radius: 999px; background: #f9fafb;
	font: inherit; font-size: 14px; color: #111827; box-shadow: none; outline: none;
}
.hms .hms-search input[type="search"]:focus,
.hms .hms-field select:focus {
	border-color: var(--hms-accent); background: #fff;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
.hms-field { display: flex; flex-direction: column; flex: 0 1 190px; min-width: 150px; margin: 0; }
.hms-field span {
	font-size: 11px; font-weight: 600; color: #6b7280; letter-spacing: .02em; margin: 0 0 3px 14px;
}
.hms .hms-field select {
	height: 44px; margin: 0; padding: 0 14px;
	border: 1px solid #e5e7eb; border-radius: 999px; background: #f9fafb;
	font: inherit; font-size: 14px; font-weight: 600; color: #111827; cursor: pointer; outline: none;
}
.hms-meta { display: flex; align-items: center; gap: 12px; margin-left: auto; min-height: 44px; }
.hms-count { font-size: 13px; font-weight: 700; color: #6b7280; white-space: nowrap; }
.hms .hms-reset {
	background: none; border: 0; padding: 0; font: inherit; font-size: 13px; font-weight: 700;
	color: var(--hms-accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.hms .hms-reset[hidden] { display: none; }

.hms-viewport { position: relative; height: var(--hms-h); background: #e8eaed; }
.hms-map { position: absolute; inset: 0; z-index: 0; isolation: isolate; }
.hms-placeholder {
	position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
	font-size: 14px; color: #6b7280; pointer-events: none;
}
.hms-ready .hms-placeholder { display: none; }

.hms .hms-fs {
	position: absolute; top: 14px; right: 14px; z-index: 5;
	display: inline-flex; align-items: center; gap: 8px;
	padding: 9px 15px; border: 1px solid rgba(0, 0, 0, .08); border-radius: 999px;
	background: #fff; color: #111827; font: inherit; font-size: 13px; font-weight: 700;
	cursor: pointer; box-shadow: 0 8px 20px rgba(0, 0, 0, .14); transition: background .2s, color .2s;
}
.hms .hms-fs:hover, .hms .hms-fs:focus-visible { background: var(--hms-dark); color: #fff; }

.hms-stage.is-fs {
	position: fixed; inset: 0; z-index: 99999; border-radius: 0; border: 0;
	display: flex; flex-direction: column;
}
.hms-stage.is-fs .hms-viewport { flex: 1; height: auto; }
body.hms-noscroll { overflow: hidden; }

/* ---------- Pines ---------- */
.hms-pin-wrap { background: none !important; border: 0 !important; }
.hms-pin {
	position: relative; width: 44px; height: 44px; border-radius: 50%;
	border: 3px solid #fff; background: var(--hms-dark); color: #fff;
	box-shadow: 0 6px 16px rgba(0, 0, 0, .28); overflow: hidden; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	font-weight: 800; font-size: 16px; transition: transform .2s, border-color .2s;
}
.hms-pin img {
	position: absolute; inset: 0; width: 100%; height: 100%;
	object-fit: cover; background: #fff; pointer-events: none;
}
.hms-pin:hover, .hms-pin.is-active { transform: scale(1.22); border-color: var(--hms-accent); }
.hms .marker-cluster div { font-family: inherit; font-weight: 800; }

/* ---------- Ventana del mapa ---------- */
.hms .leaflet-popup-content-wrapper {
	padding: 0; border-radius: 22px; overflow: hidden;
	box-shadow: 0 20px 40px rgba(0, 0, 0, .18); border: 1px solid #f3f4f6;
}
.hms .leaflet-popup-content { margin: 0; line-height: 1.4; font-family: inherit; }
.hms .leaflet-container a.leaflet-popup-close-button {
	top: 10px; right: 10px; width: 26px; height: 26px; padding: 0;
	display: flex; align-items: center; justify-content: center;
	background: rgba(255, 255, 255, .9); border-radius: 50%; color: #111827; font-size: 16px; z-index: 10;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.hms-popup-img { position: relative; height: 140px; background: #f3f4f6; }
.hms-popup-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hms-badge {
	position: absolute; top: 10px; left: 10px; background: rgba(255, 255, 255, .92);
	color: #111827; font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 12px;
}
.hms-popup-body { padding: 16px; }
.hms .hms-popup-body h3 { font-size: 15px; font-weight: 800; color: #111827; margin: 0 0 8px; padding: 0; line-height: 1.25; }
.hms-popup-row { border-top: 1px solid #f3f4f6; padding-top: 12px; margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.hms-popup-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Datos y botones (compartidos) ---------- */
.hms .hms-info { list-style: none; margin: 0 0 4px; padding: 0; }
.hms .hms-info li { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 6px; padding: 0; font-size: 13px; color: #4b5563; }
.hms .hms-info svg { flex-shrink: 0; margin-top: 3px; color: var(--hms-accent); }
.hms .hms-info a { color: #4b5563; text-decoration: none; word-break: break-word; }
.hms .hms-info a:hover { color: var(--hms-accent); }

.hms-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 10px; }
.hms-chip { background: #f3f4f6; color: #374151; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 6px; letter-spacing: .02em; }
.hms-popup-row .hms-chips { margin: 0; }

.hms a.hms-btn, .hms button.hms-btn {
	display: inline-flex; align-items: center; justify-content: center;
	padding: 8px 15px; border: 1px solid var(--hms-dark); border-radius: 999px;
	background: var(--hms-dark); color: #fff; font: inherit; font-size: 12px; font-weight: 700;
	line-height: 1.2; text-decoration: none; cursor: pointer; transition: background .2s, border-color .2s, color .2s;
}
.hms a.hms-btn:hover, .hms button.hms-btn:hover { background: var(--hms-accent); border-color: var(--hms-accent); color: #fff; }
.hms a.hms-btn--ghost, .hms button.hms-btn--ghost { background: #fff; color: var(--hms-dark); border-color: #d1d5db; }
.hms a.hms-btn--ghost:hover { background: var(--hms-dark); border-color: var(--hms-dark); color: #fff; }
.hms a.hms-btn:focus-visible, .hms button.hms-btn:focus-visible, .hms .hms-reset:focus-visible, .hms .hms-fs:focus-visible {
	outline: 2px solid var(--hms-accent); outline-offset: 2px;
}

/* ---------- Listado de fichas ---------- */
.hms-list {
	display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px; margin-top: 28px;
}
.hms-card {
	display: flex; flex-direction: column; background: #fff;
	border: 1px solid #eef0f3; border-radius: 22px; overflow: hidden;
	transition: border-color .2s, box-shadow .2s;
}
.hms-card[hidden] { display: none; }
.hms-card.has-pin { cursor: pointer; }
.hms-card:hover { box-shadow: 0 10px 28px rgba(0, 0, 0, .07); }
.hms-card.is-active { border-color: var(--hms-accent); box-shadow: 0 0 0 2px var(--hms-accent); }
.hms-card-img { position: relative; aspect-ratio: 16 / 9; background: #f3f4f6; }
.hms-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hms-card-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
.hms .hms-card-body h3 { font-size: 16px; font-weight: 800; line-height: 1.25; color: #111827; margin: 0 0 8px; padding: 0; }
.hms-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid #f3f4f6; }
.hms-card-body .hms-info { margin-bottom: 14px; }
.hms-none { text-align: center; color: #6b7280; font-size: 14px; margin: 28px 0 0; }
.hms-none[hidden] { display: none; }
.hms-empty-admin { padding: 14px 18px; background: #fef3c7; border-radius: 12px; font-size: 14px; }

/* ---------- Página de una sede ---------- */
.hms-single { padding: 0; margin: 0 0 28px; max-width: none; }
.hms-single-img { width: 100%; max-height: 380px; object-fit: cover; border-radius: 22px; margin-bottom: 18px; display: block; }
.hms-single-box { border: 1px solid #eef0f3; border-radius: 22px; padding: 22px 24px; background: #fff; }
.hms-single-box .hms-info li { font-size: 15px; }

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
	.hms { padding: 0 12px; }
	.hms-stage { border-radius: 20px; }
	.hms-toolbar { padding: 14px; gap: 12px; }
	.hms-search, .hms-field { flex: 1 1 100%; }
	.hms-meta { margin-left: 0; width: 100%; justify-content: space-between; min-height: 0; }
	.hms-viewport { height: min(var(--hms-h), 70vh); }
	.hms .hms-fs span { display: none; }
	.hms .hms-fs { padding: 10px; }
	.hms-list { grid-template-columns: 1fr; gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.hms * { transition: none !important; }
}
