/* ElectroRuta · Plantillas visuales de anunciantes por plan (Visible / Destacado / Premium).
   Capa única: la usan la franja "Tu ruta incluye", el popup del mapa,
   la tarjeta flotante Premium y el preview del editor. */

:root {
  --er-ad-green: #1db982;
  --er-ad-green-dark: #12966a;
  --er-ad-ink: #15312b;
  --er-ad-muted: #6c7f7a;
  --er-ad-line: #dbe8e3;
  --er-ad-gold: #f0a500;
  --er-ad-violet: #7c3aed;
}

/* ---------- Tarjeta base ---------- */
.er-ad {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--er-ad-line);
  border-radius: 16px;
  background: #fff;
  color: var(--er-ad-ink);
  box-shadow: 0 8px 22px rgba(20, 57, 48, .07);
}

.er-ad__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(140deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

.er-business-icon { display: block; width: 1em; height: 1em; }
.er-ad__icon .er-business-icon { width: 20px; height: 20px; }

.er-ad__icon.er-ad__icon--cafeteria { background: linear-gradient(140deg, #f97316, #ea580c); }
.er-ad__icon.er-ad__icon--restaurante { background: linear-gradient(140deg, #ef4444, #dc2626); }
.er-ad__icon.er-ad__icon--hotel { background: linear-gradient(140deg, #8b5cf6, #6d28d9); }
.er-ad__icon.er-ad__icon--taller { background: linear-gradient(140deg, #2563eb, #1d4ed8); }
.er-ad__icon.er-ad__icon--supermercado,
.er-ad__icon.er-ad__icon--tienda { background: linear-gradient(140deg, #0ea5e9, #0369a1); }
.er-ad__icon.er-ad__icon--gasolinera,
.er-ad__icon.er-ad__icon--estacion_glp,
.er-ad__icon.er-ad__icon--area_servicio { background: linear-gradient(140deg, #1db982, #12966a); }

.er-ad__body { min-width: 0; display: grid; gap: 4px; }

.er-ad__head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.er-ad__business {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Plan identity follows the effective plan, independently of the card surface. */
.er-ad[data-plan] .er-ad__business,
.er-campaign-card[data-plan] .er-campaign-card__business {
  display: flex;
  align-items: center;
  column-gap: 4px;
}
.er-ad__name { min-width: 0; overflow-wrap: anywhere; }
.er-ad__plan-crown {
  display: block;
  flex: 0 0 1em;
  width: 1em;
  height: 1em;
  color: #2563eb;
  background-color: currentColor;
  -webkit-mask: url('../icons/lucide/crown.svg') center / contain no-repeat;
  mask: url('../icons/lucide/crown.svg') center / contain no-repeat;
}
.er-ad__plan-crown--premium { color: #b8860b; }

.er-ad__title { justify-self: start; max-width: 100%; padding: 2px 6px; border-radius: 5px; background: #eaf6f1; font-size: 12.5px; line-height: 1.4; font-weight: 700; color: #08764f; overflow-wrap: anywhere; }
.er-ad--promotion .er-ad__text { display: block; overflow: visible; overflow-wrap: anywhere; -webkit-line-clamp: unset; }

.er-ad__text {
  margin: 0;
  color: var(--er-ad-muted);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.er-ad__distance {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 2px 0 0;
  color: var(--er-ad-muted);
  font-size: 11.5px;
}

.er-ad__distance i { color: var(--er-ad-green); font-style: normal; }

.er-ad__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.er-ad__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border: 1px solid var(--er-ad-line);
  border-radius: 10px;
  background: #fff;
  color: var(--er-ad-ink);
  font-size: 11.5px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.er-ad__btn--ghost:hover { border-color: var(--er-ad-green); color: var(--er-ad-green-dark); }

.er-ad__btn--solid {
  border-color: transparent;
  background: linear-gradient(135deg, var(--er-ad-green), var(--er-ad-green-dark));
  color: #fff;
}

.er-ad__btn--solid:hover { filter: brightness(1.05); }
.er-ad__btn.is-added { background: #eaf6f1; color: var(--er-ad-green-dark); border-color: var(--er-ad-green); }

.er-ad__map-link {
  justify-self: start;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--er-ad-green-dark);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
}

.er-ad__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.er-ad__badge i { font-style: normal; }
.er-ad__badge--destacado { background: #fff5df; color: #8a6100; }
.er-ad__badge--premium { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; }

.er-ad__sponsored {
  margin-left: auto;
  flex: none;
  color: #9aa8a4;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ---------- Plan Visible ---------- */
.er-ad--visible .er-ad__actions { margin-top: 4px; }

/* ---------- Plan Destacado ---------- */
.er-ad--destacado {
  border-color: #bfe6d5;
  background: linear-gradient(180deg, #f6fdfa, #fff 60%);
  box-shadow: 0 12px 28px rgba(18, 150, 106, .14);
}

.er-ad--destacado::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 16px 0 0 16px;
  background: linear-gradient(180deg, var(--er-ad-gold), var(--er-ad-green));
}

/* ---------- Superficie Premium del mapa ---------- */
.er-ad--premium-photo {
  grid-template-columns: 1fr;
  padding: 0;
  overflow: hidden;
  border-color: #ddd0fb;
  box-shadow: 0 16px 34px rgba(124, 58, 237, .18);
}

.er-ad--premium-photo .er-ad__media { height: 108px; background: #f3eeff; }
.er-ad--premium-photo .er-ad__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.er-ad--premium-photo .er-ad__media--empty { display: grid; place-items: center; font-size: 30px; color: var(--er-ad-violet); }
.er-ad__media--empty .er-business-icon { width: 32px; height: 32px; }
.er-ad--premium-photo .er-ad__body { padding: 10px 12px 12px; }
.er-ad--premium-photo .er-ad__sponsored { color: #6c7f7a; }

.er-ad__tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0; padding: 0; list-style: none; }
.er-ad__tags li {
  padding: 3px 7px;
  border: 1px solid #e6dcfb;
  border-radius: 999px;
  background: #faf7ff;
  color: #5b21b6;
  font-size: 10px;
  font-weight: 700;
}

/* ---------- Franja "Tu ruta incluye" ---------- */
.route-includes-list .er-ad { height: 100%; min-height: 100%; }

/* ---------- Popup del mapa ---------- */
.business-campaign-popup .er-ad { border: 0; box-shadow: none; }

/* ---------- Pines del mapa por plan ---------- */
.er-sponsored-marker { border: 0; background: transparent; }

.er-ad-pin {
  display: grid;
  place-items: center;
  width: var(--er-ad-marker-size, 30px);
  height: var(--er-ad-marker-size, 30px);
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
  transform-origin: center;
  background: linear-gradient(140deg, #1db982, #12966a);
  border: 2px solid #fff;
  box-shadow: 0 6px 14px rgba(12, 40, 33, .32);
  color: #fff;
}

.er-ad-pin span { display: grid; place-items: center; width: 100%; height: 100%; transform: rotate(45deg); line-height: 1; }
.er-ad-pin .er-business-icon { width: 52%; height: 52%; }
.er-ad-pin--destacado { background: linear-gradient(140deg, #fbbf24, #f59e0b); }
.er-ad-pin--premium {
  background: linear-gradient(140deg, #a855f7, #6d28d9);
  box-shadow: 0 0 0 6px rgba(168, 85, 247, .22), 0 8px 18px rgba(60, 20, 110, .35);
}

.er-ad-pin.is-active { outline: 3px solid rgba(29, 185, 130, .45); outline-offset: 2px; }
.er-ad-pin--premium.is-active { outline-color: rgba(168, 85, 247, .55); }

/* ---------- Tarjeta flotante Premium sobre el mapa ---------- */
.map-card { position: relative; }

.er-premium-float {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 620;
  width: min(330px, calc(100% - 28px));
  border-radius: 18px;
  border: 1px solid #e4d8fd;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 18px 40px rgba(38, 12, 74, .22);
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.er-premium-float[hidden] { display: none; }

.er-premium-float__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: linear-gradient(135deg, #f6f1ff, #fdfbff);
  border-bottom: 1px solid #efe7fd;
}

.er-premium-float__kicker,
.er-premium-float__title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  flex: 1 1 auto;
  color: #5b21b6;
  font-size: 12px;
  font-weight: 900;
}

.er-premium-float__kicker i,
.er-premium-float__title i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-style: normal;
  font-size: 12px;
}

.er-premium-float__counter { color: var(--er-ad-muted); font-size: 11px; font-weight: 700; }

.er-premium-float__nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.er-premium-float__nav-btn,
.er-premium-float__close {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid #e6dcfb;
  border-radius: 50%;
  background: #fff;
  color: #5b21b6;
  font-size: 12px;
  cursor: pointer;
}

.er-premium-float__nav-btn:disabled { opacity: .4; cursor: default; }
.er-premium-float__body .er-ad { border: 0; box-shadow: none; border-radius: 0; }
.er-premium-float.is-single .er-premium-float__nav-btn:not(.er-premium-float__close),
.er-premium-float.is-single .er-premium-float__counter { display: none; }

@media (max-width: 960px) {
  /* En pantallas pequeñas la tarjeta Premium nunca tapa el mapa: se coloca
     debajo, ocupa el ancho del dispositivo y limita su altura. */
  .er-premium-float {
    position: static;
    inset: auto;
    width: 100%;
    max-width: 100%;
    margin: 10px 0 0;
    border-radius: 14px;
    box-sizing: border-box;
    box-shadow: 0 8px 20px rgba(38, 12, 74, .14);
    backdrop-filter: none;
  }

  .er-premium-float__head { padding: 7px 9px; }
  .er-premium-float__body { max-height: 46vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .er-premium-float__body .er-ad { width: 100%; max-width: 100%; box-sizing: border-box; }
  .er-premium-float__body .er-ad__media { height: 110px; }
}

@media (max-width: 640px) {
  .er-premium-float__kicker,
.er-premium-float__title { font-size: 11px; }
  .er-premium-float__body { max-height: 40vh; }
  .er-premium-float__body .er-ad__media { height: 96px; }
  .er-ad--premium-photo .er-ad__media { height: 128px; }
  .er-ad__business { font-size: 15px; }
  .er-ad__text { font-size: 12.5px; }
}

/* ---------- Tarifas por plan dentro del editor del anunciante ---------- */
.adv-plan-checkout { margin: 0 0 1.25rem; }
.adv-plan-checkout-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.adv-plan-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}
.adv-plan-option.is-current { border-color: #10b981; box-shadow: 0 0 0 2px rgba(16, 185, 129, .16); }
.adv-plan-option.er-ad-plan--destacado { border-color: #bfdbfe; }
.adv-plan-option.er-ad-plan--premium { border-color: #e4d8fd; }
.adv-plan-option h3 { margin: 0; font-size: 1.05rem; }
.adv-plan-option .adv-plan-price { font-size: 1.5rem; font-weight: 800; }
.adv-plan-option .adv-plan-price small { font-size: .8rem; font-weight: 600; color: #64748b; }
.adv-plan-option p { margin: 0; color: #475569; font-size: .9rem; }
.adv-plan-option ul { margin: 0; padding-left: 1.1rem; color: #475569; font-size: .85rem; }
.adv-plan-option form { margin-top: auto; }
.adv-plan-option .adv-btn { width: 100%; }
.adv-plan-checkout-note { margin: 12px 0 0; color: #64748b; font-size: .85rem; }

@media (max-width: 520px) {
  .adv-plan-checkout-grid { grid-template-columns: 1fr; }
}

/* Establishment logos personalize cards only; the map pin rules stay unchanged. */
.er-ad__logo-circle { position: relative; overflow: hidden; }
.er-ad__logo-circle img.er-ad__logo-img { position: absolute; inset: 0; width: 100%; height: 100%; box-sizing: border-box; padding: 4px; border-radius: 50%; background: #fff; object-fit: contain; opacity: 0; }
.er-ad__logo-circle.has-logo img.er-ad__logo-img { opacity: 1; }
.er-ad__logo-circle.has-logo>span { visibility: hidden; }
.er-ad__media { position: relative; }
.er-ad__media>.er-ad__logo-circle { position: absolute; right: 8px; bottom: 8px; }
.er-ad__media--empty>.er-ad__logo-circle { position: relative; right: auto; bottom: auto; }
