/* -------------------------------------------
    Header for Shop Demos
    - Toggle Icon
    - Woo Icon Count
    - Mini Basket Box
    - Mini Cart
    - Compare Dropdown
    - Wishlist Dropdown
    - Cart Dropdown
---------------------------------------------- */

@import '../config';
@import '../mixins';
@import '../direction';

// Toggle Icon
@include mq(lg, max) {
    .header {

        .wishlist,
        .compare-open,
        .dropdown .cart-toggle {
            i {
                margin-bottom: 0;
            }
        }

        .dropdown .cart-toggle {
            >.cart-label {
                display: none;
            }
        }

        .dropdown>.cart-toggle>.cart-label+i {
            margin-bottom: 0;
        }
    }
}

// Woo Icon Count
.header .wish-count,
.header .compare-count,
.cart-dropdown.badge-type .cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    #{$left}: 100%;
    top: 5px;
    width: 1.72em;
    height: 1.72em;
    z-index: 1;
    font-family: var(--alpha-body-font-family);
    font-size: 11px;
    border-radius: 50%;
    background-color: var(--alpha-primary-color);
    color: #fff;
    transform: translate(if-ltr(-50%, 50%), -50%);
    text-align: center;
}

// Mini Basket Box
.mini-basket-box {

    .mini-list {
        max-height: 33rem;
        margin: 0;
        padding-#{$left}: 0;
        padding-#{$right}: 5px;
        list-style: none;
        overflow-y: scroll;
        overflow-x: hidden;
        text-transform: capitalize;

        +.buttons {
            margin-top: 2rem;
            margin-bottom: 0;
            border-top: 1px solid var(--alpha-change-border-color-light);
            padding-top: 20px;
        }
    }

    .mini-item {
        display: flex;
        position: relative;
        align-items: center;
        padding: 1rem 0;

        &:last-child {
            padding-bottom: 0;
        }

        a {
            padding: 0;
        }

        >a:nth-child(2) {
            flex: 0 0 8rem;
            max-width: 8rem;
            padding: 0;

            img {
                width: 100%;
                object-fit: cover;
            }
        }

        .remove {
            position: absolute;
            top: 0;
            #{$right}: -1rem;
            width: 2rem;
            height: 2rem;
            line-height: 2rem;
            text-align: center;
            border-radius: 50%;
            font-size: 0.8572em;
            color: var(--alpha-change-color-dark-1);
            background: var(--alpha-change-color-light-1);
            transition: color 0.4s, border 0.4s;
            box-shadow: 0px 2px 5px 1px rgba(0, 0, 0, 0.15);
            z-index: 3;

            >i {
                width: 100%;
            }

            &:hover {
                color: var(--alpha-primary-color);
            }
        }

        span.quantity {
            display: flex;
            align-items: center;
            line-height: 1;
            border: none;
            font-size: 1.14286em;
            height: auto;
            color: var(--alpha-change-color-dark-1);

            del {
                color: var(--alpha-change-color-light-3);
                margin-#{$left}: 0.3571em;

                span {
                    font-weight: 400;
                }
            }
        }

        .amount {
            color: inherit;
            font-weight: 600;
        }
    }

    .mini-item-meta {
        flex: 1;
        margin: side-values(auto 2rem auto 0);
        line-height: 1.3;

        a {
            margin-bottom: 1rem;
            @include text-block();

            &:hover {
                color: var(--alpha-primary-color);
            }
        }
    }

    .woocommerce-mini-cart__buttons {
        margin-bottom: 0;
    }

    &.offcanvas-type {
        .mini-list {
            max-height: calc(100vh - 18.5rem);
            margin: -10px;
            padding: 10px 15px 10px 10px;
        }
    }
}

.mini-basket-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -1rem 0;

    >i {
        font-size: 4.7rem;
        opacity: .6;
        margin-#{$right}: 2.5rem;
    }

    p {
        margin: 0;
        font-size: 12px;
    }

    .mini-basket-empty-content a {
        padding: 0;
        font-size: 14px;
        color: var(--alpha-primary-color);

        i {
            margin-#{$left}: 4px
        }

        &:hover {
            color: var(--alpha-primary-color-hover);
        }
    }

    .offcanvas & {
        flex-flow: column;
        margin-top: 5.5rem;
        text-align: center;

        i {
            font-size: 13rem;
            margin: 0;
            opacity: .2;
        }

        p {
            margin: 1.5rem 0 1.1rem;
            font-size: 1.8rem;
            text-align: center;
        }

        a {
            display: inline-block;
            padding: .6rem 2rem;
            font-size: 12px;
            background: var(--alpha-primary-color);
            color: var(--alpha-white-color);
            border-radius: var(--alpha-border-radius);
            transition: background .3s;

            &:hover,
            &:focus {
                color: var(--alpha-white-color);
                background: var(--alpha-primary-color-hover);
            }

            i {
                display: none;
            }
        }
    }
}

// Mini Cart
.badge-type {
    i+span {
        margin-#{$left}: 0;
        margin-top: 10px;
    }
}

.mini_cart_item {
    color: var(--alpha-dark-color);

    .cart-item-meta {
        a {
            line-height: 1.43;
        }

        .variation {
            display: none;
        }

        .quantity {
            color: var(--alpha-grey-color);
        }

        .amount {
            margin-#{$left}: 0.5rem;
            font-weight: 600;
        }
    }

    img {
        display: block;
        width: 8rem;
        object-fit: cover;
    }
}

span.quantity .times {
    position: relative;
    margin-#{$left}: .5rem;
    width: .6em;
    text-indent: -9999px;

    &:before,
    &:after {
        content: '';
        position: absolute;
        width: 100%;
        height: 1px;
        background-color: var(--alpha-change-color-dark-1);
        top: 50%;
        #{$left}: 0;
        text-indent: 0;
    }

    &:before {
        transform: rotate(45deg);
    }

    &:after {
        transform: rotate(-45deg);
    }
}

// Compare Dropdown
.compare-dropdown {
    .compare-list {
        margin: side-values(0 -1.9rem 0 0);
        padding: side-values(0 1.5rem 0 0);
        max-width: none;
    }

    .compare-item {
        min-height: auto;
        width: 100%;
        max-width: 100%;
    }

    .compare-item+.compare-item {
        margin-#{$left}: 0;
    }

    .compare-buttons .btn {
        color: var(--alpha-change-color-light-1);
    }
}

// Wishlist Dropdown
.wishlist-item {
    color: var(--alpha-dark-color);
}

.wishlist-dropdown {
    .wish-list {
        margin: side-values(0 -1.9rem 0 0);
        padding: side-values(0 1.5rem 0 0);
        max-width: none;
    }

    .wishlist-item {
        min-height: auto;
        width: 100%;
        max-width: 100%;
    }

    .wishlist-item+.wishlist-item {
        margin-#{$left}: 0;
    }

    .wishlist-buttons .btn {
        color: var(--alpha-change-color-light-1);
    }
}

// Cart Dropdown
.cart-dropdown {
    .cart-toggle {
        padding: 0.6rem 0;
    }

    .cart-label {
        display: block;
        cursor: pointer;

        span {
            display: inline-block;
        }
    }

    .cart-name-delimiter {
        margin: side-values(0 5px 0 3px);
    }

    .cart-name+.cart-price,
    .cart-label+i,
    i+.cart-label,
    .cart-label+.cart-count-wrap {
        margin-#{$left}: 7px;
    }

    .cart-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid var(--alpha-change-border-color);
        padding-bottom: 1em;
        margin-bottom: 0.71429em;

        .btn-close {
            i {
                margin-bottom: 0;
                margin-#{$left}: 5px;
            }
        }
    }

    .cart-title {
        font-size: 1.14286em;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0;
        line-height: 1.4;
        margin-bottom: 0;
    }

    .minicart-icon {
        display: inline-block;
    }

    .cart-count {
        >i {
            font-size: 1.0909em;
            line-height: 1.6364;
        }
    }

    .minicart-icon .cart-count {
        transition: color 0.4s;
    }

    &:hover {
        .minicart-icon {
            color: var(--alpha-change-color-light-1);
            background: var(--alpha-primary-color);

            &::before {
                transform: rotateY(180deg);
            }
        }

        .minicart-icon .cart-count {
            color: var(--alpha-change-color-light-1);
        }
    }

    &.badge-type {
        .cart-toggle>i {
            text-align: center;
        }

        .cart-toggle .fa {
            padding-#{$right}: 5px;
            font-size: 1.7em;
            font-family: inherit;

            &::before {
                font-family: "Font Awesome 5 Free";
            }
        }

        &:hover {
            color: var(--alpha-primary-color);
        }
    }

    &.label-type {
        .cart-count {
            color: inherit;
        }
    }

    &.inline-type {
        .cart-name {
            display: block;
            font-size: 0.785em;
            margin-bottom: 5px;
        }

        .cart-price {
            font-weight: 700;
        }

        .cart-label .cart-price {
            margin: 0;
        }
    }

    .cart_list {
        margin: side-values(0 -1.9rem 0 0);
        padding: side-values(0 1.5rem 0 0);
    }

    .cart-item-meta a:hover {
        color: var(--alpha-primary-color);
    }

    .total {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 1rem 0 2rem;
        padding: 0.125em 0;
        font-size: 1.14286em;
        text-transform: capitalize;
        line-height: 3;
        color: var(--alpha-change-color-dark-1);
        letter-spacing: -0.025em;
        border-top: 1px solid var(--alpha-change-border-color);

        strong {
            font-size: 0.875em;
            color: var(--alpha-change-color-dark-1);
        }

        strong,
        .amount {
            font-weight: 600;
        }

        &:first-of-type {
            margin-top: 2rem;
        }

        >strong {
            font-weight: 400;
            color: var(--alpha-body-color);
        }
    }

    .buttons {
        a {
            justify-content: center;
            padding: 1.2rem 0.6rem;
            line-height: 1.45;
            color: var(--alpha-change-color-dark-1);
            background-color: transparent;
            border-color: var(--alpha-change-color-dark-1);
            border-width: 1px;

            &:hover,
            &:active,
            &:focus {
                border-color: var(--alpha-primary-color);
                background-color: var(--alpha-primary-color);
                color: var(--alpha-change-color-light-1);
            }

            &+a {
                margin-top: 2rem;
            }
        }

        .checkout {
            @include button-variant(var(--alpha-change-color-dark-1),
                var(--alpha-change-color-dark-1-hover));
        }
    }

    &.block-type {
        .offcanvas-open {
            flex-direction: column-reverse;
        }

        i,
        .cart-count-wrap {
            margin-#{$left}: 0;
        }
    }

    &:not(.cart-offcanvas) {
        .cart-header {
            display: none;
        }
    }

    &.cart-offcanvas {
        .dropdown-box {
            body.admin-bar & {
                margin-top: 3.2rem;
            }
        }

        .cart_list {
            max-height: calc(100vh - 28.1rem);
        }
    }

    .d-loading.small i {
        top: calc(50% - 3px);
    }
}