*, main, html {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: sans-serif;
    max-width: 100vw;
    overflow-x: hidden;
    /* min-height: 120vh; */
    display: flex;
    flex-direction: column;

    main {
        margin-inline: 2em;
        padding-top: 5vh;
        flex-grow: 1;
        /* width: 100vw; */

        &:has(.board) {
            margin-inline: 0;
            padding-inline: 0;
        }
    }
}

form {
    padding: 1rem;
    border-radius: 1rem;
    background-color: beige;
    border: 3px solid black;
    width: fit-content;
    margin: .25em;
}

footer {
    margin-top: 2em;
    width: 100%;
    color: lightgray;
    background-color: darkslateblue;
    padding: 2em 3em 5em 3em;

    a {
        color: white;
        &:hover {
            text-decoration: wavy;
        }
    }
}

/* main {
    margin-inline: 0;
    padding-inline: 0;
} */

.board {
    background-color: #fdfdfd;
    width: 99vw;

    display: flex;
    flex-direction: row;  /* ... */
    gap: 1rem;
    align-items: flex-start;
    padding-inline: 18px;
    /* padding: 1rem 0; */
    overflow-x: auto;
    /* min-width: 1200px; */

    overflow: scroll;

    .board-column {
        --bg: #f3f3f3;
        --bd: #222222; 

        flex: 1 1 0;
        /* min-width: 250px; */
        color: #222222;
        background-color: var(--bg);
        border-radius: 16px;
        border: 3px solid var(--bd);
        padding: 1rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
        font-size: 1rem;
        width: 25vw;


        h3 {
            margin: 0;
            padding-bottom: .5rem;
            border-bottom: 2px solid var(--bd);
            text-transform: capitalize;
        }

        &.column-idea {
            --bg: #ffe500;
            --bd: #d0bb00;
        }
        &.column-issue {
            --bg: #ff51a0;
            --bd: #af366c;
        }
        &.column-todo {
            --bg: #abcfff;
            --bd: #7d97b9;
        }
        &.column-other {
            --bg: #bbb;
            --bd: #888;
        }

        .column-items {
            display: flex;
            flex-direction: column;
            gap: .75rem;
            /* overflow: scroll; */

            min-height: 50dvh;
            min-width: 100%;
            transition: background-color 0.2s ease;

            /*overflow: scroll; /* or hidden ... ? */

            &.drag-over-active {
                background-color: rgba(0, 0, 0, 0.05);
            }

            .item {
                border-radius: 8px;
                background-color: #ffffff; 
                border: 3px solid var(--bd);
                padding: .75rem;
                transition: border-style .2s ease;

                &:hover {
                    border-style: dashed;
                }

                &.state-new {
                    /*color: red; /* test ... */

                    --state-var: #fafb;
                    border-color: red;
                    /* border-width: 3px; */
                }

                form {
                    background-color: transparent;
                    border: none;
                    padding: 0;
                    margin: 0;
                    width: 100%;
                    display: flex;
                    flex-direction: column;
                    gap: .5rem;

                    span {
                        font-family: monospace;
                        font-size: .8rem;
                        color: #666;
                        margin-bottom: .25rem;
                    }

                    label {
                        font-size: .85rem;
                        font-weight: 600;
                        margin-bottom: -.25rem;
                    }

                    input[type="text"],
                    input[type="url"],
                    select,
                    textarea {
                        width: 100%;
                        padding: .4rem;
                        border: 1px solid #ccc;
                        border-radius: 4px;
                        font-family: inherit;
                        font-size: .9rem;
                    }

                    textarea {
                        resize: vertical;
                        min-height: 60px;
                    }

                    input[type="submit"] {
                        margin-top: .5rem;
                        background-color: var(--bd);
                        color: #ffffff;
                        border: none;
                        padding: .5rem;
                        border-radius: 4px;
                        cursor: pointer;
                        font-weight: bold;
                        
                        &:hover {
                            opacity: .85;
                            color: #000000;
                        }
                    }
                }

                &.collapsed {
                    /* form {
                        *:not(input[name="name"]) {
                            display: none;
                            visibility: hidden;
                        }
                    } */
                    /* *:not(form) {
                    &*:not(has(from)) {
                        display: none;
                        visibility: hidden;
                        background-color: none;
                    }} */
                    form {
                        > * {
                            display: none;
                        }

                        input[name="name"],
                        label[for^="name_"] {
                            display: block;
                        }
                    }

                    .media-item,
                    #upload-media-form {
                        display: none;
                    }
                }

                .collapse-toggle{
                    appearance: none;
                    -webkit-appearance: none;
                    top: 0.75rem;
                    right: 0.75rem;
                    width: 1.25rem;
                    height: 1.25rem;
                    margin: 0;
                    cursor: pointer;
                    outline: none;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    z-index: 2;

                    &::before {
                        content: '';
                        display: block;
                        width: 0.6rem;
                        height: 0.6rem;
                        border-right: 2px solid var(--bd);
                        border-bottom: 2px solid var(--bd);
                        transform: rotate(45deg);
                        /* no transition becuase the content also instantly display:none ... */
                    }

                    &:hover::before {
                        opacity: 0.7;
                    }

                    &:checked::before {
                        transform: rotate(-135deg);
                    }
                }

                
                cursor: grab;
                &:active {
                    cursor: grabbing;
                }

                .item.dragging {
                    opacity: 0.5;
                    background-color: #f0f0f0;
                    cursor: grab; /* just fallback .. */
                }
            }
        }
    }

    .media-item {
        width: 100%;
        img {
            width: 100%;
            /* border-radius: .22rem;; */
        }
        border-radius: .22rem;
        overflow: hidden;
        a.delete-media {
            color: red;
            text-decoration: none;

            &:hover {
                color: darkred;
            }
        }
        background-color: #eee;

        /* ToDO: "Lightbox" */

        margin-block-start: .3rem;
    }

    #upload-media-form {
        margin-block: .5rem;
        /* padding: 3rem; */
        background-color: lightblue;
        padding: .2rem;
    }
}

#itemCreationForm {
    display: flex;
    flex-direction: column;

    note {
        color: #9f9f9f;
    }

    label {
        margin-top: .5rem;
    }
}

#time-container {
    font-size: 2rem;
    font-weight: bold;
    color: #af366c;
    margin-bottom: 1rem;
    /* margin-inline-start: 20%; */
    padding: 0.5rem;
    /* padding-inline: 5rem; */
    border: 2px solid #af366c;
    border-radius: 8px;
    width: fit-content;
    text-align: center;
    
    &.none {
        /* display: none; */
        visibility: hidden;
    }
}



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


#toasts {
    position: fixed;
    top: 1rem;
    right: 1rem;

    z-index: 9999;

    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    pointer-events: none;

    .toast {
        pointer-events: auto;

        display: flex;
        align-items: center;
        justify-content: space-between;

        min-width: 250px;
        max-width: 350px;

        padding: 0.75rem 1rem;
        background-color: #1e1e1e;
        color: #ffffff;
        
        border-radius: 4px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        font-family: system-ui, sans-serif;
        animation: toast-slide-in 0.2s ease-out forwards;

        &.toast-info {
            border-left: 4px solid #3b82f6;
        }

        &.toast-success {
            border-left: 4px solid #10b981;
        }

        &.toast-error {
            border-left: 4px solid #ef4444;
        }

        &.toast-warning {
            border-left: 4px solid #f59e0b;
        }

        .toast-message {
            flex-grow: 1;
            font-size: 0.875rem;
            line-height: 1.4;
            margin-right: 0.75rem;
            word-wrap: break-word;
        }

        .toast-close {
            background: transparent;
            border: none;
            color: currentColor;
            font-size: 1.25rem;
            line-height: 1;
            cursor: pointer;
            padding: 0;
            opacity: 0.6;
            transition: opacity 0.15s ease;

            &:hover,
            &:focus-visible {
                opacity: 1;
                outline: none;
            }
        }
    }
}


@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

img.img-preview,
img#img_preview {
    max-width: 30vw;
    max-height: 30dvh;
    height: auto;
    width: auto;
    border: 4px solid lightgray;
    border-radius: 2rem; /* ??? */
    margin-bottom: .4rem;

    /* DONE: display:none until shown by JS ... */
    display: none;
    /* WELL "done" ... */


    &.shown {
        display: block;
    }

    /* OPTION: only use &:not(.shown) ... (would save ONE LINE)  */
}