/* Constellation Star Effects */

/* Star node group */
.star-node {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.star-node.dimmed {
    opacity: 0.15;
}

.star-node.highlighted {
    opacity: 1;
}

/* Outer glow */
.star-glow {
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

.star-node:hover .star-glow,
.star-node.selected .star-glow {
    opacity: 0.8;
}

/* Core star */
.star-core {
    transition: r 0.2s ease;
}

.star-node:hover .star-core {
    r: attr(r) + 1;
}

/* Twinkle points (4-point star polygon) */
.star-twinkle {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.star-node:hover .star-twinkle,
.star-node.selected .star-twinkle {
    opacity: 0.8;
}

/* Pulse animation for selected stars */
.star-pulse {
    opacity: 0;
}

.star-node.selected .star-pulse {
    animation: starBreathing 3s ease-in-out infinite;
}

@keyframes starBreathing {
    0%, 100% {
        opacity: 0.2;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

/* Random twinkle animation for ambient nodes */
.star-ambient-twinkle {
    animation: ambientTwinkle var(--twinkle-duration, 3s) ease-in-out var(--twinkle-delay, 0s) infinite;
}

@keyframes ambientTwinkle {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Edge lines */
.constellation-edge {
    stroke: rgba(200, 180, 255, 0.15);
    stroke-width: 1;
    fill: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.constellation-edge.visible {
    opacity: 1;
}

.constellation-edge.active {
    stroke: rgba(200, 180, 255, 0.5);
    stroke-width: 1.5;
}

.constellation-edge.mentor_mentee {
    stroke: rgba(255, 215, 0, 0.4);
}

.constellation-edge.coaching_tree {
    stroke: rgba(100, 200, 255, 0.4);
}

.constellation-edge.shared_staff {
    stroke: rgba(180, 180, 180, 0.3);
    stroke-dasharray: 4 4;
}

/* Edge animation on selection */
/* Edge hidden by type filter */
.constellation-edge.type-hidden {
    display: none;
}

.constellation-edge.animating {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: edgeDraw 0.4s ease-out forwards;
}

@keyframes edgeDraw {
    to { stroke-dashoffset: 0; }
}

/* Hover tooltip */
.constellation-tooltip {
    position: absolute;
    padding: 8px 12px;
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(200, 180, 255, 0.2);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 13px;
    pointer-events: none;
    z-index: 50;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.constellation-tooltip.visible {
    opacity: 1;
}

.constellation-tooltip .tooltip-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    color: #fff;
}

.constellation-tooltip .tooltip-team {
    color: rgba(200, 180, 255, 0.7);
    font-size: 12px;
}

.constellation-tooltip .tooltip-record {
    font-family: var(--font-data, 'JetBrains Mono', monospace);
    color: var(--color-data-secondary, rgba(0, 255, 200, 0.55));
    font-size: 11px;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

/* === Semantic Zoom Labels === */
.star-label {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    text-anchor: middle;
    font-family: var(--font-data, 'JetBrains Mono', monospace);
}

.star-label-name {
    fill: rgba(255, 255, 255, 0.9);
    font-size: 10px;
    font-weight: 600;
}

.star-label-team {
    fill: rgba(200, 180, 255, 0.6);
    font-size: 8px;
    font-weight: 400;
}

.star-label-record {
    fill: var(--color-data-secondary, rgba(0, 255, 200, 0.55));
    font-size: 8px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Zoom-level reveals */
.constellation-svg.zoom-level-1 .star-label-name {
    opacity: 1;
}

.constellation-svg.zoom-level-2 .star-label-name,
.constellation-svg.zoom-level-2 .star-label-team {
    opacity: 1;
}

.constellation-svg.zoom-level-3 .star-label-name,
.constellation-svg.zoom-level-3 .star-label-team,
.constellation-svg.zoom-level-3 .star-label-record {
    opacity: 1;
}

/* Dimmed nodes dim labels too */
.star-node.dimmed .star-label {
    opacity: 0.08 !important;
}

/* Out-of-view nodes hide labels for performance */
.star-node.out-of-view .star-label {
    opacity: 0 !important;
    transition: none;
}

/* === Filtered-out state (for Task 9 formation transitions) === */
.star-node.filtered-out {
    opacity: 0.08;
    transition: opacity 0.6s ease;
}

/* === Refresh pulse for edges === */
@keyframes refreshPulse {
    0% { stroke-opacity: 0.15; }
    50% { stroke-opacity: 0.6; }
    100% { stroke-opacity: 0.15; }
}

.constellation-edge.refresh-pulse {
    animation: refreshPulse 1s ease-in-out;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .star-node.selected .star-pulse,
    .star-ambient-twinkle {
        animation: none;
    }

    .constellation-edge.animating {
        animation: none;
        stroke-dashoffset: 0;
    }

    .constellation-edge.refresh-pulse {
        animation: none;
    }

    .star-glow,
    .star-core,
    .star-twinkle,
    .constellation-edge,
    .constellation-tooltip {
        transition: none;
    }

    .star-label {
        transition: none;
    }

    .star-node.filtered-out {
        transition: none;
    }
}
