/* ============================================================
   Megaguay Locator — estilos (H1–H3 desktop dark + base light).
   Todo scopeado bajo #mg-locator para ganarle al theme (Hello Biz).
   ============================================================ */

#mg-locator { box-sizing: border-box; }
#mg-locator *, #mg-locator *::before, #mg-locator *::after { box-sizing: border-box; }

/* ---- Reset: neutraliza estilos del theme (botones/inputs/links rosados) ---- */
#mg-locator button,
#mg-locator input,
#mg-locator a {
  font: inherit; color: inherit; background: transparent;
  border: 0; border-radius: 0; box-shadow: none;
  -webkit-appearance: none; appearance: none;
  margin: 0; padding: 0; min-height: 0; width: auto;
  text-decoration: none; text-transform: none; letter-spacing: normal; line-height: normal;
  cursor: pointer;
}
#mg-locator input { cursor: text; }
#mg-locator button:hover, #mg-locator button:focus,
#mg-locator input:focus { outline: none; box-shadow: none; background: transparent; }
#mg-locator svg { display: block; }
#mg-locator p, #mg-locator h2, #mg-locator h3 { margin: 0; }

/* ---- Tokens DARK (default) ---- */
#mg-locator {
  --mg-bg: #0e0f13;
  --mg-sidebar: #15171c;
  --mg-card: #1b1e25;
  --mg-card-sel: #20232b;
  --mg-border: #2a2e38;
  --mg-text: #f5f6f8;
  --mg-text-2: #a7aebc;
  --mg-text-3: #6e7689;
  --mg-accent: #fff042;
  --mg-violeta: #642483;
  --mg-violeta-2: #a875e0;
  --mg-badge-dist: #2a2140;
  --mg-open: #34d399;
  --mg-open-bg: #13241c;
  --mg-closed: #f87171;
  --mg-closed-bg: #2a1518;
  --mg-action-bg: #23262f;
  --mg-divider: #323641;
  --mg-avatar: var(--mg-violeta);
  --mg-avatar-ic: #ffffff;
  --mg-sel-glow: 0 6px 20px 1px rgba(255,240,66,.30), 0 0 14px 0 rgba(255,240,66,.14);
  --mg-sel-ink: #1a1525;
  --mg-detail-shadow: 0 12px 32px -6px rgba(0,0,0,.45);
  --mg-wa-border: rgba(255,255,255,.34);
  --mg-wa-text: #ffffff;

  font-family: "Montserrat", system-ui, -apple-system, sans-serif;
  color: var(--mg-text);
  background: var(--mg-bg);

  /* Full-bleed: rompe el contenedor del theme */
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

#mg-locator[data-theme="light"] {
  --mg-bg: #f4f2fa;
  --mg-sidebar: #ffffff;
  --mg-card: #ffffff;
  --mg-card-sel: #ffffff;
  --mg-border: #e5e1f0;
  --mg-text: #1a1525;
  --mg-text-2: #6b6480;
  --mg-text-3: #9a93ad;
  --mg-accent: #e6007e;
  --mg-violeta-2: #642483;
  --mg-badge-dist: #ece2f3;
  --mg-open: #16a34a;
  --mg-open-bg: #e6f7ef;
  --mg-closed: #dc2626;
  --mg-closed-bg: #fdeaea;
  --mg-action-bg: #f4f2fa;
  --mg-divider: #e5e1f0;
  --mg-avatar: var(--mg-violeta);
  --mg-avatar-ic: #ffffff;
  --mg-sel-glow: 0 6px 20px 1px rgba(230,0,126,.20), 0 0 14px 0 rgba(230,0,126,.12);
  --mg-sel-ink: #ffffff;
  --mg-detail-shadow: 0 12px 32px -6px rgba(80,40,120,.28);
  --mg-wa-border: #4d3188;
  --mg-wa-text: #4d3188;
}

#mg-locator .mg-ic { width: 1em; height: 1em; flex: none; }
/* Texto solo para lectores/buscadores (SEO), sin alterar el diseño. */
#mg-locator .mg-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Shell: sidebar + mapa ---- */
#mg-locator .mg__shell {
  display: grid;
  grid-template-columns: 416px 1fr;
  gap: 16px;
  height: clamp(560px, 86vh, 900px);
  padding: 16px;
}

/* ============================ SIDEBAR ============================ */
#mg-locator .mg-sidebar {
  background: var(--mg-sidebar);
  border-radius: 20px;
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}

#mg-locator .mg-topbar { display: flex; align-items: center; gap: 10px; padding: 22px 18px 14px 22px; }
#mg-locator .mg-logo { height: 34px; width: auto; }
#mg-locator[data-theme="dark"] .mg-logo--light { display: none; }
#mg-locator[data-theme="light"] .mg-logo--dark { display: none; }
#mg-locator .mg-topbar__spacer { flex: 1; }

#mg-locator .mg-toggle { display: flex; gap: 4px; padding: 4px; background: var(--mg-card); border: 1px solid var(--mg-border); border-radius: 11px; }
#mg-locator .mg-toggle__seg { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; color: var(--mg-text-3); }
#mg-locator .mg-toggle__seg .mg-ic { width: 18px; height: 18px; }
#mg-locator .mg-toggle__seg.is-active { background: var(--mg-border); color: var(--mg-text); }

#mg-locator .mg-search { padding: 0 20px 14px; }
#mg-locator .mg-search__box { display: flex; align-items: center; gap: 10px; background: var(--mg-card); border: 1.5px solid var(--mg-border); border-radius: 12px; padding: 13px 14px; }
#mg-locator .mg-search__ic { width: 18px; height: 18px; color: var(--mg-text-3); }
#mg-locator .mg-search__input { flex: 1; min-width: 0; background: transparent; color: var(--mg-text); font: 400 14px "Montserrat", sans-serif; }
#mg-locator .mg-search__input::placeholder { color: var(--mg-text-3); opacity: 1; }
/* Botón nativo de limpiar (X) recoloreado por tema. */
#mg-locator .mg-search__input::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; margin-left: 6px; cursor: pointer;
  background-color: var(--mg-text-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / contain no-repeat;
}

#mg-locator .mg-filters { display: flex; gap: 8px; padding: 0 20px 14px; }
#mg-locator .mg-chip { display: flex; align-items: center; justify-content: center; gap: 7px; flex: 1; min-width: 0; padding: 9px 11px 9px 13px; background: var(--mg-card); border: 1.5px solid var(--mg-border); border-radius: 10px; color: var(--mg-text); font: 600 13px "Rubik", sans-serif; white-space: nowrap; }
#mg-locator .mg-chip .mg-ic { width: 14px; height: 14px; color: var(--mg-text-3); }
#mg-locator .mg-chip[data-filter="filtros"] .mg-ic { width: 15px; height: 15px; color: var(--mg-text-2); }
#mg-locator .mg-chip.is-active { background: var(--mg-violeta); border-color: var(--mg-violeta); color: #fff; }
#mg-locator .mg-chip.is-active .mg-ic { color: #fff; }

#mg-locator .mg-listbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px 8px; }
#mg-locator .mg-count { color: var(--mg-text-3); font: 500 12px "Montserrat", sans-serif; }
#mg-locator .mg-count strong { color: var(--mg-text-2); font-weight: 600; }

/* Segmented Lista|Mapa (solo móvil) */
#mg-locator .mg-seg { display: none; gap: 2px; padding: 3px; background: var(--mg-card); border: 1px solid var(--mg-border); border-radius: 11px; }
#mg-locator .mg-seg__btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; color: var(--mg-text-3); font: 600 13px "Rubik", sans-serif; white-space: nowrap; }
#mg-locator .mg-seg__btn .mg-ic { width: 15px; height: 15px; }
#mg-locator .mg-seg__btn.is-active { background: var(--mg-sidebar); color: var(--mg-text); box-shadow: 0 1px 3px rgba(0,0,0,.20); }

/* Back en buscador + FAB de ubicación (solo móvil mapa) */
#mg-locator .mg-search__back { display: none; align-items: center; }
#mg-locator .mg-search__back .mg-ic { width: 18px; height: 18px; color: var(--mg-text-2); }
#mg-locator .mg-map__fab { display: inline-flex; position: absolute; right: 14px; bottom: 104px; width: 44px; height: 44px; border-radius: 999px; background: var(--mg-sidebar); border: 1px solid var(--mg-border); color: var(--mg-text); box-shadow: 0 4px 14px rgba(0,0,0,.3); align-items: center; justify-content: center; z-index: 5; }
#mg-locator .mg-map__fab .mg-ic { width: 20px; height: 20px; }

/* Punto "tú estás aquí" (overlay sobre el mapa, con pulso). */
#mg-locator .mg-userdot { position: absolute; transform: translate(-50%, -50%); pointer-events: none; z-index: 400; }
#mg-locator .mg-userdot__core { display: block; width: 16px; height: 16px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 2px 6px rgba(0,0,0,.45); }
#mg-locator .mg-userdot__pulse { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; transform: translate(-50%, -50%); border-radius: 50%; background: #1a73e8; opacity: .35; animation: mg-userpulse 2s ease-out infinite; }
@keyframes mg-userpulse { 0% { width: 16px; height: 16px; opacity: .35; } 100% { width: 72px; height: 72px; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #mg-locator .mg-userdot__pulse { animation: none; opacity: .18; } }

/* ---- Lista ---- */
#mg-locator .mg-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px 16px 16px; }

/* ---- Tarjeta ---- */
#mg-locator .mg-card { display: flex; align-items: stretch; min-height: 108px; background: var(--mg-card); border: 1px solid var(--mg-border); border-radius: 16px; overflow: hidden; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
#mg-locator .mg-card.is-selected { background: var(--mg-card-sel); border: 1.5px solid var(--mg-accent); box-shadow: var(--mg-sel-glow); }
#mg-locator .mg-card.is-selected .mg-card__avatar { background: var(--mg-accent); color: var(--mg-sel-ink); }

#mg-locator .mg-card__main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 14px; }
#mg-locator .mg-card__avatar { flex: none; width: 46px; height: 46px; border-radius: 999px; background: var(--mg-avatar); color: var(--mg-avatar-ic); display: flex; align-items: center; justify-content: center; }
#mg-locator .mg-card__avatar .mg-ic { width: 23px; height: 23px; }
#mg-locator .mg-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
#mg-locator .mg-card__name { font: 700 16px "Rubik", sans-serif; color: var(--mg-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mg-locator .mg-card__badges { display: flex; flex-wrap: wrap; gap: 7px; }

#mg-locator .mg-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 9px; border-radius: 999px; font: 600 12px "Rubik", sans-serif; white-space: nowrap; }
#mg-locator .mg-badge .mg-ic { width: 13px; height: 13px; }
#mg-locator .mg-badge--dist { background: var(--mg-badge-dist); color: var(--mg-violeta-2); }
#mg-locator .mg-badge--open { background: var(--mg-open-bg); color: var(--mg-open); gap: 5px; }
#mg-locator .mg-badge--open .mg-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--mg-open); }
#mg-locator .mg-badge--open.is-closed { background: var(--mg-closed-bg); color: var(--mg-closed); }
#mg-locator .mg-badge--open.is-closed .mg-dot { background: var(--mg-closed); }
#mg-locator .mg-badge--tipo { background: var(--mg-action-bg); color: var(--mg-text-2); }

#mg-locator .mg-card__actions { position: relative; flex: none; width: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--mg-action-bg); }
#mg-locator .mg-card__actions::before { content: ""; position: absolute; left: 0; top: -1px; bottom: -1px; width: 1px; background: var(--mg-divider); }
#mg-locator .mg-action { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: var(--mg-text-2); }
#mg-locator .mg-action .mg-ic { width: 22px; height: 22px; }
#mg-locator .mg-action--wa .mg-ic { width: 24px; height: 24px; }

/* ============================ ESTADOS (sin resultados / sin ubicación / cargando) ============================ */
#mg-locator .mg-state { display: none; flex: 1; min-height: 320px; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 24px 40px; }
#mg-locator .mg-skeleton { display: none; flex-direction: column; gap: 10px; padding: 8px 16px 16px; }

/* Conmutación por data-state */
#mg-locator[data-state="empty"] .mg-list,
#mg-locator[data-state="noloc"] .mg-list,
#mg-locator[data-state="loading"] .mg-list { display: none; }
#mg-locator[data-state="empty"] .mg-state--empty { display: flex; }
#mg-locator[data-state="noloc"] .mg-state--noloc { display: flex; }
#mg-locator[data-state="loading"] .mg-skeleton { display: flex; }

#mg-locator .mg-state__icon { width: 76px; height: 76px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex: none; }
#mg-locator .mg-state__icon .mg-ic { width: 34px; height: 34px; }
#mg-locator .mg-state--empty .mg-state__icon { background: var(--mg-action-bg); color: var(--mg-text-3); }
#mg-locator .mg-state--noloc .mg-state__icon { background: var(--mg-badge-dist); color: var(--mg-violeta-2); }
#mg-locator .mg-state__title { font: 700 19px "Rubik", sans-serif; color: var(--mg-text); }
#mg-locator .mg-state__text { font: 400 14px "Montserrat", sans-serif; color: var(--mg-text-2); max-width: 300px; line-height: 1.45; }
#mg-locator .mg-state__actions { display: flex; flex-direction: column; gap: 10px; align-items: center; padding-top: 8px; }
#mg-locator .mg-state__btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 12px; font: 600 14px "Rubik", sans-serif; }
#mg-locator .mg-state__btn .mg-ic { width: 17px; height: 17px; }
#mg-locator .mg-state__btn--ghost { border: 1.5px solid var(--mg-border); color: var(--mg-text-2); }
#mg-locator .mg-state__btn--primary { background: var(--mg-violeta); color: #fff; }

/* Skeleton */
#mg-locator .mg-skel-card { display: flex; align-items: center; gap: 12px; min-height: 84px; padding: 14px; background: var(--mg-card); border: 1px solid var(--mg-border); border-radius: 16px; }
#mg-locator .mg-skel-av { width: 46px; height: 46px; border-radius: 999px; flex: none; }
#mg-locator .mg-skel-lines { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
#mg-locator .mg-skel-bar { height: 12px; border-radius: 6px; }
#mg-locator .mg-skel-bar.w1 { width: 52%; }
#mg-locator .mg-skel-bar.w2 { width: 82%; }
#mg-locator .mg-skel { background: linear-gradient(90deg, var(--mg-border) 25%, var(--mg-card-sel) 37%, var(--mg-border) 63%); background-size: 400% 100%; animation: mg-shimmer 1.4s ease infinite; }
@keyframes mg-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { #mg-locator .mg-skel { animation: none; } }

/* ============================ COLUMNA DERECHA (cabecera + mapa) ============================ */
#mg-locator .mg-main { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--mg-sidebar); border-radius: 20px; overflow: hidden; }
#mg-locator .mg-mapheader { display: flex; flex-direction: column; gap: 6px; padding: 18px 24px; border-bottom: 1px solid var(--mg-border); }
#mg-locator .mg-mapheader__top { display: flex; align-items: center; justify-content: flex-start; gap: 12px; }
#mg-locator .mg-mapheader__title { font: 700 22px "Rubik", sans-serif; color: var(--mg-text); white-space: nowrap; }

/* Badge "Cerca de mí" (desktop; visible solo si no se ha compartido ubicación) */
#mg-locator .mg-locate-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 10px; border-radius: 999px; background: var(--mg-badge-dist); color: var(--mg-violeta-2); font: 600 12px "Rubik", sans-serif; white-space: nowrap; }
#mg-locator .mg-locate-badge .mg-ic { width: 14px; height: 14px; color: var(--mg-violeta-2); }
#mg-locator[data-located] .mg-locate-badge { display: none; }
#mg-locator .mg-mapheader__text { font: 400 13px "Montserrat", sans-serif; color: var(--mg-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mg-locator .mg-mapheader__hours { flex: none; display: flex; align-items: center; gap: 7px; font: 600 13px "Montserrat", sans-serif; color: var(--mg-text); white-space: nowrap; }
#mg-locator .mg-mapheader__hours .mg-ic { width: 15px; height: 15px; color: var(--mg-text-2); }

#mg-locator .mg-map { flex: 1; min-height: 0; background: var(--mg-bg); position: relative; }
#mg-locator .mg-map__placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--mg-text-3); font-size: 14px; }

/* ============================ FICHA DETALLE (overlay mapa) ============================ */
/* Contenedor OverlayView: tamaño 0 en el ancla; la burbuja se posiciona relativa. */
#mg-locator .mg-popup { position: absolute; }
#mg-locator .mg-detail__bubble {
  position: absolute;
  left: 0; top: 0;
  transform: translate(14px, calc(-100% - 14px)); /* por defecto: arriba-derecha del pin */
  width: 384px; max-width: 384px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--mg-card); border: 1px solid var(--mg-border); border-radius: 18px;
  padding: 16px; box-shadow: var(--mg-detail-shadow);
  cursor: default;
}
/* Volteo según cuadrante para no salir del mapa (fx: l/r, fy: u/d). */
#mg-locator .mg-popup[data-fx="l"][data-fy="u"] .mg-detail__bubble { transform: translate(14px, calc(-100% - 14px)); }
#mg-locator .mg-popup[data-fx="r"][data-fy="u"] .mg-detail__bubble { transform: translate(calc(-100% - 14px), calc(-100% - 14px)); }
#mg-locator .mg-popup[data-fx="l"][data-fy="d"] .mg-detail__bubble { transform: translate(14px, 14px); }
#mg-locator .mg-popup[data-fx="r"][data-fy="d"] .mg-detail__bubble { transform: translate(calc(-100% - 14px), 14px); }

/* Botón cerrar ficha */
#mg-locator .mg-detail__close { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 999px; color: var(--mg-text-3); background: transparent; z-index: 3; }
#mg-locator .mg-detail__close .mg-ic { width: 16px; height: 16px; }
#mg-locator .mg-detail__close:hover { background: var(--mg-action-bg); color: var(--mg-text); }

/* Cabecera */
#mg-locator .mg-detail__head { display: flex; align-items: center; gap: 12px; padding-right: 22px; }
#mg-locator .mg-detail__avatar { flex: none; width: 46px; height: 46px; border-radius: 999px; background: var(--mg-violeta); color: #fff; display: flex; align-items: center; justify-content: center; }
#mg-locator .mg-detail__avatar .mg-ic { width: 22px; height: 22px; }
#mg-locator .mg-detail__head-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
#mg-locator .mg-detail__name { font: 700 18px "Rubik", sans-serif; color: var(--mg-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mg-locator .mg-detail__status { display: flex; align-items: center; gap: 7px; }
#mg-locator .mg-detail__status .mg-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--mg-open); flex: none; }
#mg-locator .mg-detail__open { font: 600 13px "Rubik", sans-serif; color: var(--mg-open); }
#mg-locator .mg-detail__closes { font: 400 12.5px "Montserrat", sans-serif; color: var(--mg-text-2); }
#mg-locator .mg-detail__status.is-closed .mg-dot { background: var(--mg-closed); }
#mg-locator .mg-detail__status.is-closed .mg-detail__open { color: var(--mg-closed); }

/* Datos */
#mg-locator .mg-detail__data { display: flex; flex-direction: column; gap: 12px; }
#mg-locator .mg-detail__group { display: flex; flex-direction: column; gap: 8px; }
#mg-locator .mg-detail__label { font: 600 10px "Rubik", sans-serif; letter-spacing: .8px; color: var(--mg-text-3); }
#mg-locator .mg-detail__badges { display: flex; flex-wrap: wrap; gap: 8px; }
#mg-locator .mg-detail__divider { height: 1px; width: 100%; background: var(--mg-divider); }

#mg-locator .mg-dbadge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px 5px 9px; border-radius: 999px; background: var(--mg-action-bg); color: var(--mg-text-2); font: 600 12px "Rubik", sans-serif; white-space: nowrap; }
#mg-locator .mg-dbadge .mg-ic { width: 13px; height: 13px; color: var(--mg-text-3); }
#mg-locator .mg-dbadge--accent { background: var(--mg-badge-dist); color: var(--mg-violeta-2); }
#mg-locator .mg-dbadge--accent .mg-ic { color: var(--mg-violeta-2); }
#mg-locator .mg-detail__tipo-ic { display: none; align-items: center; }
#mg-locator .mg-detail__tipo-ic.is-on { display: inline-flex; }

/* Acciones */
#mg-locator .mg-detail__actions { display: flex; gap: 10px; }
#mg-locator .mg-detail__btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: 12px; font: 600 14px "Rubik", sans-serif; }
#mg-locator .mg-detail__btn .mg-ic { width: 17px; height: 17px; }
#mg-locator .mg-detail__btn--go { flex: 1; min-width: 0; background: var(--mg-violeta); color: #fff; }
#mg-locator .mg-detail__btn--wa { flex: none; background: var(--mg-card); border: 1.5px solid var(--mg-wa-border); color: var(--mg-wa-text); }
#mg-locator .mg-detail__btn--wa .mg-ic { width: 16px; height: 16px; color: inherit; }

/* ============================ PANEL DE FILTROS (popover) ============================ */
#mg-locator .mg-fpop { position: absolute; z-index: 60; display: flex; flex-direction: column; gap: 16px; width: 380px; max-width: calc(100vw - 32px); padding: 16px; background: var(--mg-sidebar); border: 1px solid var(--mg-border); border-radius: 18px; box-shadow: var(--mg-detail-shadow); }
#mg-locator .mg-fpop[hidden] { display: none; }
#mg-locator .mg-fpop__head { display: flex; align-items: center; justify-content: space-between; }
#mg-locator .mg-fpop__title { font: 700 18px "Rubik", sans-serif; color: var(--mg-text); }
#mg-locator .mg-fpop__close { color: var(--mg-text-3); display: flex; }
#mg-locator .mg-fpop__close .mg-ic { width: 18px; height: 18px; }
#mg-locator .mg-fpop__body { display: flex; flex-direction: column; gap: 16px; }
#mg-locator .mg-fgroup { display: flex; flex-direction: column; gap: 10px; }
#mg-locator .mg-fpop__label { font: 600 11px "Rubik", sans-serif; letter-spacing: .8px; text-transform: uppercase; color: var(--mg-text-3); }
#mg-locator .mg-fpop__chips { display: flex; flex-wrap: wrap; gap: 8px; }
#mg-locator .mg-fgroup--scroll .mg-fpop__chips { max-height: 132px; overflow-y: auto; padding-right: 2px; }
#mg-locator .mg-fchip { padding: 8px 12px; border-radius: 999px; background: var(--mg-card); border: 1.5px solid var(--mg-border); color: var(--mg-text); font: 600 13px "Rubik", sans-serif; white-space: nowrap; }
#mg-locator .mg-fchip.is-on { background: var(--mg-violeta); border-color: var(--mg-violeta); color: #fff; }
#mg-locator .mg-fpop__foot { display: flex; gap: 10px; padding-top: 4px; }
#mg-locator .mg-fpop__btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 20px; border-radius: 12px; font: 600 14px "Rubik", sans-serif; }
#mg-locator .mg-fpop__btn--ghost { border: 1.5px solid var(--mg-border); color: var(--mg-text-2); }
#mg-locator .mg-fpop__btn--primary { flex: 1; min-width: 0; background: var(--mg-violeta); color: #fff; }

/* ============================ TOAST (feedback) ============================ */
#mg-locator .mg-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 999px; background: var(--mg-sidebar); border: 1px solid var(--mg-border); color: var(--mg-text); font: 600 13px "Montserrat", sans-serif; box-shadow: 0 8px 24px rgba(0,0,0,.4); text-align: center; }
#mg-locator .mg-toast[hidden] { display: none; }

/* ============================ RESPONSIVE / MÓVIL ============================ */
@media (max-width: 860px) {
  /* Una sola columna: aplanamos sidebar y main para intercalar con order. */
  #mg-locator .mg__shell { display: flex; flex-direction: column; gap: 0; height: auto; padding: 14px; position: relative; }
  #mg-locator .mg-sidebar, #mg-locator .mg-main { display: contents; }

  /* ---- Vista LISTA (orden del header móvil) ---- */
  #mg-locator .mg-topbar    { order: 1; padding: 6px 4px 14px; }
  #mg-locator .mg-mapheader { order: 2; display: flex; flex-direction: column; gap: 8px; border-bottom: 0; padding: 0 4px 14px; }
  #mg-locator .mg-mapheader__top { display: contents; }
  #mg-locator .mg-mapheader__title { order: 1; font-size: 26px; white-space: normal; }
  #mg-locator .mg-mapheader__text  { order: 2; white-space: normal; }
  #mg-locator .mg-mapheader__hours { order: 3; white-space: normal; }
  #mg-locator .mg-locate-badge { display: none; }
  #mg-locator .mg-search    { order: 3; padding: 0 4px 12px; }
  #mg-locator .mg-filters   { order: 4; padding: 0 4px 14px; }
  #mg-locator .mg-listbar   { order: 5; padding: 0 4px 12px; }
  #mg-locator .mg-seg       { display: flex; }
  #mg-locator .mg-list      { order: 6; padding: 0 4px 16px; overflow: visible; max-height: none; }
  #mg-locator .mg-state     { order: 6; }
  #mg-locator .mg-skeleton  { order: 6; padding: 0 4px 16px; }
  #mg-locator .mg-map       { order: 7; display: none; }
  #mg-locator .mg-map__fab  { display: none; } /* solo visible en vista mapa */
  #mg-locator .mg-detail    { display: none; }

  /* ---- Vista MAPA ---- */
  #mg-locator[data-view="map"] .mg__shell { padding: 0; height: 82vh; min-height: 560px; }
  #mg-locator[data-view="map"] .mg-mapheader,
  #mg-locator[data-view="map"] .mg-filters,
  #mg-locator[data-view="map"] .mg-list,
  #mg-locator[data-view="map"] .mg-state,
  #mg-locator[data-view="map"] .mg-skeleton { display: none; }

  #mg-locator[data-view="map"] .mg-map { display: block; order: 0; position: absolute; inset: 0; border-radius: 0; }
  #mg-locator[data-view="map"] .mg-map__fab { display: inline-flex; bottom: 320px; }

  /* Buscador flotante con back */
  #mg-locator[data-view="map"] .mg-search { order: 0; position: absolute; top: 14px; left: 14px; right: 14px; z-index: 5; padding: 0; }
  #mg-locator[data-view="map"] .mg-search__box { box-shadow: 0 6px 18px rgba(0,0,0,.30); }
  #mg-locator[data-view="map"] .mg-search__back { display: inline-flex; }

  /* Segmented (izq) + toggle de tema (der) flotando bajo el buscador */
  #mg-locator[data-view="map"] .mg-listbar { order: 0; position: absolute; top: 70px; left: 14px; z-index: 5; padding: 0; }
  #mg-locator[data-view="map"] .mg-listbar .mg-count { display: none; }
  #mg-locator[data-view="map"] .mg-seg { box-shadow: 0 6px 18px rgba(0,0,0,.22); }
  #mg-locator[data-view="map"] .mg-topbar { order: 0; position: absolute; top: 70px; right: 14px; z-index: 5; padding: 0; width: auto; }
  #mg-locator[data-view="map"] .mg-topbar .mg-logo,
  #mg-locator[data-view="map"] .mg-topbar__spacer { display: none; }
  #mg-locator[data-view="map"] .mg-toggle { box-shadow: 0 6px 18px rgba(0,0,0,.22); }

  /* Bottom-sheet de la ficha */
  #mg-locator[data-view="map"] .mg-detail.is-sheet { display: block; position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; }
  #mg-locator[data-view="map"] .mg-detail.is-sheet .mg-detail__bubble {
    position: static; transform: none; width: 100%; max-width: none;
    border-radius: 18px 18px 0 0; box-shadow: 0 -8px 28px rgba(0,0,0,.35);
  }

  /* Filtros como bottom-sheet en móvil */
  #mg-locator .mg-fpop { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-width: none; border-radius: 18px 18px 0 0; max-height: 82vh; overflow-y: auto; z-index: 70; box-shadow: 0 -8px 28px rgba(0,0,0,.4); }
}
