/* --- Ecosystem Animation Styles --- */
.ecosystem-wrapper {
    width: 100%;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: none !important;
    transform: none !important;
    /* Ensure tooltips aren't clipped */
    overflow: visible;
    z-index: 5;
}

.ecosystem-container {
    width: 500px;
    height: 500px;
    position: relative;
    transform-origin: center center;
}

@media (min-width: 1200px) {
    .ecosystem-container {
        transform: scale(1);
    }
}

@media (max-width: 992px) {
    .ecosystem-wrapper {
        height: 450px;
    }

    .ecosystem-container {
        transform: scale(0.85);
    }
}

@media (max-width: 768px) {
    .ecosystem-wrapper {
        min-height: 480px;
        /* Increased height to allow room for nodes */
        margin-top: 20px;
        margin-bottom: 20px;
        width: 100%;
        max-width: 100vw;
        overflow: hidden;
        /* Changed from clip to hidden to prevent scrollbars */
        position: relative;
    }

    .ecosystem-container {
        position: absolute;
        /* Added to ensure centering works with left/top 50% */
        left: 50%;
        top: 50%;
        margin-left: 0;
        transform: translate(-50%, -50%) scale(0.60);
        /* Decreased from 0.75 to 0.60 for tablet/large phone */
    }

    /* --- Mobile Tooltip Logic: AWAY FROM CENTER --- */

    /* General Mobile Reset */
    .node-tooltip {
        width: 150px !important;
        /* Smaller width for mobile */
        font-size: 0.75rem !important;
        padding: 8px !important;
        text-align: center !important;
        white-space: normal !important;
    }

    /* TOP HALF NODES (open UP) */
    /* Internships (5), Students (1), Professionals (2) are generally upper half */

    .node-1 .node-tooltip,
    .node-2 .node-tooltip,
    .node-5 .node-tooltip {
        top: auto !important;
        bottom: 80px !important;
        /* Force ABOVE the node */
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
    }

    /* BOTTOM HALF NODES (open DOWN) */
    /* Jobs (4), Business (3) */
    .node-3 .node-tooltip,
    .node-4 .node-tooltip {
        bottom: auto !important;
        top: 80px !important;
        /* Force BELOW the node */
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
    }

}

@media (max-width: 480px) {
    .ecosystem-container {
        /* Further reduced scale to prevent any overlap */
        transform: translate(-50%, -50%) scale(0.55);
    }

    /* Adjust text size specifically for very small screens */
    .eco-center-title {
        font-size: 1.2rem;
    }

    .eco-center-subtitle {
        font-size: 0.7rem;
    }

    /* Push text labels out slightly to avoid overlap */
    .node-label {
        bottom: -35px;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }
}

/* Center Node */
.eco-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 0 30px rgba(232, 67, 147, 0.4);
    animation: ecoPulse 3s infinite ease-in-out;
}

.eco-center-content {
    text-align: center;
    color: white;
    z-index: 2;
}

.eco-center-title {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.eco-center-subtitle {
    display: block;
    font-size: 0.8rem;
    opacity: 0.9;
    letter-spacing: 1px;
    margin-top: 4px;
}

.eco-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid var(--brand-orange);
    opacity: 0;
    animation: ecoRipple 3s infinite;
}

@keyframes ecoPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 30px rgba(232, 67, 147, 0.4);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.05);
        box-shadow: 0 0 50px rgba(232, 67, 147, 0.6);
    }
}

@keyframes ecoRipple {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.8;
        border-width: 2px;
    }

    100% {
        width: 250%;
        height: 250%;
        opacity: 0;
        border-width: 0px;
    }
}

/* Connecting Lines */
.eco-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.eco-line {
    stroke: #4fd1c5;
    stroke-width: 2;
    stroke-dasharray: 5, 5;
    opacity: 0.6;
}

body.dark-mode .eco-line {
    stroke: #4fd1c5;
    opacity: 0.4;
}

/* Particles */
.eco-particle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background-color: #fff;
    border: 2px solid var(--brand-pink);
    border-radius: 50%;
    z-index: 8;
    pointer-events: none;
    opacity: 0;
    box-shadow: 0 0 10px var(--brand-pink);
    animation: particleTravel 3s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes particleTravel {
    0% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-160px);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-170px);
        opacity: 0;
    }
}

.eco-particle:nth-child(1) {
    animation-delay: 0s;
}

.eco-particle:nth-child(2) {
    animation-delay: 0.6s;
}

.eco-particle:nth-child(3) {
    animation-delay: 1.2s;
}

.eco-particle:nth-child(4) {
    animation-delay: 1.8s;
}

.eco-particle:nth-child(5) {
    animation-delay: 2.4s;
}


/* Satellite Nodes */
.eco-node {
    position: absolute;
    width: 70px;
    height: 70px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 11;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid transparent;
}

.node-1 {
    top: 45px;
    left: 215px;
}

.node-2 {
    top: 162px;
    left: 376px;
}

.node-3 {
    top: 352px;
    left: 315px;
}

.node-4 {
    top: 352px;
    left: 115px;
}

.node-5 {
    top: 162px;
    left: 54px;
}


.node-icon {
    font-size: 1.5rem;
    color: var(--brand-purple);
    transition: color 0.3s ease;
}

.node-label {
    position: absolute;
    bottom: -30px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Hover States */
.eco-node:hover {
    transform: scale(1.15);
    border-color: var(--brand-pink);
    box-shadow: 0 0 20px rgba(232, 67, 147, 0.3);
    z-index: 20;
}

.eco-node:hover .node-icon {
    color: var(--brand-pink);
    transform: scale(1.1);
}

.eco-node:hover .node-label {
    color: var(--brand-pink);
}

/* Tooltips - Default (Desktop) */
.node-tooltip {
    position: absolute;
    /* Default position overridden below for specific nodes */
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 220px;
    background: rgba(255, 255, 255, 1);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #eee;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    text-align: left;
    z-index: 100;
}

/* --- Desktop Logic (Mobile uses overrides above) --- */

/* Node 1 (Students - Top): Open RIGHT (Side) as requested */
.node-1 .node-tooltip {
    bottom: auto;
    top: 50%;
    left: 85px;
    /* Side */
    transform: translateY(-50%) translateX(10px);
}

.node-1:hover .node-tooltip {
    transform: translateY(-50%) translateX(0);
}

/* Node 2 (Professionals - Top Right): Open RIGHT */
.node-2 .node-tooltip {
    bottom: auto;
    top: 50%;
    left: 85px;
    transform: translateY(-50%) translateX(10px);
}

.node-2:hover .node-tooltip {
    transform: translateY(-50%) translateX(0);
}

/* Node 3 (Business - Bottom Right): Open BOTTOM */
.node-3 .node-tooltip {
    bottom: auto;
    top: 85px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
}

.node-3:hover .node-tooltip {
    transform: translateX(-50%) translateY(0);
}

/* Node 4 (Jobs - Bottom Left): Open BOTTOM */
.node-4 .node-tooltip {
    bottom: auto;
    top: 85px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
}

.node-4:hover .node-tooltip {
    transform: translateX(-50%) translateY(0);
}

/* Node 5 (Internships - Top Left): Open LEFT */
.node-5 .node-tooltip {
    bottom: auto;
    top: 50%;
    right: 85px;
    /* Left of node */
    left: auto;
    transform: translateY(-50%) translateX(10px);
}

.node-5:hover .node-tooltip {
    transform: translateY(-50%) translateX(0);
}


body.dark-mode .eco-node {
    background: #2a2a2a;
    border-color: #333;
}

body.dark-mode .node-tooltip {
    background: #1e1e1e;
    border-color: #333;
    color: white;
}

.eco-node:hover .node-tooltip {
    opacity: 1;
    visibility: visible;
}

.tooltip-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--brand-purple);
    font-weight: 700;
    font-size: 1rem;
}

.node-tooltip p {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

body.dark-mode .node-tooltip p {
    color: #ccc;
}

.tooltip-tag {
    display: inline-block;
    background: var(--primary-gradient);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Dark Mode - Node Labels */
body.dark-mode .node-label {
    background: rgba(30, 30, 30, 0.95);
    color: #e0e0e0;
    border: 1px solid #444;
}

body.dark-mode .eco-node:hover .node-label {
    color: var(--brand-pink);
}

body.dark-mode .node-icon {
    color: var(--brand-purple-light, #a78bfa);
}