/* =========================================================
   Sidebar lọc + thanh sắp xếp + thẻ sản phẩm dùng chung
   Trang danh mục (category.html) & trang tìm kiếm (search.html)
   Phạm vi: section.filter-modern-page — không ảnh hưởng trang khác
   ========================================================= */

.filter-modern-page .main-content-product { gap: 24px; align-items: flex-start; }
.filter-modern-page .right-content-product { width: calc(100% - 274px); min-width: 0; max-width: 100%; }
.filter-modern-page .cate-product-list { min-width: 0; max-width: 100%; }

/* ---------- Lưới sản phẩm ---------- */
/* Khoảng cách dùng chung biến --product-gap (mặc định 10px) như trang danh mục */
.filter-modern-page .search-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--product-gap, 10px);
    margin: 0;
    width: 100%;
    min-width: 0;
}
.filter-modern-page .search-grid > .col-md-3 {
    flex: none; max-width: none; width: auto; padding: 0; border: 0;
}
.filter-modern-page .search-grid > nav,
.filter-modern-page .search-grid > .search-empty { grid-column: 1 / -1; }

.filter-modern-page .search-grid .item-product,
.filter-modern-page #category-products-wrap .item-product {
    height: 100%;
    margin: 0;
    max-width: 100%;
    border: 1px solid var(--brand-line, #DCE6F0);
    border-radius: 12px;
    background: #fff;
    transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.filter-modern-page .search-grid .item-product:hover,
.filter-modern-page #category-products-wrap .item-product:hover {
    border-color: var(--brand-blue, #1C88D0);
    box-shadow: 0 6px 18px rgba(11, 45, 110, .08);
    transform: translateY(-2px);
}

@media (max-width: 1199px) {
    .filter-modern-page .search-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
    .filter-modern-page .right-content-product { width: 100%; flex: 1 1 100%; }
    .filter-modern-page .search-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-modern-page .n-filter-toolbar > a:not(.show-for-900) { margin-right: 0; }
}

/* ---------- Thanh sắp xếp ---------- */
.filter-modern-page .n-filter-toolbar { display: flex !important; flex-wrap: wrap; gap: 8px; }
.filter-modern-page .n-filter-toolbar > a {
    background: #fff;
    color: var(--brand-ink, #0E1A2B);
    border: 1px solid var(--brand-line, #DCE6F0);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    text-transform: none;
}
.filter-modern-page .n-filter-toolbar > a:hover {
    border-color: var(--brand-blue, #1C88D0);
    color: var(--brand-blue, #1C88D0);
    background: #fff;
}
.filter-modern-page .n-filter-toolbar > a[data-check='true'] {
    background: var(--brand-navy, #0B2D6E) !important;
    border-color: var(--brand-navy, #0B2D6E);
    color: #fff !important;
}

/* ---------- Sidebar lọc ---------- */
@media (min-width: 1024px) {
    .filter-modern-page .left-content-product {
        border: 1px solid var(--brand-line, #DCE6F0);
        border-radius: 12px;
        padding: 16px;
    }
}
.filter-modern-page .left-content-product .cate-left .title {
    border: 0;
    border-bottom: 2px solid var(--brand-blue, #1C88D0);
    border-radius: 0;
    margin: 0 0 4px;
    padding: 0 0 10px;
    text-align: left;
    font-size: 16px;
    font-weight: 700;
    color: var(--brand-navy, #0B2D6E);
    text-transform: none;
}
.filter-modern-page .left-content-product .filter-item {
    border-bottom: 1px solid var(--brand-line, #DCE6F0);
    padding-bottom: 6px;
}
.filter-modern-page .left-content-product .filter-item:last-of-type { border-bottom: 0; }
.filter-modern-page .left-content-product .title-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0;
    padding: 14px 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--brand-navy, #0B2D6E);
    text-transform: none;
}
.filter-modern-page div.filter-item div.title-item > span {
    font-size: 12px;
    color: var(--brand-steel, #5B6B80);
}

/* Ô tìm trong nhóm lọc */
.filter-modern-page div.filter-item div.search { position: relative; margin: 0 0 6px; }
.filter-modern-page div.filter-item div.search span:first-child {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brand-steel, #5B6B80);
    font-size: 14px;
    pointer-events: none;
    display: flex;
}
.filter-modern-page div.filter-item div.search span:last-child { display: none !important; }
.filter-modern-page .left-content-product div.filter-item div.search input,
.filter-modern-page div.filter-item input.thuoctinh_search {
    width: 100%;
    height: 36px;
    margin: 0 !important;
    padding: 0 12px 0 34px;
    font-size: 13px;
    color: var(--brand-ink, #0E1A2B);
    background: #F5F8FB;
    border: 1px solid transparent;
    border-radius: 8px;
    outline: none;
    box-shadow: none;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.filter-modern-page div.filter-item input.thuoctinh_search::placeholder { color: #8A97A8; }
.filter-modern-page div.filter-item input.thuoctinh_search:focus {
    background: #fff;
    border-color: var(--brand-blue, #1C88D0);
    box-shadow: 0 0 0 3px rgba(28, 136, 208, .15);
}

/* Danh sách lựa chọn: 1 cột, cuộn mảnh */
.filter-modern-page .left-content-product .filter-item ul,
.filter-modern-page .left-content-product .filter-item.active ul {
    display: block !important;
    max-height: 232px !important;
    padding: 2px 0 !important;
    margin: 0;
    scrollbar-width: thin;
    scrollbar-color: #C5D3E2 transparent;
}
.filter-modern-page .filter-item ul::-webkit-scrollbar { width: 6px; }
.filter-modern-page .filter-item ul::-webkit-scrollbar-thumb { background: #C5D3E2; border-radius: 6px; }
.filter-modern-page .filter-item ul li { width: 100%; flex: none; padding: 0; }
.filter-modern-page .filter-item label { min-height: 0; padding: 0; margin: 0; }
.filter-modern-page .filter-item label span.name { width: 100%; }
.filter-modern-page .filter-item label a {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--brand-ink, #0E1A2B);
    text-transform: none;
    overflow-wrap: anywhere;
}
.filter-modern-page .filter-item label a:hover { background: var(--brand-mist, #EAF3FB); }
.filter-modern-page .filter-item label a:before {
    content: "";
    font-family: inherit;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    margin: 1px 0 0;
    border: 1.5px solid #B8C6D6;
    border-radius: 4px;
    background: #fff center / 11px no-repeat;
    transition: background-color .15s ease, border-color .15s ease;
}
.filter-modern-page .filter-item label a.checked { color: var(--brand-blue, #1C88D0); font-weight: 600; }
.filter-modern-page .filter-item label a.checked:before {
    content: "";
    font-family: inherit;
    border-color: var(--brand-blue, #1C88D0);
    background-color: var(--brand-blue, #1C88D0);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    color: transparent;
}
.filter-modern-page ul li.hidden { display: none !important; }

/* Trạng thái trống */
.filter-modern-page .search-empty {
    padding: 48px 16px;
    text-align: center;
    color: var(--brand-steel, #5B6B80);
    background: #fff;
    border-radius: 12px;
    border: 1px dashed var(--brand-line, #DCE6F0);
}
.filter-modern-page .search-filter-empty { padding: 10px 0; color: var(--brand-steel, #5B6B80); font-size: 13px; }
