/* N-Body Gravitational Simulation - Space Theme */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --accent: #00d4ff;
    --accent-hover: #00a8cc;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border: #2a2a4a;
    --danger: #ff4757;
    --success: #2ed573;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Canvas */
#simulation-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* Toolbar */
#toolbar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid var(--border);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    z-index: 100;
}

#toolbar label {
    color: var(--text-secondary);
    font-size: 12px;
}

#toolbar button {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}

#toolbar button:hover {
    background: var(--accent);
    border-color: var(--accent);
}

#toolbar button.active {
    background: var(--accent);
    border-color: var(--accent);
}

#toolbar .toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

/* Play/Pause Button Icons */
#play-pause-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon {
    width: 16px;
    height: 16px;
    display: inline-block;
}

.play-icon {
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 14px solid var(--text-primary);
    margin-left: 2px;
}

.pause-icon {
    width: 14px;
    height: 16px;
    border-left: 4px solid var(--text-primary);
    border-right: 4px solid var(--text-primary);
}

/* Speed Slider */
#speed-slider {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    background: var(--bg-primary);
    border-radius: 3px;
    cursor: pointer;
}

#speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

#speed-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#speed-value {
    font-size: 12px;
    color: var(--accent);
    min-width: 35px;
}

/* Preset Select */
#preset-select {
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
}

#preset-select:focus {
    outline: none;
    border-color: var(--accent);
}

#preset-select option {
    background: var(--bg-secondary);
}

/* Gravity controls */
#gravity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

#gravity-controls.hidden {
    display: none;
}

#gravity-controls label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

#gravity-controls input[type="range"] {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    background: var(--bg-primary);
    border-radius: 2px;
    cursor: pointer;
}

#gravity-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

#gravity-controls input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Property Panel */
#property-panel {
    position: absolute;
    top: 70px;
    right: 10px;
    width: 220px;
    padding: 16px;
    background: rgba(26, 26, 46, 0.95);
    border: 1px solid var(--border);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    z-index: 100;
}

#property-panel.hidden {
    display: none;
}

#property-panel h3 {
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.property-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.property-row label {
    font-size: 12px;
    color: var(--text-secondary);
}

.property-row input[type="number"],
.property-row input[type="text"] {
    width: 100px;
    padding: 4px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
}

.property-row input[type="number"]:focus,
.property-row input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
}

.property-row input[type="color"] {
    width: 40px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.property-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.property-row input[type="color"]::-webkit-color-swatch {
    border-radius: 2px;
    border: none;
}

.property-row button {
    width: 100%;
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.property-row button:hover {
    background: var(--accent);
    border-color: var(--accent);
}

#delete-body-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
}

#focus-body-btn:hover {
    background: var(--success);
    border-color: var(--success);
}

/* Instructions */
#instructions {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 12px 16px;
    background: rgba(26, 26, 46, 0.9);
    border: 1px solid var(--border);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    z-index: 100;
    font-size: 11px;
    line-height: 1.6;
}

#instructions.hidden {
    display: none;
}

#instructions p {
    margin: 2px 0;
    color: var(--text-secondary);
}

#instructions strong {
    color: var(--accent);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #toolbar {
        flex-wrap: wrap;
        justify-content: center;
        max-width: 90%;
    }

    #toolbar .toolbar-divider {
        display: none;
    }

    #property-panel {
        width: calc(100% - 20px);
        right: 10px;
        left: 10px;
    }

    #instructions {
        display: none;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

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

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