
html {
    scroll-padding: 5px;
}

@keyframes reveal-search {
    from {
        pointer-events: none;
        user-select: none;
    }
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
    to {
        pointer-events: all;
        user-select: text;
    }
}

@keyframes unreveal-search {
    from {
        pointer-events: none;
        user-select: none;
    }
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
    to {
        pointer-events: all;
        user-select: text;
    }
}

@keyframes spinner {
    from {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(180deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes scroller {
    from {
        background-position: 0px;
    }
    to {
        background-position: 56.57px;
        /* background-position: calc( 80px * sin( 45deg ) ); */
    }
}

#user-search /* , #activity-search */ {
    margin-bottom: 0 !important;
    transition: background 1s;
    & + ul {
        position: absolute;
        width:100%;
        height: auto;
        z-index: 9999999999;
        /* margin-top: -16px;
        margin-top: -32px; */
        border-radius: 0 0 8px 8px;

        animation: unreveal-search 0.1s 0.3s both;
        animation-direction: reverse;
        animation-fill-mode: forwards;
        
    }
    
    &:focus-within + ul:not(.hidden) {
        animation: reveal-search 0.1s both;
    }
    &:focus-within + ul.hidden {
        /* animation: reveal-search 0.1s both; */
        animation: unreveal-search 0.1s 0s both;
        animation-delay: 0!important;
        animation-direction: reverse;
        animation-fill-mode: forwards;
    }
}

#activity-search {
    margin-bottom: 0 !important;
    margin-top: 30px;
    display: none !important;
}

ul#users-list
/* , ul#activities-list */
{
    scroll-margin-top: 20px;
    list-style: none;
    padding: 0;
    overflow: auto;
    
    li {
        padding: 0.5em 1em;
        cursor: pointer;
        background: #eee;
        transition: background-color 0.2s;

        &:not(:first-child){
            border-top: 0.5px dotted #fafafa;
        }
        
        /* &:nth-child(2n+1) {
            background: #ddd;
        } */
        
        &:hover {
            background: #fff;
        }

        label {
            pointer-events: none;
            user-select: none;
        }
    }
}

ul#activities-list {
    transition: background 1s;

    scroll-margin-top: 20px;
    list-style: none;
    padding: 0;
    overflow: auto;

    display: grid;
    grid-template-columns: 1fr;
    justify-content: space-evenly;
    align-items: stretch;
    justify-items: stretch;
    align-content: stretch;

    li {
        text-wrap: balance;
    }

    li:not(.disabled, [disabled]) label {
        cursor: pointer;
    }
    li.disabled label, li[disabled] label {
        cursor: inherit;
    }

}

.loading {
    cursor: wait;
    user-select: none;
    background: repeating-linear-gradient(-45deg,#fff 0 20px,#f4f4f4 0 40px);
    animation: forwards infinite linear scroller 1s;
    position: relative;

    &::before{
        content: "Chargement";
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        text-align: center;
        align-content: center;
    }

    & ::placeholder {
        color: transparent;
        opacity: 0;
    }
}

.search-hidden {
    display: none;
}
.search-disabled {
    opacity: 0.35;
    user-select: none;
    pointer-events: none;
    cursor: not-allowed;
}

#users-title span.time{
    display:block;
    &:first-letter{
        text-transform: uppercase;
    }
}

#activities-title {
    .time {
        break-inside: avoid;
        white-space: nowrap;
    }
}

#fullscreen-button {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 999;
    border: none;
    color: white;
    background-color: black;
    padding: 1em;
    border-radius: 100px;
    aspect-ratio: 1;
    display: block;
    width: 100px;
    height: 100px;
    cursor: pointer;
    line-height: 1;

    transition: opacity 0.35s;

    opacity: 0;
    &:hover {
        opacity: 0.5;
    }
    &::before {
        content: "\1F5D6";
        font-size: 24pt;
    }
}

#activity-confirm {
    a {
        background-color: var(--orange);
        color: white !important;
        width: 100%;
        text-align: center;
        padding: 1em;
        border-radius: 3px;


        &:not(.disabled, .error, .done, .loading){
            border-width: 0px;
        }

        &, & i{
            transition: color 0.3s, border-width 0.3s, border-color 0.3s, background-color 0.3s, margin 0.3s, opacity 0.3s, padding 0.3s !important;
        }

        .disabled &,
        &.disabled {
            pointer-events: none;
            border-color: silver !important;
            color: silver !important;
            background-color: #ddd !important;
        }


        .loading:not(.done,.error) & i {
            animation: spinner 2s infinite linear;
        }

        .loading &,
        &.loading {
            cursor: wait !important;

            & i {
                cursor: wait;
                margin: 0;
                padding: 8px;
                visibility: visible;
                opacity: 1;
                color: inherit !important;
            }

        }
        .done &,
        &.done {
            color: green!important;
            background-color: var(--wp--preset--color--vivid-green-cyan) !important;
            border-color: green !important;
        }
        .error &,
        &.error {
            color: red!important;
            background-color: var(--wp--preset--color--luminous-vivid-orange) !important;
            border-color: red !important;
        }
    }
}

a i {
    color: inherit !important;
}

@media (max-width: 599px) {
    ul#activities-list li {
        padding: 0.5em 1em;
        &:has(input[type=checkbox]:checked){
            border: none;
            color: var(--orange);
        }
        &:nth-child(2n+1) {
            background-color: rgba(0,0,0,0.1);
        }
    }

}

@media (min-width: 600px) {
    ul#activities-list {
        min-height: 100px;
        grid-template-columns: 1fr 1fr 1fr;
        grid-column-gap: 20px;
        grid-row-gap: 20px;
        margin: 0 1px 20px;
        overflow: visible;

        &.empty {
            grid-template-columns: 1fr;
        }

        li {
            min-height: 66px;
            font-family: Montserrat, Helvetica, Arial, Lucida, sans-serif;
            font-size: 20px;
            font-weight: 500;
            position: relative;
            border-radius: 3px;
            border: 2px solid transparent;
            box-shadow: 0 0 0 1px silver;
            transition: box-shadow 0.3s, border 0.3s, color 0.3s;
            align-content: center;

            label {
                display: block;
                padding: 1em;
                text-align: center;
            }

            &.disabled {
                user-select: none;
                cursor: not-allowed;
                /* pointer-events: none; */
            }

            &:not(.disabled) {
                cursor: pointer;
                input[type=checkbox] {
                    visibility: hidden;
                    cursor: pointer;
                    position: absolute;
                    top: 8px; right: 8px;
                }
                &:hover {
                    border-color: var(--orange);
                    box-shadow: none;
                }
                &:has(input[type=checkbox]:checked){
                    border-color: var(--orange);
                    color: var(--orange);
                    border-width: 2px;
                    box-shadow: 0 0 16px -8px var(--orange);
                }
            }
        }
    }
}