/* Herramienta cartográfica Hatarja */
.map-tool-card {
  display:grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap:14px;
  align-items:center;
  margin: 12px 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(79,96,69,.12), rgba(255,255,255,.52));
  box-shadow: 0 8px 24px rgba(45,55,42,.05);
}
.map-tool-card__icon {
  width:52px; height:52px; border-radius:13px;
  display:grid; place-items:center; background:rgba(255,255,255,.72);
  border:1px solid var(--line);
}
.map-tool-card__icon img { width:36px; height:36px; }
.map-tool-card__copy h2 { margin:0 0 3px; font-size:1.03rem; }
.map-tool-card__copy p { margin:0; color:var(--muted); font-size:.72rem; line-height:1.5; }
.map-tool-card__link {
  white-space:nowrap; text-decoration:none; font-size:.70rem; font-weight:850;
  color:var(--forest-dark); padding:8px 10px; border-radius:9px;
  border:1px solid var(--line); background:rgba(255,255,255,.70);
}

.maps-shell { width:100%; }
.maps-info-note {
  margin:0 0 12px; padding:10px 12px; border-radius:11px;
  background:rgba(246,244,236,.82); border:1px solid var(--line);
  color:var(--muted); font-size:.70rem; line-height:1.48;
}
.maps-toolbar {
  display:flex; flex-wrap:wrap; gap:7px; align-items:center;
  margin-bottom:10px; padding:9px; border:1px solid var(--line); border-radius:12px;
  background:rgba(255,255,255,.50);
}
.maps-toolbar button,
.maps-tabs button,
.maps-panel button {
  min-height:31px; border:1px solid var(--line); border-radius:8px;
  background:rgba(255,255,255,.82); color:var(--text); padding:6px 9px;
  font:800 .66rem/1.1 system-ui,-apple-system,Segoe UI,sans-serif; cursor:pointer;
}
.maps-toolbar button:hover,
.maps-tabs button:hover,
.maps-panel button:hover { background:rgba(78,102,72,.10); }
.maps-toolbar .maps-primary { background:var(--forest-dark); color:white; border-color:transparent; }
.maps-toolbar-spacer { flex:1 1 auto; }
.maps-status { color:var(--muted); font-size:.65rem; margin-left:auto; }
.maps-tabs { display:flex; flex-wrap:wrap; gap:6px; margin: 0 0 9px; }
.maps-tabs button.is-active { background:var(--forest-dark); color:#fff; border-color:transparent; }
.maps-workspace {
  display:grid; grid-template-columns:minmax(0,1fr) 260px; gap:10px; align-items:start;
}
#hatarja-map {
  height:560px; width:100%; border:1px solid var(--line); border-radius:14px; overflow:hidden;
  background:#e9ece5;
}
.maps-sidebar { display:grid; gap:9px; }
.maps-panel {
  padding:11px; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.54);
}
.maps-panel[hidden] { display:none; }
.maps-panel h2 { margin:0 0 5px; font-size:.85rem; }
.maps-panel p { margin:0 0 8px; color:var(--muted); font-size:.66rem; line-height:1.45; }
.maps-panel label { display:block; margin:7px 0 3px; font-size:.62rem; font-weight:850; color:var(--muted); }
.maps-panel input[type="text"], .maps-panel input[type="search"], .maps-panel select {
  width:100%; min-height:31px; padding:5px 7px; border:1px solid var(--line); border-radius:7px;
  background:rgba(255,255,255,.86); color:var(--text); font-size:.68rem;
}
.maps-panel input[type="file"] { width:100%; font-size:.62rem; }
.maps-panel-actions { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px; }
.maps-results { display:grid; gap:4px; margin-top:7px; max-height:150px; overflow:auto; }
.maps-result {
  width:100%; text-align:left; border:1px solid var(--line); border-radius:7px; padding:6px;
  background:rgba(255,255,255,.76); color:var(--text); font-size:.63rem; cursor:pointer;
}
.maps-metrics {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; margin-top:8px;
}
.maps-metric { padding:7px; border-radius:8px; border:1px solid var(--line); background:rgba(255,255,255,.60); }
.maps-metric strong { display:block; font-size:.75rem; }
.maps-metric span { color:var(--muted); font-size:.58rem; }
.maps-help { margin-top:10px; color:var(--muted); font-size:.61rem; line-height:1.45; }
.maps-credit { margin-top:8px; font-size:.58rem; color:var(--muted); }

@media (max-width: 900px) {
  .maps-workspace { grid-template-columns:1fr; }
  #hatarja-map { height:460px; }
  .maps-sidebar { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .map-tool-card { grid-template-columns:auto 1fr; }
  .map-tool-card__link { grid-column:1 / -1; justify-self:start; }
}
@media (max-width: 620px) {
  #hatarja-map { height:390px; }
  .maps-sidebar { grid-template-columns:1fr; }
  .maps-toolbar-spacer { display:none; }
  .maps-status { width:100%; margin-left:0; }
}
@media print {
  #site-header, #site-footer, #section-subnav, .maps-toolbar, .maps-tabs, .maps-sidebar, .breadcrumbs, .page-hero { display:none !important; }
  .section-layout, .content-shell, .maps-workspace { display:block !important; width:100% !important; }
  #hatarja-map { height:690px !important; border:1px solid #777; }
  .maps-info-note { display:none; }
}


/* Marcadores del visor cartográfico */
.hatarja-map-marker{width:15px;height:15px;border-radius:50%;background:#f4efe2;border:3px solid #3f523a;box-shadow:0 2px 7px rgba(0,0,0,.24);display:grid;place-items:center;font:800 10px/1 system-ui,sans-serif;color:#fff;}
.hatarja-map-marker.route{width:26px;height:26px;background:#405a39;border-color:#fff;}
.hatarja-map-marker.search{background:#b16a4c;border-color:#fff;}
.hatarja-map-marker.location{width:18px;height:18px;background:#2f7594;border:4px solid #d9eff7;}
#hatarja-map:fullscreen{height:100vh !important;border-radius:0;}
.maplibregl-popup-content{font:600 12px/1.35 system-ui,sans-serif;color:#263126;border-radius:10px;}


/* Leaflet · integración Hatarja */
#hatarja-map .leaflet-container{font-family:system-ui,-apple-system,Segoe UI,sans-serif;}
#hatarja-map .leaflet-control-attribution{font-size:9px;}
#hatarja-map .leaflet-popup-content-wrapper{border-radius:10px;color:#263126;}
#hatarja-map .leaflet-tooltip{font:800 11px/1 system-ui,sans-serif;border-radius:8px;}
#hatarja-map:fullscreen{height:100vh !important;border-radius:0;}
.maps-emergency-note{position:absolute;left:12px;bottom:12px;z-index:900;max-width:430px;padding:8px 10px;border-radius:9px;background:rgba(255,255,255,.94);border:1px solid #ccc;font:600 12px/1.35 system-ui;color:#333;}


/* Selector visible de fondo cartográfico */
.maps-basemap-switcher {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:5px;
  min-height:31px;
  padding:4px 5px;
  border:1px solid var(--line);
  border-radius:9px;
  background:rgba(255,255,255,.72);
}
.maps-basemap-label {
  padding:0 4px;
  color:var(--muted);
  font:850 .62rem/1.1 system-ui,-apple-system,Segoe UI,sans-serif;
}
.maps-basemap-switcher button {
  min-height:25px;
  padding:4px 8px;
  border:1px solid var(--line);
  border-radius:7px;
  background:rgba(255,255,255,.82);
  color:var(--text);
  font:800 .62rem/1.1 system-ui,-apple-system,Segoe UI,sans-serif;
  cursor:pointer;
}
.maps-basemap-switcher button:hover { background:rgba(78,102,72,.10); }
.maps-basemap-switcher button.is-active {
  background:var(--forest-dark);
  border-color:var(--forest-dark);
  color:#fff;
}
.maps-basemap-switcher button:focus-visible { outline:2px solid var(--forest-dark); outline-offset:2px; }

/* La capa Claro reutiliza el mismo mapa de calles y modifica únicamente su tratamiento visual. */
.hatarja-clear-pane .leaflet-tile {
  filter: grayscale(.42) saturate(.58) brightness(1.13) contrast(.82);
}

@media (max-width: 620px) {
  .maps-basemap-switcher { width:100%; }
}


/* ===== V7 · controles cartográficos integrados ===== */
.maps-control-deck {
  display: grid;
  gap: 0;
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.52);
  box-shadow: 0 8px 22px rgba(35,42,35,.035);
}
.maps-control-group { padding: 9px 10px; }
.maps-control-group + .maps-control-group { border-top: 1px solid var(--line); }
.maps-control-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}
.maps-control-heading > div { display: grid; gap: 1px; }
.maps-control-kicker {
  color: var(--muted);
  font-size: .56rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.maps-control-heading strong { font-size: .77rem; line-height: 1.15; }
.maps-control-heading p { margin: 0; max-width: 48ch; color: var(--muted); font-size: .60rem; line-height: 1.35; text-align: right; }
.maps-tabs {
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 6px;
  margin: 0;
}
.maps-tabs button {
  min-width: 0;
  min-height: 44px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  padding: 6px 7px;
  text-align: center;
}
.maps-tabs button span { font-size: .66rem; font-weight: 850; line-height: 1.12; }
.maps-tabs button small { color: var(--muted); font-size: .54rem; font-weight: 680; line-height: 1.1; }
.maps-tabs button.is-active small { color: rgba(255,255,255,.78); }
.maps-toolbar {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.maps-toolbar-spacer { display: none; }
.maps-control-status {
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  background: rgba(128,128,128,.025);
}
.maps-status { display: block; margin: 0; font-size: .61rem; }
@media (max-width: 900px) {
  .maps-tabs { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .maps-control-heading { align-items: start; }
}
@media (max-width: 620px) {
  .maps-control-heading { display: grid; gap: 3px; }
  .maps-control-heading p { text-align: left; }
  .maps-tabs { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .maps-toolbar { align-items: stretch; }
  .maps-toolbar > button { flex: 1 1 calc(50% - 5px); }
  .maps-basemap-switcher { flex: 1 1 100%; }
}
@media (max-width: 390px) {
  .maps-tabs { grid-template-columns: 1fr; }
}


/* ===== V7 · fondo cartográfico local de reserva ===== */
#hatarja-map{
  background-color:#dce8ec;
  background-image:url("../assets/images/iberia-map-fallback.svg");
  background-position:center;
  background-repeat:no-repeat;
  background-size:cover;
}
#hatarja-map .leaflet-pane.hatarja-fallback-pane{pointer-events:none}

.maps-static-fallback{display:block;width:100%;height:100%;object-fit:cover;background:#dce8ec}

/* V7 · acciones de borrado con diferenciación suave */
.maps-toolbar button[data-map-action="clear"],
.maps-panel button[data-map-action="undo"]{background:rgba(176,82,66,.10);border-color:rgba(156,74,61,.28);color:inherit}
.maps-toolbar button[data-map-action="clear"]:hover,
.maps-panel button[data-map-action="undo"]:hover{background:rgba(176,82,66,.17);border-color:rgba(156,74,61,.38)}
