/* ══════════════════════════════════════════════════════════════════
   BSCare – red-map.css  (Mapa "La Red que Conecta Ecuador")
   ══════════════════════════════════════════════════════════════════ */

/* ── MAP & PRESENCIA NACIONAL SECTION ───────────────────────────── */
.map-section {
  background: var(--blue-bg);
  padding: 5.5rem 2rem;
  position: relative;
  overflow: hidden;
}

.map-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1312 / 1199;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-bg-img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 12px 28px rgba(0, 58, 140, 0.14));
}

.ecuador-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 2;
}

/* Network connections */
.net-line {
  stroke-dasharray: 12 8;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.net-line.visible {
  opacity: 0.95;
  animation: dashAnim 2.8s linear infinite;
}
@keyframes dashAnim {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -80; }
}

/* Pulse rings for Anconcito nucleus */
.pulse-ring {
  animation: pulseRing 2.6s ease-out infinite;
  transform-origin: center;
}
.pr-1 { animation-delay: 0s; }
.pr-2 { animation-delay: 0.8s; }
.pr-3 { animation-delay: 1.6s; }
@keyframes pulseRing {
  0%   { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* City dots on map */
.city-dot {
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.city-dot:hover {
  transform: scale(1.25);
}
.city-dot.nucleus {
  transform-origin: 330px 945px;
}
#node-quito { transform-origin: 615px 375px; }
#node-guayaquil { transform-origin: 465px 875px; }
#node-cuenca { transform-origin: 575px 935px; }
#node-esmeraldas { transform-origin: 470px 195px; }

/* Travel dot animation */
.travel-pulse {
  animation: travelAnim 0.4s ease-in-out infinite alternate;
}
@keyframes travelAnim {
  from { r: 6; opacity: 0.8; }
  to   { r: 10; opacity: 1; }
}

/* City labels on SVG map */
.city-lbl {
  font-family: var(--font-display), 'Poppins', sans-serif;
  font-size: 24px;
  font-weight: 800;
  fill: var(--gray-900);
  pointer-events: none;
  filter: drop-shadow(0 2px 5px rgba(255, 255, 255, 0.9));
}
.city-sub-lbl {
  font-family: var(--font-body), sans-serif;
  font-size: 18px;
  font-weight: 700;
  fill: var(--blue-dark);
  pointer-events: none;
  filter: drop-shadow(0 2px 5px rgba(255, 255, 255, 0.9));
}
.nucleus-lbl {
  fill: var(--blue-primary);
  font-size: 28px;
  font-weight: 900;
}

/* ══════════════════════════════════════════════════════════════════
   EXPLORADOR DE LA RED (mapa + información de la ciudad fusionados)
   ══════════════════════════════════════════════════════════════════ */
.rx {
  max-width: var(--max-w); margin: 0 auto;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 2.5rem;
  align-items: center;
  padding: 2.25rem;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 25% 40%, rgba(0,163,255,0.12), transparent 55%),
    radial-gradient(rgba(0,58,140,0.09) 1px, transparent 1.4px) 0 0 / 22px 22px,
    linear-gradient(160deg, #FFFFFF 0%, #EAF2FF 100%);
  border: 1px solid rgba(0,58,140,0.1);
  box-shadow: 0 24px 60px rgba(0,58,140,0.12);
  position: relative;
}
.rx::before {                                   /* línea de marca superior */
  content: ''; position: absolute; top: 0; left: 2rem; right: 2rem; height: 4px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--blue-primary), #00A3FF, var(--red-primary));
}

/* ── Mapa ── */
.rx-map { position: relative; display: flex; flex-direction: column; }
.rx-map-badge {
  position: absolute; top: 0; left: 0; z-index: 3;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 6px;
  background: rgba(255,255,255,0.9); backdrop-filter: blur(6px);
  border: 1px solid rgba(0,58,140,0.15); border-radius: var(--radius-full);
  font-size: 0.8rem; font-weight: 600; color: var(--blue-primary);
  box-shadow: 0 6px 18px rgba(0,58,140,0.1);
}
.rx-map-badge-ico {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--blue-primary); color: #FFD54A;
}
.map-tagline {
  margin-top: 0.75rem; text-align: center;
  font-family: var(--font-display); font-style: italic; font-weight: 800;
  font-size: 1.02rem; color: var(--blue-primary);
}

/* Ciudad elegida: su ruta se ilumina y las demás se atenúan */
.rx[data-city] .net-line.visible { opacity: 0.35; transition: opacity 0.4s ease, stroke-width 0.4s ease; }
.rx[data-city="quito"] #line-quito.visible,
.rx[data-city="guayaquil"] #line-guayaquil.visible,
.rx[data-city="cuenca"] #line-cuenca.visible,
.rx[data-city="esmeraldas"] #line-esmeraldas.visible,
.rx[data-city="ancon"] .net-line.visible { opacity: 1; stroke-width: 5; }
.city-dot.selected { transform: scale(1.3); }
.city-dot.selected circle:nth-child(3) { filter: url(#glow-nucleus); }
.city-dot.selected .city-lbl { fill: var(--blue-primary); }

/* ── Pestañas de ciudades ── */
.rx-info { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.rx-tabs {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.3rem; padding: 0.35rem;
  background: rgba(255,255,255,0.8); border: 1px solid rgba(0,58,140,0.1);
  border-radius: 18px;
}
.rx-tab {
  position: relative; overflow: hidden; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 0.55rem 0.2rem;
  border: 0; border-radius: 13px; background: none; cursor: pointer;
  font-family: var(--font-main); font-size: 0.74rem; font-weight: 700; color: var(--gray-600);
  transition: background var(--t-med), color var(--t-med);
}
.rx-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-tab:hover { color: var(--blue-primary); background: var(--blue-pale); }
.rx-tab.active { background: var(--blue-primary); color: #fff; box-shadow: 0 6px 16px rgba(0,58,140,0.3); }
.rx-tab[data-city="esmeraldas"].active { background: var(--red-primary); box-shadow: 0 6px 16px rgba(204,26,26,0.3); }
.rx-tab-progress {                               /* avance del recorrido automático */
  position: absolute; left: 0; bottom: 0; height: 3px; width: 0;
  background: rgba(255,255,255,0.75);
}
.rx.touring .rx-tab.active .rx-tab-progress { animation: rxProgress var(--rx-dur, 7s) linear forwards; }
@keyframes rxProgress { to { width: 100%; } }

/* ── Tarjeta de la ciudad ── */
.rx-card {
  background: #fff; border-radius: 24px; overflow: hidden;
  border: 1px solid rgba(0,58,140,0.08);
  box-shadow: 0 18px 44px rgba(0,58,140,0.14);
}
.rx-photo { position: relative; height: 210px; overflow: hidden; background: var(--blue-deep); }
.rx-photo-img {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0; transform: scale(1.12);
  transition: opacity 0.8s ease;
}
.rx-photo-img.show { opacity: 1; animation: rxKenBurns 9s ease-out forwards; }
@keyframes rxKenBurns { from { transform: scale(1.12) translateX(1.5%); } to { transform: scale(1) translateX(0); } }
.rx-photo::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(0,26,70,0.05) 25%, rgba(0,30,80,0.85) 100%);
}
.rx-photo-head { position: absolute; left: 1.4rem; right: 1.4rem; bottom: 1.1rem; z-index: 2; color: #fff; }
.rx-photo-head h3 {
  font-family: var(--font-display); font-weight: 900; font-size: 1.75rem;
  line-height: 1.1; margin: 0.35rem 0 0.2rem; color: #fff;
}
.rx-photo-head p { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: rgba(255,255,255,0.88); margin: 0; }
.rx-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-full);
  background: #FFD54A; color: #5C4500;
  font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
}
.rx-badge[hidden] { display: none; }
.rx-card.swap .rx-photo-head, .rx-card.swap .rx-body { animation: rxSwap 0.55s ease; }
@keyframes rxSwap { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.rx-body { padding: 1.25rem 1.4rem 1.4rem; }
.rx-desc { font-size: 0.9rem; color: var(--gray-600); line-height: 1.65; margin-bottom: 1rem; min-height: 4.6em; }
.rx-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 1.1rem; }
.rx-stat {
  text-align: center; padding: 0.6rem 0.4rem;
  background: var(--blue-bg); border: 1px solid rgba(0,58,140,0.08); border-radius: 14px;
}
.rx-stat strong {
  display: block; font-family: var(--font-display); font-weight: 900;
  font-size: 1.45rem; color: var(--blue-primary); line-height: 1.1;
}
.rx-stat span { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); }
.rx-actions { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.rx-cta { display: inline-flex; align-items: center; gap: 8px; }
.rx-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; font-weight: 700; color: var(--blue-primary);
  transition: gap var(--t-fast), color var(--t-fast);
}
.rx-link:hover { gap: 9px; color: var(--blue-mid); }
.rx-hint { font-size: 0.75rem; color: var(--gray-500); text-align: center; margin: 0; }

/* ── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .rx { grid-template-columns: 1fr; gap: 1.5rem; }
  .rx-map { max-width: 560px; width: 100%; margin: 0 auto; padding-top: 2.5rem; }
  .rx-map-badge { left: 50%; transform: translateX(-50%); white-space: nowrap; }
}
@media (max-width: 640px) {
  .map-section { padding: 4rem 1rem; }
  .rx { padding: 1.5rem 0.9rem 1.1rem; border-radius: 24px; }
  .rx-tabs { gap: 0.1rem; padding: 0.25rem; }
  .rx-tab { padding: 0.5rem 0; font-size: 0.6rem; letter-spacing: -0.01em; }
  .rx-tab span { overflow: visible; }
  .rx-photo { height: 180px; }
  .rx-photo-head h3 { font-size: 1.45rem; }
  .rx-body { padding: 1.1rem; }
  .rx-stat strong { font-size: 1.2rem; }
  .rx-stat span { font-size: 0.6rem; }
  .map-tagline { font-size: 0.9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .rx-photo-img.show { animation: none; transform: none; }
  .rx-card.swap .rx-photo-head, .rx-card.swap .rx-body { animation: none; }
}

/* ══════════════════════════════════════════════════════════════════
   TELEMEDICINA: video de Sami con marco azul
   ══════════════════════════════════════════════════════════════════ */
.tm-video-frame {
  position: relative; margin: 3rem auto;
  width: min(100%, 320px);
  animation: tmFloat 6s ease-in-out infinite;
}
.tm-video {
  position: relative; z-index: 1;
  display: block; width: 100%; aspect-ratio: 9 / 16;
  border-radius: 28px; background: var(--blue-deep);
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0,58,140,0.08), 0 0 40px rgba(0,163,255,0.35), 0 26px 60px rgba(0,58,140,0.28);
}
/* Aura: anillos que salen del borde y cambian de azul a rojo, como el puntero */
.tm-aura {
  position: absolute; inset: 0; z-index: 0;
  border-radius: 28px;
  border: 2px solid rgba(0,58,140,0.9);
  pointer-events: none;
  animation: tmAura 3s ease-out infinite;
}
.tm-aura.a2 { animation-delay: 1s; }
.tm-aura.a3 { animation-delay: 2s; }
@keyframes tmAura {
  0%   { transform: scale(0.98); opacity: 0.9; border-color: rgba(0,58,140,0.9); }
  50%  { transform: scale(1.08); opacity: 0.45; border-color: rgba(204,26,26,0.8); }
  100% { transform: scale(1.16); opacity: 0; border-color: rgba(0,58,140,0); }
}
/* Movimiento suave del video */
@keyframes tmFloat {
  0%, 100% { transform: translateY(0) rotate(-1.2deg); }
  50%      { transform: translateY(-14px) rotate(1.2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .tm-video-frame, .tm-aura { animation: none; }
}
.tm-sami-quote {
  margin: 0 0 1rem; padding: 0.9rem 1.1rem;
  border-left: 4px solid var(--blue-primary);
  border-radius: 0 14px 14px 0;
  background: var(--blue-bg);
}
.tm-sami-quote p {
  margin: 0; font-style: italic; font-size: 0.98rem; line-height: 1.6; color: var(--gray-700);
}
.tm-sami-quote strong { color: var(--blue-primary); font-style: normal; }
@media (max-width: 640px) {
  .tm-video-frame { width: min(100%, 260px); }
}
