/* Ecosistema de Inteligencias - Glassmorphism Design */
.ecosystem-section {
    padding: 80px 0;
    background: radial-gradient(circle at center, #0a3d5c 0%, #041e2a 100%);
    position: relative;
    overflow: hidden;
    color: var(--color-white);
}

.ecosystem-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 140%;
    background: url('../images/neural-pattern.svg');
    opacity: 0.05;
    animation: rotateBackground 100s linear infinite;
    pointer-events: none;
}

@keyframes rotateBackground {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ecosystem-header {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
    z-index: 2;
}

.ecosystem-header .section-title {
    color: var(--color-white);
    margin-bottom: 20px;
}

.ecosystem-header .section-subtitle {
    color: rgba(255, 255, 255, 0.8);
    max-width: 800px;
    margin: 0 auto;
}

/* --- Hub & Spoke Layout Container --- */
.hub-spoke-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 40px;
    width: 100%;
    position: relative;
    z-index: 2;
}

/* Nodos (Columnas de IAs) */
.nodes-column {
    display: flex;
    flex-direction: column;
    gap: 55px;
    flex: 1;
    z-index: 2;
}

.left-nodes {
    align-items: flex-end;
}

.right-nodes {
    align-items: flex-start;
}

/* --- Hub Central (Orquestador) --- */
.orchestrator-core-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    flex: 0 0 220px;
}

.orchestrator-core {
    width: 150px;
    height: 150px;
    background: radial-gradient(circle at center, var(--color-secondary) 0%, #a85800 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 50px rgba(255, 140, 0, 0.4), inset 0 0 20px rgba(0,0,0,0.5);
    position: relative;
    margin-bottom: 20px;
    animation: pulseCore 3s ease-in-out infinite;
    z-index: 3;
}

.core-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--color-secondary);
    animation: expandRing 3s ease-out infinite;
    opacity: 0;
    z-index: -1;
}

@keyframes pulseCore {
    0%, 100% { transform: scale(1); box-shadow: 0 0 30px rgba(255, 140, 0, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 0 60px rgba(255, 140, 0, 0.8); }
}

@keyframes expandRing {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.8); opacity: 0; }
}

.orchestrator-core img {
    width: 55%;
    height: auto;
    filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.core-label {
    color: var(--color-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    text-align: center;
    margin-top: 10px;
    text-shadow: 0 0 10px rgba(255, 140, 0, 0.5);
}

/* --- Tarjetas de Inteligencia (Nodos) --- */
.intelligence-card {
    background: rgba(10, 25, 40, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px 24px;
    width: 100%;
    max-width: 320px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    /* overflow: visible for the connecting lines to show */
    z-index: 2;
    /* Grid for compact layout without modifying HTML */
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 12px;
}

/* Specific Grid templates depending on column side */
.right-nodes .intelligence-card {
    grid-template-columns: auto 1fr;
    grid-template-areas: 
        "icon title"
        "desc desc"
        "stats stats";
    text-align: left;
}

.left-nodes .intelligence-card {
    grid-template-columns: 1fr auto;
    grid-template-areas: 
        "title icon"
        "desc desc"
        "stats stats";
    text-align: right;
}

/* Líneas conectores (Spokes) */
.intelligence-card::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 55px;
    height: 2px;
    background: linear-gradient(90deg, rgba(255, 140, 0, 0) 0%, rgba(255, 140, 0, 0.8) 50%, rgba(255, 140, 0, 0) 100%);
    opacity: 0.2;
    z-index: -1;
    pointer-events: none;
    transition: all 0.3s ease;
}

.left-nodes .card-icon-wrapper {
    margin-left: auto;
    margin-right: 0;
}

.left-nodes .stat-item {
    justify-content: flex-end;
}

.left-nodes .intelligence-card::after {
    right: -55px;
}

.right-nodes .intelligence-card::after {
    left: -55px;
}

/* Curvatura / Efecto de Encerrar el Logo */
.left-nodes .intelligence-card:nth-child(1) {
    margin-right: -45px;
    /* Eliminar margin-bottom extra para que el gap de 30px mande */
}
.left-nodes .intelligence-card:nth-child(3) {
    margin-right: -45px;
    /* Eliminar margin-top extra para que el gap de 30px mande */
}

.left-nodes .intelligence-card:nth-child(1)::after,
.left-nodes .intelligence-card:nth-child(3)::after {
    width: 40px;
    right: -40px;
}

.right-nodes .intelligence-card:nth-child(1) {
    margin-left: -45px;
    /* Eliminar margin-bottom extra */
}
.right-nodes .intelligence-card:nth-child(3) {
    margin-left: -45px;
    /* Eliminar margin-top extra */
}

.right-nodes .intelligence-card:nth-child(1)::after,
.right-nodes .intelligence-card:nth-child(3)::after {
    width: 40px;
    left: -40px;
}

.intelligence-card:hover {
    transform: translateY(-5px) !important; /* overrides any structural transforms */
    background: rgba(15, 30, 50, 0.85);
    border-color: rgba(255, 140, 0, 0.4);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4), 0 0 20px rgba(255, 140, 0, 0.05) inset;
}

/* Brillo en la línea al hacer hover en el nodo */
.intelligence-card:hover::after {
    opacity: 1;
    box-shadow: 0 0 10px var(--color-secondary);
    width: 70px; /* Se estira hacia el centro */
}

/* Ajustes de hover para las tarjetas curvas por sobre-escritura !important */
.left-nodes .intelligence-card:nth-child(1):hover::after,
.left-nodes .intelligence-card:nth-child(3):hover::after {
    width: 55px;
    right: -55px;
}

.right-nodes .intelligence-card:nth-child(1):hover::after,
.right-nodes .intelligence-card:nth-child(3):hover::after {
    width: 55px;
    left: -55px;
}


/* Iconos */
.card-icon-wrapper {
    grid-area: icon;
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0; /* Override old margin */
    font-size: 18px;
    color: var(--color-secondary);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.intelligence-card:hover .card-icon-wrapper {
    background: var(--color-secondary);
    color: var(--color-white);
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.5);
    border-color: var(--color-secondary);
}

.intelligence-card h3 {
    grid-area: title;
    font-size: 1.25rem;
    margin-bottom: 0;
    align-self: center;
    color: var(--color-white);
    font-weight: 600;
}

.intelligence-card p {
    grid-area: desc;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.45;
    margin-bottom: 0;
}

/* Métricas / Criterios */
.card-stats {
    grid-area: stats;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.stat-item i {
    color: var(--color-secondary);
    font-size: 0.9rem;
}

.stat-value {
    font-weight: 700;
    color: var(--color-white);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* --- Mobile Adjustments --- */
@media (max-width: 1024px) {
    .hub-spoke-layout {
        flex-direction: column;
        gap: 60px;
    }
    
    .orchestrator-core-container {
        order: -1; /* Poner el Core arriba en móvil */
        flex: 0 0 auto;
    }

    .nodes-column {
        width: 100%;
        align-items: center;
        gap: 40px;
    }

    .intelligence-card {
        text-align: center !important;
        max-width: 100%;
        grid-template-columns: 1fr !important;
        grid-template-areas: 
            "icon"
            "title"
            "desc"
            "stats" !important;
        gap: 15px;
    }

    .card-icon-wrapper {
        margin: 0 auto !important;
    }

    /* Override any specific grid row behaviors for left/right nodes */
    .left-nodes .intelligence-card,
    .right-nodes .intelligence-card {
        text-align: center;
        grid-template-columns: 1fr;
        grid-template-areas: 
            "icon"
            "title"
            "desc"
            "stats";
    }

    .left-nodes .card-icon-wrapper,
    .right-nodes .card-icon-wrapper {
        margin: 0 auto !important;
    }

    .stat-item {
        justify-content: center !important;
    }
    
    /* Remover líneas de conexión laterales en móvil */
    .intelligence-card::after {
        display: none;
    }
}
