/* Constellation Page Layout */

/* Data typography variables */
:root {
    --font-data: 'JetBrains Mono', monospace;
    --color-data-primary: rgba(0, 255, 200, 0.85);
    --color-data-secondary: rgba(0, 255, 200, 0.55);
    --color-data-glow: rgba(0, 255, 200, 0.25);
}

.constellation-container {
    position: relative;
    width: 100vw;
    height: calc(100vh - 56px); /* Subtract navbar height */
    overflow: hidden;
    background:
        radial-gradient(ellipse 60% 50% at 20% 30%, rgba(80, 40, 120, 0.15), transparent),
        radial-gradient(ellipse 50% 40% at 75% 70%, rgba(30, 60, 120, 0.12), transparent),
        #0a0a14;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

.constellation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.constellation-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* Loading state */
.constellation-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: #0a0a14;
}

.constellation-loading-content {
    text-align: center;
}

.constellation-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(200, 180, 255, 0.8);
    border-radius: 50%;
    animation: constellationSpin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes constellationSpin {
    to { transform: rotate(360deg); }
}

.constellation-loading-text {
    color: rgba(200, 180, 255, 0.7);
    font-size: 14px;
    font-weight: 300;
    letter-spacing: 1px;
}

/* Empty state */
.constellation-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    color: rgba(200, 180, 255, 0.6);
}

.constellation-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.constellation-empty h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.7);
}

.constellation-empty p {
    font-size: 14px;
    opacity: 0.6;
}

/* === Minimap === */
.constellation-minimap-container {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 120px;
    height: 80px;
    z-index: 10;
    background: rgba(10, 10, 20, 0.8);
    border: 1px solid rgba(200, 180, 255, 0.15);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.constellation-minimap-container canvas {
    width: 120px;
    height: 80px;
    display: block;
}

/* Shift left when panel is open */
.constellation-panel.open ~ .constellation-minimap-container,
.constellation-container:has(.constellation-panel.open) .constellation-minimap-container {
    right: 380px;
}

.constellation-minimap-viewport {
    position: absolute;
    border: 1px solid rgba(0, 255, 200, 0.5);
    border-radius: 2px;
    pointer-events: none;
    transition: none;
}

/* Role attribute for a11y */
.constellation-minimap-container[role="img"] {
    /* Accessible but non-interactive via keyboard */
}

/* Responsive */
@media (max-width: 992px) {
    .constellation-container {
        height: calc(100vh - 56px);
    }

    .constellation-minimap-container {
        right: 16px !important; /* Don't shift on tablet/mobile */
    }
}

@media (max-width: 768px) {
    .constellation-container {
        height: calc(100vh - 56px);
        height: calc(100dvh - 56px);
    }

    .constellation-minimap-container {
        display: none; /* Hidden on mobile */
    }
}

/* === Radar Scan Loading Effect === */
@keyframes radarScan {
    0% { top: -2px; opacity: 0; }
    5% { opacity: 1; }
    95% { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}

.constellation-scan-active::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 255, 200, 0.1) 20%,
        rgba(0, 255, 200, 0.4) 50%,
        rgba(0, 255, 200, 0.1) 80%,
        transparent 100%
    );
    box-shadow: 0 0 20px rgba(0, 255, 200, 0.3), 0 0 60px rgba(0, 255, 200, 0.1);
    z-index: 5;
    pointer-events: none;
    animation: radarScan 1.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Stars hidden before scan reveals them */
.constellation-scan-active .star-node {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.constellation-scan-active .star-node.scan-revealed {
    opacity: 1;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .constellation-loading-spinner {
        animation: none;
        border-top-color: rgba(200, 180, 255, 0.4);
    }

    .constellation-scan-active::after {
        animation: none;
        display: none;
    }

    .constellation-scan-active .star-node {
        opacity: 1;
        transition: none;
    }
}
