@import url('var.css');

/* UNIVERSAL STYLING */
.page {
    background-color: var(--mainBlue);
}

.sidebar {
    .top {
        #add-icon {
            mask: url("../svg/add.svg") no-repeat center center;
        }
    }

    form {
        .control {
            button:hover {
                cursor: pointer;
                transform: translateY(-1px);
            }

            #more-filters-btn {
                flex-direction: column;
                justify-content: space-evenly;

                .bar {
                    z-index: 2;
                    width: 1.8em;
                    height: 3px;
                    background-color: black;
                    border-radius: 2px;
                    align-self: center;
                    transition: transform 0.3s ease, opacity 0.3s ease;
                }
            }

            #more-filters-btn.open .bar:nth-child(1) {
                transform: rotate(45deg) translate(0.31em, 0.29em);
            }
            #more-filters-btn.open .bar:nth-child(2) {
                display: none;
            }
            #more-filters-btn.open .bar:nth-child(3) {
                transform: rotate(-45deg) translate(0.31em, -0.29em);
            }

            #pdf-icon {
                mask: url("../svg/file-pdf-solid.svg") no-repeat center center;
            }
        }

        .more-filters {
            max-height: 0;
            overflow: hidden;
            opacity: 0;
            transition: var(--mainTransition);
            display: flex;
            flex-direction: column;
            align-content: space-between;
            justify-content: center;

            label {
                padding-top: 0.5em;
                text-align: center;
            }

            .room,
            .user-filter,
            .date {
                display: flex;
                flex-direction: column;
                padding: 0.5em 0;
                margin: 2px;
                align-items: center;
            }

            .pictogram-grid {
                padding: 0.5em 0;
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(2.5em, 1fr));
                gap: 0.5em;
                justify-items: center;
                align-items: center;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;

                .pictogram-item {
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    height: auto;
                    width: 100%;

                    .pictogram {
                        height: 100%;
                        width: 100%;
                    }
                }

                .pictogram-item.selected {
                    background-color: var(--lighterBlue);
                    border-radius: 10px;
                }

                .pictogram-item:hover {
                    cursor: pointer;
                    transform: translateY(-1px);
                }

            }

            .prevention-programm {
                display: flex;
                flex-direction: column;
                align-items: center;

                input[type="checkbox"] {
                    width: 1.2em;
                    height: 1.2em;
                    margin: 0.5em;
                    border: 2px solid var(--grey);
                    border-radius: 4px;
                    cursor: pointer;
                    position: relative;
                    transition: background-color 0.3s ease, border-color 0.3s ease;
                }

            }

        }

        .more-filters.visible {
            max-height: 600px;
            opacity: 1;
        }
    }

    .end {
        margin: 0;
        padding: 0;
    }
}

.spinner {
    border: 2px solid grey;
    border-radius: 50%;
    border-left: 2px solid var(--lightBlue);
    width: 1em;
    height: 1em;
    animation: spin 1s linear infinite;
    margin-left: 0.5em;
    display: inline-block;
    vertical-align: middle;
}
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

main {
    display: flex;
    flex-direction: column;

    .substance-table {
        max-width: 100vw;
        padding: 0 0.5em;
        border-spacing: 0 0.4em;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        hyphens: auto;

        thead {
            position: sticky;
            top: 4em;
            z-index: 10;

            th {
                padding: 1em 0;
                background-color: var(--mainBlue);
                color: var(--mainTextColor);

                span {
                    display: flex;
                    flex-direction: row;
                    justify-content: space-evenly;
                    gap: 0.5em;
                    align-items: center;

                    svg {
                        width: 1em;
                        height: 1em;
                        background-color: var(--lighterBlue);
                    }

                    #sort-icon {
                        mask: url("../svg/sort-solid-full.svg") no-repeat center center;
                    }
                }
            }
        }

        tbody {
            td {
                padding: 0.5em 1em;
            }

            tr {
                box-shadow: 0 2px 4px rgba(0,0,0,0.06);
                cursor: pointer;

                td:first-child {
                    border-top-left-radius: var(--mainRadius);
                    border-bottom-left-radius: var(--mainRadius);
                }

                td:last-child {
                    border-top-right-radius: var(--mainRadius);
                    border-bottom-right-radius: var(--mainRadius);
                }
            }

            tr:nth-child(even) {
                background-color: var(--lighterBlue);
            }

            tr:nth-child(odd) {
                background-color: var(--lightBlue);
            }

            tr:hover {
                transform: translateY(-1px);
                box-shadow: var(--mainShadow);
            }
        }
    }

    .pagination {
        display: flex;
        align-items: center;

        button {
            display: flex;
            justify-content: center;
            place-items: center;
            padding: 0 1em;
            height: 3em;
            width: fit-content;
            border: 2px solid var(--lighterBlue);
            border-radius: 1.5em;
            box-shadow: var(--mainShadow);
        }

        button:hover {
            transform: translateY(-1px);
            box-shadow: var(--mainShadow);
        }

        label {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 0.5em;
            color: var(--mainTextColor);
            padding-right: 0.5em;

            select {
                border: none;
                padding: 0;
                margin: 0;
                height: 2em;
                border-radius: 1em;
                font-size: 1em;
                color: black;
                text-align: center;
                justify-content: center;
                background-color: #90a0c5;
            }
        }
    }

    .pagination::before {
        content: "";
        flex: 1;
    }
}

/* MOBILE STYLING */
@media screen and (max-width: 1000px) {
    .substance-table .col-description,
    .substance-table .col-department {
        display: none;
    }
}
