/* =========================
   RED AGENCIAS - GRAPH VIEW (PRO)
   - Tab 🕸️ Red
   - Fullscreen + pan/zoom + scroll "infinito"
   - Pills con nombre completo (2 líneas) + tooltip nativo
   ========================= */

:root{
  --raG-bg: rgba(2, 6, 23, .70);
  --raG-br: rgba(255,255,255,.12);
  --raG-br2: rgba(255,255,255,.18);
  --raG-tx: rgba(255,255,255,.92);
  --raG-muted: rgba(255,255,255,.70);
  --raG-glow: rgba(255,152,0,.55);
  --raG-shadow: 0 18px 60px rgba(0,0,0,.45);
}

/* Hacer que el panel Red pueda crecer sin romper el layout */
#ra-panel-red{
  overflow: hidden;
}

/* Host del grafo PRO (solo tab Red) */
#ra-red-graph-host{
  position: relative;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: var(--raG-bg);
  overflow: hidden;
  height: 60vh;            /* JS lo auto-ajusta a viewport */
  min-height: 520px;
  box-shadow: 0 18px 55px rgba(0,0,0,.35) inset;
}

#ra-red-graph-host[data-mode="pan"]{ cursor: grab; }
#ra-red-graph-host[data-mode="pan"].dragging{ cursor: grabbing; }
#ra-red-graph-host[data-mode="scroll"]{ cursor: default; }

.raG-toolbar{
  display:flex;
  align-items:center;
  gap:8px;
  margin: 10px 0 10px;
  flex-wrap: wrap;
}
.raG-btn{
  border: 1px solid var(--raG-br2);
  background: rgba(255,255,255,.06);
  color: var(--raG-tx);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}
.raG-btn:hover{ box-shadow: 0 0 0 2px rgba(255,152,0,.20) inset; }
.raG-btn[data-on="1"]{
  border-color: rgba(255,152,0,.45);
  background: rgba(255,152,0,.10);
}
.raG-hint{
  margin-left:auto;
  color: var(--raG-muted);
  font-size: 12px;
  white-space: nowrap;
}

.raG-searchwrap{
  position: relative;
  flex: 1 1 320px;
  max-width: 520px;
}
.raG-search{
  width: 100%;
  border: 1px solid var(--raG-br2);
  background: rgba(255,255,255,.06);
  color: var(--raG-tx);
  padding: 8px 10px;
  border-radius: 10px;
  outline: none;
}
.raG-suggest{
  position:absolute;
  top: 44px;
  left:0;
  right:0;
  background: rgba(8, 12, 28, .95);
  border: 1px solid var(--raG-br2);
  border-radius: 12px;
  box-shadow: var(--raG-shadow);
  max-height: 280px;
  overflow: auto;
  z-index: 30;
}
.raG-suggest .it{
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.raG-suggest .it:hover{ background: rgba(255,152,0,.08); }

.raG-links{
  position:absolute;
  left:0;
  top:0;
  z-index:1;
  pointer-events:none;
}
.raG-canvas{
  position:absolute;
  left:0;
  top:0;
  z-index:2;
  transform-origin: 0 0;
}

/* Pills PRO */
.raG-node{
  position:absolute;
  display:inline-flex;
  align-items:flex-start;
  gap:8px;
  padding: 9px 12px;
  border-radius: 16px;
  border: 1px solid var(--raG-br2);
  background: rgba(255,255,255,.06);
  color: var(--raG-tx);
  box-shadow: 0 8px 28px rgba(0,0,0,.25);
  cursor: pointer;
  user-select:none;
  width: fit-content;
  max-width: 520px;
}
.raG-node:hover{ box-shadow: 0 0 0 2px rgba(255,152,0,.18) inset, 0 14px 30px rgba(0,0,0,.30); }
.raG-node[data-focus="1"]{ animation: raGfocus 1.1s ease-in-out 0s 1; box-shadow: 0 0 0 2px rgba(255,152,0,.28) inset, 0 20px 60px rgba(0,0,0,.45); }
@keyframes raGfocus{
  0%{ transform: scale(1); }
  40%{ transform: scale(1.06); }
  100%{ transform: scale(1); }
}

.raG-node .tag{
  font-size: 11px;
  padding: 2px 7px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: rgba(255,255,255,.80);
  background: rgba(0,0,0,.18);
  line-height: 1.3;
  flex: 0 0 auto;
}

.raG-node .name{
  font-weight: 800;
  line-height: 1.15;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;   /* 2 líneas */
  max-width: 380px;
}
.raG-node .sub{
  font-size: 11px;
  color: var(--raG-muted);
  margin-left: 6px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  white-space: nowrap;
  align-self: center;
}

.raG-node .img{
  width: 26px;
  height: 26px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.20);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  flex: 0 0 auto;
}
.raG-node .img.ph{
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  font-size: 12px;
  background: rgba(255,255,255,.10);
  color: rgba(255,255,255,.92);
}
.raG-node[data-tipo="negocio"] .img.ph{ background: rgba(56,189,248,.18); border-color: rgba(56,189,248,.35); }
.raG-node[data-tipo="grupo"] .img.ph{ background: rgba(74,222,128,.16); border-color: rgba(74,222,128,.35); }
.raG-node[data-tipo="agencia"] .img.ph{ background: rgba(249,115,22,.16); border-color: rgba(249,115,22,.35); }
.raG-node[data-tipo="marca"] .img.ph{ background: rgba(34,211,238,.14); border-color: rgba(34,211,238,.32); }
.raG-node[data-tipo="modelo"] .img.ph{ background: rgba(250,204,21,.14); border-color: rgba(250,204,21,.32); }
.raG-node[data-tipo="vendedor"] .img.ph{ background: rgba(196,181,253,.16); border-color: rgba(196,181,253,.35); }
.raG-node[data-tipo="staff"] .img.ph{ background: rgba(148,163,184,.16); border-color: rgba(148,163,184,.35); }
.raG-node[data-tipo="cliente"] .img.ph{ background: rgba(249,168,212,.16); border-color: rgba(249,168,212,.35); }

/* Panel lateral (fallback / opcional) */
.raG-panel{
  position: absolute;
  top: 86px;
  right: 10px;
  width: 340px;
  max-height: calc(100% - 96px);
  overflow: auto;
  z-index: 40;
  border-radius: 16px;
  border: 1px solid var(--raG-br2);
  background: rgba(8, 12, 28, .92);
  box-shadow: var(--raG-shadow);
  padding: 12px;
}
.raG-panel h3{
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--raG-tx);
}
.raG-row{ display:flex; gap:8px; align-items:center; }
.raG-input, .raG-textarea, .raG-select{
  width: 100%;
  border: 1px solid var(--raG-br2);
  background: rgba(255,255,255,.06);
  color: var(--raG-tx);
  padding: 8px 10px;
  border-radius: 10px;
  outline: none;
}
.raG-textarea{ min-height: 84px; resize: vertical; }
.raG-actions{ display:flex; flex-wrap:wrap; gap:8px; margin: 8px 0 10px; }
.raG-act{
  border: 1px solid var(--raG-br2);
  background: rgba(255,255,255,.06);
  color: var(--raG-tx);
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}
.raG-act:hover{ box-shadow: 0 0 0 2px rgba(255,152,0,.18) inset; }
.raG-mini{
  font-size: 12px;
  color: var(--raG-muted);
}
.raG-collapser{
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  cursor: pointer;
  display:flex;
  justify-content: space-between;
  align-items:center;
}
.raG-collapser:hover{ background: rgba(255,152,0,.06); }

.raG-toast{
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 60;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--raG-br2);
  background: rgba(8, 12, 28, .92);
  box-shadow: var(--raG-shadow);
  color: var(--raG-tx);
  display:none;
}

@media (max-width: 980px){
  .raG-hint{ display:none; }
  .raG-panel{ width: 92vw; max-width: 420px; right: 8px; }
}
