/* SEO and Accessibility Styles */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus indicators for accessibility */
*:focus {
    outline: 2px solid #4fc3f7;
    outline-offset: 2px;
}

button:focus,
input:focus,
a:focus {
    outline: 2px solid #4fc3f7;
    outline-offset: 2px;
}

/* Skip to content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #4fc3f7;
    color: #000;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 6px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    overflow: hidden;
    color: #fff;
    cursor: grab;
}

body.grabbing {
    cursor: grabbing;
}

/* Canvas Styles */
#solarSystemCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at center, #0f0f23 0%, #000 100%);
}

/* UI Overlay */
#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    font-size: 14px;
}

/* Info Panel (Top) */
#info-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 30px;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.info-section h3 {
    color: #64b5f6;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 600;
}

#current-time {
    font-family: 'Courier New', monospace;
    color: #fff;
    font-size: 14px;
}

#oumuamua-info div {
    margin: 4px 0;
    color: #e0e0e0;
}

#oumuamua-info span {
    color: #4fc3f7;
    font-weight: 600;
}

/* Control Panel (Right) */
#control-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    min-width: 220px;
    pointer-events: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.control-group {
    margin-bottom: 20px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group h4 {
    color: #64b5f6;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

/* Buttons */
button {
    background: linear-gradient(145deg, #2196f3, #1976d2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    margin: 4px 8px 4px 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

button:hover {
    background: linear-gradient(145deg, #42a5f5, #2196f3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

/* Slider */
.slider-group {
    margin: 12px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-group label {
    color: #e0e0e0;
    font-weight: 500;
    min-width: 50px;
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2196f3;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.5);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2196f3;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.5);
}

#speed-display {
    color: #4fc3f7;
    font-weight: 600;
    min-width: 35px;
}

/* Checkboxes */
.checkbox-label {
    display: flex;
    align-items: center;
    margin: 8px 0;
    cursor: pointer;
    color: #e0e0e0;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: #2196f3;
    cursor: pointer;
}

/* Planet Tooltip */
#planet-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 12px;
    min-width: 200px;
    pointer-events: none;
    z-index: 20;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    transform: translate(-50%, -100%);
    margin-top: -10px;
}

#planet-tooltip h4 {
    color: #64b5f6;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 600;
}

#planet-tooltip div {
    margin: 4px 0;
    color: #e0e0e0;
}

#planet-tooltip span {
    color: #4fc3f7;
    font-weight: 600;
}

.tooltip.hidden {
    display: none;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #0f0f23 0%, #000 100%);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    pointer-events: auto;
}

.loading-content {
    text-align: center;
    max-width: 400px;
}

.loading-content h2 {
    color: #64b5f6;
    margin-bottom: 30px;
    font-size: 24px;
    font-weight: 600;
}

.loading-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 20px;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #2196f3, #64b5f6);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.5);
}

#loading-text {
    color: #e0e0e0;
    font-size: 16px;
}

/* Instructions */
#instructions {
    display: none; /* Hidden by default for cleaner experience */
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    max-width: 300px;
    pointer-events: auto;
    z-index: 15;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#instructions h3 {
    color: #64b5f6;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

#instructions ul {
    list-style: none;
    margin-bottom: 15px;
}

#instructions li {
    margin: 8px 0;
    color: #e0e0e0;
    font-size: 14px;
}

#instructions strong {
    color: #4fc3f7;
}

#hide-instructions {
    width: 100%;
    margin-top: 10px;
}

.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    #info-panel {
        position: absolute;
        top: 10px;
        left: 10px;
        right: 10px;
        flex-direction: column;
        gap: 8px;
        max-width: none;
        padding: 12px;
        font-size: 11px;
        transform: translateY(0);
        transition: transform 0.3s ease;
    }
    
    #info-panel.minimized {
        transform: translateY(-85%);
    }
    
    #info-panel::after {
        content: "👁️ Hide Info";
        display: block;
        text-align: center;
        color: #64b5f6;
        font-weight: bold;
        padding: 8px;
        cursor: pointer;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        margin: 10px -12px -12px -12px;
        background: rgba(33, 150, 243, 0.2);
        font-size: 10px;
    }
    
    #info-panel.minimized::after {
        content: "👁️ Show Info";
    }
    
    .info-section {
        flex: 1;
        min-width: 0;
    }
    
    .info-section h3 {
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    #control-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: none;
        padding: 15px;
        background: rgba(0, 0, 0, 0.95);
        transform: translateY(0);
        transition: transform 0.3s ease;
        border-top: 1px solid rgba(79, 195, 247, 0.3);
        border-radius: 15px 15px 0 0;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.6);
    }
    
    #control-panel.minimized {
        transform: translateY(calc(100% - 40px));
    }
    
    #control-panel::before {
        content: "⬆ Controls ⬆";
        display: block;
        text-align: center;
        color: #64b5f6;
        font-weight: bold;
        padding: 10px;
        cursor: pointer;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        margin: -15px -15px 15px -15px;
        background: rgba(33, 150, 243, 0.2);
    }
    
    #control-panel.minimized::before {
        content: "⬇ Show Controls ⬇";
        margin-bottom: -15px;
    }
    
    .control-group {
        margin-bottom: 12px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .control-group h4 {
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    .slider-group {
        flex-direction: column;
        gap: 5px;
        align-items: stretch;
    }
    
    .slider-group label {
        min-width: auto;
    }
    
    .checkbox-label {
        font-size: 12px;
        margin: 4px 0;
    }
    
    button {
        padding: 6px 12px;
        font-size: 12px;
        margin: 2px 4px 2px 0;
    }
    
    #instructions {
        display: none !important; /* Hide instructions completely on mobile */
    }
    
    #instructions ul {
        margin-bottom: 8px;
    }
    
    #instructions li {
        margin: 3px 0;
        font-size: 10px;
    }
    
    #instructions h3 {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    #hide-instructions {
        padding: 4px 8px;
        font-size: 10px;
        margin-top: 5px;
    }
    
    /* Mobile tooltip adjustments */
    #planet-tooltip {
        max-width: 250px;
        font-size: 11px;
        padding: 8px;
    }
    
    #planet-tooltip h4 {
        font-size: 13px;
        margin-bottom: 5px;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(33, 150, 243, 0.7);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(33, 150, 243, 0.9);
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.fade-out {
    animation: fadeOut 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* Mobile touch improvements and popup management */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Improve mobile button styling */
    button {
        min-height: 44px; /* iOS touch target recommendation */
        touch-action: manipulation;
    }
    
    input, button {
        -webkit-user-select: auto;
        -moz-user-select: auto;
        -ms-user-select: auto;
        user-select: auto;
    }
    
    #control-panel::before, #info-panel::after {
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(33, 150, 243, 0.3);
    }
}

/* Planet name labels */
.planet-label {
    position: absolute;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 5;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
