/* Basic Reset & Body Styling  */
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif; 
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%); 
    color: #e0e0e0; /* Light text color from homepage */
    min-height: 100vh;
    overflow-x: hidden;
}

/* Container styling */
.container {
    max-width: 1400px;
    width: 98%;
    margin: 20px auto;
    padding: 0px 20px 20px 20px;
    box-sizing: border-box;
}

/* Simulation container */
.simulation-container {
    /*I used to have somethig here*/
}

/* Header styling */
.sim-header {
    text-align: center;
}

.sim-header h1 {
    font-size: 2.5em;
    font-weight: 700;
    color: #007bff;
    text-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
    margin-bottom: 5px;
}

.sim-header h2 {
    font-size: 1.8em;
    font-weight: 600;
    color: #f0f0f0;
    margin-bottom: 10px;
}

/* Back Button */
.back-link {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(51, 51, 51, 0.9);
    color: #e0e0e0;
    padding: 8px 16px;
    border: 1px solid #444;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.back-link:hover {
    background: rgba(71, 71, 71, 0.9);
    transform: translateY(-1px);
}

.back-link:active {
    transform: translateY(0);
}

/* Description text styling */
.sim-description {
    font-size: 1.1em;
    color: #c0c0c0; 
    text-align: center;
    margin-bottom: 20px;
}

.sim-subtitle {
    font-size: 1em;
    color: #b0b0b0; 
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.5;
}

/* Grid for all simulations */
.simulations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 220px);
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    align-items: start;
    transition: all 0.3s ease-in-out;
}

/* Style for when there's only ONE simulation */
.simulations-grid.single-simulation-active {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0;
}

/* Canvas wrapper styling  */
.canvas-wrapper {
    position: relative;
    width: 220px;
    height: calc(220px * 16 / 9);
    overflow: hidden;
    border-radius: 12px; 
    background-color: #2a2a2a; 
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease-in-out;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid #444;
}

/* Single simulation sizing */
.simulations-grid.single-simulation-active .canvas-wrapper {
    --max-sim-width: 660px;
    aspect-ratio: 9 / 16;
    width: min(var(--max-sim-width), 90vw, calc(90vh * 9 / 16));
    max-height: 90vh;
    height: auto;
    margin: 0 auto;
}

/* Canvas styling */
.canvas-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Controls styling - updated to match homepage */
.controls.global-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding: 20px;
    background-color: #2a2a2a; /* Darker background matching body gradient */
    border-radius: 12px; /* Rounded corners */
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3);
    border: 1px solid #444;
}

.control-group {
    flex: 1 1 calc(33% - 20px);
    min-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.control-group label {
    margin-bottom: 5px;
    font-weight: 600; /* Matching Inter font weight */
    color: #f0f0f0; /* Bright text from homepage */
    font-size: 0.95em;
}

/* Range input styling - updated to match homepage theme */
.control-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 20px;
    background: transparent;
    outline: none;
    margin-top: 5px;
}

/* Text input styling - updated to match homepage */
.control-group input[type="text"] {
    width: 100%;
    max-width: 250px;
    margin-top: 5px;
    border-radius: 8px;
    border: 1px solid #444;
    background-color: #1a1a1a; /* Darker background */
    color: #e0e0e0;
    padding: 10px 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
    font-family: 'Inter', sans-serif;
}

.control-group input[type="text"]:focus {
    border-color: #007bff;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(0, 123, 255, 0.2);
}

/* Slider track styling */
.control-group input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #444; /* Darker track */
    border-radius: 5px;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #007bff; /* Bright blue from homepage */
    cursor: grab;
    margin-top: -8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 8px rgba(0, 123, 255, 0.3);
    transition: all 0.2s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #0056b3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 12px rgba(0, 123, 255, 0.5);
}

/* Firefox slider styling */
.control-group input[type="range"]::-moz-range-track {
    width: 100%;
    height: 4px;
    background: #444;
    border-radius: 5px;
    cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #007bff;
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 8px rgba(0, 123, 255, 0.3);
    border: none;
    transition: all 0.2s ease;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    background: #0056b3;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 12px rgba(0, 123, 255, 0.5);
}

/* Button styling - matching homepage exactly */
.control-group button {
    background: linear-gradient(45deg, #007bff, #0056b3); /* Gradient button */
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.1s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
    outline: none;
    align-self: center;
    margin-top: 10px;
    font-family: 'Inter', sans-serif;
}

.control-group button:hover {
    background: linear-gradient(45deg, #0056b3, #003d80);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.5);
}

.control-group button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

/* Value display spans */
.control-group span {
    color: #c0c0c0;
    font-size: 0.95em;
    margin-top: 5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sim-header {
        padding: 60px 0 20px 0; /* More top padding on smaller screens */
    }
    
    .sim-header h1 {
        font-size: 1.8em;
    }
    
    .back-link {
        /* Keep absolute positioning on tablets */
    }

    .control-group {
        flex: 1 1 calc(50% - 10px);
    }
    
    .simulation-container {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .sim-header h1 {
        font-size: 1.5em;
    }
    
    .control-group {
        flex: 1 1 100%;
    }
    
    .simulations-grid {
        grid-template-columns: 1fr;
    }
    
    .canvas-wrapper {
        width: 90vw;
        height: calc(90vw * 16 / 9);
    }
    
    .simulation-container {
        padding: 15px;
    }
    
    .controls.global-controls {
        padding: 15px;
    }
}