/*
Copyright (C) 2021 Yarmo Mackenbach

This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details.

You should have received a copy of the GNU Affero General Public License along
with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

If your software can interact with users remotely through a computer network,
you should also make sure that it provides a way for users to get its source.
For example, if your program is a web application, its interface could display
a "Source" link that leads users to an archive of the code. There are many
ways you could offer source, and different solutions will be better for different
programs; see section 13 for the specific requirements.

You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary. For
more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>.
*/
kx-claim {
    padding: 2px 0;
}

.kx-item {
    display: block;
    font-size: 0.9rem;
    margin-left: -4px;

    details {
        position: relative;
        width: 100%;
        border-radius: 4px;
        z-index: 0;

        &[open] {
            box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
            z-index: 100;
        }

        p {
            margin: 0;
            word-break: break-word;
            font-size: 1em;
        }

        a {
            color: var(--link-color);
        }

        hr {
            margin: 8px 0;
            border: none;
            border-top: 2px solid var(--header-background-color);
        }

        .content {
            font-size: 0.9em;
            padding: 12px;
            background-color: var(--background-color);
            border-top: 0px;
            border-radius: 0px 0px 4px 4px;
        }

        &[open] summary {
            border-radius: 4px 4px 0px 0px;
            background-color: var(--header-background-color) !important;
        }

        summary {
            display: flex;
            align-items: center;
            padding: 2px 4px;
            border-radius: 4px;
            list-style: none;
            cursor: pointer;

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

            &:hover,
            &:focus {
                background-color: var(--header-background-color);
            }

            .info {
                display: flex;
                align-items: baseline;
                gap: 8px;
                flex: 1;
            }

            .info .title {
                color: var(--text-color);
            }

            .info img {
                width: 16px;
                height: 16px;
                opacity: 0.5;
                transform: translateY(3px);

                @media (prefers-color-scheme: dark) {
                    filter: invert(1);
                }
            }

            .claim__links {

                p {
                    display: flex;
                    align-items: center;
                    flex-wrap: wrap;
                    font-size: 1em;
                    color: var(--link-color-subtle);
                }

                .a,
                span {
                    font-size: 1em;
                    margin: 0 10px 0 0;
                    color: var(--link-color-subtle);
                }
            }

            .subtitle-wrapper {
                color: var(--text-color-subtle);
            }
        }

        .subsection {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .subsection>img {
            width: 20px;
            height: 20px;
            opacity: 0.4;
        }

        @media (prefers-color-scheme: dark) {
            .subsection>img {
                filter: invert(1);
            }
        }
    }

    .verificationStatus {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border-radius: 100%;
        color: #fff;
        font-size: 1.4em;
        user-select: none;

        &::after {
            position: absolute;
            display: flex;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            align-items: center;
            justify-content: center;
        }

        .inProgress,
        .success,
        .failure {
            position: absolute;
            top: 0;
            left: 0;
            opacity: 0;
            pointer-events: none;
        }

        .inProgress {
            color: var(--loader-color);

            svg {
                animation: 1s linear 0s infinite rot360;
            }
        }

        .success {
            color: var(--success-color);
        }

        .failure {
            color: var(--failure-color);
        }
    }

    button {
        padding: 0.4rem 0.8em;
        margin-right: 8px;
        text-decoration: none;
        text-transform: uppercase;
        color: var(--button-text-color);
        background-color: var(--button-background-color);
        border: solid 1px var(--button-border-color);
        border-radius: 4px;
        cursor: pointer;
    }

    button:hover {
        background-color: var(--button-background-color-hover);
        border-color: var(--button-border-color-hover);
        color: var(--button-text-color-hover);
    }

    &[data-status="running"] {
        .title {
            color: var(--text-color-subtle) !important;
        }
        .inProgress {
            opacity: 1 !important;
        }
    }

    &[data-status="success"] {
        .title {
            color: var(--primary-color) !important;
            font-weight: bold;
        }
        .success {
            opacity: 1 !important;
        }
    }

    &[data-status="failed"] {
        .title {
            color: var(--text-color-subtle) !important;
        }
        .failure {
            opacity: 1 !important;
        }
    }

    &[data-status="success"] .verificationStatus>div,
    &[data-status="failed"] .verificationStatus>div {
        transition: opacity 0.4s ease !important;
    }

    @-webkit-keyframes rot360 {
        0% {
            -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
        }

        100% {
            -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
        }
    }

    @keyframes rot360 {
        0% {
            -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
        }

        100% {
            -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
        }
    }
}