.thm-filter {
    position: relative;
    width: 100%;
    margin: 16px 0 12px;
    padding: 14px 24px 16px;
    background: #171717;
    border-radius: 10px;
    box-sizing: border-box;
    border: 1px solid rgba(190,145,52,.28);
}

.thm-filter__title {
    margin: 0 0 12px;
    color: #ddd5c7;
    font-size: 16px;
    line-height: 1.35;
    font-weight: 600;
}

.thm-filter__items {
    display: flex;
    align-items: center;
    gap: 12px;
}

.thm-filter__dropdown {
    position: relative;
}

.thm-filter__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    min-width: 62px;
    padding: 0 12px;
    border: 0;
    border-radius: 17px;
    background: #f1f1f1;
    color: #222;
    font-size: 13px;
    line-height: 1;
    font-weight: 400;
    cursor: pointer;
}

.thm-filter__button:hover,
.thm-filter__dropdown.is-open .thm-filter__button {
    background: #ededed;
}

.thm-filter__chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    margin-left: 1px;
    font-size: 11px;
    line-height: 1;
    font-weight: 600;
    transition: transform .2s ease;
}

.thm-filter__dropdown.is-open .thm-filter__chevron {
    transform: rotate(180deg);
}

.thm-filter__menu {
    position: absolute;
    z-index: 99999;
    top: calc(100% + 7px);
    left: 0;
    min-width: 250px;
    padding: 7px 0;
    border-radius: 7px;
    background: #fbf4e4;
    box-shadow: 0 4px 15px rgba(0,0,0,.10);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}

.thm-filter__dropdown.is-open .thm-filter__menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.thm-filter__option {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 36px;
    padding: 6px 14px;
    border: 0;
    background: transparent;
    color: #202020;
    text-align: left;
    font-size: 13px;
    line-height: 1.3;
    cursor: pointer;
}

.thm-filter__option:hover {
    background: rgba(189,150,85,.08);
    color: #a97d39;
}

.thm-filter__option.is-selected {
    color: #b2823d;
}

.thm-filter__option-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 5px;
    border-radius: 50%;
    background: #bd9655;
    color: #fff;
    font-size: 13px;
    line-height: 1;
    opacity: 0;
}

.thm-filter__age-option.is-selected .thm-filter__option-check {
    opacity: 1;
}

.thm-filter__selected {
    display: none;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin: 14px -24px -16px;
    padding: 10px 0 11px;
    background: #fff;
    color: #222;
    font-size: 13px;
    line-height: 1.3;
}

.thm-filter__selected-label {
    white-space: nowrap;
}

.thm-filter__chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #222;
    font-size: 13px;
    cursor: pointer;
}

.thm-filter__chip b {
    font-size: 17px;
    line-height: 12px;
    font-weight: 400;
}

.thm-filter__chip:hover {
    color: #a97d39;
}

.thm-filter__loading {
    position: absolute;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,.55);
}

.thm-filter.is-loading .thm-filter__loading {
    display: flex;
}

.thm-filter__loading span {
    width: 22px;
    height: 22px;
    border: 2px solid #ddd;
    border-top-color: #bd9655;
    border-radius: 50%;
    animation: thm-filter-spin .7s linear infinite;
}

@keyframes thm-filter-spin {
    to { transform: rotate(360deg); }
}

.thm-filter__no-results {
    width: 100%;
    padding: 30px 10px;
    text-align: center;
}

@media (max-width: 767px) {
    .thm-filter {
        margin: 12px 0 10px;
        padding: 14px 14px 15px;
        overflow: visible;
    }

    .thm-filter__title {
        margin-bottom: 10px;
        font-size: 15px;
        line-height: 1.35;
    }

    /* Mobile: lấy toàn bộ hàng nút làm mốc để menu không tràn khỏi màn hình. */
    .thm-filter__items {
        position: relative;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .thm-filter__dropdown {
        position: static;
        min-width: 0;
    }

    .thm-filter__button {
        width: 100%;
        min-width: 0;
        height: 34px;
        padding: 0 7px;
        gap: 4px;
        font-size: 11px;
        line-height: 1.05;
        white-space: normal;
        text-align: center;
    }

    .thm-filter__button > span {
        display: block;
        min-width: 0;
        overflow: visible;
        white-space: normal;
        word-break: keep-all;
    }

    /* Menu attribute/price luôn nằm gọn theo chiều rộng box filter. */
    .thm-filter__menu,
    .thm-filter__menu--attribute,
    .thm-filter__menu--price {
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        width: auto;
        min-width: 0;
        max-width: none;
        max-height: 240px;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 7px 0;
    }

    .thm-filter__option {
        min-height: 38px;
        padding: 8px 14px;
        font-size: 13px;
        line-height: 1.35;
        white-space: normal;
    }

    /* Selected nằm thành một hàng riêng, không dùng margin desktop gây cắt chữ. */
    .thm-filter__selected {
        position: relative;
        z-index: 1;
        width: auto;
        gap: 8px 12px;
        margin: 12px -14px -15px;
        padding: 10px 14px 12px;
        overflow: visible;
    }

    .thm-filter__selected-label {
        display: block;
        width: 100%;
        margin: 0;
        line-height: 1.35;
        white-space: normal;
    }

    .thm-filter__chip {
        max-width: 100%;
        line-height: 1.35;
        text-align: left;
        white-space: normal;
    }

    .thm-filter__chip span {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}
\n\n/* ==========================================================
   MOBILE FILTER MODAL (v1.3.6)
   Popup riêng: lấy toàn bộ option của filter đang click.
   Bấm XONG mới áp dụng. Click nền ngoài chỉ đóng popup.
   ========================================================== */
.thm-filter-modal {
    display: none;
}

@media (max-width: 767px) {
    html.thm-filter-modal-open,
    html.thm-filter-modal-open body {
        overflow: hidden !important;
    }

    /* Mobile không mở menu gốc nữa. */
    .thm-filter__dropdown.is-open .thm-filter__menu {
        display: none !important;
    }

    .thm-filter-modal {
        position: fixed;
        z-index: 2147483000;
        inset: 0;
        display: block;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .18s ease, visibility .18s ease;
    }

    .thm-filter-modal.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .thm-filter-modal__backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, .58);
    }

    .thm-filter-modal__sheet {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: min(68vh, 520px);
        padding-bottom: env(safe-area-inset-bottom);
        overflow: hidden;
        border-radius: 15px 15px 0 0;
        background: rgb(23, 20, 15);
        box-shadow: 0 -8px 30px rgba(0,0,0,.24);
        transform: translateY(100%);
        transition: transform .22s ease;
    }

    .thm-filter-modal.is-open .thm-filter-modal__sheet {
        transform: translateY(0);
    }

    .thm-filter-modal__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 48px;
        padding: 0 18px;
        border-bottom: 1px solid rgba(255,255,255,.16);
    }

    .thm-filter-modal__title {
        margin: 0;
        color: #fff;
        font-size: 15px;
        line-height: 1.2;
        font-weight: 600;
    }

    .thm-filter-modal__done {
        min-width: 54px;
        min-height: 40px;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent !important;
        color: #fff !important;
        font-size: 13px;
        line-height: 1;
        font-weight: 700;
        text-align: right;
        box-shadow: none !important;
    }

    .thm-filter-modal__values {
        max-height: calc(min(68vh, 520px) - 48px);
        padding: 6px 0 10px;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .thm-filter-modal__option {
        display: flex;
        align-items: center;
        gap: 9px;
        width: 100%;
        min-height: 42px;
        margin: 0;
        padding: 9px 18px;
        border: 0;
        background: transparent !important;
        color: #d6a345 !important;
        font-size: 13px;
        line-height: 1.35;
        font-weight: 400;
        text-align: left;
        box-shadow: none !important;
    }

    .thm-filter-modal__option.is-selected {
        background: rgba(255,255,255,.06) !important;
        color: #f2bc54 !important;
        font-weight: 600;
    }

    .thm-filter-modal__mark {
        position: relative;
        flex: 0 0 16px;
        width: 16px;
        height: 16px;
        border: 1px solid rgba(214,163,69,.7);
        border-radius: 50%;
        opacity: .8;
    }

    .thm-filter-modal__option.is-selected .thm-filter-modal__mark {
        border-color: #d6a345;
        background: #d6a345;
    }

    .thm-filter-modal__option.is-selected .thm-filter-modal__mark::after {
        content: '';
        position: absolute;
        left: 4px;
        top: 1px;
        width: 5px;
        height: 9px;
        border: solid #17213d;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg);
    }

    .thm-filter-modal__text {
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}
