/**
 Blocks
 */
.blockmovetarget .accesshide {
    position: relative;
    left: initial;
}

.block:target {
    padding-top: 0 !important; /* stylelint-disable declaration-no-important */
    margin-top: 0 !important;
}

.block_search_forums .searchform {
    /* Override plugin's default. */
    text-align: left;
}

.block.block_navigation .block_tree ul,
.block_settings .block_tree ul {
    margin-left: 0;
}

.block .block-controls {
    .dropdown-toggle {
        /* So that the icon takes the colour of the icon. */
        color: $body-color;
    }

    .dropdown-toggle::after {
        display: none;
    }
}

$blocks-column-width: 360px !default;
[data-region="blocks-column"] {
    width: $blocks-column-width;
    float: right;
}

$blocks-plus-gutter: calc(#{$blocks-column-width} + (#{$grid-gutter-width} * 0.5));
/* We put an absolutely positioned div in a relatively positioned div so it takes up no space */
@include media-breakpoint-up(sm) {
    #region-main-settings-menu {
        position: relative;
        float: left;
        width: 100%;
    }
    #region-main-settings-menu > div {
        position: absolute;
        right: 0;
        z-index: 100;
        margin: 1rem;
    }
    .region_main_settings_menu_proxy {
        width: 4rem;
        height: 2rem;
        background-color: $body-bg;
        margin-left: $card-spacer-x * 0.5;
        margin-bottom: $card-spacer-x * 0.5;
        border-bottom-left-radius: 0.5rem;
        float: right;
    }
}

@include media-breakpoint-down(md) {
    #region-main-settings-menu .menubar {
        justify-content: flex-end;
    }
}

// Required for IE11 to prevent blocks being pushed under the content.
#region-main.has-blocks {
    display: inline-block;
    width: calc(100% - #{$blocks-plus-gutter});
    @include media-breakpoint-down(xl) {
        width: 100%;
        /* MDL-63102 - Remove extra space at bottom.
        If modifying make sure block-region is horizontally stacked when in full screen */
        display: block;
    }
}

.header-action {
    #region-main-settings-menu {
        position: unset;
        float: none;
        width: auto;

        & > div {
            position: unset;
            right: auto;
            margin: 0;
        }
    }
}

[data-region="blocks-column"] {
    @include media-breakpoint-down(xl) {
        width: 100%;
    }
}

.block .empty-placeholder-image-lg {
    height: 5rem;
}

.block {
    .searchbar {
        .icon {
            margin-right: 0;
        }
    }
}

//
// Cards.
//
.block .block-cards {
    .course-info-container {
        padding: 0.8rem;
    }

    .progress {
        height: 0.5rem;
    }

    .course-summaryitem {
        border: $border-width solid $border-color;
        background-color: $body-bg;
    }

    .icon {
        margin-right: 0;
    }

    .card .coursemenubtn {
        margin-top: -0.5rem;
    }

    span.categoryname {
        display: inline-block;
        color: #fff;
        text-transform: uppercase;
        font-weight: 600;
        letter-spacing: .5px;
        transition: all 0.2s;
    }

    span.categoryname,
    .btn-link {
        color: $white;
    }

    .progress-text {
        color: $gray-600;
    }

    .multiline {
        white-space: normal;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .btn.btn-link.btn-icon {
        height: 36px;
        width: 36px;
        padding: 0;
        border-radius: 50%;
        color: $primary;
    }
}

.card-grid {
    display: flex;

    .card {
        flex: 1;
    }

    .drawercontent & .col,
    .blockcolumn & .col {
        flex: 0 0 auto;
        max-width: 100%;
    }
}

.card-carousel {
    display: flex;

    .card {
        flex: 1;
        @include media-breakpoint-up(sm) {
            flex: 0 1 auto;
            width: 32%;
            max-width: 100%;
        }
    }
}

.course-card,
.theme-card {
    border-radius: 11px;
    &, * {
        transition: all 0.3s cubic-bezier(.215, .61, .355, 1);
    }
    &:hover {
        transform: translateY(-4px);
        box-shadow: 0 14px 34px rgba(16, 24, 40, .14);
    }

    .card-img-top {
        position: relative;
        padding-top: 43%;
        border-radius: 11px 11px 0 0;
        overflow: hidden;
        background-size: cover;

        .background-image {
            position: absolute;
            top: 0;
            width: 100%;
            height: 100%;
            background-position: center;
            background-size: cover;
        }

        &:hover .background-image {
            // transform: scale(1.12);
        }

        .categoryarea {
            position: absolute;
            top: 10px;
            left: 10px;
            background: rgba(0, 0, 0, .25);
            backdrop-filter: blur(6px);
            border-radius: 999px;
            font-size: 14px;
            padding: 6px 10px;
        }
    }

    .course-info-container {
        border-radius: 0 0 10px 10px;
        background: #fff;
        z-index: 2;
        position: relative;
        .coursename {
            color: darken($primary, 25%);
            margin: 0 0 12px;
            font-size: clamp(18px, 2.2vw, 24px);
            line-height: 1.2;
            text-decoration: none;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }

    .card-footer {
        background: transparent;
        .progress {
            --bs-progress-bar-bg: #365df7;
            --bs-progress-bg: #e5ecff;
            &[data-progress="100"] {
                --bs-progress-bar-bg: #22c55e;
                --bs-progress-bg: #dbf7e6;
            }
            &[data-progress="0"] {
                --bs-progress-bar-bg: #fb923c;
                --bs-progress-bg: #ffe8d6;
            }
        }
    }
}

//
// Block block_recentlyaccessedcourses
//
.block_recentlyaccessedcourses {
    .paging-bar-container {
        margin-top: -2.4rem;
        padding-right: 0.5rem;
        justify-content: flex-end;
    }

    @include media-breakpoint-down(sm) {
        .paging-bar-container {
            margin-top: 0;
        }
    }
}

#block-region-side-pre {
    .block_recentlyaccessedcourses {
        .paging-bar-container {
            margin-top: 0;
        }
    }
}

//
// Block block_recentlyaccesseditems
//
.block_recentlyaccesseditems {
    .activityiconcontainer {
        width: 40px;
        height: 40px;
    }

    aside[id^="block-region-side-"] & .card:nth-of-type(n+4) {
        display: none;
    }

    #block-region-content & [data-region="more-items-button-container"] {
        display: none;
    }

    a.card {
        &:hover,
        &:focus {
            text-decoration: none;

            h6 {
                text-decoration: underline;
            }
        }

        small {
            color: $body-color;
        }
    }
}

//
// Block block_myoverview
//
.block_myoverview {
    .content {
        min-height: 19.35rem;
        [role=search] .row > {
            * {
                width: auto;
            }
            .mb-1.me-1.flex-grow-1 {
                order: 5;
                margin-left: 23px;
            }
        }
    }

    .paged-content-page-container {
        min-height: 13rem;
    }

    .summary-image {
        height: 5rem;
        width: 5rem;
        background-position: center;
        background-size: cover;
    }

    .list-image {
        height: 5rem;
        width: 20rem;
        background-position: center;
        background-size: cover;
        @include media-breakpoint-down(xl) {
            width: 100%;
        }
    }

    // Make space for active item indicator.
    .dropdown-item {
        padding-left: map-get($spacers, 4);
    }
}
.page-mycourses {
    #region-main {
        background-color: transparent;
    }
    #page.drawers div[role="main"] {
        box-shadow: transparent 0 0 0;
        background: transparent;
        padding: 0;
    }
    .block_myoverview {
        .card-header {
            display: none;
        }
        [data-region="filter"] {
            background: #ffffff;
            padding: 8px 8px 4px;
            border-radius: 9px;
            width: fit-content;
            margin-bottom: 19px !important;
        }
        [data-region="paged-content-page"] {
            margin: 0 -10px;
        }
    }
}

//
// Block block_timeline
//
.block_timeline {
    .paged-content-page-container {
        background-color: $list-group-bg;
    }
}

.block_timeline {
    .event-action {
        padding-left: 5.55em;
    }
}

//
// Blocks block_settings and block_navigation
//
// Show expand collapse with font-awesome.
.block_settings .block_tree [aria-expanded="true"],
.block_settings .block_tree [aria-expanded="true"].emptybranch,
.block_settings .block_tree [aria-expanded="false"],
.block_navigation .block_tree [aria-expanded="true"],
.block_navigation .block_tree [aria-expanded="true"].emptybranch,
.block_navigation .block_tree [aria-expanded="false"] {
    background-image: none;
}

.block_settings .block_tree [aria-expanded="true"] > p:before,
.block_navigation .block_tree [aria-expanded="true"] > p:before {
    font: var(--fa-font-solid);
    content: fa-content($fa-var-angle-down);
    margin-right: 0;
    font-size: 16px;
    width: 16px;
}

.block_settings .block_tree [aria-expanded="false"] > p:before,
.block_navigation .block_tree [aria-expanded="false"] > p:before {
    font: var(--fa-font-solid);
    content: fa-content($fa-var-angle-right);
    margin-right: 0;
    font-size: 16px;
    width: 16px;
}

.dir-rtl {
    .block_settings .block_tree [aria-expanded="false"] > p:before,
    .block_navigation .block_tree [aria-expanded="false"] > p:before {
        font: var(--fa-font-solid);
        content: fa-content($fa-var-angle-left);
    }
}

.block_navigation .block_tree p.hasicon,
.block_settings .block_tree p.hasicon {
    text-indent: -3px;

    .icon {
        margin-right: 2px;
    }
}

.block.invisibleblock .card-title {
    color: $text-muted;
}

.block_tree .tree_item.branch {
    margin-left: 8px;
}

//
// Fake blocks
//
.pagelayout-embedded {
    .has-fake-blocks {
        padding: 1rem;
        display: flex;
    }

    .has-fake-blocks .embedded-main {
        order: 0;
        width: calc(100% - #{$blocks-column-width});
        margin-right: 1rem;
    }

    .embedded-blocks {
        order: 1;
        width: $blocks-column-width;
    }

    @media (max-width: 767.98px) {
        .has-fake-blocks {
            display: block;
        }
        .has-fake-blocks .embedded-main {
            width: 100%;
        }
        .embedded-blocks {
            width: 100%;
        }
    }
}

//
// Block add button
//
.block-add {
    color: $primary;
    border-color: $primary-light-border;
    @include gradient-bg($primary-light-background);
    @include border-radius();
    width: 100%;
    border-width: $border-width;

    .pluscontainer {
        border: $border-width solid $primary-light-border;
        border-radius: 50%;
        width: map-get($iconwidthsizes, 5);
        height: map-get($iconsizes, 5);
    }

    &:hover {
        cursor: pointer;
        background-color: $primary-light-background;

        .activity-add-text {
            text-decoration: underline;
        }
    }
}
[data-region="core/userfeedback"] {
    display: none !important;
}