/* ==========================================================================
   Physics Sandbox Container
   ========================================================================== */
.physics-sandbox {
    position: relative;
    width: 100%;
    height: 80vh;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 4px solid #666;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Toolbar
   ========================================================================== */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background: #2a2a2a;
    border-bottom: 2px solid #333;
    align-items: flex-start;
    max-height: none;
    overflow: visible;
}

.tool-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
    flex: 1;
}

.tool-section h3 {
    color: var(--accent, #00ffcc);
    font-size: 0.9rem;
    margin: 0;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.particle-tools,
.action-tools,
.view-modes,
.control-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tool-btn {
    padding: 6px 10px;
    background: #444;
    color: #fff;
    border: 2px solid #555;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 55px;
    text-align: center;
    white-space: nowrap;
}

.tool-btn:hover {
    background: #555;
    border-color: #666;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tool-btn.active {
    background: var(--accent, #00ffcc);
    color: #000;
    border-color: var(--accent, #00ffcc);
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
    font-weight: bold;
}

.view-btn {
    padding: 5px 8px;
    background: #444;
    color: #fff;
    border: 2px solid #555;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 50px;
    text-align: center;
}

.view-btn:hover {
    background: #555;
    border-color: #666;
    transform: translateY(-1px);
}

.view-btn.active {
    background: #ff6b35;
    color: #000;
    border-color: #ff6b35;
    box-shadow: 0 0 10px rgba(255, 107, 53, 0.5);
}

.control-btn {
    padding: 6px 12px;
    background: #555;
    color: #fff;
    border: 2px solid #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 60px;
    text-align: center;
}

.control-btn:hover {
    background: #666;
    border-color: #777;
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(0);
}

/* ==========================================================================
   Settings
   ========================================================================== */
.settings {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.setting-group label {
    color: #ccc;
    min-width: 50px;
    font-size: 0.8rem;
}

.setting-group input[type="range"] {
    width: 70px;
    height: 18px;
    background: #444;
    outline: none;
    border-radius: 10px;
    -webkit-appearance: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent, #00ffcc);
    border-radius: 50%;
    cursor: pointer;
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent, #00ffcc);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.setting-group span {
    color: var(--accent, #00ffcc);
    font-weight: bold;
    min-width: 30px;
    text-align: center;
    font-size: 0.75rem;
}

/* ==========================================================================
   Canvas
   ========================================================================== */
#physicsCanvas {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #111;
    cursor: crosshair;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ==========================================================================
   Instructions
   ========================================================================== */
.instructions {
    margin-top: 20px;
    padding: 15px;
    background: #2a2a2a;
    border-radius: 8px;
    color: #ccc;
}

.instructions h3 {
    color: var(--accent, #00ffcc);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.instructions ul {
    margin: 10px 0;
    padding-left: 20px;
}

.instructions li {
    margin: 5px 0;
    line-height: 1.5;
}

.instructions p {
    margin: 10px 0 0 0;
    line-height: 1.6;
}

.instructions strong {
    color: var(--accent, #00ffcc);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1400px) {
    .tool-section {
        min-width: 160px;
    }
    
    .tool-btn {
        font-size: 0.7rem;
        padding: 5px 8px;
        min-width: 50px;
    }
}

@media (max-width: 1200px) {
    .toolbar {
        flex-direction: column;
        gap: 12px;
        max-height: none;
        overflow: visible;
    }
    
    .tool-section {
        min-width: auto;
        width: 100%;
    }
    
    .particle-tools,
    .action-tools {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .physics-sandbox {
        height: 70vh;
    }
    
    .toolbar {
        padding: 10px;
        gap: 10px;
        max-height: 40vh;
    }
    
    .tool-btn {
        padding: 5px 8px;
        font-size: 0.7rem;
        min-width: 45px;
    }
    
    .setting-group {
        font-size: 0.8rem;
    }
    
    .setting-group input[type="range"] {
        width: 60px;
    }
    
    .instructions {
        font-size: 0.85rem;
        padding: 10px;
    }
    
    .instructions h3 {
        font-size: 1rem;
    }
}

/* ==========================================================================
   Scrollbar Styling
   ========================================================================== */
.toolbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.toolbar::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.toolbar::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.toolbar::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* ==========================================================================
   Particle Colors (for reference)
   ========================================================================== */
.particle-powder { background: #8B4513; }
.particle-water { background: #0066CC; }
.particle-fire { background: #FF4500; }
.particle-ice { background: #87CEEB; }
.particle-stone { background: #696969; }
.particle-sand { background: #F4A460; }
.particle-oil { background: #2F2F2F; }
.particle-gas { background: #90EE90; }
.particle-acid { background: #32CD32; }
.particle-metal { background: #C0C0C0; }
.particle-gunpowder { background: #333333; }
.particle-magma { background: #FF3300; }
.particle-nitro { background: #FFD700; }
.particle-mercury { background: #E6E6FA; }
.particle-spark { background: #FFFF00; }
.particle-salt { background: #FFFFFF; }
.particle-glass { background: #E0E0E0; }
.particle-soapy { background: #E6F3FF; }
.particle-vine { background: #228B22; }
