@import "vars";

.social i {
    display: inline;
    font-size: 1.9em;
}

.facebook-this, .tweet-this, .gplus-this {
    display: inline;
}

.tweet-this i {
    color: #55ACEE;
}

.facebook-this it {
    color: #133783;
}

.gplus-this i {
    color: #DD4B38;
}

.social {
    font-size: 1.3em;
    float: right;
}

// Bootstrap-y buttons
.button, button, input[type=submit] {
    -webkit-transition: .3s all ease;
    -o-transition: .3s all ease;
    transition: .3s all ease;
    align-items: center;
    background-clip: padding-box;
    background-color: $theme_color;
    border: 1px solid transparent;
    border-radius: .25rem;
    box-shadow: rgba(0, 0, 0, 0.02) 0 1px 3px 0;
    box-sizing: border-box;
    color: #fff !important;
    cursor: pointer;
    display: block;
    font-family: system-ui,-apple-system,system-ui,"Helvetica Neue",Helvetica,Arial,sans-serif;
    font-size: 16px;
    font-weight: 600;
    justify-content: center;
    line-height: 1.25;
    margin: 0;
    min-height: 3rem;
    padding: calc(.875rem - 1px) calc(1.5rem - 1px);
    position: relative;
    text-decoration: none;
    transition: all 250ms;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    vertical-align: middle;
    text-align: center;
    width: auto;

    &.disabled, &[disabled] {
        background: linear-gradient(to bottom, darkgray 0, gray 100%) repeat-x !important;
        border-color: grey !important;
        cursor: not-allowed;
    }

    &.small {
        min-height: auto;
        padding: calc(.5rem - 1px) calc(1rem - 1px);
    }

    &.btn-gray {
        background: gray;
    }

    &.btn-hovergray {
        &:hover {
            background: lightgray;
        }
    }

    &.btn-green {
        background: #28a745;

        &:hover {
            background: green;
        }
    }

    &.btn-darkred {
        background: darkred;

        &:hover {
            background: brown;
        }
    }

    &.btn-midnightblue {
        background: midnightblue;

        &:hover {
            background: darkblue;
        }
    }

    &.btn-darkGreen {
        background: $theme_color;
    }

    // class = "unselectable button full small" only appear in online-judge/templates/contest/list.html
    // this attribute center buttons in contest list (including "Join", "Virutal Join", "Spectable")
    &.unselectable.button.full.small {
        margin: 0 auto
    }
}

.button.full, input[type=submit].full, button.full {

}

.button:hover, button:hover, input[type=submit]:hover {
    background-color: $theme_color;
    box-shadow: rgba(0, 0, 0, 0.1) 0 4px 12px;
    transform: translateY(-1px);
}

.button:focus, button:focus, input[type=submit]:focus {
    background-color: $theme_color;
    box-shadow: rgba(0, 0, 0, 0.1) 0 4px 12px;
}

.button:active, button:active, input[type=submit]:hover {
    background-color: $theme_color;
    box-shadow: rgba(0, 0, 0, .06) 0 2px 4px;
    transform: translateY(0);
}

.inline-button {
    display: inline;
    vertical-align: top;
    padding: 3px 6px;
}

input {
    &[type=text], &[type=password], &[type=email], &[type=number], &[type=datetime-local], &[type=date] {
        padding: 4px 8px;
        color: #555;
        background: #FFF none;
        border: 1px solid $border_gray;
        border-radius: $widget_border_radius;
        box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
        transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
        box-sizing: border-box;

        // Need this explicitly because UA stylesheet for Chrome on 4k makes
        // everything look bad otherwise (forces it to 9.3px)
        font-size: $base_font_size;
    }

    &[type=number] {
        padding: 2px 0 2px 5px;
    }
}

textarea {
    padding: 8px;
    background: #FFF none;
    border: 1px solid $border_gray;
    border-radius: $widget_border_radius;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
    transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
    box-sizing: border-box;
}

textarea:hover {
    border-color: black;
}

input {
    &[type="text"]:hover, &[type="password"]:hover {
        border-color: rgba(82, 168, 236, 0.8);
        box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
    }
}

textarea:focus {
    border-color: black;
    border-width: unset;
    outline: 0;
}

input {
    &[type="text"]:focus, &[type="password"]:focus {
        border-color: rgba(82, 168, 236, 0.8);
        box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
        outline: 0;
    }
}

// Bootstrap-y copy button
.btn-clipboard {
    top: -5px;
    right: -8px;
    display: block;
    font-size: 12px;
    cursor: pointer;
    position: absolute;
    padding: 5px 8px;
    font-family: system-ui, "Noto Sans";

    &:hover {
        border-radius: $widget_border_radius;
        border: 1px solid #E1E1E8;
        background-color: #FFF;
    }
}

.copy-clipboard {
    position: relative;
}

// Bootstrap-y tabs
.ul_tab_a_active {
    color: $theme_color;
    cursor: default;
    font-weight: bold;
    border-bottom: 3px solid $theme_color;
    background: transparent;
}

.tabs {
    border-bottom: 1px solid $border_gray;
    margin: 0 0 8px;
    width: 100%;
    display: flex;

    &.tabs-no-flex {
        display: block;
    }

    .tab {
        .tab-icon {
            padding-right: 0.3em;
            color: gray;
        }

        a, span {
            border-top-width: 3px !important;
        }

        &.active {
            a, span {
                border-top-color: $highlight_blue !important;
            }

            .tab-icon {
                color: black;
            }
        }
    }

    h2 {
        color: #393630;
    }

    > ul {
        margin: 0;
        padding: 0;
        list-style: outside none none;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;

        &::-webkit-scrollbar {
            width: 0.1rem; // Adjust the width as needed
            background-color: transparent;
        }

        &::-webkit-scrollbar-thumb {
            background-color: transparent;
        }

        > li {
            position: relative;
            display: block;

            &.active > a, &.active > span {
                @extend .ul_tab_a_active;

                &:hover {
                    @extend .ul_tab_a_active;
                }

                &:focus {
                    @extend .ul_tab_a_active;
                }
            }

            > a, > span {
                margin-right: 10px;
                line-height: 1.42857;
                position: relative;
                display: block;
                padding: 5px 5px;
                color: #555;
                text-decoration: none;
                white-space: nowrap;
                font-weight: bold;

                &:hover {
                    border-bottom: 3px solid green;
                }
            }
        }
    }
}

// Bootstrap-y pagination
ul.pagination a:hover {
    color: #FFF;
    background: #cc4e17;
}

ul.pagination {
    align-items: center;
    justify-content: center;
    display: flex;
    padding-left: 0;
    margin: 0;
    border-radius: $widget_border_radius;

    > {
        li {
            display: inline;

            > {
                a, span {
                    position: relative;
                    float: left;
                    padding: 4px 12px;
                    margin-right: 5px;
                    font-weight: bold;
                    line-height: 1.42857;
                    text-decoration: none;
                    color: $theme_color;
                    background-color: white;
                    border: 2px solid $theme_color;
                    border-radius: 10px;
                }
            }
        }

        .disabled-page > {
            a {
                color: #f1efef;
                background-color: #ab6247;
                border-color: #6a240b;
            }

            span {
                color: #f1efef;
                background-color: #ab6247;
                border-color: #6a240b;
            }
        }

        .active-page > {
            a {
                z-index: 2;
                color: white;
                background-color: $theme_color;
                border-color: transparent;
                cursor: default;
            }

            span {
                z-index: 2;
                color: #FFF;
                background-color: $highlight_blue;
                border-color: transparent;
                cursor: default;
            }
        }
    }
}

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: $widget_border_radius;
}

.alert-info {
    color: #31708f;
    background-color: #d9edf7;
    border-color: #bce8f1;
}

.alert-warning {
    color: #8a6d3b;
    background-color: #fcf8e3;
    border-color: #faebcc;
}

.alert-danger {
    color: #a94442;
    background-color: #f2dede;
    border-color: #ebccd1;
}

.alert-dismissable, .alert-dismissible {
    padding-right: 35px;
}

.alert-dismissable .close, .alert-dismissible .close {
    position: relative;
    top: -2px;
    right: -21px;
    color: inherit;
}

.close {
    float: right;
    font-size: 21px;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    filter: alpha(opacity=20);
    opacity: 0.2;
}

a.close {
    text-decoration: none !important;
    font-size: 18px !important;
    line-height: 1;

    &:hover {
        color: black !important;
    }
}

.close {
    &:focus, &:hover {
        color: #000;
        text-decoration: none;
        cursor: pointer;
        filter: alpha(opacity=50);
        opacity: 0.5;
    }
}

.badge {
    min-width: 10px;
    padding: 0 7px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    background-color: #e84848;
    border-radius: 10px;
    box-sizing: border-box;
}

.form-submit-group {
    border-top: 1px solid #EEE;
    margin-top: 0.8em;
    padding-top: 0.5em;
    text-align: right;
}

ul.select2-selection__rendered {
    padding: 0 5px !important;
}

.sidebox h3 {
    border-radius: $widget_border_radius $widget_border_radius 0 0;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 7px;
    font-size: 1.3em;
    font-weight: bold;
    background: white;
    display: flex;

    .fa {
        background: $theme_color;
        color: white;
        padding: 4px;
        margin-right: 8px;
        border-radius: 5px;
        font-size: smaller;
    }
}

.sidebox-content {
    border-top: none;
    padding: 1px 0.5em 3px;
    background: white;
    border-radius: 0 0 $widget_border_radius $widget_border_radius;

    &.sidebox-table {
        border: none;
        padding: 0;

        .table {
            margin: 0 !important;
        }
    }
}

.sidebox {
    border-top-left-radius: $widget_border_radius;
    border-top-right-radius: $widget_border_radius;
    margin-bottom: 1.5em;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.ws-closed {
    position: sticky;
    top: 42px;
    background: $announcement_red;
    border-radius: 5px 5px 0 0;
    display: none;
}

.ws-closed a {
    display: block;
    padding: 7px 0;
    text-align: center;
    color: white;
    font-weight: 600;
}

.semibold {
    font-weight: 600;
}

.messages {
    list-style-type: none;
    padding: 0;

    li {
        padding: 1em 1.5em;
        margin-bottom: 1em;
        border: 1px solid transparent;
        border-radius: 5px;

        &.debug {
            color: #383d41;
            background-color: #e2e3e5;
            border-color: #d6d8db;
        }

        &.info {
            color: #0c5460;
            background-color: #d1ecf1;
            border-color: #bee5eb;
        }

        &.success {
            color: #155724;
            background-color: #d4edda;
            border-color: #c3e6cb;
        }

        &.warning {
            color: #856404;
            background-color: #fff3cd;
            border-color: #ffeeba;
        }

        &.error {
            color: #721c24;
            background-color: #f8d7da;
            border-color: #f5c6cb;
        }
    }
}

.spoiler-text {
    border: 1px solid black;
    padding: 0.5em;
    margin-top: 0.5em;
    border-radius: 5px;
    background: #def;
}

.spoiler-summary {
    padding-left: 0.5em;
    text-decoration: underline;
}

.control-button {
    color: black !important;
    border: 0;
}

.control-button:hover {
    background: gray;
}

ul.errorlist {
    margin: 0px;
    text-align: right;
    list-style: none;
    padding: 0px;
    color: red;
    margin-bottom: 3px;
}

.registration-form {
    .sortedm2m-container, .sortedm2m-container p.selector-filter {
        width: 300px;
    }

    .sortedm2m-container p.selector-filter input {
        width: 262px;
    }

    ul.sortedm2m {
        width: 284px;
        min-height: 100px;
        max-height: 200px;
    }

    .sortedm2m-container, .sortedm2m-container p.selector-filter {
        width: 300px;
    }

    .sortedm2m-container p.selector-filter input {
        width: 262px;
    }

    ul.sortedm2m {
        width: 284px;
        min-height: 70px;
        max-height: 200px;
        height: 70px
    }

    .inline-header {
        float: left;
        font-size: 1.1em;
        padding: 4px 8px;
        padding-left: 0;
    }

    .block-header {
        color: #555;
        font-size: 1.1em;
        font-weight: 600;
        padding-bottom: 0.2em;
        padding-left: 2px;
        margin-top: 0.75em
    }

    .fullwidth {
        display: block;
        overflow: hidden;
    }

    .fullwidth input {
        width: 100%;
    }

    .fullwidth-error input {
        width: 100%;
        border-color: red;
    }

    .form-field-error {
        color: red;
    }

    small {
        font-size: 0.7em;
        padding-left: 0.6em;
    }

    #edit-form {
        border: unset;
        background: unset;
        max-width: 450px;
        width: 450px;
    }

    .full-textfield {
        padding-top: 0.5em;
    }

    .tos-section {
        display: inline-block;
        padding-right: 1em;
    }

    .pass-req {
        padding: 0;
    }
}

#center-float {
    display: inline-block;
    text-align: initial;
    width: 450px;
}

#login-panel {

    display: inline-block;
    position: relative;
    margin: 5em auto auto -10em;
    top: 40%;
    left: 50%;

    h4 {
        padding-top: 1em;
    }

    .social {
        display: inline;
        font-size: 2.3em;
        float: none;
    }

    .google-icon i {
        color: #DD4B38;
    }

    .facebook-icon i {
        color: #133783;
    }

    .github-icon i {
        color: black;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn {
        -webkit-transition: none;
        -o-transition: none;
        transition: none;
    }
}

.btn:hover {
    color: #212529;
    text-decoration: none;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-block + .btn-block {
    margin-top: 0.5rem;
}

.d-flex {
    display: -webkit-box !important;
    display: -ms-flexbox !important;
    display: flex !important;
}

.justify-content-center {
    -webkit-box-pack: center !important;
    -ms-flex-pack: center !important;
    justify-content: center !important;
}

.align-items-center {
    -webkit-box-align: center !important;
    -ms-flex-align: center !important;
    align-items: center !important;
}

.align-content-center {
    -ms-flex-line-pack: center !important;
    align-content: center !important;
}

.align-self-center {
    -ms-flex-item-align: center !important;
    -ms-grid-row-align: center !important;
    align-self: center !important;
}

.a-problem {
    font-size: 15px;
    line-height: 1.8;
    font-weight: normal;
}

a {
    -webkit-transition: .3s all ease;
    -o-transition: .3s all ease;
    transition: .3s all ease;
}

button:hover, button:focus {
    text-decoration: none;
    outline: none;
    -webkit-box-shadow: none;
    box-shadow: none;
}

.btn {
    padding: 8px 12px;
    cursor: pointer;
    border-width: 1px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    -webkit-box-shadow: 0px 10px 20px -6px rgba(0, 0, 0, 0.12);
    -moz-box-shadow: 0px 10px 20px -6px rgba(0, 0, 0, 0.12);
    box-shadow: 0px 10px 20px -6px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    position: relative;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    -webkit-transition: all 0.3s ease;
    -ms-transition: all 0.3s ease;
    transition: all 0.3s ease;
    span {
        font-size: 15px;
        margin-left: -20px;
        -moz-transition: all 0.3s ease;
        -o-transition: all 0.3s ease;
        -webkit-transition: all 0.3s ease;
        -ms-transition: all 0.3s ease;
        transition: all 0.3s ease;
    }
    .icon {
        position: absolute;
        top: 0;
        right: 0;
        width: 45px;
        bottom: 0;
        background: #fff;
        i {
            font-size: 20px;
        }
    }
    .icon.icon-round {
        border-radius: 50%;
    }
    &.btn-round {
        border-radius: 40px;
    }
    &:hover, &:active, &:focus {
        outline: none;
        span {
            margin-left: -10px;
        }
    }
    &.btn-primary {
        color: #fff;
        .icon i {
            color: #28a745;
        }
    }
    &.btn-disabled {
        color: #fff;
        background: gray;
        border-color: gray;
    }
}