// Breakpoints
$mobile-styles-breakpoint: 600px;


// Changing wp admin panel
body.settings_page_dwpp-discord-plugin-settings {

    #wpbody,
    #wpbody-content,
    #wpcontent {
        padding-top: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;

        .update-nag,
        > .notice {
            display: none !important;
        }

        .wrap {
            padding-left: 20px;

            > .notice:not(.dwpp-notice):not(#setting-error-settings_updated) {
                display: none !important;
            }
        }
    }

    #screen-meta {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

.dwpp-fake-header-to-catch-notifications {
    margin: 0 !important;
    padding: 0 !important;
}


// Header
#dwpp-header {
    margin: 0 0 1rem;
    background: #fff;
    border-bottom: 1px solid #dcdcde;
    padding: 1em 1em 0;

    > * + * {
        margin-top: 2rem;
    }

    .dwpp-title-section {
        display: flex;
        align-items: center;
        justify-content: center;
        clear: both;

        h1 {
            display: inline-block;
            font-weight: 600;
            margin: 0;
            font-size: 23px;
            line-height: 1.3;
        }
    }


    // Connected bot and user bar
    .dwpp-admin-profiles-data {
        display: grid;
        grid-template-columns: 1fr auto 1fr;

        @media (max-width: $mobile-styles-breakpoint) {
            grid-template-columns: 100%;
        }

        > div {
            display: flex;
            align-items: center;
            flex-grow: 1;

            @media (max-width: $mobile-styles-breakpoint) {
                justify-content: center;
            }

            &:first-child {
                justify-content: flex-end;

                @media (max-width: $mobile-styles-breakpoint) {
                    flex-direction: row-reverse;
                    justify-content: center;
                }
            }
        }

        .dwpp-admin-profiles-data-controls {
            padding: 10px;
            flex-grow: 0;
            flex-shrink: 0;

            @media (max-width: $mobile-styles-breakpoint) {
                padding-left: 0;
            }

            > a {
                display: flex;
                justify-content: center;
                align-items: center;
                margin: 0;

                .dashicons {
                    margin-right: 10px;
                }
            }
        }

        img {
            border-radius: 3px;
            margin: 0 10px;

            @media (max-width: $mobile-styles-breakpoint) {
                margin-left: 0;
            }
        }

        .dashicons-update {
            opacity: .7;
            animation: dwpp-rotation 2s infinite linear;
        }
    }


    // Tabs bar
    .dwpp-tab-wrapper {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;

        .dwpp-tab {
            display: block;
            text-decoration: none;
            color: inherit;
            padding: 0.5rem 1rem 1rem;
            margin: 0 1rem;
            transition: box-shadow .5s ease-in-out;
            outline: 0;
            box-shadow: none;

            &.active {
                font-weight: 600;
            }
        }
    }
}


// Documentation
.dwpp-documentation-block {
    text-align: center;
    padding: 1em 2em;
    background: white;
    margin: 16px 0;
    font-size: 14px;
    line-height: 1.3;

    h2 {
        display: flex;
        align-items: center;
        justify-content: center;

        > * {
            margin-left: .8em;
            margin-right: .8em;
        }

        span {
            opacity: .3;

            &:first-child {
                transform: scaleX(-1);
            }
        }
    }

    code,
    i {
        white-space: nowrap;
    }

    img {
        max-width: 100%;
        box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
        border: 1px solid #c3c4c7;
    }
}


// Progressbar
.dwpp-progressbar {
    height: 2em;
    width: 100%;
    margin: 2em 0;

    .dwpp-progressbar-progress {
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow: hidden;
        transition: width 1s;
        border-radius: 3px;
    }
}

#dwpp-progressbar-messages {
    max-height: 50vh;
    overflow: auto;

    .dashicons {
        opacity: .7;
        margin-right: 5px;
    }

    .dashicons-yes {
        opacity: 1 !important;
        color: green;
    }

    .dashicons-no-alt {
        opacity: 1 !important;
        color: red;
    }

    .dashicons-update {
        opacity: 0;
        animation: dwpp-rotation 2s infinite linear;
    }
}


// Data update and sync roles tab
.dwpp-admin-sync-roles {

    h2,
    p {
        text-align: center;
    }

    .dwpp-roles-buttons-panel {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;

        > * + * {
            margin-left: 10px;
        }
    }
}

.dwpp-admin-sync-roles,
.dwpp-admin-update-data {
    flex-shrink: 0;
    max-width: 800px;
    margin: 0 auto;

    .dashicons {
        opacity: .7;
    }

    .dashicons-update {
        animation: dwpp-rotation 2s infinite linear;
    }

    .dashicons-yes {
        opacity: 1;
        color: green;
    }

    .dashicons-no-alt {
        opacity: 1;
        color: red;
    }

    table {
        border-collapse: collapse;
        text-align: center;
        margin: 0 auto;

        tbody {

            tr {

                td {
                    border: 1px solid #c3c4c7;
                    padding: .5em 1em;

                    @media (max-width: $mobile-styles-breakpoint) {
                        padding-right: .5em;
                        padding-left: .5em;
                    }

                    &:first-child {
                        border-left-width: 0;
                        text-align: left;

                        @media (max-width: $mobile-styles-breakpoint) {
                            padding-left: 0;
                        }
                    }

                    &:last-child {
                        border-right-width: 0;

                        @media (max-width: $mobile-styles-breakpoint) {
                            padding-right: 0;
                        }
                    }
                }

                &:first-child td {
                    border-top-width: 0;
                }

                &:last-child td {
                    border-bottom-width: 0;
                }
            }
        }

        tfoot {

            tr {

                td {
                    padding: 0.5em 1em;

                    @media (max-width: $mobile-styles-breakpoint) {
                        padding-right: .5em;
                        padding-left: .5em;
                    }
                }
            }

            tr:last-child {

                td {
                    padding: 2em 0;
                    text-align: center;

                    @media (max-width: $mobile-styles-breakpoint) {
                        text-align: left;
                    }
                }
            }
        }
    }
}


// Roles sync panel
.dwpp-admin-sync-roles {

    table {

        tbody {

            tr {

                td {

                    .dashicons-arrow-right-alt {
                        opacity: 0.7;
                        animation: dwpp-bounce .5s alternate infinite ease-out;
                    }

                    .dashicons-arrow-left-alt {
                        opacity: 0.7;
                        animation: dwpp-bounce-reversed .5s alternate infinite ease-out;
                    }

                    &:nth-child(1) {
                        text-align: right;
                        border-right-width: 0;
                    }

                    &:nth-child(2) {
                        border-left-width: 0;
                        border-right-width: 0;
                    }

                    &:nth-child(3) {
                        text-align: left;
                        border-left-width: 0;
                    }
                }
            }
        }

        tfoot {

            tr {

                td {
                    padding: .5em;

                    &:nth-child(1) {
                        text-align: right;
                    }

                    &:nth-child(3) {
                        text-align: left;
                    }
                }
            }

            tr:nth-child(1) {

                td {
                    padding-top: 2em;
                    padding-bottom: 2em;
                }
            }

            tr:first-child {

                td {
                    text-align: center;
                }
            }

            tr:last-child {

                td {
                    padding: 0 .5em;
                }
            }
        }
    }
}


// Buttons row
.dwpp-buttons-row {
    margin: -5px;
    display: flex;
    flex-wrap: wrap;

    > li {
        margin: 5px;
        display: flex;
        align-items: center;
    }
}


// Animations
@keyframes dwpp-bounce {
    0% {
        transform: translateX(50%);
    }
    100% {
        transform: translateX(-50%);
    }
}
@keyframes dwpp-bounce-reversed {
    0% {
        transform: translateX(-50%);
    }
    100% {
        transform: translateX(50%);
    }
}

@keyframes dwpp-rotation {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(359deg);
    }
}
