/* General body and HTML settings */
body, html {
    margin: 0;
    padding: 0;
    background: #000;
    height: 100vh;
    overflow: hidden; /* Crucial: Prevents scrollbars when content is rotated/panned */
    color: #fff;
    font-family: 'Segoe UI', sans-serif;
    perspective: 1200px; /* Crucial for creating the 3D effect for child elements within the body */
    width: 100vw; /* Ensure body takes full viewport width */
}

/* --- THE GALAXY BACKGROUND --- */
.stars-parallax {
    position: fixed;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1b2735 0%, #000 100%);
    z-index: -1;
}

#stars-back {
    width: 1px;
    height: 1px;
    box-shadow: 100px 200px #fff, 500px 600px #fff, 800px 100px #fff, 1200px 800px #fff, 1500px 300px #fff, 200px 900px #fff, 400px 100px #fff, 1800px 600px #fff;
    opacity: 0.4;
    animation: twinkle 4s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* --- THE SOLAR SYSTEM CONTAINER --- */
.solar-system {
    /* Existing .solar-system styles */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    transform: scale(0.6); /* Zoomed out to see outer planets */

    /* Additional styles for camera controls (from script3.js integration) */
    position: absolute; /* Allows it to be positioned and transformed relative to body */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.1s ease-out; /* Smooth transition for rotation/pan */
    cursor: grab; /* Indicate it's draggable */
    transform-style: preserve-3d; /* Ensures child elements (planets, orbits) also participate in the 3D space when the parent is rotated */
    transform-origin: center center; /* Ensure rotations happen around the center */
}

/* --- THE SUN --- */
.sun {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, #fff, #ff0, #ff4500);
    border-radius: 50%;
    box-shadow: 0 0 80px #ff4500;
}

/* --- ORBITS --- */
.orbit {
    position: absolute;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
}

/* Realistic Orbit Speeds & Sizes */
.mercury-orbit { width: 160px; height: 160px; animation: rot 4s linear infinite; }
.venus-orbit   { width: 220px; height: 220px; animation: rot 7s linear infinite; }
.earth-orbit   { width: 300px; height: 300px; animation: rot 10s linear infinite; }
.mars-orbit    { width: 380px; height: 380px; animation: rot 15s linear infinite; }
.jupiter-orbit { width: 550px; height: 550px; animation: rot 25s linear infinite; }
.saturn-orbit  { width: 750px; height: 750px; animation: rot 40s linear infinite; }
.uranus-orbit  { width: 900px; height: 900px; animation: rot 60s linear infinite; }
.neptune-orbit { width: 1050px; height: 1050px; animation: rot 80s linear infinite; }
.pluto-orbit   { width: 1150px; height: 1150px; animation: rot 120s linear infinite; }

/* --- PLANETS --- */
.planet {
    position: absolute;
    top: 50%;
    left: -10px; /* Adjust this value if planets are not aligned correctly in orbit */
    transform: translateY(-50%);
    border-radius: 50%;
    /* Added for script2.js */
    transition: transform 0.3s ease-out, z-index 0.3s ease-out; /* Smooth transitions for zoom */
}

/* Individual Planet Styles */
.mercury { width: 8px;  height: 8px;  background: #a5a5a5; }
.venus   { width: 15px; height: 15px; background: #e3bb76; }
.earth   { width: 16px; height: 16px; background: #2271b3; box-shadow: 0 0 10px #2271b3; }
.mars    { width: 12px; height: 12px; background: #e27b58; }
.jupiter { width: 40px; height: 40px; background: radial-gradient(circle, #d39c7e, #906048); }
.saturn  { width: 35px; height: 35px; background: #f4d47a; }
.uranus  { width: 25px; height: 25px; background: #b2d1d1; }
.neptune { width: 25px; height: 25px; background: #3f54ba; }
.pluto   { width: 6px;  height: 6px;  background: #968477; }

.rings {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 10px;
    border: 3px solid rgba(244, 212, 122, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%) rotateX(75deg);
}

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

/* UI Status Colors */
.glitch-active .orbit {
    border-color: rgba(255,0,0,0.5);
    animation-play-state: paused;
}

/* --- UI PANEL --- */
.ui-panel {
    position: fixed; /* Keep UI panel fixed */
    top: 20px;
    left: 20px;
    z-index: 2001; /* Ensure it's above the solar system and info panel */
    background-color: rgba(0,0,0,0.6);
    padding: 15px;
    border-radius: 8px;
    color: white;
}

/* Styles for the Reset View button */
#reset-view-btn {
    background-color: #555;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 10px; /* Space it from other buttons */
    transition: background-color 0.2s ease;
}
#reset-view-btn:hover {
    background-color: #777;
}


/* --- PLANET INFORMATION PANEL (from script2.js) --- */
#planet-info-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    max-width: 400px;
    width: 90%;
    z-index: 2000; /* Above everything else but below ui-panel */
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 15px;
    text-align: center;
    border: 1px solid cyan;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

#planet-info-panel.active {
    display: flex; /* Show when active */
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#planet-info-panel h2 {
    margin-top: 0;
    color: cyan;
    font-size: 1.8em;
    text-shadow: 0 0 5px cyan;
}

#planet-info-panel p {
    margin: 5px 0;
    line-height: 1.4;
}

#close-info-panel {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 15px;
    transition: background-color 0.2s ease;
}

#close-info-panel:hover {
    background-color: #0056b3;
}

/* --- PLANET ZOOM EFFECT (from script2.js) --- */
.planet.zoomed {
    box-shadow: 0 0 20px 5px rgba(0, 255, 255, 0.7); /* Glowing effect */
    border-radius: 50%; /* Ensure it stays circular if not already */
    cursor: zoom-out; /* Indicate it can be un-zoomed */
}

/* Optional: Dim the background when info panel is active */
.solar-system.info-panel-active {
    filter: brightness(0.5);
    transition: filter 0.3s ease;
}

/* --- CSS-ONLY HOVER TOOLTIP (from earlier interaction) --- */
.planet {
    position: relative; /* Needed for absolute positioning of tooltip */
}
.planet[data-name]:hover::after {
    content: attr(data-name); /* Get planet name from data-name attribute */
    position: absolute;
    bottom: 100%; /* Position above the planet */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none; /* Allows interaction with elements behind the tooltip */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.planet[data-name]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Audio Controls Styling */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

#toggle-music-btn {
    background-color: #337ab7;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

#toggle-music-btn:hover {
    background-color: #286090;
}

#volume-slider {
    width: 100px;
    -webkit-appearance: none; /* Override default CSS styles */
    appearance: none;
    height: 8px;
    background: #d3d3d3;
    outline: none;
    opacity: 0.7;
    -webkit-transition: .2s;
    transition: opacity .2s;
    border-radius: 4px;
}

#volume-slider:hover {
    opacity: 1;
}

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

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

/* Audio Controls Styling */
.audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

#toggle-music-btn {
    background-color: #337ab7;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

#toggle-music-btn:hover {
    background-color: #286090;
}

#volume-slider {
    width: 100px;
    -webkit-appearance: none; /* Override default CSS styles */
    appearance: none;
    height: 8px;
    background: #d3d3d3;
    outline: none;
    opacity: 0.7;
    -webkit-transition: .2s;
    transition: opacity .2s;
    border-radius: 4px;
}

#volume-slider:hover {
    opacity: 1;
}

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

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

