.map-page{
  display:grid;
  grid-template-columns:360px 1fr;
  min-height:calc(100vh - 72px);
}

.filters-panel{
  background:#0d1730;
  border-right:1px solid rgba(255,255,255,.06);
  padding:18px;
  overflow:auto;
}

.panel-box{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  padding:16px;
  margin-bottom:16px;
}

.panel-box h2,
.panel-box h3{
  margin:0 0 14px;
}

.field{
  margin-bottom:14px;
}

.field label{
  display:block;
  margin-bottom:6px;
  font-size:.92rem;
  color:var(--muted);
}

.field input,
.field select{
  width:100%;
  height:46px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.05);
  color:var(--text);
  padding:0 12px;
}

.results-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
}

.results-head span{
  background:rgba(30,107,255,.15);
  color:var(--accent);
  font-weight:800;
  padding:6px 10px;
  border-radius:999px;
}

.results-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.result-card{
  display:grid;
  grid-template-columns:72px 1fr;
  gap:12px;
  background:#0e1630;
  border:1px solid rgba(255,255,255,.06);
  border-radius:16px;
  padding:10px;
  cursor:pointer;
  transition:.22s ease;
}

.result-card:hover{
  transform:translateY(-2px);
  border-color:rgba(24,227,166,.28);
}

.result-thumb{
  width:72px;
  height:72px;
  border-radius:12px;
  background:#182342 center/cover no-repeat;
}

.result-info h4{
  margin:0 0 6px;
  font-size:1rem;
}

.result-meta{
  color:var(--muted);
  font-size:.9rem;
  margin-bottom:8px;
}

.badges{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.badge{
  font-size:.72rem;
  font-weight:800;
  padding:5px 8px;
  border-radius:999px;
}

.badge-plan-uno{
  background:rgba(255,255,255,.08);
  color:#d1d5db;
}

.badge-plan-plus{
  background:rgba(30,107,255,.18);
  color:#93c5fd;
}

.badge-plan-elite{
  background:rgba(255,215,0,.16);
  color:#fde68a;
}

.map-area{
  position:relative;
}

#map{
  width:100%;
  height:calc(100vh - 72px);
}

/* ===== POPUP LIMPIO Y CLARO ===== */

.leaflet-popup-content-wrapper{
  background:linear-gradient(180deg, #f8fafc, #eef2f7);
  color:#0f172a;
  border-radius:18px;
  box-shadow:
    0 14px 34px rgba(0,0,0,.28),
    0 0 18px rgba(0,0,0,.10);
  border:1px solid rgba(255,255,255,.85);
}

.leaflet-popup-content{
  margin:14px 16px;
}

.leaflet-popup-tip{
  background:#eef2f7;
}

.popup-card{
  min-width:210px;
  max-width:220px;
  position:relative;
  border-radius:14px;
  padding-top:4px;
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  border-top:2px solid rgba(148,163,184,.20);
}

.popup-card h4{
  margin:0 0 8px;
  color:#0f172a;
  font-size:1.02rem;
  font-weight:900;
  line-height:1.2;
}

.popup-card p{
  margin:0 0 14px;
  color:#475569;
  font-size:.92rem;
  font-weight:600;
}

.popup-card.popup-uno{
  border-top:2px solid rgba(148,163,184,.35);
}

.popup-card.popup-plus{
  border-top:2px solid rgba(96,165,250,.50);
  background:linear-gradient(180deg, rgba(59,130,246,.06), rgba(45,212,191,.03));
}

.popup-card.popup-elite{
  border-top:2px solid rgba(250,204,21,.58);
  background:
    linear-gradient(180deg, rgba(250,204,21,.08), rgba(255,255,255,.02)),
    radial-gradient(circle at top right, rgba(250,204,21,.08), transparent 42%);
}

.popup-card.popup-elite::before{
  content:"";
  position:absolute;
  top:-6px;
  left:-6px;
  right:-6px;
  bottom:-6px;
  border-radius:18px;
  pointer-events:none;
  box-shadow:0 0 18px rgba(255,215,0,.10);
}

.popup-ribbon{
  display:block;
  width:76px;
  height:12px;
  border-radius:999px;
  margin:0 0 12px;
}

.popup-ribbon-uno{
  background:linear-gradient(135deg, rgba(148,163,184,.45), rgba(100,116,139,.30));
}

.popup-ribbon-plus{
  background:linear-gradient(135deg, rgba(59,130,246,.45), rgba(45,212,191,.32));
}

.popup-ribbon-elite{
  background:linear-gradient(135deg, rgba(250,204,21,.55), rgba(251,146,60,.38));
  box-shadow:0 0 10px rgba(250,204,21,.18);
}

.popup-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:6px;
}

.popup-actions-center{
  justify-content:center;
}

.popup-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 14px;
  border-radius:12px;
  font-size:.88rem;
  font-weight:900;
  transition:.2s ease;
  text-decoration:none;
}

.popup-btn:hover{
  transform:translateY(-1px);
}

.popup-btn-primary{
  background:linear-gradient(180deg, #ffffff, #e8edf3);
  color:#0f172a;
  border:1px solid rgba(255,255,255,.95);
  box-shadow:
    0 6px 14px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.9);
}

.popup-btn-primary:hover{
  box-shadow:
    0 10px 18px rgba(0,0,0,.16),
    inset 0 1px 0 rgba(255,255,255,.95);
}

.popup-card.popup-elite .popup-btn-primary{
  background:linear-gradient(135deg, #ffffff, #fff8dc);
  color:#1f2937;
  border:1px solid rgba(250,204,21,.45);
  box-shadow:
    0 8px 18px rgba(0,0,0,.14),
    0 0 10px rgba(250,204,21,.12);
}

/* ===== RESULTADOS LATERALES SEGÚN PLAN ===== */

.result-card.plus-card{
  border:1px solid rgba(30,107,255,.22);
  box-shadow:0 8px 18px rgba(30,107,255,.08);
}

.result-card.plus-card:hover{
  border-color:rgba(30,107,255,.35);
  box-shadow:
    0 10px 22px rgba(30,107,255,.12),
    0 0 12px rgba(30,107,255,.10);
}

.result-card.elite-card{
  border:1px solid rgba(255,215,0,.28);
  box-shadow:
    0 10px 22px rgba(0,0,0,.20),
    0 0 16px rgba(255,215,0,.10);
  background:linear-gradient(180deg, rgba(255,215,0,.05), rgba(255,255,255,.02));
}

.result-card.elite-card:hover{
  border-color:rgba(255,215,0,.42);
  box-shadow:
    0 12px 24px rgba(0,0,0,.24),
    0 0 18px rgba(255,215,0,.14),
    0 0 28px rgba(255,215,0,.10);
}

/* ===== PINES DEL MAPA ===== */

.mc-marker-wrap{
  background:transparent !important;
  border:none !important;
}

.marker{
  position:relative;
  border-radius:50% 50% 50% 0;
  transform:rotate(-45deg);
  border:3px solid #fff;
}

.marker::after{
  content:"";
  position:absolute;
  width:8px;
  height:8px;
  background:#fff;
  border-radius:50%;
  top:50%;
  left:50%;
  transform:translate(-50%, -50%) rotate(45deg);
}

.marker-uno{
  width:18px;
  height:18px;
  background:#7c8aa5;
  box-shadow:0 4px 10px rgba(0,0,0,.18);
}

.marker-plus{
  width:22px;
  height:22px;
  background:linear-gradient(135deg, #1E6BFF, #18E3A6);
  box-shadow:
    0 6px 14px rgba(0,0,0,.22),
    0 0 14px rgba(30,107,255,.18);
}

.marker-elite{
  width:26px;
  height:26px;
  background:linear-gradient(135deg, #FFD700, #FFA500);
  box-shadow:
    0 8px 18px rgba(0,0,0,.28),
    0 0 0 4px rgba(255,215,0,.12),
    0 0 18px rgba(255,215,0,.35),
    0 0 34px rgba(255,215,0,.18);
  animation:elitePulse 2s ease-in-out infinite;
}

.marker-elite::before{
  content:"";
  position:absolute;
  inset:-8px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(255,215,0,.28) 0%, rgba(255,215,0,.08) 45%, transparent 75%);
  transform:rotate(45deg);
  z-index:-1;
}

@keyframes elitePulse{
  0%, 100%{
    transform:rotate(-45deg) scale(1);
    filter:brightness(1);
  }
  50%{
    transform:rotate(-45deg) scale(1.08);
    filter:brightness(1.08);
  }
}

/* ===== ANIMACIONES POPUP ===== */

.leaflet-popup{
  transform-origin:bottom center;
  animation:popupFadeScale .25s ease-out;
}

@keyframes popupFadeScale{
  0%{
    opacity:0;
    transform:translateY(10px) scale(.92);
  }
  60%{
    opacity:1;
    transform:translateY(-2px) scale(1.02);
  }
  100%{
    opacity:1;
    transform:translateY(0) scale(1);
  }
}

.popup-card{
  animation:popupContentIn .35s ease;
}

@keyframes popupContentIn{
  0%{
    opacity:0;
    transform:translateY(8px);
  }
  100%{
    opacity:1;
    transform:translateY(0);
  }
}

.popup-card.popup-elite{
  animation:popupElite .4s ease;
}

@keyframes popupElite{
  0%{
    opacity:0;
    transform:scale(.9) translateY(12px);
    filter:brightness(.9);
  }
  60%{
    transform:scale(1.04) translateY(-2px);
    filter:brightness(1.05);
  }
  100%{
    opacity:1;
    transform:scale(1) translateY(0);
    filter:brightness(1);
  }
}

.popup-card.popup-elite::after{
  content:"";
  position:absolute;
  inset:-6px;
  border-radius:18px;
  background:radial-gradient(circle, rgba(255,215,0,.25), transparent 70%);
  opacity:0;
  animation:eliteGlowIn .6s ease;
  pointer-events:none;
}

@keyframes eliteGlowIn{
  0%{
    opacity:.35;
    transform:scale(.9);
  }
  100%{
    opacity:0;
    transform:scale(1.1);
  }
}

@media (max-width: 920px){
  .map-page{
    grid-template-columns:1fr;
  }

  .filters-panel{
    border-right:none;
    border-bottom:1px solid rgba(255,255,255,.06);
  }

  #map{
    height:60vh;
  }
}