/* styles from elouan.xyz, but we need more styles. */

:root {
    --default-highlight: var(--fuchsia);
}

body {
    max-width: 1400px !important;
    margin: 0 auto;
    padding: 30px 25px;
}

.editor-column {
    /* New wrapper for editor related items */
    flex: 1;
    /* Grow to fill remaining space */
    min-width: 0;
    /* Important for flex shrinking */
    display: flex;
    flex-direction: column;
}

.editor-wrapper {
    position: relative;
    border-radius: var(--editor-border-radius);
    overflow: hidden;
    border: 1px solid var(--editor-border-color);
    min-height: 400px;
    /* Give editor a larger default height */
    flex-grow: 1;
    /* Allow editor wrapper to grow if needed */
    margin-bottom: 0.5em;
    /* Space before language display */
}

.dropdown {
    max-height: 300px;
    overflow: scroll;
}

#codeInput {
    z-index: 2;
    display: block;
    height: 100%;
    min-height: inherit;
    font-family: var(--font-mono);
    font-size: var(--editor-font-size);
    line-height: var(--editor-line-height);
    white-space: pre;
    overflow-wrap: normal;
    overflow: auto;
    tab-size: 2;
    -moz-tab-size: 2;
    box-sizing: border-box;
    width: 100%;
    min-height: 350px;
    background-color: var(--stone-800);
    color: var(--stone-100);
    border: 1px solid var(--stone-600);
    padding: 10px;
    resize: vertical;
    margin-bottom: 1em;
}

#outputImageDisplay {
    margin-top: 1em;
    max-width: 100%;
    border: 1px dashed var(--stone-500);
}

#outputImageDisplay.hidden {
    display: none;
}

#pondiverse-controls {
    margin-top: 1.5em;
    /* Space above buttons */
    display: flex;
    gap: 1em;
    flex-wrap: wrap;
    /* justify-content: flex-end; */
    /* Optional: align right */
}

#pondiverse-controls button {
    /* Inherit general button styles from style.css */
    padding: 0.5em 1em;
    font-size: 1em;
    /* Add transition if desired */
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

#copy-image-button {
    --color: var(--cyan);
    /* Different color for Copy */
}

/* Disabled state (applies to both) */
#pondiverse-controls button:disabled {
    --color: var(--stone-600);
    background-color: var(--stone-700);
    color: var(--stone-500);
    cursor: not-allowed;
    outline: none;
    border-color: transparent;
    /* Hide border when disabled maybe */
}

#pondiverse-controls button:disabled:hover {
    background-color: var(--stone-700);
    /* Prevent hover effect */
    color: var(--stone-500);
    outline: none;
}

/* Optional: Style for 'Copied!' state */
#copy-image-button.copied {
    --color: var(--default-highlight);
    /* Optionally change background too */
    /* background-color: var(--default-highlight); */
    /* color: var(--stone-950); */
}

.pondiverse-button {
    --color: var(--fuchsia);
    padding: 0.5em 1em;
    font-size: 1em;
    margin-right: 1em;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

/* Disabled state */
.pondiverse-button:disabled {
    --color: var(--stone-600);
    background-color: var(--stone-700);
    color: var(--stone-500);
    cursor: not-allowed;
    outline: none;
}

.pondiverse-button:disabled:hover {
    background-color: var(--stone-700);
    color: var(--stone-500);
    outline: none;
}

#pondiverse-dialog {
    color: var(--stone-100);
    font-size: 1.1em;
    font-family: Inter, sans-serif;
    padding: 0;
    background-color: transparent;
    border: none;
    max-width: 500px;
}

#pondiverse-dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.7);
}

#pondiverse-dialog form {
    background-color: var(--stone-900);
    border: 1px solid var(--stone-700);
    padding: 1.5em 2em;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

#pondiverse-dialog a {
    --color: var(--default-highlight);
}

#pondiverse-dialog input[type="text"] {
    width: 100%;
    padding: 10px 15px;
    margin: 0.5em 0 1em 0;
    border: 1px solid var(--stone-600);
    background-color: var(--stone-800);
    color: var(--stone-100);
    font-size: 1em;
    box-sizing: border-box;
}

#pondiverse-dialog input[type="text"]:focus {
    outline: 2px solid var(--default-highlight);
    outline-offset: 1px;
    border-color: var(--default-highlight);
}

#pondiverse-dialog button {
    font-size: 1em;
    padding: 0.6em 1.2em;
    margin-top: 1em;
}

#pondiverse-dialog button[type="submit"] {
    --color: var(--blue);
}

#pondiverse-dialog button.secondary {
    --color: var(--stone-500);
    background-color: var(--stone-700);
}

#pondiverse-dialog button.secondary:hover {
    background-color: var(--color);
    color: var(--stone-050);
    outline: 2px solid var(--color);
}

#pondiverse-dialog button[type="submit"]:disabled {
    --color: var(--stone-600);
    background-color: var(--stone-700);
    color: var(--stone-500);
    cursor: not-allowed;
    outline: none;
}

#pondiverse-dialog button[type="submit"]:disabled:hover {
    background-color: var(--stone-700);
    color: var(--stone-500);
    outline: none;
}

#pondiverse-dialog hgroup.space {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5em;
}

#pondiverse-dialog #preview-image {
    max-width: 100%;
    max-height: 250px;
    margin: 1em auto;
    display: block;
    border: 1px solid var(--stone-700);
}

#pondiverse-dialog #preview-image[src=""] {
    display: none;
}

#pondiverse-dialog #preview-image:not([src=""]):not([style*="display: none"]) {
    margin-bottom: 1.5em;
}

#customization-controls {
    border: 1px solid var(--stone-700);
    padding: 1em 1.5em;
    margin-bottom: 1.5em;
    background-color: var(--stone-900);
}

#customization-controls h3 {
    margin-top: 0;
    margin-bottom: 1em;
    font-size: 1.1em;
    border-bottom: 1px solid var(--stone-700);
    padding-bottom: 0.5em;
}

.control-group {
    display: flex;
    align-items: center;
    margin-bottom: 1em;
    gap: 1em;
    flex-wrap: wrap;
    /* Allow wrapping on small screens */
}

.control-group label {
    flex-basis: 120px;
    /* Minimum width for labels */
    flex-shrink: 0;
    padding: 0;
    /* Override default label padding */
    font-size: 0.9em;
    color: var(--stone-300);
}

.control-group input[type="range"],
.control-group select,
.control-group input[type="color"] {
    flex-grow: 1;
    min-width: 150px;
    /* Prevent controls from becoming too small */
}

/* Style range inputs */
.control-group input[type="range"] {
    cursor: pointer;
}

/* Style select dropdowns */
.control-group select {
    background-color: var(--stone-800);
    color: var(--stone-100);
    border: 1px solid var(--stone-600);
    padding: 5px 8px;
    cursor: pointer;
}

/* Style color inputs */
.control-group input[type="color"] {
    border: 1px solid var(--stone-600);
    padding: 2px;
    height: 30px;
    /* Adjust height */
    cursor: pointer;
    background-color: var(--stone-800);
    /* Background for the input box itself */
    min-width: 50px;
    /* Make color picker smaller */
    flex-grow: 0;
    /* Don't let it grow too much */
}

/* Display value next to sliders */
.value-display {
    font-size: 0.9em;
    color: var(--stone-400);
    min-width: 40px;
    /* Reserve space */
    text-align: right;
}


/* --- Preview Area using CSS Variables --- */
#codePreviewContainer {
    position: relative;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
    min-height: inherit;
    background-color: var(--code-bg-color);
    padding: var(--code-padding);
    margin: 0;
    border: solid small var(--stone-150);
    border-radius: 0;
    box-sizing: border-box;
    font-size: var(--code-font-size);
    font-family: var(--code-font-family);
}

#codePreviewContainer pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

#codePreviewContainer pre code.hljs {
    /* Use CSS variables for dynamic styles */
    font-size: var(--code-font-size, 1em);
    /* Default value */
    font-family: var(--code-font-family, var(--font-mono));
    /* Default value */

    /* The background/color is mostly handled by the theme CSS */
    /* We might need JS to override theme background if needed */
    /* background-color: transparent; /* Let container handle bg */

    /* Keep other styles */
    line-height: 1.5;
    display: block;
    /* Needed for block-level styling */
    padding: 0;
    /* Padding now on container */
}

/* Ensure .hljs itself doesn't override container background if we set it via var */
.hljs {
    background: transparent !important;
    /* Override theme background */
    color: inherit;
    /* Inherit base color unless theme specifies */
}

#app-container {
    display: flex;
    gap: 2em;
    /* Space between columns */
    align-items: flex-start;
    /* Align top edges */
    margin-top: 1.5em;
}

#customization-controls {
    flex: 0 0 320px;
    /* Don't grow, don't shrink, set fixed width */
    border: 1px solid var(--stone-700);
    border-radius: 5px;
    background-color: var(--stone-900);
    overflow: hidden;
    margin-bottom: 0;
    /* Remove bottom margin as it's inside flex */
    align-self: stretch;
    /* Make it stretch to container height if needed */
}

#customization-controls summary {
    padding: 0.8em 1.5em;
    font-family: var(--font-mono);
    /* Match h3 style */
    font-size: 1.1em;
    cursor: pointer;
    outline: none;
    /* Remove focus outline from summary */
    color: var(--stone-200);
    border-bottom: 1px solid var(--stone-700);
    /* Separator when open */
    transition: background-color 0.2s ease;
    list-style-position: inside;
    /* Better marker alignment */
}

#customization-controls summary:hover {
    background-color: var(--stone-800);
}

/* Style the default disclosure triangle */
#customization-controls summary::marker {
    color: var(--stone-400);
    /* font-size: 0.8em; */
    /* Adjust size if needed */
}

/* For Webkit browsers */
#customization-controls summary::-webkit-details-marker {
    color: var(--stone-400);
}

.customization-content {
    padding: 0em 1.5em 1em 1.5em;
    /* Padding for the content area */
}

.control-group {
    display: flex;
    align-items: center;
    margin-bottom: 1em;
    gap: 1em;
    flex-wrap: wrap;
}

.control-group label {
    flex-basis: 120px;
    flex-shrink: 0;
    padding: 0;
    font-size: 0.9em;
    color: var(--stone-300);
}

.control-group input[type="range"],
.control-group select,
.control-group input[type="color"] {
    flex-grow: 1;
    min-width: 150px;
}

.control-group input[type="range"] {
    cursor: pointer;
}

.control-group select {
    background-color: var(--stone-800);
    color: var(--stone-100);
    border: 1px solid var(--stone-600);
    padding: 5px 8px;
    border-radius: 3px;
    cursor: pointer;
}

.control-group input[type="color"] {
    border: 1px solid var(--stone-600);
    padding: 2px;
    height: 30px;
    cursor: pointer;
    background-color: var(--stone-800);
    border-radius: 3px;
    min-width: 50px;
    flex-grow: 0;
}

.value-display {
    font-size: 0.9em;
    color: var(--stone-400);
    min-width: 40px;
    text-align: right;
}

@media (max-width: 900px) {

    /* Adjust breakpoint as needed */
    #app-container {
        flex-direction: column;
        /* Stack columns vertically */
        gap: 1.5em;
    }

    details#customization-controls {
        flex: 1 1 auto;
        /* Allow it to take full width */
        width: 100%;
        align-self: auto;
        /* Reset stretch */
    }

    .editor-column {
        width: 100%;
        /* Ensure editor takes full width */
    }

    body {
        padding: 20px 15px;
        /* Reduce padding */
    }
}

@media (max-width: 500px) {
    body {
        padding: 15px 10px;
        font-size: 1em;
        /* Slightly smaller base font */
    }

    h1 {
        font-size: 1.6em;
    }

    .editor-wrapper {
        min-height: 300px;
    }

    #codePreviewContainer pre code.hljs {
        min-height: calc(300px - 2 * var(--editor-padding));
    }

    #pondiverse-controls {
        justify-content: center;
    }

    /* Center buttons */
}