/* ===================================
   Black Hole Merger Simulation Styles
   =================================== */

/* Base Styles */
html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #000;
    color: #fff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100%;
    width: 100%;
}

/* Canvas Container */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* UI Overlay */
.ui-overlay {
    position: relative;
    pointer-events: none;
}

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

/* Glassmorphic Panel Effect */
.glassmorphic-panel {
    background: rgba(30, 30, 45, 0.65);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* Control Panel Styles */
.control-panel {
    transition: all 0.3s ease;
}

.control-panel::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.control-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

/* Collapsible Content Animation */
#collapsible-content {
    max-height: 600px;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, 
                padding 0.5s ease-in-out, 
                margin 0.5s ease-in-out,
                opacity 0.3s ease-in-out;
    opacity: 1;
}

.collapsed #collapsible-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    opacity: 0;
}

/* Button Styles */
.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-icon:active {
    transform: scale(0.95);
}

/* Slider Styles */
.slider,
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    transition: background 0.3s;
}

.slider:hover,
input[type="range"]:hover {
    background: rgba(255, 255, 255, 0.2);
}

.slider::-webkit-slider-thumb,
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(30, 30, 45, 0.8);
    transition: all 0.2s;
}

.slider::-moz-range-thumb,
input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(30, 30, 45, 0.8);
    transition: all 0.2s;
}

.slider::-webkit-slider-thumb:hover,
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Toggle Checkbox Styles */
.toggle-checkbox {
    position: relative;
    width: 44px;
    height: 24px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-checkbox:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle-checkbox::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    background: white;
    transition: transform 0.3s;
}

.toggle-checkbox:checked::before {
    transform: translateX(20px);
}

/* Progress Bar Animation */
#progressBar {
    position: relative;
    overflow: hidden;
}

#progressBar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Info Modal Styles */
#infoModal {
    display: none;
    animation: fadeIn 0.3s ease;
}

#infoModal.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Loading Screen */
#loadingScreen {
    background: radial-gradient(ellipse at center, #0a0a1a 0%, #000000 100%);
    transition: opacity 0.5s ease;
}

#loadingScreen.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Responsive Design */
@media (max-width: 640px) {
    .control-panel {
        max-width: calc(100vw - 2rem);
    }
    
    #controlsContainer {
        max-width: 100%;
    }
    
    .glassmorphic-panel {
        padding: 1rem;
    }
    
    #infoModal .glassmorphic-panel {
        max-width: calc(100vw - 2rem);
        max-height: calc(100vh - 4rem);
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

/* Hover Effects */
#infoBtn {
    position: relative;
    overflow: hidden;
}

#infoBtn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

#infoBtn:hover::before {
    width: 300px;
    height: 300px;
}

/* Performance Optimizations */
* {
    will-change: auto;
}

.glassmorphic-panel,
.btn-icon,
.slider {
    will-change: transform;
}

/* Accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Custom Scrollbar for Modal */
#infoModal .glassmorphic-panel::-webkit-scrollbar {
    width: 8px;
}

#infoModal .glassmorphic-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

#infoModal .glassmorphic-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

/* Status Text Glow Effect */
#statusText {
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5),
                 0 0 20px rgba(56, 189, 248, 0.3),
                 0 0 30px rgba(56, 189, 248, 0.1);
}

/* Title Gradient */
h1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Phase-specific Colors */
.phase-inspiral #statusText {
    color: #38bdf8;
}

.phase-merger #statusText {
    color: #f59e0b;
    animation: pulse 0.5s ease-in-out infinite;
}

.phase-ringdown #statusText {
    color: #a78bfa;
}