/* Bo loc nang cao trang gia xe (/oto/, /xe-tai/, /xe-may/, /tim-kiem-*) + tab "Gia xe theo khoang gia".
   Nap rieng (media=print -> all) tu template, KHONG nam trong 10 file critical CSS. Moi quy tac bat dau bang
   #filter.tbx-filter de thang cac quy tac cu "#filter ..." trong themes.css / style.responsive.css. */

#filter.tbx-filter {
    --tf-blue: #2070e8;
    --tf-blue-bg: #eef4ff;
    --tf-text: #111827;
    --tf-muted: #6b7280;
    --tf-line: #e5e7eb;
    --tf-soft: #f5f7fb;
    background: rgba(17, 24, 39, .55);
    padding-left: 0 !important;
}
#filter.tbx-filter .modal-dialog.large {
    width: auto;
    max-width: 980px;
    margin: 40px auto;
    padding: 0 16px;
}
#filter.tbx-filter .modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px);
    min-height: 0;
    border: 0;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
    overflow: hidden;
    background: #fff;
}
#filter.tbx-filter .tbx-f-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--tf-line);
    flex: 0 0 auto;
}
#filter.tbx-filter .tbx-f-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--tf-text);
    line-height: 1.3;
}
#filter.tbx-filter .tbx-f-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: var(--tf-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
#filter.tbx-filter .tbx-f-close svg {
    fill: #374151;
}
#filter.tbx-filter .tbx-f-close:hover {
    background: #e5e7eb;
}
#filter.tbx-filter .modal-body {
    flex: 1 1 auto;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 24px 16px;
}
#filter.tbx-filter .tbx-f-sec {
    padding: 16px 0;
    border-bottom: 1px solid var(--tf-line);
}
#filter.tbx-filter .tbx-f-sec:last-child {
    border-bottom: 0;
}
#filter.tbx-filter .tbx-f-sec-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
#filter.tbx-filter .tbx-f-sec-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--tf-text);
}

/* input an nhung van nhan ban phim */
#filter.tbx-filter input.tbx-f-in {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    border: 0;
    pointer-events: none;
}

/* O tim hang */
#filter.tbx-filter input.tbx-f-search {
    width: 220px;
    max-width: 55%;
    height: 36px;
    margin: 0;
    padding: 0 12px 0 34px;
    border: 1px solid var(--tf-line);
    border-radius: 999px;
    font-size: 14px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center;
}
#filter.tbx-filter input.tbx-f-search:focus {
    outline: 0;
    border-color: var(--tf-blue);
    box-shadow: 0 0 0 3px rgba(32, 112, 232, .15);
}

/* Luoi hang xe */
#filter.tbx-filter .tbx-f-brands {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
}
#filter.tbx-filter .tbx-f-brands:not(.is-open):not(.is-search) label.tbx-f-brand:nth-of-type(n+17),
#filter.tbx-filter .tbx-f-brands label.tbx-f-brand.is-miss {
    display: none;
}
#filter.tbx-filter label.tbx-f-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 78px;
    margin: 0;
    padding: 10px 4px 8px;
    border: 1px solid var(--tf-line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-weight: 500;
    transition: border-color .15s, background-color .15s, box-shadow .15s;
}
#filter.tbx-filter .tbx-f-logo {
    display: block;
    width: 56px;
    height: 32px;
}
#filter.tbx-filter .tbx-f-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#filter.tbx-filter .tbx-f-name {
    font-size: 12.5px;
    line-height: 1.25;
    color: #374151;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
#filter.tbx-filter .tbx-f-nomatch {
    padding: 8px 0;
    color: var(--tf-muted);
    font-size: 14px;
}
#filter.tbx-filter .tbx-f-more {
    display: block;
    margin: 12px auto 0;
    padding: 6px 14px;
    border: 0;
    background: none;
    color: var(--tf-blue);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
#filter.tbx-filter .tbx-f-more.hidden {
    display: none;
}
#filter.tbx-filter .tbx-f-more:after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-3px) rotate(45deg);
}

/* Chip phan khuc / loai xe / khoang gia */
#filter.tbx-filter .tbx-f-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
#filter.tbx-filter .tbx-f-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    margin: 0;
    padding: 6px 14px;
    border: 1px solid var(--tf-line);
    border-radius: 999px;
    background: #fff;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    transition: border-color .15s, background-color .15s, color .15s;
}
#filter.tbx-filter label.tbx-f-brand:hover,
#filter.tbx-filter .tbx-f-chip:hover {
    border-color: #9ca3af;
}
#filter.tbx-filter input.tbx-f-in:checked + label.tbx-f-brand,
#filter.tbx-filter input.tbx-f-in:checked + label.tbx-f-chip,
#filter.tbx-filter .tbx-f-chip.is-on {
    border-color: var(--tf-blue);
    background: var(--tf-blue-bg);
    color: var(--tf-blue);
    box-shadow: inset 0 0 0 1px var(--tf-blue);
}
#filter.tbx-filter input.tbx-f-in:checked + label.tbx-f-brand .tbx-f-name {
    color: var(--tf-blue);
    font-weight: 600;
}
#filter.tbx-filter input.tbx-f-in:checked + label.tbx-f-chip:before,
#filter.tbx-filter .tbx-f-chip.is-on:before {
    content: "";
    width: 5px;
    height: 10px;
    margin: -3px 8px 0 1px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}
#filter.tbx-filter input.tbx-f-in:focus-visible + label {
    outline: 2px solid var(--tf-blue);
    outline-offset: 2px;
}

/* Khoang gia */
#filter.tbx-filter .tbx-f-presets:empty {
    display: none;
}
#filter.tbx-filter .tbx-f-price {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    max-width: 520px;
}
#filter.tbx-filter .tbx-f-money {
    position: relative;
    flex: 1 1 0;
    margin: 0;
    font-weight: 400;
}
#filter.tbx-filter .tbx-f-money input {
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 60px 0 14px;
    border: 1px solid var(--tf-line);
    border-radius: 10px;
    font-size: 15px;
    color: var(--tf-text);
    background: #fff;
}
#filter.tbx-filter .tbx-f-money input:focus {
    outline: 0;
    border-color: var(--tf-blue);
    box-shadow: 0 0 0 3px rgba(32, 112, 232, .15);
}
#filter.tbx-filter .tbx-f-money span {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--tf-muted);
    pointer-events: none;
}
#filter.tbx-filter .tbx-f-dash {
    color: var(--tf-muted);
}
#filter.tbx-filter .tbx-f-hint {
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--tf-muted);
    font-weight: 400;
}

/* Chan modal dinh */
#filter.tbx-filter .tbx-f-foot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 24px;
    border-top: 1px solid var(--tf-line);
    background: #fff;
}
#filter.tbx-filter .tbx-f-reset {
    border: 0;
    background: none;
    padding: 10px 4px;
    color: var(--tf-text);
    font-size: 15px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
#filter.tbx-filter .tbx-f-reset:disabled {
    color: #9ca3af;
    cursor: default;
    text-decoration: none;
}
#filter.tbx-filter .tbx-f-apply {
    min-width: 200px;
    height: 46px;
    padding: 0 24px;
    border: 0;
    border-radius: 10px;
    background: var(--tf-blue);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s;
}
#filter.tbx-filter .tbx-f-apply:hover {
    background: #185cc2;
}
#filter.tbx-filter .tbx-f-apply.is-loading {
    opacity: .75;
    cursor: progress;
}
#filter.tbx-filter .tbx-f-apply.is-loading:before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: -2px;
    border: 2px solid rgba(255, 255, 255, .5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tbx-f-spin .7s linear infinite;
}
@keyframes tbx-f-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 991px) {
    #filter.tbx-filter .tbx-f-brands {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
    #filter.tbx-filter .tbx-f-brands:not(.is-open):not(.is-search) label.tbx-f-brand:nth-of-type(n+13) {
        display: none;
    }
}

/* Mobile: toan man hinh */
@media (max-width: 767px) {
    #filter.tbx-filter {
        background: #fff;
    }
    #filter.tbx-filter .modal-dialog.large {
        max-width: none;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
    }
    #filter.tbx-filter .modal-content {
        height: 100%;
        max-height: none;
        min-height: 0;
        border-radius: 0;
        box-shadow: none;
    }
    #filter.tbx-filter .tbx-f-head {
        padding: 10px 16px;
    }
    #filter.tbx-filter .tbx-f-title {
        font-size: 18px;
    }
    #filter.tbx-filter .modal-body {
        padding: 0 16px 16px;
    }
    #filter.tbx-filter .tbx-f-sec-head {
        flex-wrap: wrap;
    }
    #filter.tbx-filter input.tbx-f-search {
        width: 100%;
        max-width: none;
        order: 2;
    }
    #filter.tbx-filter .tbx-f-brands {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }
    #filter.tbx-filter .tbx-f-brands:not(.is-open):not(.is-search) label.tbx-f-brand:nth-of-type(n+13) {
        display: none;
    }
    #filter.tbx-filter label.tbx-f-brand {
        min-height: 70px;
        padding: 8px 2px 6px;
    }
    #filter.tbx-filter .tbx-f-logo {
        width: 48px;
        height: 28px;
    }
    #filter.tbx-filter .tbx-f-name {
        font-size: 11.5px;
    }
    #filter.tbx-filter .tbx-f-chip {
        min-height: 34px;
        padding: 5px 12px;
        font-size: 13.5px;
    }
    #filter.tbx-filter .tbx-f-foot {
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
        box-shadow: 0 -4px 12px rgba(0, 0, 0, .06);
    }
    #filter.tbx-filter .tbx-f-apply {
        flex: 1 1 auto;
        min-width: 0;
    }
}
