/* Explorador de prestadores: panel lateral y ficha inferior en móvil. */
.qv-map-explorer {
  --map-bg: #17242e;
  --map-plan-surface: #17242e;
  --map-soft: #253541;
  --map-text: #edf4f8;
  --map-subtext: #b0bdc8;
  --map-border: rgba(224, 235, 244, .14);
  --map-accent: var(--brand, oklch(0.62 0.19 252));
  --map-link: #73bcff;
  --map-panel-width: 330px;
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal, 2000) + 20);
  background: var(--map-bg);
  color: var(--map-text);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease;
  isolation: isolate;
}
.qv-map-explorer.light-theme {
  --map-bg: #fcfcfb;
  --map-plan-surface: #fff;
  --map-soft: #eef2f4;
  --map-text: #192a36;
  --map-subtext: #596b78;
  --map-border: #e2e8eb;
  --map-link: #086cc4;
}
.qv-map-explorer.is-active { opacity: 1; pointer-events: auto; }
.qv-map-explorer[hidden], #map-explorer [hidden] { display: none !important; }
#map-explorer *, #map-explorer *::before, #map-explorer *::after { box-sizing: border-box; }
#map-explorer button, #map-explorer input { font: inherit; }
#map-explorer button { cursor: pointer; }
#map-explorer button:focus-visible, #map-explorer input:focus-visible, #map-explorer a:focus-visible {
  outline: 2px solid var(--map-link); outline-offset: 3px;
}
#mapbox-container { position: absolute; inset: 0; }
.map-sidebar {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(36px, env(safe-area-inset-bottom)));
  width: var(--map-panel-width);
  display: flex;
  flex-direction: column;
  z-index: 3;
  border: 1px solid var(--map-border);
  border-radius: 24px;
  background: var(--map-bg);
  box-shadow: 0 12px 50px rgba(21, 42, 55, .15);
}
.map-header { position: relative; z-index: 2; padding: 18px 18px 14px; flex: 0 0 auto; }
.map-header-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.map-brand-img { width: 44px; height: 27px; object-fit: contain; }
#map-explorer .map-header h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; line-height: 1.3; letter-spacing: -.3px; color: var(--map-text); }
.map-close { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 0; border-radius: 14px; background: var(--map-soft); color: var(--map-subtext); font-size: 12px !important; }
.map-close svg { width: 15px; height: 15px; }
#map-explorer .map-search-wrap { position: relative; min-width: 0; margin: 0; }
#map-explorer .map-search-input { width: 100%; height: 46px; padding: 0 40px; border: 1px solid transparent; border-radius: 13px; background: var(--map-soft); color: var(--map-text); box-shadow: none; font-size: 14px; }
#map-explorer .map-search-input::placeholder { color: var(--map-subtext); opacity: 1; }
.map-search-icon { position: absolute; left: 13px; top: 14px; width: 18px; height: 18px; color: var(--map-subtext); pointer-events: none; }
.map-search-clear { position: absolute; top: 1px; right: 2px; width: 40px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 11px; color: var(--map-subtext); background: transparent; }
.map-search-clear svg { width: 16px; height: 16px; }
.map-search-status { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.map-search-status.is-error { top: calc(100% + 8px); left: 0; width: 100%; height: auto; margin: 0; padding: 12px; overflow: visible; clip-path: none; white-space: normal; background: var(--map-bg); border-radius: 12px; font-size: 13px; }
.map-search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; max-height: min(480px, 55dvh); padding: 6px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--map-border); border-radius: 15px; color: var(--map-text); background: var(--map-bg); box-shadow: 0 12px 32px rgba(20, 36, 49, .2); }
.map-search-group + .map-search-group { border-top: 1px solid var(--map-border); margin-top: 6px; padding-top: 6px; }
.map-search-group__header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 8px 6px; }
.map-search-group__header > span { font-size: 13px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.map-search-group__header small { color: var(--map-subtext); font-size: 10px; flex-shrink: 0; }
.map-search-option { width: 100%; min-height: 54px; padding: 10px 8px; border: 0; border-radius: 9px; display: grid; grid-template-columns: 20px minmax(0, 1fr) 14px; align-items: center; gap: 8px; text-align: left; background: transparent; color: inherit; }
.map-search-option:hover, .map-search-option.is-active { background: var(--map-soft); }
.map-search-option svg { width: 17px; height: 17px; color: var(--map-link); }
.map-search-option__copy { display: flex; flex-direction: column; min-width: 0; gap: 3px; }
.map-search-option__address { font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.map-search-option__action, .map-search-more { color: var(--map-subtext); font-size: 11px; line-height: 1.4; }
.map-search-more { margin: 6px 8px; }
.map-search-empty { padding: 14px 8px; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--map-subtext); }
.map-search-empty > svg { width: 22px; flex-shrink: 0; }
.map-search-empty > span { display: grid; gap: 4px; }
.map-search-empty strong { color: var(--map-text); }
.map-panel-body { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: 4px 18px 18px; scrollbar-width: thin; }
#map-explorer .map-browse h3 { margin: 0 0 8px; font-size: 14px; color: var(--map-text); }
.map-browse > p { margin: 0 0 15px; color: var(--map-subtext); font-size: 13px; line-height: 1.55; }
.map-clinic-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 2px; border: 0; border-bottom: 1px solid var(--map-border); background: transparent; color: var(--map-text); text-align: left; }
.map-clinic-row > svg { width: 20px; flex-shrink: 0; color: var(--map-link); }
.map-clinic-row > span { min-width: 0; font-size: 13px; font-weight: 600; }
.map-clinic-row small { display: block; margin-top: 5px; color: var(--map-subtext); font-weight: 400; font-size: 11px; line-height: 1.4; }
#map-explorer .map-clinic-group { border-bottom: 1px solid var(--map-border); }
.map-clinic-group summary { display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 12px 2px; color: var(--map-text); cursor: pointer; list-style: none; font-size: 13px; font-weight: 600; }
.map-clinic-group summary::-webkit-details-marker { display: none; }
.map-clinic-group summary::before { content: '+'; width: 20px; text-align: center; color: var(--map-link); font-size: 20px; font-weight: 400; }
.map-clinic-group[open] summary::before { content: '−'; }
.map-clinic-group summary small { display: block; font-weight: 400; font-size: 11px; color: var(--map-subtext); margin-top: 5px; }
.map-clinic-group .map-clinic-row { padding-left: 16px; border-bottom: 0; }
.map-clinic-group summary:focus-visible { outline: 2px solid var(--map-link); outline-offset: 1px; border-radius: 6px; }
.map-browse-empty { color: var(--map-subtext); font-size: 13px; line-height: 1.5; padding: 10px 0; }
#map-explorer .map-location-note { margin: 18px 0 0; color: var(--map-subtext); font-size: 11px; line-height: 1.55; }
.clinic-card:not(.is-visible) { display: none; }
.map-back { display: flex; align-items: center; gap: 3px; min-height: 44px; margin: -4px 0 8px; padding: 0; border: 0; background: none; color: var(--map-link); font-size: 12px !important; }
.map-back svg { width: 16px; height: 16px; }
.clinic-info { margin-bottom: 18px; }
#map-explorer .clinic-name { margin: 0 0 7px; font-size: 20px; font-weight: 650; line-height: 1.25; letter-spacing: -.35px; color: var(--map-text); }
.clinic-address, .clinic-distance { margin: 0; font-size: 12px; line-height: 1.6; color: var(--map-subtext); }
.clinic-distance { margin-top: 9px; color: var(--map-link); }
#map-explorer .map-plans-title { margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--map-text); }
.map-plans-grid { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--map-border); border-radius: 14px; overflow: hidden; background: var(--map-plan-surface); }
.map-plan-mini { width: 100%; padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; border: 0; border-bottom: 1px solid var(--map-border); background: transparent; color: var(--map-text); text-align: left; border-radius: 0; }
.map-plan-mini:last-child { border-bottom: 0; }
#map-explorer .map-plan-mini:focus-visible { outline-offset: -3px; }
.map-plan-header { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.map-plan-logo { width: 85px; height: 24px; object-fit: contain; object-position: left center; background: #fff; border-radius: 5px; padding: 3px; }
.map-plan-badge { font-size: 11px; font-weight: 500; color: var(--map-subtext); }
.map-plan-name { grid-column: 1 / -1; font-size: 12px; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
.map-plan-coverage-grid { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cov-box { display: flex; flex-direction: column; gap: 3px; }
.cov-val { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 650; }
.cov-val svg { width: 14px; height: 14px; flex: none; color: var(--map-link); }
.cov-lab { font-size: 10px; color: var(--map-subtext); }
.map-plan-price { align-self: center; font-size: 15px; font-weight: 650; text-align: right; white-space: nowrap; }
.map-plan-price small { display: block; font-size: 10px; color: var(--map-subtext); font-weight: 400; }
.map-plan-price.is-unquoted { white-space: normal; max-width: 100px; font-size: 12px; color: var(--map-subtext); }
.map-plan-mini.is-primary .map-plan-badge { color: var(--map-link); }
.map-plans-empty { display: flex; align-items: flex-start; gap: 10px; padding: 16px; border-radius: 14px; background: var(--map-soft); }
.map-plans-empty > svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--map-subtext); }
.map-plans-empty__title { margin: 0 0 7px; font-size: 13px; color: var(--map-text); font-weight: 600; }
.map-plans-empty__sub { margin: 0; font-size: 12px; line-height: 1.6; color: var(--map-subtext); }
.map-controls { position: absolute; right: max(16px, env(safe-area-inset-right)); top: 198px; z-index: 2; display: flex; flex-direction: column; gap: 8px; }
.map-ctrl-btn { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 1px solid var(--map-border); border-radius: 14px; background: var(--map-bg); color: var(--map-text); font-size: 12px !important; font-weight: 600 !important; box-shadow: 0 3px 12px rgba(21, 42, 55, .1); }
.map-ctrl-btn svg { width: 17px; height: 17px; }
.map-ctrl-btn:disabled { cursor: not-allowed !important; opacity: .45; }
#map-explorer .mapboxgl-ctrl-top-right { top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); }
#map-explorer .mapboxgl-ctrl-top-right .mapboxgl-ctrl { margin: 0 0 10px; }
#map-explorer .mapboxgl-ctrl-group { overflow: hidden; border-radius: 14px; background: var(--map-bg); box-shadow: 0 3px 12px rgba(21, 42, 55, .13); }
#map-explorer .mapboxgl-ctrl-group button { width: 38px; height: 38px; }
#map-explorer:not(.light-theme) .mapboxgl-ctrl-icon { filter: invert(1); }
/* Mapbox posiciona el botón exterior; sólo animamos el símbolo interior. */
#map-explorer .qv-marker { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; overflow: visible; z-index: 1; }
.qv-marker-dot { width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; background: var(--map-accent); color: #fff; box-shadow: 0 2px 7px rgba(16, 50, 72, .26); transition: transform .2s ease; }
.qv-marker-dot svg { width: 15px; height: 15px; }
.qv-marker-label { position: absolute; left: 50%; bottom: 47px; transform: translateX(-50%); max-width: 210px; width: max-content; padding: 6px 9px; border-radius: 9px; color: var(--map-text); background: var(--map-bg); font-size: 12px; font-weight: 600; line-height: 1.3; box-shadow: 0 2px 8px rgba(16, 50, 72, .16); visibility: hidden; pointer-events: none; }
#map-explorer .qv-marker:hover, #map-explorer .qv-marker:focus-visible, #map-explorer .qv-marker.is-selected { z-index: 2; }
.qv-marker:hover .qv-marker-label, .qv-marker:focus-visible .qv-marker-label, .qv-marker.is-selected .qv-marker-label { visibility: visible; }
.qv-marker.is-selected .qv-marker-dot { transform: scale(1.3); box-shadow: 0 0 0 6px color-mix(in srgb, var(--map-accent) 18%, transparent), 0 3px 8px rgba(16, 50, 72, .22); }
.qv-marker.is-selected .qv-marker-label { background: var(--map-accent); color: #fff; }
.qv-marker.is-cluster .qv-marker-dot { width: 38px; height: 38px; font-size: 13px; font-weight: 650; background: var(--map-bg); color: var(--map-link); border-color: var(--map-link); }
@media (hover: hover) { .map-plan-mini:hover .map-plan-name { color: var(--map-accent); } .map-clinic-row:hover, .map-close:hover, .map-search-clear:hover { background: var(--map-soft); } .map-ctrl-btn:hover { color: var(--map-link); } }
@media (max-width: 768px) {
  .map-sidebar { display: contents; }
  .map-header { position: absolute; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); padding: 10px 14px 12px; border: 1px solid var(--map-border); border-radius: 20px; background: var(--map-bg); box-shadow: 0 5px 22px rgba(21, 42, 55, .12); z-index: 4; }
  .map-header-top { margin: 0 0 8px; }
  .map-brand-img { width: 40px; height: 25px; }
  #map-explorer .map-header h2 { position: absolute; top: 23px; left: 66px; right: 66px; margin: 0; font-size: 14px; letter-spacing: -.25px; }
  .map-close { padding: 0 10px; min-height: 40px; }
  .map-close span { display: none; }
  #map-explorer .map-search-input { font-size: 16px; height: 44px; }
  .map-search-icon { top: 13px; }
  .map-search-results { max-height: min(52dvh, 420px); }
  .map-panel-body { position: absolute; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); bottom: max(32px, env(safe-area-inset-bottom)); max-height: 43dvh; padding: 16px 18px; border: 1px solid var(--map-border); border-radius: 22px; background: var(--map-bg); box-shadow: 0 8px 28px rgba(21, 42, 55, .14); z-index: 3; }
  .map-browse { max-height: 145px; }
  .map-browse > p { font-size: 12px; }
  .clinic-info { margin-bottom: 15px; }
  #map-explorer .clinic-name { font-size: 19px; }
  .map-back { margin-bottom: 6px; }
  #map-explorer .mapboxgl-ctrl-top-right { top: 137px; right: 12px; }
  #map-explorer .mapboxgl-ctrl-top-right .mapboxgl-ctrl-group:first-child { display: none; }
  .map-controls { top: 137px; right: 65px; flex-direction: row; gap: 6px; }
  .map-ctrl-btn { width: 40px; height: 44px; border-radius: 13px; }
  #map-explorer .mapboxgl-ctrl-group button { width: 40px; height: 44px; }
}
@media (max-height: 520px) and (max-width: 768px) and (orientation: landscape) {
  .map-panel-body { right: 55%; max-height: calc(100dvh - 164px); }
  .map-header { right: 55%; }
  #map-explorer .map-header h2 { display: none; }
  #map-explorer .mapboxgl-ctrl-top-right { top: 8px; }
  .map-controls { top: 8px; }
}
@media (prefers-reduced-motion: reduce) { .qv-map-explorer, .qv-marker-dot { transition: none; } }
