@use 'sass:color';

@use 'variables' as v;

// theme overrides
.btn {
    background-color: v.$color-theme-bg-dark;
    color: #fff;

    &:hover {
        background-color: color.scale(v.$color-theme-bg-dark, $lightness: 10%);
    }
}

a {
    color: #e1641b;
    text-decoration: none;
    cursor: pointer;

    &:hover {
        color: #bc4600;
    }

    &:visited {
        color: #eba177;
    }
}

// Add scrollbar to TOC (side navigation)
.wy-side-scroll {
    width: auto;
    overflow-y: auto;
}

.wy-side-nav-search {
    background-color: v.$color-theme-bg-dark;
    a {
        text-align: right !important;
        float: right;
    }
}

@mixin menu_vertical_current_hover_light_mode_colors {
    &:hover {
        background-color: #777777;
        color: darkorange;
    }
}

@mixin menu_vertical_current_light_mode_colors {
    @include menu_vertical_current_hover_light_mode_colors;

    &:visited {
        color: #303030;
        @include menu_vertical_current_hover_light_mode_colors;
    }
}

@mixin menu_vertical_alt_current_hover_light_mode_colors {
    color: #e8e8e8;
    &:hover {
        color: lightgoldenrodyellow;
    }
}

.wy-menu-vertical {
    p.caption {
        color: #fff;
    }
    li {
        a {
            @include menu_vertical_alt_current_hover_light_mode_colors;

            &:visited {
                @include menu_vertical_alt_current_hover_light_mode_colors;
            }
        }
        &.current {
            a {
                background-color: #eeeeee;
                color: #303030;

                @include menu_vertical_current_light_mode_colors;
            }
            &.toctree-l2 {
                li.toctree-l3>a {
                    @include menu_vertical_current_light_mode_colors;
                }
            }
            &.toctree-l3 {
                li.toctree-l4>a {
                    @include menu_vertical_current_light_mode_colors;
                }
            }
        }
    }
}

.wy-nav-top {
    background-color: v.$color-theme-bg-dark;
    img {
        border-radius: 0 !important;
        background-color: transparent !important;
    }

    a {
        color: #e8e8e8;

        &:hover {
            color: #100000;
        }

        &:visited {
            color: #e8e8e8;
            &:hover {
                color: #100000;
            }
        }
    }
}

.wy-table-responsive table td, .wy-table-responsive table th {
    white-space: normal;
}

.wy-table-responsive {
    margin-bottom: 24px;
    max-width: 100%;
    overflow: visible;
}

.wy-menu {
    p {
        margin-left: 20px;
        margin-bottom: 7px;
        margin-top: 10px;
    }
}

.admonition-in-other-languages {
    background: v.$color-theme-alt-bg;
    padding: 12px;
    margin-bottom: 24px;
}

.rst-content {
    .highlight {
        background: #ebf4f9;
    }
}

// theme overrides
// widget
pre.widget {
    white-space: normal;
    padding-bottom: 10px;
    position: relative;
}

.tab {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 10px;

    button {
        background-color: inherit;
        float: left;
        outline: none;
        cursor: pointer;
        padding: 6px 16px;
        transition: 0.3s;
        flex: 0 0 auto;
        border: 1px solid transparent;
        color: v.$color-tab-font;
        font-family: v.$mono-font;
        font-size: 13px;
        border-left: 1px dotted v.$color-widget-border;
        border-right: 1px dotted v.$color-widget-border;
        border-bottom: 1px dotted v.$color-widget-border;
        &:hover {
            background-color: color.scale(v.$color-theme-bg-dark, $lightness: 30%);
            color: v.$color-tab-hover-font;
            cursor: pointer;
        }
        &.active {
            color: v.$color-tab-active-font;
            border-left: 1px solid v.$color-widget-border;
            border-right: 1px solid v.$color-widget-border;
            border-bottom: 3px solid v.$color-theme-bg-dark;
        }
    }
}

.tab-content {
    display: none;
    padding: 0px;
}

.settings-bar {
    background-color: v.$color-settingsbar-bg;
    font-family: v.$lato-sans-serif-font;
    padding-left: 13px;
    display: block;
    margin-top: 0px;

    button {
        background-color: transparent;
        color: v.$color-font-grey;
        opacity: 0.5;
        padding: 5px;
        margin-left: 5px;
        margin-right: 5px;
        font-size: 13px;
        border: none;

        &:hover {
            opacity: 1.0;
        }
    }

    .dropdown-container {
        position: relative;
        display: inline-block;

        .dropdown-content {
            display: none;
            position: absolute;
            background-color: v.$color-theme-bg-light;
            min-width: 300px;
            box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
            z-index: 10;
            padding: 8px;
            cursor: pointer;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;

            a {
                color: black;
                padding: 12px 16px;
                text-decoration: none;
                display: block;

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

        &:hover {
            .dropdown-content {
                display: block;
            }
            .dropdown-btn {
                opacity: 1.0;
            }
        }
    }
}

div {
    .compiler-switch-entry {
        overflow: hidden;
    }

    .compiler-switch-name {
        float: left;
    }

    .compiler-switch-help {
        float: right;
    }

    .compiler-switches-entries {
        padding: 10px;
        transition: 1.0s;
    }
}

.compiler-switch-help-info {
    background-color: v.$color-settingsbar-bg;
    font-size: 0.85em;
}

.compiler-switch-help-info-click-remove {
    background-color: v.$color-settingsbar-bg;
    font-size: 0.70em;
}

div {
    &.file {
        display: none;
    }
    &.editor-container {
        height: 30em;
        border: 1px solid v.$color-widget-border;
        margin: 0px;
        &.inline {
            height: 20em;
            border: 1px solid v.$color-widget-border;
            margin: .5em 0;
        }
    }
    &.editor_label {
        font-family: v.$mono-font;
        border: 1px solid v.$color-widget-border;
        border-bottom: 0px;
        display: inline-block;
        padding: 3px 5px;
        font-size: 0.75em;
        color: v.$color-font-grey;
    }
    &.non-tabbed-links {
        display: flex;
        border: 1px solid v.$color-widget-border;
    }
    &.code_block_info {
        font-family: v.$mono-font;
        font-size: 12px;
        font-style: normal;
        background: v.$color-widget-output-area;
        margin-top: 8px;
        max-height: 250px;
        overflow-y: auto;
        line-height: normal;
    }
    &.code_block_info_header {
        margin-top: 2px;
        font-weight: bold;
        padding-left: 3px;
        padding-right: 3px;
    }
    &.code_block_info_contents {
        color: v.$color-font-grey;
        padding-left: 15px;
        padding-right: 3px;
        white-space: pre-wrap;
    }
    &.output_line {
        color: v.$color-font-grey;
        padding-left: 15px;
        padding-right: 3px;
        white-space: pre-wrap;
    }
    &.output_msg {
        color: v.$color-widget-msg;
        padding-left: 15px;
        padding-right: 3px;
        white-space: pre-wrap;
        &:hover {
            background-color: #fdd;
        }
    }
    &.output_msg_info {
        color: v.$color-widget-info;
        padding-left: 15px;
        padding-right: 3px;
        white-space: pre-wrap;
        &:hover {
            background-color: v.$color-widget-msg-info-bg-hover;
        }
    }
    &.output_info {
        color: v.$color-widget-info;
        padding-left: 3px;
        padding-right: 3px;
        white-space: pre-wrap;
    }
    &.output_error {
        color: v.$color-widget-error;
        padding-left: 3px;
        padding-right: 3px;
        white-space: pre-wrap;
    }
    &.output_success {
        color: v.$color-widget-success;
        padding-left: 3px;
        padding-right: 3px;
        font-weight: v.$fontweight-bold;
    }
    &.output-area {
        font-family: v.$mono-font;
        font-size: 12px;
        font-style: normal;
        background: v.$color-widget-output-area;
        margin-top: 8px;
        max-height: 250px;
        overflow-y: auto;
        line-height: normal;
    }
    &.output-row {
        margin-right: 0px;
        button {
            margin-right: 4px;
            margin-top: 2px;
            margin-bottom: 0px;
        }
    }
}

.read-only {
    background-color: v.$color-widget-readonly;
    opacity: 0.2;
    position: absolute;
}

// widget
// layout customizations
img.logo {
    width: 150px !important;
    height: auto;
    /*    margin: 10px 20px !important;  */
    text-align: right !important;
}

div#learn-adacore-com>h1 {
    display: none;
}

.legal {
    padding: 20px;
    color: v.$color-font-grey;
    font-size: 12px;
    text-align: center;
    a {
        color: v.$color-font-grey;
    }
}

#scrollToTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: v.$color-scroll-button-bg;
    color: v.$color-scroll-button-fg;
    cursor: pointer;
    padding: 15px;
    border-radius: 10px;
    font-size: 18px;
    transition: opacity 600ms;
    &:hover {
        background-color: v.$color-scroll-button-hover;
    }
    &.show {
        opacity: 1;
    }
    &.hide {
        opacity: 0;
    }
}

html {
    scroll-behavior: smooth;
}

.img-row {
    display: flex;
    img {
        flex: 33.33%;
        padding: 5px;
        vertical-align: top;
    }
}

#sidebarfooter {
    position: absolute;
    bottom: 0px;
}

// layout customizations
div {
    &.download-button.docutils.container {
        float: right;
        width: 300px;
        margin: 20px;
    }

    // gap logo
    &.gap-logo.docutils.container {
        float: left;
        width: 280px;
        margin-right: 5px;
        margin-top: 45px;
        margin-bottom: 45px;
    }

    // ada-training logo
    &.ada-training-logo.docutils.container {
        float: left;
        width: 253px;
        margin-left: 12px;
        margin-right: 20px;
        margin-top: 5px;
        margin-bottom: 5px;
    }

    // hiding toctree on main page
    &.content-blocks.docutils.container {
        display: none;
    }
}

a.ebook-download-button {
    background-color: v.$color-theme-bg-dark;
    display: block;
    padding-top: 2px;
    padding-left: 1em;
    padding-right: 1em;
    text-decoration: none;
    color: #FFF;
    font-weight: 600;
    float: none;
    font-family: sans-serif;
    margin-top: 2px;

    &:before {
        font-family: v.$icon-font;
        font-style: normal;
        font-weight: v.$icon-weight;
        content: v.$download-icon;
        margin-right: 3px;
    }
}


div.ebook-download {
    display: block;
    float: right;
    border: 5px solid transparent;
    overflow: hidden;
}

div.frontpage-ebook-and-buttons-block {
    width: 19%;
    height:auto;
    margin:0.5%;
}

// Larger size for the full course cover that is alone above the others
div.frontpage-ebook-and-buttons-block.full-learning-ada-cover {
    width: 30%;
}

// if the screen is too small, use a fixed with instead of a percentage of the
// available space.
@media only screen and (max-width: 600px) {
    div.frontpage-ebook-and-buttons-block {
        width: 150px;
    }

    // Larger size for the full course cover
    div.frontpage-ebook-and-buttons-block.full-learning-ada-cover {
        width: 210px;
    }
}

div.frontpage-ebooks {
    display:inline-flex;
    flex-wrap:wrap;
    flex-direction:row;
    width:100%;
    margin-bottom:1.4em;
}

// download buttons

div.mwac-banner.docutils.container {
    padding-bottom: 20px;
}

// lab stuff
div {
    &.lab-area {
        font-family: v.$mono-font;
        font-size: 12px;
        font-weight: v.$fontweight-normal;
        background: v.$color-labarea-bg;
    }
    &.lab_test_case {
        padding-left: 3px;
        padding-right: 3px;
        padding-bottom: 5px;
        margin-top: 0px;
        margin-bottom: 5px;
    }
    &.lab_test_msg {
        color: v.$color-labarea-fg;
        padding-left: 20px;
        padding-right: 3px;
        code {
            white-space: pre-wrap;
        }
    }
    &.lab_test_success {
        background: v.$color-success-green-bg;
    }
    &.lab_test_failed {
        background: v.$color-fail-red-bg;
    }
}

span.lab_test_msg_title {
    font-weight: v.$fontweight-bold;
    padding-right: 5px;
}

div {
    &.lab_status {
        font-weight: v.$fontweight-bold;
        padding-left: 15px;
        padding-right: 3px;
    }
    &.lab_results {
        margin-top: 5px;
        margin-bottom: 5px;
    }
}

button {
    &.lab_test_success {
        background: v.$color-success-green-light-bg;
        span:after {
            content: "Pass";
        }
        &:hover {
            background-color: v.$color-success-green-bg;
        }
    }
    &.accordion span:after {
        font-family: v.$mono-font;
        font-size: 10px;
        font-style: italic;
        font-weight: v.$fontweight-semibold;
        color: v.$color-font-grey;
        margin-left: 8px;
    }
    &.lab_test_failed {
        background: v.$color-fail-red-light-bg;
        span:after {
            content: "Fail";
        }
        &:hover {
            background-color: v.$color-fail-red-bg;
        }
    }
    &.active {
        &.lab_test_success {
            background: v.$color-success-green-bg;
        }
        &.lab_test_failed {
            background: v.$color-fail-red-bg;
        }
    }
}

.accordion {
    background-color: v.$color-theme-bg-light;
    color: v.$color-theme-fg-dark;
    cursor: pointer;
    padding: 10px;
    width: 100%;
    text-align: left;
    border: none;
    outline: none;
    transition: 0.4s;
    font-weight: v.$fontweight-bold;
    border-radius: 7px;
    &.active {
        border-bottom-right-radius: 0px;
        border-bottom-left-radius: 0px;
    }
    &:after {
        font-family: v.$icon-font;
        font-style: normal;
        font-weight: v.$icon-weight;
        content: v.$triangle-right-icon;
        font-size: 16px;
        color: darkblue;
        float: right;
        margin-left: 5px;
    }
    &.active:after {
        font-family: v.$icon-font;
        font-style: normal;
        font-weight: v.$icon-weight;
        content: v.$triangle-down-icon;
        font-size: 16px;
        color: v.$color-font-grey;
        float: right;
        margin-left: 5px;
    }
}

.lab_test_case {
    padding: 0 18px;
    overflow: hidden;
    border-bottom-right-radius: 7px;
    border-bottom-left-radius: 7px;
}

.custom_check_container {
    display: block;

    label {
        display: inline-block;
    }
}

label.custom_check,
.console_output {
    display: inline-block;
}

.spinner {
    width: 70px;
    text-align: center;
    display: inline-block;
    >div {
        width: 7px;
        height: 7px;
        background-color: v.$color-spinner-fg;
        border-radius: 100%;
        display: inline-block;
        -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
        animation: sk-bouncedelay 1.4s infinite ease-in-out both;
        margin-right: 5px;
    }
    .bounce1 {
        -webkit-animation-delay: -0.32s;
        animation-delay: -0.32s;
    }
    .bounce2 {
        -webkit-animation-delay: -0.16s;
        animation-delay: -0.16s;
    }
}

@-webkit-keyframes sk-bouncedelay {
    0%,
    80%,
    100% {
        -webkit-transform: scale(0);
    }
    40% {
        -webkit-transform: scale(1);
    }
}

@keyframes sk-bouncedelay {
    0%,
    80%,
    100% {
        -webkit-transform: scale(0);
        transform: scale(0);
    }
    40% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
}

// lab stuff
// test stuff
div {
    &.test_name::before {
        content: "Test Name: ";
    }
    &.test_input::before {
        content: "Test Input: ";
    }
    &.test_expects::before {
        content: "Test Expects: ";
    }
    &.test_exercises::before {
        content: "Test Exercises: ";
    }
}

.passed_test {
    color: green;
}

.failed_test {
    color: red;
}

// test stuff
