celestin-setup {
    overflow:hidden;
    height: 100%;
}

#setup-component {
    display: flex;
    flex-direction: row;
    height: 100%;
    container-type: inline-size;
    container-name: setup;
    
    .sideNav {
        display: flex;
        flex-direction: row;
        gap: 0.25em;
        transition: transform 0.3s ease-in-out;
    }

    celestin-adventure-manager {
        padding-inline: 0.25em;
        margin-right: 0.25em;
        min-width: 50px;
        max-width: 20em;
    }
    celestin-template-manager {
        border-inline: 1px solid var(--pico-secondary-border);
        padding-inline: 0.25em;
    }

    #setupForm {
        margin-left: 0.5em;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        height: 100%;
    }
    
    .button-group {
        display: flex;
        justify-content: center;
        gap: 1em;
        margin-top: 1em;
        button {
            padding: 0.5em;
            flex: 1;
        }
    }
    button.middle {
        padding: 0.5em;
        display:block;
        margin-inline: auto;
        font-size: 0.8em;
    }
    .stats-container {
        display: flex;
        flex-direction: column;
        gap: 0.5em;
        margin-top: 1em;
        padding: 0;
        width: 100%;
    }

    .stat-item {
        display: flex;
        align-items: center;
        gap: 1em;
        padding: 0.5em;
        margin-bottom: 0.5em;
        background: var(--pico-background-color);
        border: 1px solid var(--pico-secondary-border);
        border-radius: 4px;
        cursor: move;
        transition: all 0.2s ease;

        &.dragging {
            opacity: 0.5;
            border-style: dashed;
        }

        .drag-handle {
            color: var(--pico-muted-color);
            cursor: move;
            opacity: 0.8;
            
            &:hover {
                opacity: 1;
                color: var(--pico-primary-hover);
            }
        }

        .stat-inputs {
            display: flex;
            flex: 1;
            gap: 1em;

            input {
                margin: 0;
                padding: 0.5em;
                height: 2.5em;

                &[name="statName"] {
                    flex: 2;
                }

                &[name="statValue"] {
                    flex: 1;
                }
            }
        }

        .delete-stat {
            padding: 0.5em;
            margin: 0;
            background: none;
            border: none;
            cursor: pointer;
            
            i {
                opacity: 0.8;
                color: var(--pico-muted-color);
                
                &:hover {
                    opacity: 1;
                    color: var(--pico-del-color);
                }
            }
        }
    }

    @container setup (max-width: 768px) {
        .stat-item {
            flex-direction: column;
            align-items: stretch;
            
            .stat-inputs {
                flex-direction: column;
                
                input {
                    width: 100%;
                }
            }
        }
    }

    .promptPreview {
        height:10em;
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        div {
            white-space: pre-wrap;
            padding: 1em;
            overflow-y: auto;
            color: var(--pico-muted-color);
            flex-grow: 1;
        }
        small {
            margin-left: 1em;
            color: var(--pico-muted-color)
        }
    }

    textarea {
        min-height: 10em;
        overflow-y: auto;
    }

    .form-content {
        overflow-y: auto;
        padding-right: 1em;
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;

        .grid-inputs {
            display: grid;
            grid-template-columns: auto 1fr;
            gap: 0.5em;
            align-items: center;
            margin-bottom: 1em;
        }

        .grid-inputs label {
            text-align: right;
            padding-right: 0.5em;
            font-size: 0.8em;
            margin: 0;
        }

        .grid-inputs input {
            padding: 0.5em;
            margin: 0;
        }

        @container setup (max-width: 768px) {
            .grid-inputs {
                grid-template-columns: 100%;
            }

            .grid-inputs label {
                text-align: left;
            }
        }
    }

    input:not([type="checkbox"]) {
        padding: 0.5em;
        height: 2.5em;
    }

    .tabs {
        display: flex;
        margin-bottom: 1em;
        border-bottom: 1px solid var(--pico-secondary-border);
        overflow-x: auto;
        flex-shrink: 0;
    }
    .tabs button {
        flex: 1;
        padding: 0.5em;
        background: none;
        border: none;
        border-bottom: 2px solid transparent;
        cursor: pointer;
        box-shadow:none;
    }
    .tabs button.active {
        border-bottom-color: var(--pico-primary);
    }
    .tab-content {
        display: none;
        flex-direction: column;
        height: 100%;
    }
    .tab-content.active {
        display: flex;
        height: 100%;
    }

    #scenario {
        flex-grow: 1;
        resize: none;
    }

    @container setup (max-width: 768px) {
        #setupForm {
            padding-left: 2em;
        }
        .sideNav {
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            background: var(--pico-background-color);
            z-index: 10;
            transform: translateX(-100%);
        }

        .sideNav::after {
            content: '>'; /* Right-pointing triangle */
            position: absolute;
            right: -1.5em;
            top: 1em;
            background: var(--pico-background-color);
            padding: 0.5em;
            border: 1px solid var(--pico-secondary-border);
            border-left: none;
            border-radius: 0 0.25em 0.25em 0;
            cursor: pointer;
        }

        .sideNav:hover,
        .sideNav:focus-within {
            transform: translateX(0);
        }

        .sideNav:hover::after,
        .sideNav:focus-within::after {
            content: '<'; /* Left-pointing triangle */
        }
    }
}