/* ==========================================================================
   ER Nearby Map — Premium UI (Google Maps first)
   Reemplazar TODO assets/er-nearby-map.css por este contenido
   ========================================================================== */

:root{
  --er-text:#111;
  --er-muted:rgba(17,17,17,.70);
  --er-muted-2:rgba(17,17,17,.55);
  --er-border:rgba(17,17,17,.10);
  --er-border-2:rgba(17,17,17,.07);
  --er-shadow:0 18px 45px rgba(0,0,0,.10);
  --er-shadow-soft:0 12px 28px rgba(0,0,0,.10);
  --er-radius:20px;
  --er-radius-2:16px;
  --er-green:#0B6600;
}

/* ===== Bloque ===== */
.er-nearme{
  position:relative;
  margin:18px 0;
  padding:16px;
  border:1px solid var(--er-border);
  border-radius:var(--er-radius);
  background:linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.82));
  box-shadow:var(--er-shadow);
  overflow:hidden;
}
.er-nearme::before{
  content:"";
  position:absolute;
  inset:-2px;
  pointer-events:none;
  background:
    radial-gradient(900px 220px at 20% 0%, rgba(0,0,0,.06), transparent 55%),
    radial-gradient(700px 220px at 100% 0%, rgba(0,0,0,.05), transparent 55%);
  opacity:.75;
}
.er-nearme>*{position:relative;}

.er-nearme-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:12px;
}
.er-nearme-title h2{
  margin:0 0 6px 0;
  font-size:20px;
  line-height:1.15;
  color:var(--er-text);
  letter-spacing:-.2px;
}
.er-nearme-title p{
  margin:0;
  font-size:14px;
  line-height:1.35;
  color:var(--er-muted);
}

.er-nearme-actions{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:8px;
  min-width:210px;
}
.er-nearme-status{
  font-size:12px;
  line-height:1.2;
  color:var(--er-muted-2);
  text-align:right;
  min-height:14px;
}

/* Botón */
.er-nearme-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.55rem;
  min-width:160px;
  padding:1rem;
  border-radius:8px;
  background:linear-gradient(180deg,#1ba4e8,#0a75b8);
  color:#fff;
  border:none;
  font-weight:700;
  letter-spacing:.01em;
  box-shadow:0 10px 22px rgba(0,0,0,.16);
  cursor:pointer;
  white-space:nowrap;
  transition:transform .12s ease, box-shadow .15s ease, filter .15s ease;
}
.er-nearme-btn:hover{filter:brightness(.98); box-shadow:0 14px 28px rgba(27,164,232,.30);}
.er-nearme-btn:active{transform:translateY(1px); opacity:.96;}

.er-nearme-map{
  width:100%;
  border-radius:var(--er-radius-2);
  overflow:hidden;
  border:1px solid var(--er-border-2);
  box-shadow:var(--er-shadow-soft);
}

/* ===== Lista ===== */
.er-nearme-list{
  margin-top:12px;
  border-radius:var(--er-radius-2);
  overflow:hidden;
  border:1px solid var(--er-border-2);
  background:rgba(255,255,255,.78);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
}
.er-nearme-item{padding:12px; border-top:1px solid rgba(17,17,17,.06);}
.er-nearme-item:first-child{border-top:0;}
.er-nearme-item-main{display:flex; align-items:center; justify-content:space-between; gap:10px;}
.er-nearme-item a{
  text-decoration:none;
  font-weight:800;
  color:var(--er-text);
  max-width:72%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.er-nearme-item a:hover{text-decoration:underline;}
.er-nearme-km{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  white-space:nowrap;
  color:#0f5132;
  background:rgba(34,197,94,.12);
  border:1px solid rgba(34,197,94,.18);
}
.er-nearme-empty{padding:14px 12px; color:var(--er-muted); font-size:14px;}

.er-nearme-morewrap{padding:12px; border-top:1px solid rgba(17,17,17,.06); background:rgba(0,0,0,.02); display:flex; justify-content:center;}
.er-nearme-morebtn{
  appearance:none;
  cursor:pointer;
  border-radius:999px;
  padding:10px 14px;
  font-weight:900;
  border:1px solid rgba(17,17,17,.14);
  background:rgba(255,255,255,.92);
  color:var(--er-text);
  box-shadow:0 10px 22px rgba(0,0,0,.10);
}
.er-nearme-morebtn:hover{background:#fff; box-shadow:0 14px 28px rgba(0,0,0,.12);}
.er-nearme-morebtn:active{transform:translateY(1px);}

/* ==========================================================================
   Google Maps InfoWindow: convertirlo en “card” y usar nuestra X
   ========================================================================== */

/* Scope: solo dentro del mapa */
.er-nearme-map .gm-style .gm-style-iw-c{
  padding:0 !important;
  border-radius:18px !important;
  background:rgba(255,255,255,.98) !important;
  border:1px solid rgba(0,0,0,.08) !important;
  box-shadow:0 18px 40px rgba(0,0,0,.18) !important;
}
.er-nearme-map .gm-style .gm-style-iw-d{
  padding:0 !important;
  overflow:visible !important;
}

/* Ocultar cola del globo */
.er-nearme-map .gm-style .gm-style-iw-tc{display:none !important;}

/* Ocultar la X de Google (usamos la nuestra) */
.er-nearme-map .gm-style button.gm-ui-hover-effect{display:none !important;}

/* Nuestro wrapper */
.er-iw{
  position:relative;
  padding:12px 14px;
  max-width:320px;
}

/* Nuestra X */
.er-iw-close{
  position:absolute;
  top:8px;
  right:8px;
  width:28px;
  height:28px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.10);
  background:rgba(255,255,255,.96);
  box-shadow:0 10px 18px rgba(0,0,0,.12);
  color:rgba(0,0,0,.70);
  font-size:22px;
  line-height:26px;
  text-align:center;
  cursor:pointer;
}
.er-iw-close:hover{color:rgba(0,0,0,.90);}

/* “Estás acá” */
.er-iw--me{
  font-weight:900;
  color:rgba(0,0,0,.80);
  padding-right:44px; /* aire para la X */
}

/* Card del popup */
.er-popup{
  display:flex;
  gap:10px;
  align-items:flex-start;
  min-width:240px;
  padding-right:44px; /* aire para la X */
}
.er-popup-thumb{
  width:54px;
  height:54px;
  border-radius:14px;
  object-fit:cover;
  flex:0 0 54px;
  border:1px solid rgba(0,0,0,.06);
  box-shadow:0 10px 18px rgba(0,0,0,.10);
}
.er-popup-thumb--fallback{background:rgba(0,0,0,.06); border:1px solid rgba(0,0,0,.08);}

.er-popup-body{display:flex; flex-direction:column; min-width:0;}
.er-popup-title{font-weight:900; line-height:1.15; margin-bottom:2px;}
.er-popup-link{color:var(--er-green); font-weight:900; text-decoration:none;}
.er-popup-link:hover{text-decoration:underline;}
.er-popup-km{margin-top:6px; font-weight:800; font-size:12px; opacity:.82;}

/* Responsive */
@media (max-width: 768px){
  .er-nearme{padding:14px; border-radius:18px;}
  .er-nearme-head{flex-direction:column; align-items:stretch;}
  .er-nearme-actions{align-items:stretch; min-width:unset;}
  .er-nearme-btn{width:100%;}
  .er-nearme-status{text-align:left;}
  .er-nearme-item a{max-width:68%;}
}

/* Volver a mostrar la puntita */
.er-nearme-map .gm-style .gm-style-iw-tc{
  display: block !important;
}

/* Ajustes estéticos de la puntita */
.er-nearme-map .gm-style .gm-style-iw-tc{
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.16));
}

/* (Opcional) si ves que queda desalineada, bajala apenas */
.er-nearme-map .gm-style .gm-style-iw-tc::after{
  transform: translateY(1px);
}

/* ✅ Puntita nativa ON */
.er-nearme-map .gm-style .gm-style-iw-tc{
  display: block !important;
}

/* ✅ Matar el header/espaciador que vuelve con padding-top */
.er-nearme-map .gm-style .gm-style-iw-ch,
.er-nearme-map .gm-style .gm-style-iw-chr,
.er-nearme-map .gm-style .gm-style-iw-chc{
  display: none !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
}

@media (max-width: 480px){
  /* El contenedor real del InfoWindow: que pueda estirarse */
  .er-nearme-map .gm-style .gm-style-iw-c{
    max-width: 96vw !important;
  }

  /* "Estás acá" -> compacto y prolijo */
  .er-nearme-map .gm-style .er-iw.er-iw--me{
    max-width: 100px !important;
    padding: 10px 14px 10px 14px !important;
    text-align: center;
  }

  .gm-style .er-iw--me .er-iw-close{
  display: none !important;
}

  /* Tu wrapper: casi ancho completo */
  .er-nearme-map .gm-style .er-iw{
    width: 92vw !important;
    max-width: 75vw !important;
    min-width: 0 !important;
    padding: 12px 14px 12px 14px !important; /* deja lugar para la X */
  }

  /* Evitar corte letra-por-letra */
  .er-nearme-map .gm-style .er-popup-title,
  .er-nearme-map .gm-style .er-popup-link{
    word-break: normal !important;
    overflow-wrap: anywhere !important; /* corta por palabra; si no entra, corta donde pueda */
    white-space: normal !important;
  }

  /* Mantener layout horizontal */
  .er-nearme-map .gm-style .er-popup{
    min-width: 0 !important;
    flex-wrap: nowrap !important;
  }

  /* Thumb razonable */
  .er-nearme-map .gm-style .er-popup-thumb{
    width: 52px !important;
    height: 52px !important;
    flex: 0 0 52px !important;
  }
}

/* ==========================================================================
   Estado previo al mapa: explicación antes de cargar Google Maps
   ========================================================================== */

.er-nearme-help{
  margin: 12px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(11,102,0,.10);
  background:
    linear-gradient(180deg, rgba(255,255,255,.86), rgba(255,255,255,.72)),
    radial-gradient(600px 180px at 0% 0%, rgba(11,102,0,.08), transparent 60%);
  box-shadow: 0 10px 22px rgba(0,0,0,.06);
}

.er-nearme-help-title{
  margin-bottom: 8px;
  font-weight: 900;
  color: var(--er-text);
  font-size: 15px;
}

.er-nearme-help-steps{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.er-nearme-help-steps span{
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(11,102,0,.08);
  border: 1px solid rgba(11,102,0,.12);
  color: rgba(17,17,17,.78);
  font-size: 12px;
  font-weight: 800;
}

.er-nearme-help p{
  margin: 0 0 7px;
  color: var(--er-muted);
  font-size: 14px;
  line-height: 1.45;
}

.er-nearme-help small{
  display: block;
  color: var(--er-muted-2);
  font-size: 12px;
  line-height: 1.35;
}

.er-nearme--active .er-nearme-help{
  display: none;
}

@media (max-width: 768px){
  .er-nearme-help{
    padding: 13px;
  }

  .er-nearme-help-steps{
    flex-direction: column;
    gap: 6px;
  }

  .er-nearme-help-steps span{
    width: 100%;
    justify-content: flex-start;
  }
}