/* =========================================
   ECOSYSTEM NETWORK - Yari Medic
   Mapa visual interactivo del ecosistema
   ========================================= */

/* Container principal */
.ecosystem-network {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #0a1024 0%, #050b1b 100%);
}

/* Canvas para líneas de conexión */
.ecosystem-network canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Container de nodos */
.ecosystem-nodes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* Nodo individual */
.ecosystem-node {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
    transform: translate(-50%, -50%);
}

/* Círculo del nodo */
.node-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.node-circle i {
    font-size: 1.8rem;
    color: var(--node-color, #15b7c5);
    transition: all 0.3s;
}

/* Imagen en el nodo central (simbolo.png) */
.node-circle .node-image {
    width: 60%;
    height: 60%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(21, 183, 197, 0.5));
}

/* Nodo central (YARI-AI) - más grande y destacado */
.ecosystem-node.node-central .node-circle {
    width: 110px;
    height: 110px;
    background: rgba(21, 183, 197, 0.15);
    border-color: rgba(21, 183, 197, 0.5);
    animation: centralPulse 3s ease-in-out infinite;
}

.ecosystem-node.node-central .node-circle i {
    font-size: 2.5rem;
}

.ecosystem-node.node-central .node-image {
    width: 70%;
    height: 70%;
}

@keyframes centralPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(21, 183, 197, 0.3),
            0 0 40px rgba(21, 183, 197, 0.2),
            0 0 60px rgba(21, 183, 197, 0.1);
    }

    50% {
        box-shadow: 0 0 30px rgba(21, 183, 197, 0.5),
            0 0 60px rgba(21, 183, 197, 0.3),
            0 0 90px rgba(21, 183, 197, 0.2);
    }
}

/* ============ MARCA DE AGUA DE FONDO (Logo.png) ============ */
.ecosystem-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    max-width: 400px;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

/* ============ LOGO EN LA PARTE SUPERIOR ============ */
.ecosystem-top-logo {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ecosystem-top-logo img {
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.3));
}

/* Etiqueta del nodo */
.node-label {
    margin-top: 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.3s;
}

/* Hover effects */
.ecosystem-node:hover .node-circle {
    transform: scale(1.15);
    border-color: var(--node-color, #15b7c5);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 30px var(--node-glow, rgba(21, 183, 197, 0.5)),
        0 15px 35px rgba(0, 0, 0, 0.3);
}

.ecosystem-node:hover .node-label {
    color: var(--node-color, #15b7c5);
    transform: scale(1.1);
}

/* Tooltip de beneficio */
.node-tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: white;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.node-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.95);
}

.ecosystem-node:hover .node-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

/* Partículas fluyendo por las conexiones */
.flow-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--node-color, #15b7c5);
    box-shadow: 0 0 10px var(--node-color, #15b7c5),
        0 0 20px var(--node-color, #15b7c5);
    z-index: 5;
    pointer-events: none;
}

/* Animación de ondas desde el centro */
.ecosystem-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 2px solid rgba(21, 183, 197, 0.3);
    animation: waveExpand 4s ease-out infinite;
    pointer-events: none;
}

.ecosystem-wave:nth-child(2) {
    animation-delay: 1s;
}

.ecosystem-wave:nth-child(3) {
    animation-delay: 2s;
}

.ecosystem-wave:nth-child(4) {
    animation-delay: 3s;
}

@keyframes waveExpand {
    0% {
        width: 110px;
        height: 110px;
        opacity: 0.6;
    }

    100% {
        width: 600px;
        height: 600px;
        opacity: 0;
    }
}

/* TODOS LOS ICONOS UNICOLOR - CYAN */
.ecosystem-node .node-circle i {
    color: #15b7c5 !important;
}

/* Colores de glow por servicio (manteniendo identidad pero icono unicolor) */
.node-yari-ai {
    --node-color: #15b7c5;
    --node-glow: rgba(21, 183, 197, 0.5);
}

.node-clinicas {
    --node-color: #15b7c5;
    --node-glow: rgba(21, 183, 197, 0.4);
}

.node-medicos {
    --node-color: #15b7c5;
    --node-glow: rgba(21, 183, 197, 0.4);
}

.node-laboratorios {
    --node-color: #15b7c5;
    --node-glow: rgba(21, 183, 197, 0.4);
}

.node-farmacias {
    --node-color: #15b7c5;
    --node-glow: rgba(21, 183, 197, 0.4);
}

.node-fisioterapia {
    --node-color: #15b7c5;
    --node-glow: rgba(21, 183, 197, 0.4);
}

.node-masajistas {
    --node-color: #15b7c5;
    --node-glow: rgba(21, 183, 197, 0.4);
}

.node-nutricion {
    --node-color: #15b7c5;
    --node-glow: rgba(21, 183, 197, 0.4);
}

.node-empresas {
    --node-color: #15b7c5;
    --node-glow: rgba(21, 183, 197, 0.4);
}

.node-seguros {
    --node-color: #15b7c5;
    --node-glow: rgba(21, 183, 197, 0.4);
}

/* Colores para los nuevos nodos integrados */
.node-contacto {
    --node-color: #10b981 !important;
    --node-glow: rgba(16, 185, 129, 0.5);
}
.node-contacto i {
    color: #10b981 !important;
}

.node-explorar {
    --node-color: #3b82f6 !important;
    --node-glow: rgba(59, 130, 246, 0.5);
}
.node-explorar i {
    color: #3b82f6 !important;
}

.node-portal {
    --node-color: #10b981 !important;
    --node-glow: rgba(16, 185, 129, 0.5);
}
.node-portal i {
    color: #10b981 !important;
}

.node-soporte {
    --node-color: #8b5cf6 !important;
    --node-glow: rgba(139, 92, 246, 0.5);
}
.node-soporte i {
    color: #8b5cf6 !important;
}

.node-buscador {
    --node-color: #15b7c5 !important;
    --node-glow: rgba(21, 183, 197, 0.5);
}
.node-buscador i {
    color: #15b7c5 !important;
}

/* Nodo arrastrable */
.ecosystem-node.draggable {
    cursor: grab;
}

.ecosystem-node.dragging {
    cursor: grabbing;
    z-index: 100;
}

.ecosystem-node.dragging .node-circle {
    transform: scale(1.2);
    box-shadow: 0 0 40px rgba(21, 183, 197, 0.6),
        0 20px 50px rgba(0, 0, 0, 0.4);
}

/* ==================== VERSIÓN TABLET ==================== */
@media (max-width: 1024px) {
    .node-circle {
        width: 60px;
        height: 60px;
    }

    .node-circle i {
        font-size: 1.4rem;
    }

    .ecosystem-node.node-central .node-circle {
        width: 80px;
        height: 80px;
    }

    .node-label {
        font-size: 0.6rem;
    }

    .node-tooltip {
        display: none;
    }
}

/* ==================== MOBILE: EXPERIENCIA 3D INMERSIVA ==================== */
@media (max-width: 768px) {

    /* OCULTAR el formulario tradicional en móvil */
    .page-container {
        display: none !important;
    }

    /* Ocultar floatings */
    .portal-float,
    .soporte-float,
    .lupa-float {
        display: none !important;
    }

    /* El ecosistema ocupa TODA la pantalla */
    .ecosystem-network {
        opacity: 1;
        z-index: 10;
    }

    /* MOSTRAR los nodos en móvil también */
    .ecosystem-nodes {
        display: block !important;
    }

    /* Canvas más visible */
    .ecosystem-network canvas {
        opacity: 0.7;
    }

    /* Waves visibles */
    .ecosystem-wave {
        display: block;
    }

    /* Ajustar tamaño de nodos para móvil */
    .ecosystem-node .node-circle {
        width: 55px;
        height: 55px;
    }

    .ecosystem-node .node-circle i {
        font-size: 1.3rem;
    }

    .ecosystem-node.node-central .node-circle {
        width: 75px;
        height: 75px;
    }

    .ecosystem-node.node-central .node-circle i {
        font-size: 1.8rem;
    }

    .ecosystem-node .node-label {
        font-size: 0.55rem;
        margin-top: 0.5rem;
    }

    /* Ocultar tooltip en móvil (usaremos modales) */
    .node-tooltip {
        display: none !important;
    }

    /* MOSTRAR formulario como modal cuando se hace click en Login/Registro */
    .page-container.show-form {
        display: block !important;
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        max-width: 400px !important;
        max-height: 80vh !important;
        overflow-y: auto !important;
        z-index: 1000 !important;
        border-radius: 24px !important;
        animation: modalSlideIn 0.3s ease-out;
    }

    @keyframes modalSlideIn {
        from {
            opacity: 0;
            transform: translate(-50%, -50%) scale(0.9);
        }

        to {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }
    }

    /* Overlay oscuro detrás del modal */
    .page-container.show-form::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: -1;
    }

    /* Botón para cerrar el modal y volver al ecosistema */
    .page-container.show-form .branding-section {
        display: none !important;
    }
}

/* ==================== MOBILE: Banner ya NO se usa (3D nodes son la UI) ==================== */
.mobile-ecosystem {
    display: none !important;
}