.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== SEARCH BAR ===== */
.menu-section {
    margin: 32px auto 0 auto;
    border-radius: 4px;
}

.menu-bar {
    gap: 18px;
    background: #f2f2f2;
    border-radius: 4px;
    padding: 9px 13px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.menu-bar .search_bar {
    width: fit-content;
}

form.menu-search {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

form.menu-search label {
    margin-top: 1em;
    margin-bottom: 0.5em;
}


form.menu-search textarea {
    padding: 0.5em;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 1em;
}

form.menu-search button {
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 6px 18px;
}

form.menu-search button:hover {
    background: #555;
}

.form-input {
    position: relative;
    margin: 0 auto;
}

.search-input {
    outline: none;
    padding: 4px 10px;
    padding-left: 28px;
    border-radius: 4px;
    width: 250px;
}

.search-icon {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 20px;
    pointer-events: none;
}

/* ===== QUICK SEARCH BAR ===== */
.bar-quick_select {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-quick_select .filter-dropdown {
    position: relative;
    cursor: pointer;
}

.bar-quick_select .filter-menu {
    position: absolute;
    top: 90%;
    right: 0;
    width: 200px;
    background: #fff;
    border: 1px solid #e5e5e5;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.17);
    border-radius: 6px;
    padding: 5px;
    display: none;
    z-index: 1000;
}

.bar-quick_select .filter-dropdown:hover .filter-menu {
    display: block;
}

.bar-quick_select .filter-option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    cursor: pointer;
}

.bar-quick_select .filter-option:hover {
    background: #f5f5f5;
}

.bar-quick_select .filter-option input {
    accent-color: #000;
}

/* footer */
.bar-quick_select .filter-footer {
    border-top: 1px solid #eee;
    padding: 5px 9px;
    text-align: right;
}

.bar-quick_select .btn-clear-filter {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
}

.bar-quick_select .btn-clear-filter:hover {
    color: #000;
    text-decoration: underline;
}









/* ===== MOBILE HEADER (Results + Filter button) ===== */
.header-mobile {
    display: none;
    padding: 12px 10px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.header-mobile h2 {
    margin: 0;
    line-height: 1;
}

.filter-btn {
    padding: 6px 16px;
    border: 1px solid #333;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn svg {
    width: 16px;
    height: 16px;
}









/* ===== FILTER STYLES (chung cho desktop & mobile) ===== */
.filter-group {
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.filter-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.filter-group h4 {
    margin: 15px 0 10px;
    font-size: 1em;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.filter-group h4 span {
    transition: transform 0.3s ease;
    font-size: clamp(14px, 1.2vw, 16px);
}

.filter-group h4.active span {
    transform: rotate(180deg);
}

.filter-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-left: 5px;
    transition: max-height 0.4s ease-out, opacity 0.3s ease;
}

.filter-group ul.active {
    max-height: fit-content;
    opacity: 1;
}

.filter-group li {
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    /* checkbox align top khi label nhiều dòng */
    gap: 8px;
}

.filter-group li:hover {
    cursor: pointer;
}

.filter-group li input[type="checkbox"] {
    flex-shrink: 0;
    /* QUAN TRỌNG */
    margin-top: 3px;
    /* căn đẹp với text */
    margin-right: 8px;
    color: #9b9b9b !important;
}

.filter-group li input[type="checkbox"]:hover {
    cursor: pointer;
}

.filter-group li label {
    color: #6e6e6e !important;
    flex: 1;
    white-space: normal;
    /* cho phép xuống dòng */
    word-break: break-word;
    /* tránh tràn */
}













/* ===== MAIN LAYOUT ===== */
.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    align-items: stretch;
    gap: 20px;
}

.sidebar-col {
    width: 260px;
    position: relative;
    height: 100%;
    /* giữ chỗ trong grid */
}

.sidebar-filter {
    height: 100%;
    background: #fff;
    padding: 30px 10px;
    position: sticky;
    top: 0;
    height: calc(100vh - 0px);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    z-index: 10;
}

.sidebar-filter::-webkit-scrollbar {
    display: none;
}

/* Khi scroll thì mới fixed */
.sidebar-filter.is-fixed {
    top: 0;
    width: 260px;
    overflow-y: auto;
    z-index: 100;
}






/* ===== PRODUCT LIST ===== */
.main-content {
    flex: 1;
    padding: 30px 10px;
}



/* PRODUCT LIST GRID */
.product-list {
    margin: 0px auto;
    padding: 0 10px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 50px 24px;
    padding: 0;
}




.product-item {
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.product-item .product-image {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    width: 100%;
    aspect-ratio: 1;
}

.product-item .product-image img {
    width: 100%;
    border-radius: 10px;
    height: auto;
    aspect-ratio: 1;
    display: block;
    transition: opacity 0.6s ease, transform 0.6s ease;
    cursor: pointer;
}

.product-item .product-image:hover img {
    transform: scale(1.05);
}




.product-detail {
    padding: 14px 5px;
    width: 100%;
    display: flex;
    min-height: 160px;
    flex-direction: column;
}


.product-status {
    color: #777777;
    min-height: 15px;
    line-height: 96%;
}

.product-name {
    font-weight: bold;
    margin-bottom: 4px;
    color: #222;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 115%;
    max-height: calc(1.4em * 2);
}

.product-price {
    color: #3c7031;
    font-weight: 500;
    margin-bottom: 14px;
}

.product-btn {
    text-decoration: none;
}


.action-wrapper {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: auto;
}

.action-wrapper .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 6px 6px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
}

.action-wrapper .btn i {
    font-size: 14px;
}

.action-wrapper .btn-cart {
    color: #2e7d32;
    border-color: #2e7d32;
}

.action-wrapper .btn-cart:hover {
    background: #2e7d32;
    color: #fff;
    scale: 0.95;
}

.action-wrapper .btn-detail {
    border-color: #1565c0;
    color: #1565c0;
}

.action-wrapper .btn-detail a {
    text-decoration: none;
    color: inherit;
}

.action-wrapper .btn-detail:hover {
    background: #1565c0;
    color: #fff;
    scale: 0.95;
}












/* ===== MOBILE FILTER MODAL ===== */
.filter-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    z-index: 2000;
    background: #fff;

    /* QUAN TRỌNG: KHÓA THEO VIEWPORT */
    height: 100%;
    max-height: 100%;

    /* CHIA 3 PHẦN */
    display: none;
    grid-template-rows: auto minmax(0, 1fr) auto;

    overflow: hidden;
    /* 🔥 CẮT LIÊN HỆ VỚI PAGE DƯỚI */
}

.filter-modal.active {
    display: grid;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* 🔥 ĐẨY CLOSE SANG PHẢI */
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    background: #fff;
}

.close-modal {
    cursor: pointer;
    padding: 0 10px;
    font-size: clamp(20px, 1.2vw, 26px);
}

.modal-content {
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
    padding: 20px;

    padding-bottom: 30px;
    /* 👈 CHIỀU CAO FOOTER */
}

.modal-footer {
    padding: 12px 15px;
    border-top: 1px solid #ddd;
    background: #fff;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.modal-header {
    flex-shrink: 0;
    /* không bị co */
    background: #fff;
}

.modal-header h2 {
    margin: 0;            /* QUAN TRỌNG */
    line-height: 1;  
}

.btn-clear {
    padding: 6px 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

.btn-apply {
    padding: 6px 15px;
    border-radius: 10px;
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
}








/*
  ******  RESPONSIVE LAYOUT  ******
*/
@media screen and (max-width: 1200px) {
    .search-input {
        width: 200px;
    }
}

@media screen and (max-width: 991px) {
    form.menu-search {
        gap: 12px;
    }

    .search-input {
        width: 250px;
        padding: 5px 23px;
        padding-right: 15px;
    }

    .search-icon {
        font-size: 16px;
    }

    form.menu-search button {
        min-width: 80px;
        padding: 7px 15px;
    }

    .layout {
        grid-template-columns: 230px 1fr;
        gap: 4px;
    }

    .sidebar-col {
        width: 230px;
    }

    /* Khi scroll thì mới fixed */
    .sidebar-filter.is-fixed {
        width: 230px;
    }

    .filter-group li {
        margin-bottom: 7px;
    }

    .filter-group li input[type="checkbox"] {
        margin-right: 2px;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 40px 24px;
    }

    .product-detail {
        min-height: 150px;
    }
}

@media screen and (max-width: 768px) {
    .header-mobile {
        display: flex;
        align-items: center;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar-col {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding-top: 0;
        padding: 20px 0px;
    }

    .filter-group {
        margin-bottom: 20px;
        padding-bottom: 10px;
    }

    .filter-group ul.active {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0px 10px;
    }

    .filter-group li {
        margin-bottom: 5px;
    }
}

@media screen and (max-width: 660px) {}

@media screen and (max-width: 580px) {
    .menu-bar {
        gap: 3px;
        padding: 10px 10px;
        padding-bottom: 05px;
    }

    .menu-bar {
        padding: 10px;
    }

    .search_bar {
        width: 100%;
    }

    .search-input {
        padding: 3px 20px;
        padding-right: 10px;
        width: 100%;
    }

    .search-icon {
        font-size: 14px;
    }

    form.menu-search button {
        padding: 5px 13px;
        min-width: unset;
    }

    form.menu-search {
        justify-content: space-between;
    }

    .form-input {
        margin: 0;
        flex: 1;
    }

    .filter-btn {
        padding: 4px 16px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px 24px;
    }

    .product-detail {
        min-height: 147px;
    }

    .product-price {
        margin-bottom: 9px;
    }
}

@media screen and (max-width: 450px) {
    .filter-group ul.active {
        grid-template-columns: repeat(1, 1fr);
        gap: 0px 10px;
    }

    .products-grid {
        gap: 25px 18px;
    }
}

@media screen and (max-width: 365px) {}