/* AutoVibe Initial CSS for project 1756904677052 - Iteration 1 */

/* Basic Reset & Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Variables for easier theme management - Dark Theme (Default) */
:root {
    --bg-color: #1a1a2e;
    --text-color: #e0e0e0;
    --accent-color: #e94560;
    --secondary-text-color: #b0b0b0;
    --panel-bg-color: #232946;
    --border-color: #4a4a68;
    --input-bg-color: #333956;
    --button-bg-color: var(--accent-color);
    --button-text-color: #fff;
    --hover-color: #ff6a80;
    --focus-outline-color: #6d597a;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* Light Theme Variables */
body.light-theme {
    --bg-color: #f0f2f5;
    --text-color: #333333;
    --accent-color: #007bff;
    --secondary-text-color: #6c757d;
    --panel-bg-color: #ffffff;
    --border-color: #ced4da;
    --input-bg-color: #e9ecef;
    --button-bg-color: var(--accent-color);
    --button-text-color: #ffffff;
    --hover-color: #0056b3;
    --focus-outline-color: #80bdff;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Body Styling */
body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Full viewport height */
    overflow-x: hidden; /* Prevent horizontal scroll */
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth theme transition */
}

/* Header Styling */
header {
    width: 100%;
    padding: 20px;
    background-color: var(--panel-bg-color);
    text-align: center;
    box-shadow: 0 2px 10px var(--shadow-color);
    z-index: 10;
    transition: background-color 0.3s ease;
}

h1 {
    font-size: 2.5em;
    color: var(--accent-color);
    margin: 0;
    letter-spacing: 1px;
}

/* Main Content Layout */
main {
    display: flex;
    flex-grow: 1; /* Allow main to take up available vertical space */
    padding: 20px;
    gap: 20px; /* Space between controls and fractal view */
    width: 100%; /* Ensure main takes full width for padding */
    justify-content: center; /* Center content horizontally within main */
    align-items: stretch; /* Stretch children to fill main's height */
}

/* Control Panel Styling */
#controls-panel {
    flex-shrink: 0; /* Prevent panel from shrinking */
    width: 300px; /* Fixed width for the control panel */
    background-color: var(--panel-bg-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow-color);
    overflow-y: auto; /* Enable scrolling for controls if they exceed height */
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

#controls-panel h2 {
    font-size: 1.5em;
    color: var(--accent-color);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

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

#julia-params {
    display: none; /* Hidden by default, script.js will show if Julia set is selected */
}

/* Styling for control items to handle labels, inputs, and checkboxes */
.control-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    flex-wrap: wrap; /* Allow items to wrap on smaller widths */
}

.control-item label {
    font-size: 1em;
    color: var(--secondary-text-color);
    margin-right: 10px;
    min-width: 80px; /* Give labels a consistent minimum width */
    cursor: pointer;
}

/* Input, Select, Button Base Styles */
select,
input[type="number"],
input[type="range"] {
    width: auto;
    flex-grow: 1; /* Allow inputs to take up available space */
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg-color);
    color: var(--text-color);
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.3s ease, color 0.3s ease;
}

select:focus,
input[type="number"]:focus,
input[type="range"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--focus-outline-color);
}

select:disabled,
input[type="number"]:disabled,
input[type="range"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--input-bg-color);
    border-color: var(--border-color);
}

/* Specific styles for range input */
input[type="range"] {
    -webkit-appearance: none;
    height: 8px;
    background: var(--border-color);
    border-radius: 5px;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: grab;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 0 5px var(--shadow-color);
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--hover-color);
    transform: scale(1.1);
}

input[type="range"]::-webkit-slider-thumb:active {
    cursor: grabbing;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: grab;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 0 5px var(--shadow-color);
    border: none;
}

input[type="range"]::-moz-range-thumb:hover {
    background: var(--hover-color);
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb:active {
    cursor: grabbing;
}

input[type="range"]::-ms-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: grab;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 0 5px var(--shadow-color);
}

input[type="range"]::-ms-thumb:hover {
    background: var(--hover-color);
    transform: scale(1.1);
}

input[type="range"]::-ms-thumb:active {
    cursor: grabbing;
}

/* Track for range input */
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 5px;
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 5px;
}

input[type="range"]::-ms-track {
    width: 100%;
    height: 8px;
    background: transparent;
    border-color: transparent;
    border-width: 6px 0;
    color: transparent;
}
input[type="range"]::-ms-fill-lower {
    background: var(--border-color);
    border-radius: 5px;
}
input[type="range"]::-ms-fill-upper {
    background: var(--border-color);
    border-radius: 5px;
}

#iterations-value {
    margin-left: 10px;
    min-width: 40px;
    text-align: right;
    color: var(--accent-color);
    font-weight: bold;
}

/* Custom Checkbox Styling */
/* Hide the default checkbox */
input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    display: inline-block;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background-color: var(--input-bg-color);
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s, border-color 0.2s;
    flex-shrink: 0; /* Prevent it from shrinking */
}

/* Style the custom checkbox when checked */
input[type="checkbox"]:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

/* Add a checkmark for the custom checkbox */
input[type="checkbox"]:checked::after {
    content: '✔'; /* Unicode checkmark */
    font-size: 14px;
    color: var(--button-text-color); /* White checkmark */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1; /* Ensure vertical centering */
}

/* Focus styles for accessibility */
input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--focus-outline-color);
}

/* Ensure label and checkbox align in a control-item */
.control-item input[type="checkbox"] + label {
    margin-left: 10px; /* Space between checkbox and its label */
    flex-grow: 1; /* Allow label to take remaining space */
    min-width: unset; /* Remove min-width constraint for checkbox labels */
}

/* Disabled checkbox and its label */
input[type="checkbox"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--input-bg-color);
    border-color: var(--border-color);
}

input[type="checkbox"]:checked:disabled::after {
    color: var(--secondary-text-color); /* Dim the checkmark */
}

input[type="checkbox"]:disabled + label {
    color: var(--secondary-text-color); /* Dim the label text */
    opacity: 0.6;
    cursor: not-allowed;
}


/* Button Styling */
button {
    flex-grow: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    background-color: var(--button-bg-color);
    color: var(--button-text-color);
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    outline: none;
    margin-top: 5px; /* Add slight margin for stacked buttons */
}

button:hover {
    background-color: var(--hover-color);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button:focus-visible {
    box-shadow: 0 0 0 2px var(--focus-outline-color);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--border-color); /* A more neutral color for disabled buttons */
    transform: none; /* Remove hover/active effects */
    box-shadow: none;
}

button:disabled:hover {
    background-color: var(--border-color); /* Keep the disabled background on hover */
    transform: none;
}

/* If multiple buttons are in a single control-item, arrange them horizontally */
.control-item button {
    margin-top: 0; /* Reset margin if in a flex row */
    margin-right: 10px; /* Space between buttons */
}
.control-item button:last-child {
    margin-right: 0;
}
/* Ensure buttons in a control-group align properly for responsive layout */
.control-group .control-item:has(button) {
    flex-direction: row; /* Keep buttons in a row by default */
    flex-wrap: wrap; /* Allow wrapping */
    justify-content: flex-start; /* Align to start */
}


/* Fractal View Styling */
#fractal-view {
    flex-grow: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow-color);
    min-height: 300px; /* Ensure fractal view has a minimum height */
    cursor: grab; /* Initial cursor for canvas interaction */
}

#fractal-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background-color: #000;
}

#loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--text-color);
    padding: 15px 25px;
    border-radius: 5px;
    font-size: 1.2em;
    z-index: 5;
    white-space: nowrap;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#fractal-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent dark background */
    color: #fff; /* White text for contrast */
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9em;
    z-index: 5; /* Above canvas, below loading indicator */
    pointer-events: none; /* Allow mouse events to pass through to canvas */
    transition: background-color 0.3s ease, color 0.3s ease;
}

#fractal-info p {
    margin: 5px 0;
    line-height: 1.2;
    color: inherit; /* Inherit color from parent */
}

#fractal-info p:first-child {
    margin-top: 0;
}

#fractal-info p:last-child {
    margin-bottom: 0;
}

#fractal-info span {
    font-weight: bold;
    color: var(--accent-color); /* Highlight values */
    transition: color 0.3s ease;
}

/* Light theme for fractal-info */
body.light-theme #fractal-info {
    background-color: rgba(255, 255, 255, 0.7); /* Semi-transparent light background */
    color: var(--text-color); /* Dark text */
}

/* Footer Styling */
footer {
    width: 100%;
    padding: 15px 20px;
    background-color: var(--panel-bg-color);
    text-align: center;
    color: var(--secondary-text-color);
    font-size: 0.9em;
    margin-top: auto; /* Push footer to the bottom */
    box-shadow: 0 -2px 10px var(--shadow-color);
    z-index: 10;
    transition: background-color 0.3s ease, color 0.3s ease;
}

footer p {
    margin: 0;
    color: inherit;
}

/* Styling for elements explicitly marked as disabled by script.js */
/* This is for consistency, as most disabled states are handled by :disabled pseudo-class */
.disabled-control {
    pointer-events: none; /* Prevent mouse interactions */
    /* Opacity is often handled by :disabled, but can be added here if needed for non-form elements */
    /* filter: grayscale(50%); for an additional visual cue */
}


/* Basic responsiveness */
@media (max-width: 1024px) {
    main {
        flex-direction: column; /* Stack controls and fractal view vertically */
        padding: 15px;
        gap: 15px;
    }

    #controls-panel {
        width: 100%; /* Full width for controls */
        max-height: 40vh; /* Limit height to prevent taking up too much vertical space */
        padding: 15px;
    }

    #controls-panel h2 {
        font-size: 1.3em;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .control-item label {
        min-width: 60px;
    }

    h1 {
        font-size: 2em;
    }

    header {
        padding: 15px;
    }

    footer {
        padding: 10px 15px;
    }

    /* Adjust button layout for smaller screens */
    .control-group .control-item:has(button) {
        flex-direction: column; /* Stack buttons vertically */
        align-items: stretch; /* Stretch buttons to full width */
    }
    .control-item button {
        margin-right: 0; /* Remove horizontal margin */
        margin-bottom: 10px; /* Add vertical margin between stacked buttons */
    }
    .control-item button:last-child {
        margin-bottom: 0;
    }

    #fractal-info {
        bottom: 10px;
        left: 10px;
        padding: 8px 12px;
        font-size: 0.85em;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
    }

    /* Paragraph styling (for general paragraphs, though only footer p is used) */
    p {
        font-size: 0.9em;
        padding: 0 10px;
    }

    select,
    input[type="number"],
    button {
        padding: 6px 10px;
        font-size: 0.9em;
    }

    .control-item {
        flex-direction: column; /* Stack label and input/control */
        align-items: flex-start;
        margin-bottom: 10px;
    }

    .control-item label {
        margin-bottom: 5px;
        margin-right: 0;
    }

    select,
    input[type="number"],
    input[type="range"] {
        width: 100%; /* Make inputs full width */
    }

    #iterations-value {
        width: 100%;
        text-align: left;
        margin-left: 0;
        margin-top: 5px;
    }

    button {
        width: 100%; /* Make buttons full width */
        margin-top: 5px;
    }

    /* For checkbox labels on small screens */
    .control-item input[type="checkbox"] + label {
        margin-left: 0;
        margin-top: 5px; /* Add space between checkbox and label if stacked */
    }
    .control-item:has(input[type="checkbox"]) {
        flex-direction: row; /* Keep checkbox and label in a row if possible */
        justify-content: flex-start;
        align-items: center;
    }
    .control-item:has(input[type="checkbox"]) label {
        min-width: unset;
    }

    #fractal-info {
        bottom: 5px;
        left: 5px;
        padding: 6px 10px;
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }

    header, footer {
        padding: 10px;
    }

    main {
        padding: 10px;
        gap: 10px;
    }

    #controls-panel {
        padding: 10px;
    }

    #controls-panel h2 {
        font-size: 1.2em;
    }
}