.alterState{
    &[data-state=hidden]{
        display: none;
    }
}

.warning{
    text-align: center;
    color: var(--yellow-100);
    margin: 1rem;
    &[data-state=hidden]{
        display: none;
    }
}

.scrollable{
    --height: 400px;
    max-height: var(--height);
    overflow-y: auto;
}

button, .button{
    --colour: var(--purple-800);
    display: inline-block;
    width: fit-content;
    padding: 0.2rem 2rem;
    border-radius: 4px;
    background: var(--colour);
    border: 1px solid oklch(from var(--colour) calc(l + 0.2) c h);
    font-weight: bold;
    cursor: pointer;
    color: var(--white);
    transition: filter 0.4s;
    &[data-state=hidden]{display: none}
    &[data-colour=red]{--colour: var(--red-600)}
    &[data-colour=blue]{--colour: var(--blue-800)}
    &[data-colour=green]{--colour: var(--green-700)}
    &[data-colour=orange]{--colour: var(--orange-600)}
    &:hover,
    &:focus-visible{
        color: oklch(from var(--white), calc(l + 0.5) c h);
        background: oklch(from var(--colour) calc(l - 0.1) c h);
        border-color: oklch(from var(--colour) calc(l + 0.2) c h);
    }
    &[data-selected="1"]{
        filter: hue-rotate(180deg);
    }
}

.buttons{
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    button, a{
        padding: 0.35rem 0.75rem;
        font-size: 0.95rem;
        font-weight: 400;
    }
}

input, textarea, select, .fileUploadInput{
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--blue-1200);
    background: linear-gradient(var(--blue-1000), var(--blue-1100));
    color: var(--white);
    &:invalid:not(:placeholder-shown){
        border-color: var(--orange-500);
    }
    &::placeholder{
        color: var(--grey-200);
    }
}

select{
    background: var(--blue-1000);
}

form:not(.stripped){
    width: 600px;
    max-width: 100%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-inline: auto;
    border: 2px solid var(--blue-800);
    border-radius: 8px;
    section{
        width: 100%;
        h2{
            margin-bottom: 1rem;
            border-bottom: 2px solid var(--blue-900);
        }
    }
    .formField{
        width: 90%;
        display: flex;
        flex-direction: column;
        margin-inline: auto;
        gap: 0.35rem;
        & + .formField{
            margin-top: 1rem;
        }
        label{
            font-weight: bold;
        }
        input, textarea, select, .fileUploadInput{
            width: 100%;
        }
        &.checkboxField{
            flex-direction: row;
            justify-content: flex-end;
            align-items: center;
            label{
                margin: 0 0 0 0.5rem;
                font-weight: 400;
                font-size: 0.8rem;
            }
            .checkbox{
                --_height: 20px;
                --_width: calc(var(--_height) * 2.25);
                --_br: 10px;
                display: flex;
                flex-direction: row-reverse;
                justify-content: flex-start;
                label{
                    cursor: pointer;
                    display: block;
                    height: var(--_height);
                    width: var(--_width);
                    background: var(--grey-600);
                    position: relative;
                    border-radius: var(--_br);
                    &::after{
                        content: '';
                        position: absolute;
                        top: 0;
                        left: 0;
                        width: var(--_height);
                        height: var(--_height);
                        border-radius: 50%;
                        background-color: var(--grey-300);
                        transition: transform 0.25s;
                    }
                }
                input{
                    height: 0;
                    width: 0;
                    pointer-events: none;
                }
                input:checked + label{
                    background: var(--grey-600);
                    &::after{
                        transform: translateX(calc(var(--_width) - var(--_height)));
                        background-color: var(--yellow-200);
                    }
                }
                input:disabled:checked + label{
                    background: var(--grey-600);
                    &::after{
                        transform: translateX(calc(var(--_width) - var(--_height)));
                        background-color: var(--grey-600);
                    }
                }
            }
        }
        .fileUploadInput{
            position: relative;
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 0;
            label{
                background: var(--blue-800);
                padding: 0.5rem;
                cursor: pointer;
                font-size: 0.9rem;
                &:hover{
                    background: var(--blue-400);
                }
            }
            input{
                position:absolute;
                width:1px;
                height:1px;
                padding:0;
                margin:-1px;
                overflow:hidden;
                clip:rect(0,0,0,0);
                white-space:nowrap;
                border:0;
            }
            .imageName{
                max-width: 30ch;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                font-size: 0.8rem;
            }
        }
    }
    button[type=submit]{
        margin-top: 1rem;
    }
}

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active { 
    box-shadow: 0 0 0 50px var(--blue-1100) inset !important;
    -webkit-text-fill-color: var(--white) !important;
}

.card{
    --border: 2px solid var(--blue-700); 
    border: var(--border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    &[data-type=error]{
        --border: 2px dashed var(--red-800);
        max-width: 100%;
    }
    &[data-type=small]{
        max-width: 400px;
    }
    h2{
        width: 100%;
        border-bottom: var(--border);
        padding: 0.5rem 1rem;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .body{
        padding: 1rem;
        .details{
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 0.25rem;
            & + .details{
                margin-top: 1rem;
            }
            p{
                margin: 0;
                &:nth-of-type(2){
                    margin-left: auto;
                    text-align: right;
                }
            }
        }
    }
    .buttons{
        padding: 0.5rem;
        justify-content: flex-end;
        margin-top: auto;
    }
}

.headerRow{
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 2rem;
    *{
        margin: 0;
    }
}

.dbList{
    .dbItem{
        --columns: 1fr 1fr;
         --statusBG: var(--grey-400);
        display: grid;
        grid-template-columns: var(--columns);
        gap: 1rem;
        padding: 1rem;
        background: var(--blue-1100);
        align-items: center;
        p{
            margin: 0;
            overflow: hidden;
        }
        &:nth-of-type(2n){
            background: var(--blue-1000);
        }
        .date{
            font-size: 0.8rem;
            color: var(--grey-200);
        }
        .status{
            border-radius: 20px;
            padding: 0.25rem 0.5rem;
            background: var(--statusBG);
            font-size: 0.7rem;
            font-weight: bold;
            text-align: center;
        }
        &[data-level=Error]{
            .status{
                --statusBG: var(--red-700);
            }
        }
        &[data-level=Warning]{
            .status{
                --statusBG: var(--yellow-700);
            }
        }
        &[data-level=Info]{
            .status{
                --statusBG: var(--green-700);
            }
        }
    }
}

/* .imageGrid{
    img{
        max-width: 100%;
        border-radius: 8px;
        display: block;
        margin: auto;
    }
} */

.toast{
    position: fixed;
    border: 2px solid var(--blue-900);
    background: var(--blue-1200);
    bottom: var(--bottom);
    right: 0;
    width: 400px;
    padding: 1rem;
    border-radius: 10px 0 0 10px;
    height: var(--height);
    transform: translateX(0%);
    transition: transform ease-out 0.3s;
    &[data-location=offscreen]{
        transform: translateX(100%);
    }
    .type{
        --color: white;
        font-weight: bold;
        color: var(--color);
        border-bottom: 1px solid var(--color);
        &[data-state=error]{
            --color: var(--red-600)
        }
        &[data-state=warning]{
            --color: var(--yellow-200)
        }
        &[data-state=info]{
            --color: var(--green-300)
        }
    }
    .closeButton{
        --size: 35px;
        position: absolute;
        top: 0;
        right: 0;
        padding: 0;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        height: var(--size);
        width: var(--size);
        border: 1px solid var(--blue-900);
        cursor: pointer;
        border-radius: 0 0 0 10px;
        &:hover{
            color: var(--blue-200);
        }
    }
}

:root {
  interpolate-size: allow-keywords;
}
details {
  border: 1px solid color-mix(in oklab, currentColor 15%, transparent);
  border-radius: 12px;
  overflow: clip;
}

/* header */
summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

summary::-webkit-details-marker { display:none; }

summary h4 {
  margin: 0;
  font-size: 0.95rem;
}

/* caret */
summary::after {
  content: "🔻";
  transition: transform .2s;
}

details[open] summary::after {
  transform: rotate(180deg);
}

.panel {
  overflow: hidden;
  height: 0;
  opacity: 0;
  padding-inline: 14px;
  transition: height .25s ease, opacity .2s ease;
}

details[open] .panel {
  height: auto;
  opacity: 1;
  padding-bottom: 14px;
}