/* ===== RSC ECOSYSTEM DIAGRAM - FLEXBOX/GRID LAYOUT ===== */
.rsc-ecosystem-diagram {
  position: absolute;
  left: 55%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 620px;
  max-width: 90vw;
  min-height: 600px;
  z-index: 5;
  background: transparent;
  padding: 20px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: center;
  justify-content: flex-start;
}

.rsc-ecosystem-diagram .diagram-node {
  pointer-events: auto;
}

/* ===== NODOS BASE ===== */
.diagram-node {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  background: linear-gradient(135deg, rgba(25, 25, 35, 0.95), rgba(35, 35, 45, 0.9));
  border: 2px solid rgba(80, 80, 90, 0.5);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 170px;
  width: fit-content;
  z-index: 15;
  opacity: 0;
  animation: nodeAppear 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes nodeAppear {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.diagram-node:hover {
  transform: translateY(-6px) scale(1.05);
  border-color: rgba(0, 212, 255, 0.8);
  box-shadow: 
    0 16px 48px rgba(0, 212, 255, 0.4),
    0 0 40px rgba(0, 212, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  z-index: 25;
}

.node-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(124, 58, 237, 0.15));
  border: 1.5px solid rgba(0, 212, 255, 0.4);
  border-radius: 12px;
  color: #00d4ff;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: 
    0 4px 16px rgba(0, 212, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.diagram-node:hover .node-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 
    0 6px 24px rgba(0, 212, 255, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.node-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.node-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.node-subtitle {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 400;
  line-height: 1.3;
}

/* ===== ESTRUCTURA GRID/FLEX ===== */
.diagram-connections {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* Contenedor para cada fila */
.diagram-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  width: 100%;
  position: relative;
}

/* NIVEL 1: HQ (TOP CENTER) */
.node-hq {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(76, 29, 149, 0.2));
  border-color: rgba(124, 58, 237, 0.7);
  min-width: 200px;
  padding: 18px 26px;
  box-shadow: 
    0 10px 40px rgba(124, 58, 237, 0.3),
    0 0 30px rgba(124, 58, 237, 0.2);
  animation-delay: 0.1s;
  z-index: 20;
}

.node-hq .node-icon {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(76, 29, 149, 0.25));
  border-color: rgba(124, 58, 237, 0.6);
  color: #a78bfa;
  width: 52px;
  height: 52px;
  font-size: 1.5rem;
  box-shadow: 
    0 4px 20px rgba(124, 58, 237, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.node-hq:hover {
  box-shadow: 
    0 16px 50px rgba(124, 58, 237, 0.5),
    0 0 50px rgba(124, 58, 237, 0.4);
}

/* NIVEL 2: Chain, Token, Identity (HORIZONTAL) */
.diagram-row-middle {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  width: 100%;
  flex-wrap: wrap;
}

.node-chain {
  animation-delay: 0.3s;
  z-index: 16;
}

.node-token {
  animation-delay: 0.4s;
  z-index: 16;
}

.node-id {
  animation-delay: 0.5s;
  z-index: 16;
}

/* NIVEL 3: Wallet (CENTER - DESTACADO) */
.node-wallet {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(6, 182, 212, 0.25));
  border-color: rgba(0, 212, 255, 0.8);
  min-width: 200px;
  padding: 20px 28px;
  box-shadow: 
    0 12px 50px rgba(0, 212, 255, 0.4),
    0 0 50px rgba(0, 212, 255, 0.3);
  animation-delay: 0.7s;
  animation: nodeAppear 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.7s forwards, walletPulse 3s ease-in-out infinite 1.4s;
  z-index: 18;
}

@keyframes walletPulse {
  0%, 100% {
    box-shadow: 
      0 12px 50px rgba(0, 212, 255, 0.4),
      0 0 50px rgba(0, 212, 255, 0.3);
  }
  50% {
    box-shadow: 
      0 16px 60px rgba(0, 212, 255, 0.6),
      0 0 70px rgba(0, 212, 255, 0.5);
  }
}

.node-wallet .node-icon {
  width: 58px;
  height: 58px;
  font-size: 1.8rem;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.35), rgba(6, 182, 212, 0.3));
  border-color: rgba(0, 212, 255, 0.6);
  box-shadow: 
    0 6px 24px rgba(0, 212, 255, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.node-wallet:hover {
  box-shadow: 
    0 20px 70px rgba(0, 212, 255, 0.6),
    0 0 80px rgba(0, 212, 255, 0.5);
}

/* NIVEL 4: Bank, P2P, Marketplace (BOTTOM) */
.diagram-row-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  width: 100%;
  flex-wrap: wrap;
}

.node-bank {
  animation-delay: 0.9s;
  z-index: 16;
}

.node-p2p {
  animation-delay: 1s;
  z-index: 16;
}

.node-market {
  animation-delay: 1.1s;
  z-index: 16;
}

/* ===== LÍNEAS DE CONEXIÓN (OCULTAS - SE PUEDEN AGREGAR DESPUÉS) ===== */
/* ===== LÍNEAS DE CONEXIÓN SIMPLES ===== */
.diagram-connections {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.conn-line {
  position: absolute;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 212, 255, 0.6) 0,
    rgba(0, 212, 255, 0.6) 4px,
    transparent 4px,
    transparent 8px
  );
  opacity: 0;
  animation: lineAppear 0.8s ease forwards, lineFlow 2s linear infinite;
}

@keyframes lineAppear {
  to {
    opacity: 0.6;
  }
}

@keyframes lineFlow {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 16px;
  }
}

/* HQ -> Chain (diagonal izquierda) */
.conn-hq-chain {
  top: 15%;
  left: 50%;
  width: 180px;
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    rgba(124, 58, 237, 0.7) 0,
    rgba(124, 58, 237, 0.7) 4px,
    transparent 4px,
    transparent 8px
  );
  transform: translateX(-50%) rotate(155deg);
  transform-origin: center;
  animation-delay: 1.2s, 2s;
}

/* HQ -> Token (vertical) */
.conn-hq-token {
  top: 15%;
  left: 50%;
  height: 15%;
  width: 2px;
  transform: translateX(-50%);
  animation-delay: 1.3s, 2.1s;
}

/* HQ -> ID (diagonal derecha) */
.conn-hq-id {
  top: 15%;
  right: 50%;
  width: 180px;
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    rgba(124, 58, 237, 0.7) 0,
    rgba(124, 58, 237, 0.7) 4px,
    transparent 4px,
    transparent 8px
  );
  transform: translateX(50%) rotate(25deg);
  transform-origin: center;
  animation-delay: 1.4s, 2.2s;
}

/* Chain -> Wallet (diagonal hacia centro) */
.conn-chain-wallet {
  top: 40%;
  left: 50%;
  width: 200px;
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    rgba(0, 212, 255, 0.7) 0,
    rgba(0, 212, 255, 0.7) 4px,
    transparent 4px,
    transparent 8px
  );
  transform: translateX(-50%) rotate(25deg);
  transform-origin: center;
  animation-delay: 1.5s, 2.3s;
}

/* Token -> Wallet (vertical) */
.conn-token-wallet {
  top: 40%;
  left: 50%;
  height: 12%;
  width: 2px;
  transform: translateX(-50%);
  animation-delay: 1.6s, 2.4s;
}

/* ID -> Wallet (diagonal hacia centro) */
.conn-id-wallet {
  top: 40%;
  right: 50%;
  width: 200px;
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    rgba(0, 212, 255, 0.7) 0,
    rgba(0, 212, 255, 0.7) 4px,
    transparent 4px,
    transparent 8px
  );
  transform: translateX(50%) rotate(155deg);
  transform-origin: center;
  animation-delay: 1.7s, 2.5s;
}

/* Wallet -> Bank (diagonal izquierda) */
.conn-wallet-bank {
  top: 70%;
  left: 50%;
  width: 180px;
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    rgba(0, 212, 255, 0.7) 0,
    rgba(0, 212, 255, 0.7) 4px,
    transparent 4px,
    transparent 8px
  );
  transform: translateX(-50%) rotate(155deg);
  transform-origin: center;
  animation-delay: 1.8s, 2.6s;
}

/* Wallet -> P2P (vertical) */
.conn-wallet-p2p {
  top: 70%;
  left: 50%;
  height: 15%;
  width: 2px;
  transform: translateX(-50%);
  animation-delay: 1.9s, 2.7s;
}

/* Wallet -> Market (diagonal derecha) */
.conn-wallet-market {
  top: 70%;
  right: 50%;
  width: 180px;
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    rgba(0, 212, 255, 0.7) 0,
    rgba(0, 212, 255, 0.7) 4px,
    transparent 4px,
    transparent 8px
  );
  transform: translateX(50%) rotate(25deg);
  transform-origin: center;
  animation-delay: 2s, 2.8s;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1600px) {
  .rsc-ecosystem-diagram {
    width: 580px;
    max-width: 88vw;
    min-height: 580px;
  }
}

@media (max-width: 1400px) {
  .rsc-ecosystem-diagram {
    width: 540px;
    max-width: 85vw;
    min-height: 560px;
    left: 52%;
  }
  
  .diagram-row-middle,
  .diagram-row-bottom {
    gap: 18px;
  }
}

@media (max-width: 1200px) {
  .rsc-ecosystem-diagram {
    width: 500px;
    max-width: 82vw;
    min-height: 540px;
    left: 50%;
    transform: translate(-50%, -50%);
    gap: 28px;
  }
  
  .diagram-row-middle,
  .diagram-row-bottom {
    gap: 15px;
  }
  
  .diagram-node {
    min-width: 160px;
    padding: 15px 20px;
  }
  
  .node-title { font-size: 0.8rem; }
  .node-subtitle { font-size: 0.65rem; }
  
  /* Ajustar líneas en tablets */
  .conn-line {
    opacity: 0.5;
  }
}

@media (max-width: 992px) {
  .rsc-ecosystem-diagram {
    width: 480px;
    max-width: 90vw;
    min-height: 520px;
    gap: 25px;
  }
  
  .diagram-row-middle,
  .diagram-row-bottom {
    gap: 12px;
  }
  
  .diagram-node {
    min-width: 150px;
    padding: 14px 18px;
  }
  
  .node-icon {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
  }
}

@media (max-width: 900px) {
  .rsc-ecosystem-diagram {
    position: relative;
    width: calc(100% - 32px);
    max-width: 100%;
    min-height: auto;
    top: 0;
    right: auto;
    left: auto;
    transform: none;
    margin: 30px auto 40px;
    gap: 24px;
    padding: 16px;
  }
  
  /* Ocultar líneas en móvil */
  .diagram-connections {
    display: none;
  }
  
  .diagram-row-middle,
  .diagram-row-bottom {
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .diagram-node {
    min-width: calc(50% - 6px);
    max-width: calc(50% - 6px);
    flex: 0 1 calc(50% - 6px);
    padding: 14px 16px;
    gap: 10px;
  }
  
  .node-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
  
  .node-title { 
    font-size: 0.75rem; 
    line-height: 1.3;
  }
  .node-subtitle { 
    font-size: 0.65rem; 
    line-height: 1.4;
  }
}

@media (max-width: 768px) {
  .rsc-ecosystem-diagram {
    width: calc(100% - 24px);
    margin: 25px auto 35px;
    gap: 20px;
    padding: 12px;
  }
  
  .diagram-row-middle,
  .diagram-row-bottom {
    gap: 10px;
  }
  
  .diagram-node {
    min-width: calc(50% - 5px);
    max-width: calc(50% - 5px);
    flex: 0 1 calc(50% - 5px);
    padding: 12px 14px;
    gap: 8px;
  }
  
  .node-icon {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  
  .node-title { 
    font-size: 0.7rem; 
    letter-spacing: 0.3px;
  }
  .node-subtitle { 
    font-size: 0.6rem; 
  }
}

@media (max-width: 600px) {
  .rsc-ecosystem-diagram {
    width: calc(100% - 20px);
    margin: 20px auto 30px;
    gap: 18px;
    padding: 10px;
  }
  
  .diagram-row,
  .diagram-row-middle,
  .diagram-row-bottom {
    gap: 12px;
    flex-direction: column;
    width: 100%;
  }
  
  .diagram-node {
    padding: 14px 18px;
    min-width: 100%;
    max-width: 100%;
    width: 100%;
    gap: 12px;
    box-sizing: border-box;
  }
  
  .node-icon {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    flex-shrink: 0;
  }
  
  .node-title { 
    font-size: 0.8rem; 
    line-height: 1.4;
  }
  .node-subtitle { 
    font-size: 0.7rem; 
    line-height: 1.5;
  }
  
  /* Ajustes especiales para nodos destacados */
  .node-hq,
  .node-wallet {
    min-width: 100%;
    padding: 16px 20px;
  }
  
  .node-hq .node-icon,
  .node-wallet .node-icon {
    width: 48px;
    height: 48px;
  }
}

@media (max-width: 480px) {
  .rsc-ecosystem-diagram {
    gap: 16px;
    padding: 8px;
    margin: 15px auto 25px;
  }
  
  .diagram-row,
  .diagram-row-middle,
  .diagram-row-bottom {
    gap: 10px;
  }
  
  .diagram-node {
    padding: 12px 16px;
    gap: 10px;
  }
  
  .node-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
  
  .node-title { 
    font-size: 0.75rem; 
  }
  .node-subtitle { 
    font-size: 0.65rem; 
  }
  
  .node-hq,
  .node-wallet {
    padding: 14px 18px;
  }
}

@media (max-width: 360px) {
  .rsc-ecosystem-diagram {
    gap: 14px;
    padding: 6px;
    margin: 12px auto 20px;
  }
  
  .diagram-node {
    padding: 10px 14px;
    gap: 8px;
  }
  
  .node-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  .node-title { 
    font-size: 0.7rem; 
  }
  .node-subtitle { 
    font-size: 0.6rem; 
  }
}
