/* Mapa del flujo institucional — estilo diagrama (lienzo oscuro) */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

.mapa-wrap {
  --mapa-bg: #070a13;
  --mapa-card: rgba(15, 23, 42, 0.95);
  --mapa-border: rgba(255, 255, 255, 0.14);
  --mapa-text: #f8fafc;
  --mapa-muted: #94a3b8;
  --mapa-font: 'Outfit', 'Source Sans 3', sans-serif;
  margin: -8px -4px 0;
}

.mapa-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: .9rem;
}

.mapa-hint {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
}

.mapa-lienzo-shell {
  position: relative;
  height: min(78vh, 820px);
  min-height: 560px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid #1e293b;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(56, 189, 248, 0.08), transparent 45%),
    radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.07), transparent 40%),
    var(--mapa-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 18px 40px rgba(15, 23, 42, 0.25);
}

.mapa-canvas-wrapper {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  font-family: var(--mapa-font);
}

.mapa-canvas-wrapper.panning {
  cursor: grabbing;
}

.mapa-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 2460px;
  height: 1200px;
  transform-origin: 0 0;
}

.mapa-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}

.mapa-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.38);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mapa-line-si { stroke: rgba(16, 185, 129, 0.85); }
.mapa-line-no { stroke: rgba(248, 113, 113, 0.85); }
.mapa-line-loop {
  stroke: rgba(248, 113, 113, 0.7);
  stroke-dasharray: 6 5;
}
.mapa-line-bypass {
  stroke: rgba(56, 189, 248, 0.75);
  stroke-dasharray: 7 5;
}

.mapa-label {
  fill: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--mapa-font);
  paint-order: stroke;
  stroke: #070a13;
  stroke-width: 3px;
}
.mapa-label-si { fill: #34d399; }
.mapa-label-no { fill: #f87171; }
.mapa-label-bypass { fill: #38bdf8; }

.mapa-group {
  position: absolute;
  z-index: 2;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.mapa-group.activo {
  border-color: #fbbf24;
  border-width: 2.5px;
  box-shadow:
    0 0 0 4px rgba(251, 191, 36, 0.35),
    0 0 40px rgba(251, 191, 36, 0.45),
    inset 0 0 30px rgba(251, 191, 36, 0.08);
  background: rgba(251, 191, 36, 0.08);
  animation: mapa-pulse-group 1.6s ease-in-out infinite;
}

.mapa-group.activo .mapa-group-title {
  color: #fbbf24;
  background: #0b1220;
}

.mapa-group-title {
  position: absolute;
  top: -11px;
  left: 14px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #94a3b8;
  background: var(--mapa-bg);
}

.mapa-lienzo-shell.con-activo .mapa-node:not(.activo) {
  opacity: 0.42;
  filter: saturate(0.7);
}

.mapa-lienzo-shell.con-activo .mapa-group:not(.activo) {
  opacity: 0.5;
}

.mapa-node.activo {
  z-index: 12;
}

.mapa-node.activo .mapa-node-process,
.mapa-node.activo .mapa-diamond,
.mapa-node.activo.mapa-node-pill {
  outline: none;
  border-color: #fbbf24 !important;
  border-width: 3px;
  box-shadow:
    0 0 0 5px rgba(251, 191, 36, 0.45),
    0 0 0 10px rgba(251, 191, 36, 0.18),
    0 0 48px rgba(251, 191, 36, 0.75),
    0 0 80px rgba(56, 189, 248, 0.35);
  animation: mapa-pulse-node 1.4s ease-in-out infinite;
  transform-origin: center center;
}

.mapa-node.activo .mapa-diamond {
  border-color: #fbbf24;
}

.mapa-node.activo.mapa-node-pill {
  background: linear-gradient(135deg, #b45309, #f59e0b);
  border-color: #fde68a !important;
  color: #0f172a;
}

.mapa-badge-etapa {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #0f172a;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border: 1px solid #fde68a;
  box-shadow: 0 4px 16px rgba(251, 191, 36, 0.55);
  pointer-events: none;
  animation: mapa-badge-bounce 1.4s ease-in-out infinite;
}

.mapa-node.mapa-node-decision .mapa-badge-etapa {
  top: -8px;
}

@keyframes mapa-pulse-node {
  0%, 100% {
    box-shadow:
      0 0 0 5px rgba(251, 191, 36, 0.45),
      0 0 0 10px rgba(251, 191, 36, 0.18),
      0 0 48px rgba(251, 191, 36, 0.75),
      0 0 80px rgba(56, 189, 248, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 8px rgba(251, 191, 36, 0.55),
      0 0 0 16px rgba(251, 191, 36, 0.12),
      0 0 64px rgba(251, 191, 36, 0.95),
      0 0 100px rgba(56, 189, 248, 0.45);
  }
}

@keyframes mapa-pulse-group {
  0%, 100% { box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.35), 0 0 40px rgba(251, 191, 36, 0.45); }
  50% { box-shadow: 0 0 0 7px rgba(251, 191, 36, 0.45), 0 0 56px rgba(251, 191, 36, 0.6); }
}

@keyframes mapa-badge-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-3px); }
}

.mapa-etapa-banner {
  display: none;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.18), rgba(56, 189, 248, 0.1));
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #92400e;
  font-size: .92rem;
}

.mapa-etapa-banner.visible {
  display: flex;
}

.mapa-etapa-banner strong {
  color: #b45309;
}

.mapa-node {
  position: absolute;
  z-index: 5;
  color: var(--mapa-text);
  user-select: none;
}

.mapa-node-process {
  width: 228px;
  min-height: 98px;
  border-radius: 10px;
  background: var(--mapa-card);
  border: 2px solid var(--node-color, #38bdf8);
  padding: 12px 13px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.mapa-node-process.retorno {
  border-radius: 18px;
  border-color: #94a3b8;
  min-height: 72px;
}

.mapa-node-process.aprobacion {
  border-color: #f97316;
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.25);
}

.mapa-node-decision {
  width: 132px;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mapa-diamond {
  width: 96px;
  height: 96px;
  background: var(--mapa-card);
  border: 2px solid #e2e8f0;
  transform: rotate(45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.mapa-diamond-inner {
  transform: rotate(-45deg);
  text-align: center;
  width: 110px;
  padding: 4px;
}

.mapa-node-pill {
  width: 240px;
  height: 56px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  border: 2px solid #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.45);
  padding: 8px 14px;
}

.mapa-title {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.mapa-lead {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 500;
  margin-top: 2px;
}

.mapa-desc {
  font-size: 9.5px;
  color: var(--mapa-muted);
  margin-top: 6px;
  line-height: 1.25;
}

.mapa-controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 20;
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--mapa-border);
  backdrop-filter: blur(8px);
}

.mapa-controls button,
.mapa-zoom-label {
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--mapa-border);
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--mapa-font);
}

.mapa-controls button:hover {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
}

.mapa-zoom-label {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  cursor: default;
  min-width: 48px;
}

@media (max-width: 720px) {
  .mapa-lienzo-shell {
    min-height: 480px;
    height: 70vh;
  }
}
