/* ==========================================
   Horizontal Category Filter Menu
   ========================================== */
.horizontal-category-scroll-container {
    width: 100%;
    margin-bottom: 25px;
    background: #fff;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    position: relative;
}
.horizontal-category-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.horizontal-category-scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
    width: 100%;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
}
.horizontal-category-scroll::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}
.category-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    white-space: nowrap;
    height: 36px;
    box-sizing: border-box;
    flex-shrink: 0;
}
.category-tab-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 50%;
    background-color: #fff;
    padding: 1px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}
.category-tab-icon {
    font-size: 13px;
    color: #64748b;
    transition: color 0.2s ease;
}
.category-tab:hover {
    background-color: #e8f5e9;
    color: #1a5740;
    border-color: #a5d6a7;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(26, 87, 64, 0.08);
}
.category-tab:hover .category-tab-icon {
    color: #1a5740;
}
.category-tab:hover .category-tab-img {
    transform: scale(1.1);
    border-color: #a5d6a7;
}
.category-tab.active {
    background-color: #1a5740;
    color: #fff;
    border-color: #1a5740;
    box-shadow: 0 4px 6px -1px rgba(26, 87, 64, 0.15), 0 2px 4px -1px rgba(26, 87, 64, 0.1);
}
.category-tab.active .category-tab-icon {
    color: #fff;
}
.category-tab.active .category-tab-img {
    border-color: #fff;
}

/* Sliding navigation arrows */
.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: white;
    color: #1a5740;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
    z-index: 10;
    outline: none;
}
.scroll-arrow:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #113f2e;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.scroll-arrow.scroll-left {
    left: -16px;
}
.scroll-arrow.scroll-right {
    right: -16px;
}

/* ==========================================
   Sidebar Filters & Lists Styling
   ========================================== */
.news-category-sidebar-li {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 12px !important;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s;
    border-radius: 6px;
    margin-bottom: 2px;
}
.news-category-sidebar-li:hover {
    background-color: #f8fafc;
}
.news-category-sidebar-li:last-child {
    border-bottom: none;
}
.filter-checkbox {
    width: 17px !important;
    height: 17px !important;
    cursor: pointer;
    accent-color: #1a5740;
    margin: 0 !important;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    flex-shrink: 0;
}
.news-sidebar-label {
    margin: 0 !important;
    cursor: pointer;
    font-weight: 500 !important;
    color: #334155;
    flex: 1;
    display: flex;
    align-items: center;
    user-select: none;
}
.news-sidebar-link {
    font-size: 13.5px !important;
    font-weight: 500 !important;
    color: #334155 !important;
    text-decoration: none !important;
    transition: color 0.2s;
}
.news-category-sidebar-li:hover .news-sidebar-link {
    color: #1a5740 !important;
}
.sidebar-scroll-list::-webkit-scrollbar {
    width: 6px;
}
.sidebar-scroll-list::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-scroll-list::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
}
@media (min-width: 992px) {
    #productGrid {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        overflow-x: hidden;
        padding-right: 8px;
    }
    #productGrid::-webkit-scrollbar {
        width: 6px;
    }
    #productGrid::-webkit-scrollbar-track {
        background: transparent;
    }
    #productGrid::-webkit-scrollbar-thumb {
        background-color: #cbd5e1;
        border-radius: 20px;
    }
}
.news-category-sidebar-li.level-1 {
    font-weight: 600 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    background-color: #f8fafc;
    margin-top: 6px;
}
.news-category-sidebar-li.level-2 {
    margin-left: 15px !important;
    border-left: 1px dashed #cbd5e1;
    border-bottom: none !important;
    border-radius: 0 !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}
.news-category-sidebar-li.level-3 {
    margin-left: 30px !important;
    border-left: 1px dashed #cbd5e1;
    border-bottom: none !important;
    border-radius: 0 !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}

/* Sidebar Nhóm thuốc specific item */
.nhomthuoc-sidebar-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none !important;
    transition: all 0.2s ease-in-out;
}
.nhomthuoc-sidebar-item a:hover {
    background-color: #e8f5e9 !important;
    border-color: #a5d6a7 !important;
    transform: translateX(3px);
    box-shadow: 0 2px 4px rgba(26, 87, 64, 0.06);
}
.nhomthuoc-sidebar-item a:hover i.fa-angle-right {
    color: #1a5740 !important;
    transform: translateX(2px);
}

/* ==========================================
   Quick Search Tag Suggestions Row
   ========================================== */
.quick-search-tags-container {
    margin-bottom: 16px;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    background: #ffffff;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
}
.quick-search-tags-container::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}
.quick-search-tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s ease;
}
.quick-search-tag-pill:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1a5740;
}
.quick-search-tag-pill.active {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #1a5740;
    box-shadow: 0 2px 4px rgba(26, 87, 64, 0.08);
}
.quick-search-tag-img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    margin-right: 5px;
    border-radius: 4px;
}
.quick-search-tag-icon {
    color: #d97706;
    margin-right: 5px;
    font-size: 12px;
}

/* ==========================================
   MOBILE FILTER DRAWER
   Ẩn sidebar trên mobile, mở bằng nút bộ lọc
   ========================================== */

/* Nút "Bộ lọc" cố định dưới màn hình (chỉ mobile) */
.mobile-filter-btn,
.filter-drawer-side-toggle {
    display: none !important;
}

@media (max-width: 991px) {
    .horizontal-category-scroll-container {
        margin: 0 10px 14px 10px !important;
        width: calc(100% - 20px) !important;
        clear: both !important;
        box-sizing: border-box !important;
    }

    /* Ẩn cột sidebar trên mobile */
    .col-md-3.sidebar-filter-col {
        display: none !important;
    }

    /* Aside chuyển thành drawer trượt từ trái */
    .sidebar-filter-col aside {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 85% !important;
        max-width: 320px !important;
        height: 100vh !important;
        overflow-y: auto !important;
        background: #fff !important;
        z-index: 9999 !important;
        transform: translateX(-110%) !important;
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 4px 0 24px rgba(0,0,0,0.13) !important;
        padding: 16px 12px !important;
        display: block !important;
    }

    /* Khi mở: sidebar trượt vào */
    .sidebar-filter-col.filter-open aside {
        transform: translateX(0) !important;
    }

    /* Bật hiển thị col khi mở (để aside có context) */
    .sidebar-filter-col.filter-open {
        display: block !important;
        position: fixed !important;
        top: 0; left: 0;
        width: 100%; height: 100%;
        z-index: 9998;
    }

    /* Overlay tối phía sau drawer */
    .filter-drawer-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 9997;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    .filter-drawer-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Header trong drawer: tiêu đề + nút đóng */
    .filter-drawer-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 16px;
        padding-bottom: 12px;
        border-bottom: 2px solid #e2e8f0;
    }
    .filter-drawer-header-title {
        font-size: 16px;
        font-weight: 700;
        color: #1e293b;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .filter-drawer-close-btn {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: none;
        background: #f1f5f9;
        color: #64748b;
        font-size: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        line-height: 1;
        transition: all 0.2s;
    }
    .filter-drawer-close-btn:hover {
        background: #fee2e2;
        color: #dc2626;
    }

    /* Nút mũi tên đóng/mở nằm nổi ở giữa cạnh phải của Drawer bộ lọc trên mobile (gọn gàng, không bị che/cuộn) */
    .sidebar-filter-col.filter-open .filter-drawer-side-toggle {
        display: flex !important;
        position: fixed !important;
        top: 50% !important;
        left: min(85vw, 320px) !important;
        transform: translateY(-50%) !important;
        width: 28px !important;
        height: 46px !important;
        background: linear-gradient(135deg, #1a5740 0%, #27ae60 100%) !important;
        color: #ffffff !important;
        border: none !important;
        border-radius: 0 12px 12px 0 !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer !important;
        box-shadow: 3px 0 12px rgba(0, 0, 0, 0.22) !important;
        z-index: 10005 !important;
        font-size: 13px !important;
        padding: 0 !important;
        margin: 0 !important;
        outline: none !important;
        transition: all 0.2s ease !important;
    }

    .sidebar-filter-col.filter-open .filter-drawer-side-toggle:hover,
    .sidebar-filter-col.filter-open .filter-drawer-side-toggle:active {
        background: linear-gradient(135deg, #15462f 0%, #1a8f4c 100%) !important;
        width: 32px !important;
    }

    /* Nút bộ lọc sticky dưới màn hình */
    .mobile-filter-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 8px;
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 9990;
        background: linear-gradient(135deg, #1a5740 0%, #27ae60 100%);
        color: #fff !important;
        font-size: 14px;
        font-weight: 700;
        padding: 12px 28px;
        border-radius: 50px;
        border: none;
        box-shadow: 0 6px 20px rgba(26, 87, 64, 0.4);
        cursor: pointer;
        text-decoration: none !important;
        letter-spacing: 0.3px;
        transition: all 0.25s ease;
        animation: btn-bounce 2.5s ease-in-out infinite;
    }
    .mobile-filter-btn:hover,
    .mobile-filter-btn:active {
        background: linear-gradient(135deg, #15462f 0%, #1a8f4c 100%);
        box-shadow: 0 10px 28px rgba(26, 87, 64, 0.5);
        transform: translateX(-50%) translateY(-2px);
        color: #fff !important;
        text-decoration: none !important;
    }
    @keyframes btn-bounce {
        0%, 100% { transform: translateX(-50%) translateY(0); }
        50% { transform: translateX(-50%) translateY(-4px); }
    }

    /* col-md-9 chiếm full khi sidebar ẩn */
    .col-md-9.product-listing-col {
        width: 100% !important;
        float: none !important;
    }

    /* Thêm padding bottom cho CỘT DANH SÁCH SẢN PHẨM để tránh nút Bộ lọc sticky che sản phẩm cuối */
    .product-listing-col {
        padding-bottom: 70px !important;
    }
}
