/* * * * * * * * * * * * * * * * * * *\
| * * * POLICE  * * * * * * * * * * * |
\* * * * * * * * * * * * * * * * * * */

html {
    font-family: Alegreya Sans,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";
    font-size: 100%;
}

/* * * * * * * * * * * * * * * * * * *\
| * * * FLEXBOX PAGE  * * * * * * * * |
\* * * * * * * * * * * * * * * * * * */

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    height: 100%;
    min-height: 100vh;
    width: auto;
}

header {
    flex: 0 1 auto;
}

main {
    flex: 1 1 auto;
    overflow: auto;
}

footer {
    flex: 0 1 auto;
}

/* * * * * * * * * * * * * * * * * * *\
| * * * ICÔNES  * * * * * * * * * * * |
\* * * * * * * * * * * * * * * * * * */

img.icon.key {
    content:url("/icons/key.svg");
}

img.icon.lock {
    content:url("/icons/lock.svg");
}

img.icon.spinner {
    content:url("/icons/spinner.svg");

}

img.icon.unlock {
    content:url("/icons/unlock.svg");
}

img.icon.user {
    content:url("/icons/user.svg");
}

img.icon.external {
    content:url("/icons/external.svg");
}

img.icon.sphere {
    content:url("/icons/sphere.svg");
}

img.icon.mail {
    content:url("/icons/mail.svg");
}

img.icon.location {
    content:url("/icons/location.svg");
}

img.icon.black {
    filter: none;
}

img.icon.red {
    filter: invert(33%) sepia(100%) saturate(6230%) hue-rotate(331deg) brightness(101%) contrast(101%);
}

img.icon.green {
    filter: brightness(0) saturate(100%) invert(52%) sepia(43%) saturate(1183%) hue-rotate(73deg) brightness(85%) contrast(104%);
}

img.icon.white {
    filter: invert(1);
}

/* * * * * * * * * * * * * * * * * * *\
| * * * HEADER  * * * * * * * * * * * |
\* * * * * * * * * * * * * * * * * * */
header {
    position: relative;
    background-color: #bf0303;
    padding: 1rem;
    height: 2rem;
    overflow: hidden;
    color: white;
    font-variant: small-caps;
    display: flex;
    flex-direction: row;
    align-items: center;
    box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);

    img {
        height: 2rem;
        filter: drop-shadow(1px 1px 2px black);
    }

    >h1 {
        text-shadow: 1px 1px 2px black;
    }

    h1 {
        font-size: 1.5rem;
        line-height: 2rem;
        margin: 0 0.5rem;
        letter-spacing: 0.2rem;

        &.long-title {
            display: none;
        }
    }

    a {
        text-decoration: none;
        color: inherit;
        font-size: inherit;
    }

    .space {
        flex: 1 1 auto;
    }

    .burger {
        height: 2rem;
        width: 2rem;
        display: flex;
        align-items: center;
        justify-content: space-evenly;
        flex-direction: column;
        cursor: pointer;

        transition: height 0.25s ease;

        .line {
            height: 0.2rem;
            width: 2rem;
            background-color: #FFF;
            border-radius: 0.15rem;
            box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);
        }

        &:hover {
            height: 2.5rem;
        }
    }

    .long-user, a.long-connect {
        display: none;
    }

    @media screen and (min-width: 50rem) {
        .space {
            display: none;
        }

        h1 {
            letter-spacing: revert;
            text-align: center;

            &.long-title {
                display: block;
                flex: 1 1 auto;
            }

            &.short-title {
                display: none;
            }
        }

        & {
            height: 4rem;
        }

        img {
            height: 4rem;
        }

        .burger {
            display: none;
        }

        .long-user {
            display: block;
            position: relative;
            height: calc(4rem - 4px);
            border: 2px solid white;
            border-radius: 2rem;
            overflow: hidden;
            box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);

            a.avatar {
                position: absolute;
                top: -2px;
                right: -2px;
                height: calc(4rem - 4px);
                width: 4rem;
                border: 2px solid white;
                border-radius: 50%;
                background-color: #ffac31;
                overflow: hidden;

                img {
                    width: 4rem;
                    height: 4.5rem;
                }
            }

            .long-user-menu {
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                background-color: #9e0707;

                p {
                    height: calc(1.25rem - 4px);
                    width: calc(100% - 7rem);
                    padding: 0.5rem 5rem 0.25rem 2rem;
                    margin: 0;
                    font-weight: 600;
                    border-bottom: 2px solid white;
                    text-align: center;
                }

                a {
                    display: flex;
                    flex-direction: row;
                    align-items: center;
                    justify-content: left;
                    width: calc(100% - 7rem);
                    padding: 0.25rem 5rem 0.5rem 2rem;
                    height: calc(1.25rem - 2px);
                    border-bottom: 0;
                    background-color: #e03d5d;

                    &:hover {
                        background-color: #c12f4b;
                    }

                    img {
                        height: 1.25rem;
                        width: 1.25rem;
                    }

                    p {
                        text-align: left;
                        height: 1.25rem;
                        width: calc(100% - 7.5rem);
                        padding: 0 0 0 0.5rem;
                        font-size: 1rem;
                        border-bottom: 0;
                    }
                }
            }
        }

        a.long-connect {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: left;
            width: calc(7rem);
            padding: 0.5rem 1rem 0.5rem 1rem;
            background-color: #4ba031;
            height: calc(1.5rem - 4px);
            border: 2px solid white;
            border-radius: 2rem;
            overflow: hidden;
            box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);

            &:hover {
                background-color: #3b8324;
            }

            img {
                height: 1.25rem;
                width: 1.25rem;
            }

            p {
                height: 1.25rem;
                width: calc(100% - 0.5rem);
                padding: 0 0 0 0.5rem;
                font-size: 1rem;
                border-bottom: 0;
            }
        }
    }
}

#curtain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #00000080;
    z-index: 100;

    display: none;

    &.active {
        display: block;
    }
}

nav.big-nav {
    display: none;
}

nav.small-nav {
    position: fixed;
    top: 0;
    right: calc(-70% - 1rem);
    padding: 0.5rem 0 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: baseline;
    width: min(calc(70% - 1rem), 32rem);
    height: 100vh;
    background-color: #333333;
    z-index: 100;

    transition: right 0.5s ease-out;

    h1 {
        font-size: 1rem;
        width: calc(100% - 1rem);
        text-align: center;
        margin: 0 1rem 0 0;
    }

    a {
        font-variant: normal;
        padding: 1rem 0;
        border-bottom: 1px solid white;
        width: 100%;

        &:hover {
            background-color: #2b2b2b;
        }

        &:not(:has(img)) {
            padding-left: 1.5rem;
            width: calc(100% - 1.5rem);
        }

        img {
            display: inline;
            height: 0.9rem;
            width: 0.9rem;
            margin-right: 0.6rem;
        }
    }

    div.user {
        width: calc(100% - 2px - 1rem);
        margin: 0.5rem 1rem 0 0;
        text-align: center;
        border: 1px solid white;
        border-radius: 1rem;
        overflow: hidden;

        p {
            padding: 0.5rem 0 0.25rem 0;
            margin: 0;
            font-weight: 600;
            border-bottom: 1px solid white;
        }

        a {
            display: block;
            padding: 0.25rem 0;
            width: 100%;
            border-bottom: 0;

            &.green {
                background-color: #4ba031;

                &:hover {
                    background-color: #3b8324;
                }
            }

            &.red {
                background-color: #e03d5d;

                &:hover {
                    background-color: #c12f4b;
                }
            }
        }
    }

    &.active {
        right: 0;
    }
}

@media screen and (min-width: 50rem) {
    nav.small-nav {
        display: none;
    }

    nav.big-nav {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        background-color: #9e0707;
        z-index: 1;
        box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);

        a {
            display: block;
            font-variant: normal;
            width: auto;
            height: 1.25rem;
            padding: 0.5rem 1.5rem;
            text-decoration: none;
            color: white;
            text-align: center;

            &:hover {
                background-color: #8c0606;
            }

            img {
                margin-right: 0.5rem;
                height: 0.9rem;
            }
        }
    }
}

/* * * * * * * * * * * * * * * * * * *\
| * * * FOOTER  * * * * * * * * * * * |
\* * * * * * * * * * * * * * * * * * */

footer {
    background-color: #EEEEEE;
    padding: 0 1rem;

    p {
        margin: 0.5rem;
        font-size: 0.5rem;
        text-align: center;
    }
}

/* * * * * * * * * * * * * * * * * * *\
| * * * MAIN  * * * * * * * * * * * * |
\* * * * * * * * * * * * * * * * * * */
main {
    padding: 0 2rem;
    width: calc(100% - 4rem);
    max-width: 1080px;
    margin: 0 auto;

    h1 {
        text-align: center;
    }
}

/* * * * * * * * * * * * * * * * * * *\
| * * * MAIN FEATURES * * * * * * * * |
\* * * * * * * * * * * * * * * * * * */
.image-background {
    background-position: center;
    background-size: cover;
    backdrop-filter: brightness(150%);
    padding: 1rem 2rem;
    margin: 0 -2rem 2rem -2rem;

    h1 {
        font-variant: all-small-caps;
        text-shadow: 2px 2px white;
    }

    p {
        text-align: center;
        text-shadow: 2px 2px white;
    }
}

.image-legend {
    img {
        width: calc(100% - 3px);
        border-color: black;
        border-style: solid;
        border-width: 3px;
        border-radius: 20px;
        box-shadow: 2px 2px 5px lightgray;
    }

    p {
        margin-top: 0;
        font-size: small;
        text-align: center;
        font-style: italic;
    }
}

.cards-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;

    .card {
        width: calc(30rem - 1px);
        margin: 0.75rem;
        background-color: #fff7f7;
        border-color: #efe1e1;;
        border-width: 1px;
        border-style: solid;
        border-radius: 10px;
        box-shadow: 2px 2px 5px lightgray;

        h2 {
            text-align: center;
            font-size: 1.5rem;
            font-variant: all-small-caps;
            margin: 0;

            img {
                height: 1rem;
                width: 1rem;
                margin-right: 0.25rem;
            }
        }

        p {
            text-align: center;
        }
    }
}

/* * * * * * * * * * * * * * * * * * *\
| * * * FORM  * * * * * * * * * * * * |
\* * * * * * * * * * * * * * * * * * */
form {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    .field {
        position: relative;
        align-items: center;
        width: 100%;
        height: 2.5rem;
        max-width: 30rem;
        margin-top: 1rem;
        text-align: center;

        label {
            position: absolute;
            width: 100%;
            font-size: 1rem;
            line-height: 2rem;
            left: 0;
            user-select: none;
            color: gray;
            cursor: text;

            transition: 0.2s;

            &:has(~input:focus), &:has(~input:not(:placeholder-shown)) {
                font-size: 0.75rem;
                line-height: 0.75rem;
                top: -1rem;
                left: 25%;
                width: 50%;
            }
        }

        input {
            border: 1px solid black;
            margin: 1px;
            border-radius: 0.4rem;
            width: calc(100% - 4px);
            font-size: 1rem;
            line-height: 2rem;
            padding: 0;
            outline: none;
            text-align: center;
            box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);
        }

        input:not([type="submit"]) {
            &:focus {
                border: 2px solid cadetblue;
                margin: 0;
            }

            &:read-only {
                user-input: readonly;
                color: #4c4c4c;
            }
        }

        input[type="submit"] {
            background-color: #ffac31;
            cursor: pointer;

            &:hover, &:active {
                background-color: #f4980f;
            }
        }
    }

    p {
        width: 100%;
        max-width: 40rem;
        text-align: center;
        font-size: 1rem;
        margin: 0 0 0.5rem 0;
    }

    p.message {
        border: 1px solid darkred;
        background-color: #FF000010;
        border-radius: 0.4rem;
        padding: 0.5rem;
    }

    p.hint {
        font-size: 0.8rem;
    }
}

/* * * * * * * * * * * * * * * * * * *\
| * * * TABLEAU * * * * * * * * * * * |
\* * * * * * * * * * * * * * * * * * */
main.table-main {
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: revert;
    overflow: visible;
}

.table-container {
    position: relative;
    height: 100%;
    overflow-x: auto;

    table {
        height: 100%;
        border-collapse: collapse;

        thead {
            box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);

            tr {
                background-color: #ffac31;

                &:hover, &:active {
                    background-color: #f4980f;
                }

                th {
                    height: 2rem;
                    text-wrap: nowrap;
                    padding: 0.5rem;

                    &:hover, &:active {
                        background-color: #e18c0c;
                    }
                }

                th#status_bar.synchronized {
                    background-color: #3b8324;
                }

                th#status_bar.sending {
                    background-color: #c6bc2a;
                }

                th#status_bar.error {
                    background-color: #ff0000;
                }

                th#status_bar {
                    height: 1rem;
                    padding: 0.5rem;
                    color: white;

                    div {
                        display: flex;
                        flex-direction: row;
                        align-items: center;
                        width: 100%;

                        img {
                            height: 1.25rem;
                            width: 1.25rem;
                        }

                        p {
                            font-style: italic;
                            margin: 0 0 0 0.5rem;
                        }
                    }
                }
            }
        }

        tbody {
            box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);

            tr {
                &:nth-child(even) {
                    background-color: #eaeaea;
                }

                &:hover, &:active {
                    background-color: #dadada;
                }

                td {
                    padding: 0.5rem;
                    text-align: center;

                    &:hover, &:active {
                        background-color: #cacaca;
                    }

                    input {
                        border: 1px solid black;
                        border-radius: 0.4rem;
                        outline: none;
                        text-align: center;
                        font-size: 1rem;
                        line-height: 2rem;
                        padding: 0;
                        box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2);
                    }

                    input[readonly] {
                        background-color: #eaeaea;
                    }

                    input[type="checkbox"] {
                        outline: none;
                        text-align: center;
                        transform: scale(2);
                    }
                }
            }
        }
    }
}