/* Galaxy Explorer Styles */

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0d14 0%, #1a1b3e 50%, #2c1810 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loading-content {
    text-align: center;
    color: #fff;
    max-width: 400px;
    padding: 2rem;
}

.loading-animation {
    margin-bottom: 2rem;
}

.planet-loader {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    position: relative;
}

.orbit {
    width: 80px;
    height: 80px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    position: relative;
    animation: orbit 2s linear infinite;
}

.planet {
    width: 12px;
    height: 12px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    border-radius: 50%;
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
}

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

.loading-content h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.loading-content p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
}

.loading-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4, #44a08d);
    width: 0%;
    transition: width 0.3s ease;
}

/* Galaxy Container */
.galaxy-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 120px); /* Account for header (~80px) and some padding */
    min-height: 600px;
    overflow: hidden;
    background: #000;
    margin-top: 20px;
    /* Ensure this container captures scroll events */
    touch-action: none;
    overscroll-behavior: contain;
}

#galaxyCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* UI Controls */
.galaxy-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.galaxy-ui > * {
    pointer-events: auto;
}

/* Top Controls */
.top-controls {
    position: absolute;
    top: 80px;
    right: 2rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.control-group {
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.control-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn svg {
    width: 20px;
    height: 20px;
}

.control-btn.active {
    background: rgba(76, 205, 196, 0.3);
    border-color: rgba(76, 205, 196, 0.5);
}

/* Audio Controls */
.audio-controls {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.audio-btn {
    position: relative;
}

.volume-slider {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4ecdc4;
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4ecdc4;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Navigation Hint */
.navigation-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 400px;
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

.hint-content {
    color: #fff;
}

.hint-icon {
    margin-bottom: 1rem;
}

.hint-icon svg {
    width: 32px;
    height: 32px;
    color: #4ecdc4;
}

.navigation-hint p {
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
}

.dismiss-hint {
    background: #4ecdc4;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
}

.dismiss-hint:hover {
    background: #44a08d;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Planet Information Panel */
.planet-info-panel {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 400px;
    max-height: 80vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-50%) translateX(-20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.planet-info-panel.active {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h3 {
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    margin: 0;
}

.close-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.close-btn svg {
    width: 16px;
    height: 16px;
}

.panel-content {
    padding: 1.5rem;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

.planet-image {
    margin-bottom: 1.5rem;
    text-align: center;
}

.planet-image img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    max-height: 200px;
    object-fit: cover;
}

.detail-group {
    margin-bottom: 1.5rem;
}

.detail-group h4 {
    color: #4ecdc4;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-family: 'Space Grotesk', sans-serif;
}

.info-content {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.info-content p {
    margin-bottom: 0.5rem;
}

.info-content ul {
    padding-left: 1rem;
    margin-bottom: 0.5rem;
}

.info-content li {
    margin-bottom: 0.25rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .top-controls {
        top: 70px;
        right: 1rem;
        gap: 0.5rem;
    }
    
    .control-group {
        padding: 0.25rem;
    }
    
    .control-btn {
        width: 36px;
        height: 36px;
    }
    
    .control-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .audio-controls {
        padding: 0.25rem;
        gap: 0.5rem;
    }
    
    .volume-slider {
        width: 60px;
    }
    
    .planet-info-panel {
        left: 1rem;
        right: 1rem;
        width: auto;
        max-height: 70vh;
    }
    
    .navigation-hint {
        left: 1rem;
        right: 1rem;
        transform: none;
        max-width: none;
        bottom: 1rem;
    }
    
    .panel-header {
        padding: 1rem;
    }
    
    .panel-content {
        padding: 1rem;
        max-height: calc(70vh - 70px);
    }
}

@media (max-width: 480px) {
    .top-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .planet-info-panel {
        top: 1rem;
        bottom: 1rem;
        transform: none;
        max-height: none;
        height: auto;
        display: flex;
        flex-direction: column;
    }
    
    .panel-content {
        flex: 1;
        max-height: none;
    }
}

/* Scrollbar Styling */
.panel-content::-webkit-scrollbar {
    width: 6px;
}

.panel-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb {
    background: rgba(76, 205, 196, 0.5);
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 205, 196, 0.7);
}

/* Hide loading screen when loaded */
.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Modal Backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

/* Planet Info Panel */
.planet-info-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 2px solid rgba(76, 205, 196, 0.5);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    pointer-events: auto;
}

.planet-info-panel.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.planet-info-header {
    background: linear-gradient(135deg, rgba(76, 205, 196, 0.2), rgba(68, 160, 141, 0.2));
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(76, 205, 196, 0.3);
}

.planet-info-header h2 {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.close-btn svg {
    width: 20px;
    height: 20px;
}

.planet-info-content {
    padding: 1.5rem;
    max-height: calc(70vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    color: #fff;
    /* Ensure scrolling works on all devices */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.planet-description {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(76, 205, 196, 0.1);
    border-left: 4px solid #4ecdc4;
    border-radius: 0 8px 8px 0;
}

.planet-description p {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.planet-facts,
.planet-missions,
.planet-fun-fact {
    margin-bottom: 1.5rem;
}

.planet-facts h3,
.planet-missions h3,
.planet-fun-fact h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.planet-facts ul,
.planet-missions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.planet-facts li,
.planet-missions li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    /* Ensure text is selectable and doesn't interfere with scrolling */
    user-select: text;
}

.planet-facts li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #4ecdc4;
    font-weight: bold;
}

.planet-missions li:before {
    content: "🚀";
    position: absolute;
    left: 0;
}

.planet-facts li:last-child,
.planet-missions li:last-child {
    border-bottom: none;
}

.planet-fun-fact {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(255, 165, 0, 0.1));
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 165, 0, 0.3);
    margin-bottom: 2rem; /* Add extra space at bottom for easier scrolling */
}

.planet-fun-fact p {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
}

/* Scrollbar for planet info */
.planet-info-content::-webkit-scrollbar {
    width: 8px;
}

.planet-info-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin: 4px;
}

.planet-info-content::-webkit-scrollbar-thumb {
    background: rgba(76, 205, 196, 0.6);
    border-radius: 4px;
    border: 1px solid rgba(76, 205, 196, 0.2);
}

.planet-info-content::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 205, 196, 0.8);
}

/* Firefox scrollbar */
.planet-info-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(76, 205, 196, 0.6) rgba(255, 255, 255, 0.1);
}

/* Mobile responsive for planet info */
@media (max-width: 768px) {
    .planet-info-panel {
        width: 95%;
        max-height: 85vh;
        top: 45%;
    }
    
    .planet-info-header {
        padding: 1rem;
    }
    
    .planet-info-header h2 {
        font-size: 1.5rem;
    }
    
    .planet-info-content {
        padding: 1rem;
        max-height: calc(85vh - 100px);
        /* Ensure touch scrolling works properly on mobile */
        touch-action: pan-y;
    }
}

/* Galaxy-specific main content adjustments */
.galaxy-container ~ .footer {
    position: relative;
    z-index: 5;
}