/* -------------------------------------------
    Woocommerce Blocks
        1. Editor Style
           1-1  Base Style
           1-2  Login Form
           1-3  Woocommerce Info
           1-4  Sub Pages
           1-5  Overlay
           1-6  Rating Form
           1-7  WCML
           1-8  Yith Compare
        2. Sidebar Widget
           2-1  Base Style
           2-2  Product List
           2-3  Cart
           2-4  Product Tag Cloud
           2-5  WC Reviews
---------------------------------------------- */

// 1. Editor Style

// 1-1. Base Style
.form-row [type="text"],
.form-row [type="tel"],
.form-row [type="password"],
.form-row [type="email"],
.form-row textarea,
.form-row .select2-container .select2-selection,
.form-row select {
    display: block;
    width: 100%;
    min-height: 4.1rem;
    padding: .85rem 2rem;
    border: 1px solid var(--alpha-change-border-color);
    font-size: 1.4rem;
    line-height: 1.5;
    font-weight: 400;
    color: var(--alpha-body-color);
    background-color: transparent;
    border-radius: 2px;
    box-shadow: none;
    outline: 0;
}

.woocommerce-form {
    font-size: 1.3rem;

    .form-row {
        margin-bottom: 1.8rem;
    }

    label {
        margin-bottom: 8px;
    }
}

.woocommerce-form__label-for-checkbox:hover {
    cursor: pointer;
}

.button {
    display: inline-block;
    border: 2px solid var(--alpha-change-border-color);
    outline: 0;
    border-radius: 0;
    padding: 1.3rem 2.7rem;
    font-weight: 600;
    font-size: 1.4rem;
    line-height: 1.2;
    text-transform: uppercase;
    text-align: center;
    transition: color 0.3s, border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
    white-space: nowrap;
    cursor: pointer;

    @include button-variant(var(--alpha-primary-color), var(--alpha-primary-color-hover)); // issue : duplicate

    &.loading {
        opacity: .3;
    }

    &[disabled] {
        cursor: not-allowed;
        pointer-events: none;
    }
}

// 1-2. Login Form
.form-footer label {
    margin-bottom: 0;
}

.lost_password {
    margin-bottom: 0;

    a {
        color: $danger-color;

        &:hover,
        &:focus {
            color: lighten($danger-color, 10%);
        }
    }
}

.woocommerce-privacy-policy-link {
    color: var(--alpha-primary-color);

    &:hover {
        text-decoration: underline;
    }
}

form {
    .submit-status {
        margin: 2rem 0 0;
        color: var(--alpha-danger-color);
    }
}

form.lost_reset_password {
    width: 450px;
    margin: 0 auto;
    border: 1px solid var(--alpha-change-border-color-light);
    padding: 5rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.woocommerce>.login-popup {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    background: var(--alpha-change-color-light-1);
}

.woocommerce-form .button,
.woocommerce-form-row .button {
    display: block;
    width: 100%;
}

.woocommerce-form-login {
    p {
        font-size: inherit;
        line-height: 1.84;

        &:empty:before {
            content: none;
        }
    }

    .form-row {
        font-size: 1.3rem;
        margin-bottom: 2.5rem;

        label {
            display: inline-block;
            margin-bottom: 8px;
            font-size: 1.4rem;
        }

        span {
            vertical-align: middle;
        }

        .form-control {
            height: 3.7rem;
        }

        .input-text {
            background: var(--alpha-change-color-light-1);
        }

        input {
            margin-#{$right}: .5rem;

            &[type="radio"] {
                vertical-align: sub;
            }
        }
    }

    .login-popup & .form-row:nth-child(2) {
        margin-bottom: 2rem;
    }

    .user-role {
        margin: 2.7rem 0 2.5rem;

        .radio:first-child {
            margin-bottom: 1.2rem;
        }
    }

    .custom-checkbox {
        display: flex;
        align-items: center;

        input[type="checkbox"] {
            margin-#{$right}: 1rem;
        }

        label {
            margin-bottom: 0;
        }
    }

    .form-footer {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        justify-content: space-between;
        margin-bottom: 1.3rem;
        font-size: 1.2rem;

        p {
            margin-bottom: 6px;
            line-height: inherit;
        }
    }

    .button {
        padding: 1rem;
    }

    .lost-link {
        text-align: $right;
        color: $danger-color;

        &:hover {
            text-decoration: underline;
        }
    }

    .social-login {
        margin-bottom: 2.5rem;
        color: var(--alpha-grey-color);

        p {
            margin-bottom: 8px;
            font-size: 1.2rem;
        }
    }

    .social-icon {
        color: var(--alpha-body-color);

        &.framed {
            border-color: var(--alpha-change-color-light-3);
        }
    }

    .custom-checkbox {
        margin-bottom: 2.5rem;
        line-height: initial;
    }

    .woocommerce-password-strength {
        margin: 10px 0;
        padding: 8px;
        color: var(--alpha-change-color-light-1);
        text-align: center;
        background: var(--alpha-primary-color);

        &.short {
            background: $alert-color;
        }

        &.bad {
            background: $danger-color;
        }

        &.good {
            background: $success-color;
        }
    }

    .woocommerce-password-hint {
        font-size: 1.2rem;
        line-height: 1.86;
    }

    .title {
        font-size: 1.3rem;
        font-weight: normal;
        color: var(--alpha-body-color);
        margin-bottom: 1.5rem;
    }
}


// 1-3. Woocommerce Info
.main-content>.woocommerce-info {
    padding-top: 1.8rem;
}

@include mq(lg) {
    .left-sidebar.closed~.main-content>.woocommerce-info {
        padding-#{$left}: 10rem;
    }
}

// 1-4. Sub Pages
.woocommerce .alert {
    display: block;
    margin-bottom: 2rem;
    padding-#{$right}: 4rem;
    background: transparent;
    border: 1px solid;

    i {
        margin-#{$right}: 5px;
    }

    .btn:first-child {
        margin-#{$right}: 1rem;
    }

    .button {
        width: auto;
    }

    .btn.btn-close {
        top: 50%;
        transform: translateY(-50%);
    }

    .close-icon {
        width: 14px;
        height: 14px;
    }

    .close-icon:before,
    .close-icon:after {
        color: inherit;
    }

    +.alert {
        margin-top: -1rem;
    }
}

.woocommerce {

    .alert-success a:not(.btn),
    .alert-success i {
        color: var(--alpha-success-color);
    }

    .alert-danger a:not(.btn),
    .alert-danger i {
        color: var(--alpha-danger-color);
    }

    .alert-danger>.button {
        display: none;
    }

    .alert-info a:not(.btn),
    .alert-info i {
        color: var(--alpha-info-color);
    }

    .showcoupon+.btn-close,
    .showlogin+.btn-close {
        display: none;
    }
}

.compare-page .alpha-compare-table.empty {
    margin-top: 7rem;
}

// 1-5. Overlay
.blockOverlay {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% + 10px) !important;

    background: var(--alpha-change-color-light-1) !important;
    opacity: 0.6 !important;
}

.woocommerce-cart .blockMsg,
.woocommerce-checkout .blockMsg {
    opacity: 0;
}

.woocommerce .add_to_wishlist .blockOverlay {
    background: transparent !important;
}

.woocommerce .blockUI.blockOverlay::before {
    background: none;
}

// 1-6. Rating Form
.comment-form-rating {
    color: var(--alpha-change-color-dark-1);
    margin-bottom: 2.2rem;
}

.comment-respond .comment-form-cookies-consent {
    margin-bottom: 2rem;
}

.stars {
    display: inline-block;
    margin: side-values(0 0 0 1rem);
    line-height: 1;

    .comment-respond & {
        margin-bottom: 0;
        vertical-align: 1px;
    }

    span {
        display: flex;
        position: relative;
        height: 1.2rem;
        font-size: 1.2rem;
    }

    a {
        color: var(--alpha-change-color-light-3);
        text-indent: if-ltr(-9999px, 9999px);
        width: 1.4rem;
    }

    a:before {
        content: '';
        position: absolute;
        #{$left}: 0;
        height: 14px;
        line-height: 1;
        font-family: $framework-font;
        text-indent: 0;
        overflow: hidden;
        white-space: nowrap;
        letter-spacing: 0.2em;
    }

    a.active:before,
    a:hover:before {
        content: "\e986" "\e986" "\e986" "\e986" "\e986";
        color: var(--alpha-secondary-color);
    }

    .star-1 {
        z-index: 10;
    }

    .star-2 {
        z-index: 9;
    }

    .star-3 {
        z-index: 8;
    }

    .star-4 {
        z-index: 7;
    }

    .start-5 {
        z-index: 6;
    }

    .star-1:before {
        width: 20%;
    }

    .star-2:before {
        width: 40%;
    }

    .star-3:before {
        width: 60%;
    }

    .star-4:before {
        width: 80%;
    }

    .star-5:before {
        content: "\e986" "\e986" "\e986" "\e986" "\e986";
    }
}

// 1-7. WCML
.wcml-spinner {
    display: none;
}

.entry-summary .product_meta .wcml_currency_switcher {
    display: none;
}

// 1-8. Yith Compare
.yith_woocompare_colorbox #cboxTopCenter,
.yith_woocompare_colorbox #cboxTopLeft,
.yith_woocompare_colorbox #cboxTopRight,
.yith_woocompare_colorbox #cboxMiddleLeft,
.yith_woocompare_colorbox #cboxMiddleRight,
.yith_woocompare_colorbox #cboxBottomLeft,
.yith_woocompare_colorbox #cboxBottomCenter,
.yith_woocompare_colorbox #cboxBottomRight {
    background: transparent;
    width: 0;
    height: 0;
}

@include mq('320px', 'max') {
    .page-content .woocommerce-form-login .lost_password {
        margin-#{$left}: 0;
    }
}

.woocommerce-store-notice.demo_store {
    display: block;
    text-align: center;
    width: 100%;
    position: absolute;
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
    padding: 1em 0;
    margin: 0;
    color: #fff;
    border: none;
    border-radius: 0;
    background-color: var(--alpha-primary-color);
    box-shadow: 0 1px 1em rgb(0 0 0 / 20%);
    font-size: 1em;
    z-index: 99998;

    .woocommerce-store-notice__dismiss-link {
        color: var(--alpha-white-color);
        border-bottom: 1px solid var(--alpha-white-color);
        transition: border-bottom-color .3s;

        &:hover {
            border-bottom-color: transparent;
        }
    }

    .admin-bar & {
        top: 32px;
    }
}


// 2. Sidebar Widgets

// 2-1. Base Style
.sidebar .widget .wc-layered-nav-term,
.sidebar .widget .with-checkbox li,
.sidebar .widget .yith-wcan-list li {
    padding: 0;

    >a,
    &.empty span {
        position: relative;
        display: block;
        color: var(--alpha-dark-body-color);
        line-height: 1.2;
        padding: side-values(1rem 0 1rem 2.8rem);

        &:hover {
            color: var(--alpha-primary-color);
        }

        &::before {
            content: '';
            position: absolute;
            border: 1px solid;
            border-radius: $corner-sm;
            width: 18px;
            height: 18px;
            top: 50%;
            transform: translateY(-50%);
            #{$left}: 0;
            color: var(--alpha-grey-color);
            font-size: .7em;
            font-weight: 900;
            font-family: 'Font Awesome 5 Free';
            text-align: center;
            line-height: 16px;

            @include only-for-retina(1.5) {
                text-indent: 0;
            }
        }
    }
}

.sidebar .widget .wc-block-product-categories a {
    color: var(--alpha-dark-body-color);
}

.sidebar .widget .wc-layered-nav-term.chosen>a::before,
.sidebar .widget .with-checkbox li.chosen>a::before,
.sidebar .widget .yith-wcan-list li.chosen>a::before {
    content: "\f00c";
    color: var(--alpha-change-color-light-1);
    background-color: var(--alpha-primary-color);
    border-color: var(--alpha-primary-color);
}

.woocommerce-message {
    .button {
        width: auto;
    }
}

.woocommerce-product-gallery .woocommerce-product-gallery__trigger {
    display: none;
}

// 2-2. Product List
.product-list-sm {
    display: flex;
    align-items: center;

    .product-media {
        line-height: 1.6;
        flex: 0 0 10rem;
        max-width: 10rem;
        margin-#{$right}: 1rem;
    }

    .product-details {
        padding: 0;
        flex: 1;
        max-width: calc(100% - 11rem);
    }

    .woocommerce-loop-product__title {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        margin-bottom: 0.6rem;
        font-size: 1.3rem;
        white-space: normal;
    }

    .woocommerce-product-rating {
        margin-bottom: 0.6rem;
    }

    .price {
        font-size: 1.6rem;
    }
}

// 2-3. Cart
.sidebar {
    .cart-header {
        display: none;
    }

    .cart_list {
        >li {
            position: relative;
            display: flex;
            align-items: center;
        }

        .cart-item-meta {
            order: 1;
            margin-#{$left}: 2rem;
        }

        img {
            width: 9.8rem;
        }

        .quantity {
            border: 0;
        }

        .remove {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 20px;
            height: 20px;
            position: absolute;
            top: 10px;
            left: 87px;
            z-index: 3;
            background: var(--alpha-change-color-light-1);
            color: var(--alpha-change-color-dark-1);
            font-size: 1.2rem;
            line-height: 12px;
            text-align: center;
            border-radius: 50%;
            box-shadow: 0 2px 6px 0 rgb(0 0 0 / 40%);
        }
    }

    .widget_shopping_cart a.button {
        color: var(--alpha-change-color-light-1);
        margin-#{$right}: 1rem;
    }
}

// 2-4. Product Tag Cloud
.sidebar .tagcloud {
    margin: .5rem 0;
}

// 2-5 WC Reviews
.wc-block-review-sort-select {
    display: flex;
    align-items: center;
}

.wc-block-review-list li {
    margin-bottom: 1rem;
}

.wc-block-all-reviews .wp-block-button__link {
    border: 0;
}

.alpha-rounded-skin {

    .form-row [type=email],
    .form-row [type=password],
    .form-row [type=tel],
    .form-row [type=text],
    .form-row textarea,
    .woocommerce .button,
    .woocommerce .btn {
        border-radius: $corner-sm;
    }
}