/* =========================================================
   Miland Product Category Filter
   WooCommerce / Avada Shop
========================================================= */


/* =========================================================
   Base
========================================================= */

.miland-product-filter,
.miland-product-filter * {
    box-sizing: border-box;
}

.miland-product-filter {
    position: relative;

    width: 420px;
    max-width: 100%;

    font-family: inherit;

    z-index: 100;
}


/* =========================================================
   Important:
   防止 Avada 样式覆盖 hidden 属性
========================================================= */

.miland-product-filter [hidden] {
    display: none !important;
}


/* =========================================================
   Main Trigger
========================================================= */

.miland-filter-trigger {
    width: 100%;
    min-height: 54px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin: 0;
    padding: 0 20px;

    border: 1px solid #e2e2e2;
    border-radius: 6px;

    outline: none;

    background: #ffffff;

    color: #222222;

    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;

    text-align: left;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}


/* Hover */

.miland-filter-trigger:hover {
    border-color: #ff941f;
}


/* Open */

.miland-product-filter.is-open
.miland-filter-trigger {
    border-color: #ff941f;

    box-shadow:
        0 5px 20px
        rgba(0, 0, 0, 0.08);
}


/* Trigger Text */

.miland-filter-trigger-text {
    display: block;

    min-width: 0;

    flex: 1;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}


/* =========================================================
   Trigger Arrow
========================================================= */

.miland-filter-trigger-arrow {
    width: 9px;
    height: 9px;

    display: block;

    flex: 0 0 auto;

    margin-top: -4px;

    border-right: 2px solid #333333;
    border-bottom: 2px solid #333333;

    transform: rotate(45deg);

    transition:
        transform 0.2s ease,
        border-color 0.2s ease;
}


/* Open Arrow */

.miland-product-filter.is-open
.miland-filter-trigger-arrow {
    margin-top: 4px;

    transform: rotate(225deg);
}


/* =========================================================
   Dropdown
========================================================= */

.miland-filter-dropdown {
    position: absolute;

    top: calc(100% + 8px);
    left: 0;

    width: 100%;

    overflow: hidden;

    border: 1px solid #e5e5e5;
    border-radius: 7px;

    background: #ffffff;

    box-shadow:
        0 14px 40px
        rgba(0, 0, 0, 0.13);

    z-index: 9999;
}


/* =========================================================
   Dropdown Header
========================================================= */

.miland-filter-header {
    width: 100%;
    min-height: 58px;

    display: flex;
    align-items: center;

    padding: 0 18px;

    border-bottom: 1px solid #eeeeee;

    background: #ffffff;
}


/* Title */

.miland-filter-title {
    min-width: 0;

    flex: 1;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    color: #111111;

    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
}


/* =========================================================
   Back Button
========================================================= */

.miland-filter-back {
    min-width: 30px;
    min-height: 40px;

    display: flex;
    align-items: center;

    gap: 5px;

    flex: 0 0 auto;

    margin: 0 8px 0 -8px;
    padding: 0 8px;

    border: 0;
    outline: none;

    background: transparent;

    color: #555555;

    font-family: inherit;

    cursor: pointer;

    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}


.miland-filter-back:hover {
    color: #ff941f;

    background: #fff8f0;

    border-radius: 4px;
}


/* Back Arrow */

.miland-filter-back-icon {
    display: block;

    margin-top: -2px;

    font-size: 27px;
    font-weight: 400;
    line-height: 1;
}


/*
 * 文字默认隐藏。
 * 顶部直接显示当前层级标题即可。
 */
.miland-filter-back-text {
    display: none;
}


/* =========================================================
   Category List
========================================================= */

.miland-filter-list {
    width: 100%;

    max-height: 430px;

    overflow-x: hidden;
    overflow-y: auto;

    overscroll-behavior: contain;

    background: #ffffff;
}


/* Scrollbar */

.miland-filter-list::-webkit-scrollbar {
    width: 6px;
}


.miland-filter-list::-webkit-scrollbar-track {
    background: #f5f5f5;
}


.miland-filter-list::-webkit-scrollbar-thumb {
    background: #cccccc;

    border-radius: 20px;
}


.miland-filter-list::-webkit-scrollbar-thumb:hover {
    background: #aaaaaa;
}


/* =========================================================
   Item Row
========================================================= */

.miland-filter-item {
    width: 100%;
    min-height: 54px;

    display: flex;
    align-items: stretch;
    justify-content: space-between;

    gap: 0;

    margin: 0;
    padding: 0 10px 0 18px;

    border: 0;
    border-bottom: 1px solid #eeeeee;

    background: #ffffff;

    color: #222222;

    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;

    text-align: left;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}


.miland-filter-item:last-child {
    border-bottom: 0;
}


/* Hover */

.miland-filter-item:hover {
    background: #fafafa;
}


/* =========================================================
   Category Name
========================================================= */

.miland-filter-item-name {
    min-width: 0;

    flex: 1;

    display: flex;
    align-items: center;

    overflow-wrap: anywhere;
}


/*
 * 分类名称本身是 Button 时
 */
button.miland-filter-item-name {
    min-height: 53px;

    margin: 0;
    padding: 10px 12px 10px 0;

    border: 0;
    outline: none;

    background: transparent;

    color: inherit;

    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;

    text-align: left;

    cursor: pointer;

    transition:
        color 0.2s ease;
}


button.miland-filter-item-name:hover {
    color: #ff941f;
}


/* =========================================================
   Child Arrow Button
========================================================= */

.miland-filter-child-trigger {
    width: 46px;
    min-width: 46px;
    min-height: 52px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 46px;

    margin: 0 -10px 0 0;
    padding: 0;

    border: 0;
    border-left: 1px solid #eeeeee;

    outline: none;

    background: transparent;

    color: #999999;

    font-family: inherit;

    cursor: pointer;

    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}


.miland-filter-child-trigger span {
    display: block;

    margin-top: -3px;

    font-size: 27px;
    font-weight: 300;
    line-height: 1;
}


.miland-filter-child-trigger:hover {
    color: #ff941f;

    background: #fff7ee;
}


/* =========================================================
   Selected Category
========================================================= */

.miland-filter-item.is-selected {
    position: relative;

    background: #fff8f1;

    color: #ff8a00;
}


.miland-filter-item.is-selected::before {
    content: "";

    position: absolute;

    top: 0;
    bottom: 0;
    left: 0;

    width: 3px;

    background: #ff941f;
}


.miland-filter-item.is-selected
.miland-filter-child-trigger {
    color: #ff941f;
}


/* =========================================================
   All Products
========================================================= */

button.miland-filter-all {
    min-height: 54px;

    align-items: center;

    padding-right: 18px;

    background: #fafafa;

    color: #111111;

    font-weight: 700;

    cursor: pointer;
}


button.miland-filter-all:hover {
    color: #ff941f;

    background: #fff8f0;
}


/* 当前 All Products */

button.miland-filter-all.is-selected {
    color: #ff941f;

    background: #fff8f0;
}


/* =========================================================
   View All Parent Category
========================================================= */

button.miland-filter-view-all {
    min-height: 54px;

    align-items: center;

    padding-right: 18px;

    background: #fffaf5;

    color: #ff8a00;

    font-weight: 700;

    cursor: pointer;
}


button.miland-filter-view-all:hover {
    color: #e97600;

    background: #fff5ea;
}


/* =========================================================
   Focus
========================================================= */

.miland-filter-trigger:focus-visible,
.miland-filter-back:focus-visible,
button.miland-filter-item-name:focus-visible,
.miland-filter-child-trigger:focus-visible,
button.miland-filter-all:focus-visible,
button.miland-filter-view-all:focus-visible {
    outline: 2px solid #ff941f;
    outline-offset: -2px;
}


/* =========================================================
   Tablet
========================================================= */

@media (max-width: 1024px) {

    .miland-product-filter {
        width: 380px;
    }


    .miland-filter-list {
        max-height: 400px;
    }

}


/* =========================================================
   Mobile
========================================================= */

@media (max-width: 767px) {

    .miland-product-filter {
        width: 100%;
    }


    .miland-filter-trigger {
        min-height: 50px;

        padding-left: 16px;
        padding-right: 16px;

        font-size: 14px;
    }


    .miland-filter-dropdown {
        top: calc(100% + 6px);
    }


    .miland-filter-header {
        min-height: 54px;

        padding-left: 14px;
        padding-right: 14px;
    }


    .miland-filter-title {
        font-size: 14px;
    }


    .miland-filter-list {
        max-height: 360px;
    }


    .miland-filter-item {
        min-height: 52px;

        padding-left: 16px;

        font-size: 14px;
    }


    button.miland-filter-item-name {
        min-height: 51px;
    }


    .miland-filter-child-trigger {
        min-height: 50px;
    }

}


/* =========================================================
   Very Small Mobile
========================================================= */

@media (max-width: 420px) {

    .miland-filter-dropdown {
        width: 100%;
    }


    .miland-filter-list {
        max-height: 330px;
    }


    .miland-filter-item {
        padding-left: 14px;
    }

}