@import url('https://fonts.googleapis.com/css2?family=Space+Mono&display=swap');

:root {
    --font-size: 14px;
    --font-line-height: 22px;
    --font-family: 'Space Mono', monospace;
    --panel-border: 2px;
    --panel-background-color: rgba(0, 0, 0, 0.85);
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 16px;
    --color: rgba(232, 174, 59, 1);
    --openai: rgba(117, 171, 158, 1);
    --error: rgba(196, 73, 112, 1);
}

html, body {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
}

body {
    display: flex;
    flex-direction: row;
    background-color: black;
}

a {
    color: inherit;
    text-decoration: none;
}

* {
    box-sizing: border-box;
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0) var(--color);
}

*::-webkit-scrollbar {
    width: 2px;
}

*::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0);
}

*::-webkit-scrollbar-thumb {
    background-color: var(--color);
    border-radius: 20px;
    border: 3px solid rgba(0, 0, 0, 0);
}

ol,
ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

pre {
    white-space: pre-wrap;     
    white-space: -moz-pre-wrap;
    white-space: -pre-wrap;    
    white-space: -o-pre-wrap;  
    word-wrap: break-word;     
    overflow: auto;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 0.5rem;
    padding: 0.5rem;
    z-index: 1;
    pointer-events: none;
    width: 100%;
    height: 100%;
}

cite {
    float: right;
}

input[type=text].prompt {
    font-family: var(--font-family);
    font-size: 24px;
    line-height: var(--font-line-height);
    color: var(--color);
    background-color: transparent;
    border-width: 0px;
    border-color: var(--color);
    border-style: solid;
    outline: none;
    text-align: left;
    width: 100%;
}

input[type=text].prompt:disabled {
    color: var(--openai);
}

input[type=text].api-key {
    font-family: var(--font-family);
    width: 60%; 
    color: var(--color);
    background: none;
    border-width: var(--panel-border);
    border-color: var(--color);
    border-style: solid;
    outline: none;
    opacity: 0.65;
}

input[type=text].api-key:focus {
    color: white;
    border-color: white;
    opacity: 1;
}

input[type="color"] {
    display: none;
}

.color-hex {
    color: white;
    cursor: pointer;
}

.color-hex:hover {
    color: black;
    background: var(--color);
}

.config-options > li {
    margin-bottom: var(--space-1);
}

.window-layout-option input[type="radio"] {
    display: none;
}

.window-layout-option input[type="radio"] + svg {
    fill: var(--color);
    width: 27px;
    margin-bottom: -5px;
    cursor: pointer;
    opacity: 0.65;
}

.window-layout-option input[type="radio"] + svg:hover {
    fill: black;
    background: var(--color);
    opacity: 1;
}

.window-layout-option input[type="radio"]:checked + svg {
    fill: white;
    opacity: 1;
}

.window-layout-option input[type="radio"]:checked + svg:hover {
    fill: white;
    background: transparent;
    opacity: 1;
}

.history {
    max-height: calc(var(--font-size) * 5);
    overflow: auto;
}

.history-item {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    border: transparent;
    outline: none;
    opacity: 0.65;
}

.history-item:hover,
.history-item:focus {
    background-color: var(--color);
    color: black;
    text-shadow: none;
}

.error-messages {
    max-height: calc(var(--font-size) * 5);
    overflow: auto;
}

.errors-item{
    color: red; 
}

.empty {
    display: none;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

pre {
    white-space: pre-wrap;     
    white-space: -moz-pre-wrap;
    white-space: -pre-wrap;    
    white-space: -o-pre-wrap;  
    word-wrap: break-word;     
    overflow-y: auto;
    max-height: calc(100vh - 32rem);
}

.editor {
    outline: transparent;
    min-height: 100px;
}

canvas {
    position: absolute;
    width: 100%;
    height: 100%;
}

.openai-logo {
    border: none;
    cursor: pointer;
    background-color: transparent;
    margin: 0;
    padding: 0;
}

.openai-logo > svg {
    fill: white;
    width: 27px;
    margin-bottom: -5px;
    transition: fill 0.3s;
}

.error {
    color: var(--error);
}

.error > svg {
    fill: var(--error);
}

.spin {
    animation: spin 5s linear infinite;
}

.spin > svg {
    fill: var(--openai);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(-360deg);
    }
}

.modal {
    position: fixed;
    z-index: 2;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.panel {
    border-width: var(--panel-border);
    border-color: var(--color);
    border-style: solid;
    background-color: var(--panel-background-color);
    padding: var(--space-2);
    margin: 0;
    font-family: var(--font-family);
    font-size: var(--font-size);
    line-height: var(--font-line-height);
    color: var(--color);
    text-align: left;
    /* backdrop-filter: blur(8px); */
    box-shadow: 
        0 1px 1px hsl(0deg 0% 0% / 0.175),
        0 2px 2px hsl(0deg 0% 0% / 0.175),
        0 4px 4px hsl(0deg 0% 0% / 0.175),
        0 8px 8px hsl(0deg 0% 0% / 0.175),
        0 16px 16px hsl(0deg 0% 0% / 0.175);
    pointer-events: auto;
}

.panel-forty {
    width: 40%;
    min-width: 550px;
    transition: width 0.3s;
}

.panel-expanded {
    width: 100%;
}

.panel-hidden {
    display: none !important;
}

.panel-legend {
    font-weight: bold;
    padding: 0 var(--space-1);
    text-transform: uppercase;
    text-shadow:
        -1px -1px 0 #000,  
         1px -1px 0 #000,
        -1px  1px 0 #000,
         1px  1px 0 #000;
}

.panel-legend-expand-button {
    background: none;
    padding: var(--space-1) 0;
    margin-right: var(--space-1);
    border: none;
    font-family: var(--font-family);
    font-size: var(--font-size);
    font-weight: bold;
    color: var(--color);
    line-height: var(--space-3);
    outline: none;
}

.panel-legend-expand-button:hover,
.panel-legend-expand-button:focus {
    background-color: var(--color);
    color: black;
    text-shadow: none;
}

.collapsed {
    max-height: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
    overflow: hidden;
}

.toggle-panel {
    display: none;
}

.toggle-panel:checked ~ .panel-legend-expand-button {
    background-color: var(--color);
    color: black;
    text-shadow: none;
}

.button {
    position: relative;
    border-width: 0px;
    border-color: var(--color);
    border-style: solid;
    background-color: transparent;
    padding: var(--space-1) var(--space-1);
    font-family: var(--font-family);
    font-size: var(--font-size);
    font-weight: bold;
    color: var(--color);
    line-height: 15px;
    outline: none;
    transition: transform 0.2s ease-out;
}

.button:hover,
.button:focus {
    background-color: var(--color);
    color: black;
    transform: translateX(var(--space-1));
    cursor: pointer;
}

.button:active {
    background-color: transparent;
    color: var(--color);
    cursor: pointer;
}

.button:hover::before, 
.button:focus::before,
.button:active::before {
    content: ">";
    margin-right: -0.5em;
    font-weight: bold;
}

.version {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-family);
    font-size: var(--font-size);
    line-height: var(--font-line-height);
    right: var(--space-2);
    bottom: var(--space-2);
    color: white;
    mix-blend-mode: exclusion;
}

.hidden {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    padding: 0 !important;
    border: 0 !important;
    height: 1px !important;
    width: 1px !important;
    overflow: hidden;
}

@media (max-width: 767px) {
    html, body {
        flex-direction: column;
    }

    .container {
        min-width: 100%;
        height: 50%;
    }

    .button {
        padding: 1rem;
    }

    .panel-legend-expand-button {
        padding: 0 1rem;
    }

    .panel-forty {
        width: 100%;
        min-width: 100%;
    }

    #modal-panel {
        text-align: center;
    }
}
