/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    user-select: none;
}

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

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

.loading-content h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #333;
    border-top: 3px solid #4facfe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading-text {
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Main Game Container */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#solar-system-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

/* Control Panels */
.control-panel {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    pointer-events: auto;
}

#nav-controls {
    top: 20px;
    left: 20px;
    min-width: 200px;
}

/* Breadcrumb Navigation */
.breadcrumb {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 0.9rem;
}

.breadcrumb-item {
    cursor: pointer;
    transition: color 0.2s;
}

.breadcrumb-item.active {
    color: #4facfe;
    font-weight: bold;
}

.breadcrumb-item:not(.active) {
    color: #ccc;
}

.breadcrumb-item:not(.active):hover {
    color: #4facfe;
}

.breadcrumb-arrow {
    color: #666;
    margin: 0 0.5rem;
}

.nav-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-btn, .zoom-btn {
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.nav-btn:hover, .zoom-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(79, 172, 254, 0.4);
}

#zoom-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Information Panel */
#info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 350px;
    max-height: 80vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    overflow-y: auto;
    pointer-events: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#info-panel.hidden {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(45deg, rgba(79, 172, 254, 0.1), rgba(0, 242, 254, 0.1));
}

#planet-name {
    font-size: 1.5rem;
    color: #4facfe;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

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

.info-content {
    padding: 1.5rem;
}

.habitability-section h3,
.planet-stats h3,
.habitability-factors h3 {
    color: #4facfe;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Habitability Score */
.habitability-score {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.score-bar {
    flex: 1;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4757, #ffa502, #2ed573);
    transition: width 0.5s ease;
    border-radius: 10px;
}

#hab-score-text {
    font-weight: bold;
    font-size: 1.1rem;
}

/* Planet Statistics */
.stat-grid {
    display: grid;
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
    color: #ccc;
}

.stat-value {
    color: #fff;
    font-weight: bold;
}

/* Survival Factors */
#survival-factors {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.factor-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid;
}

.factor-item.good { border-left-color: #2ed573; }
.factor-item.moderate { border-left-color: #ffa502; }
.factor-item.poor { border-left-color: #ff4757; }

.factor-icon {
    font-size: 1.2rem;
}

.factor-text {
    flex: 1;
}

.factor-label {
    font-weight: bold;
    display: block;
    margin-bottom: 0.25rem;
}

.factor-description {
    font-size: 0.9rem;
    color: #ccc;
}

/* Explore Section */
.explore-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.explore-btn {
    width: 100%;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border: none;
    color: white;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.explore-btn:hover {
    background: linear-gradient(45deg, #ee5a24, #ff6b6b);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

/* Search Panel */
#search-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    pointer-events: auto;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#search-panel.hidden {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    pointer-events: none;
}

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

#search-input {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    margin: 1rem 1.5rem;
    width: calc(100% - 3rem);
}

#search-input::placeholder {
    color: #ccc;
}

#search-input:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 10px rgba(79, 172, 254, 0.3);
}

#search-results {
    max-height: 200px;
    overflow-y: auto;
    padding: 0 1.5rem 1.5rem;
}

.search-result {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-result:hover {
    background: rgba(79, 172, 254, 0.2);
}

/* Instructions */
#instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.info-text {
    font-size: 0.9rem;
    color: #ccc;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    #nav-controls {
        top: 10px;
        left: 10px;
        right: 10px;
        width: auto;
    }
    
    #info-panel {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
    }
    
    #search-panel {
        width: 90vw;
        max-width: 400px;
    }
    
    #instructions {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        font-size: 0.8rem;
    }
}


/* Utility Classes */
.hidden {
    display: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(79, 172, 254, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 172, 254, 0.7);
}
