/* ===== Pill strip base ===== */
.pill-strip-wrapper {
    overflow-x: hidden;
}

.pill-strip {
    display: flex;
    align-items: center;
    gap: .5rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: .25rem;
    white-space: nowrap;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;

    transition: all .3s ease;
    /* mobile vuốt mượt */

    /* Desktop mặc định ẩn scrollbar */
    scrollbar-width: none;
    /* Firefox: thin, không none */
    -ms-overflow-style: auto;
    /* IE/Edge */
}

/* ===== Chrome, Safari, Edge ===== */
.pill-strip::-webkit-scrollbar {
    height: 4px;
    background: transparent;

    transition: all 0.3s ease;
    /* anim mượt */
}

.pill-strip::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0);
    /* ban đầu trong suốt */
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

*/ .pill-strip:hover::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    /* màu lợt khi hover */
    /* thumb hover */
}

.pill-strip::-webkit-scrollbar-track {
    background-color: rgba(0, 0, 0, 0.05);
    /* màu nhạt track */
    border-radius: 3px;
}

/* Firefox hover */
.pill-strip:hover {
    scrollbar-color: rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.05);
    scrollbar-width: thin;
    /* thumb / track */
}

/* ===== Mobile hide scrollbar ===== */
@media (max-width: 768px) {
    .pill-strip.hide-scrollbar {
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE/Edge */
    }

    .pill-strip.hide-scrollbar::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari/Android */
    }
}

/* ===== Drag scroll ===== */
.pill-strip.drag-scroll {
    cursor: grab;
}

.pill-strip.drag-scroll:active {
    cursor: grabbing;
}

/* ===== Container ===== */
.category-stripold {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.5rem;

    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.category-strip {
    display: flex;
    /* Chuyển lại thành Flexbox trên Desktop */
    flex-wrap: wrap;
    overflow-x: visible;
    justify-content: flex-start;
}

/* ===== Card cơ bản ===== */
.category-card {
    flex: 0 0 calc((100% - 1rem) / 8);
    /* 8 item, 7 gap */
    max-width: calc((100% - 1rem) / 8);
    text-align: center;
    padding: 0.25rem;
    min-height: 95px;
    transition: all .3s ease;
}

.category-card p {
    font-size: 0.9rem;
    font-weight: 500;
    /* 1. Bỏ margin-top: auto để nó không bị đẩy xuống đáy */
    margin-top: 8px;
    margin-bottom: 0;

    /* 2. Cố định chiều cao cho 2 dòng chữ */
    /* Giúp card 1 dòng và 2 dòng có tổng chiều cao bằng nhau */
    min-height: 2.1rem;
    line-height: 1.2;

    /* 3. Đảm bảo chữ luôn bắt đầu từ phía trên */
    display: flex;
    align-items: flex-start;
    /* Ưu tiên nội dung nằm ở trên cùng của vùng p */
    justify-content: center;

    /* 4. Tùy chọn: Giới hạn tối đa 2 dòng (nếu chữ quá dài) */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Thêm phần này để xử lý khoảng trống nhỏ dưới chân hình ảnh */
.category-card img {
    display: block;
    margin: 0 auto;
    /* Căn giữa hình nếu cần */
}


.category-card i {
    margin-top: 0.5rem;
    font-size: 25px;
}

.category-card:hover i {
    transform: scale(1.2);
}

.category-card a {
    color: black;
    text-decoration: none;

    display: flex;
    flex-direction: column;
    align-items: center;
    /* center ngang */
    justify-content: space-between;
    height: 100%;
    text-align: center;
}

.category-card a:hover {
    color: black;
    text-decoration: none;
}

/* 
/* Cho tablet */
/* @media (max-width: 992px) {} */

/* Cho mobile */
@media (max-width: 576px) {
    .category-card {
        font-weight: 600;
        padding: 0.15rem;
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
    }
}

.category-card:hover {
    transform: translateY(-4px);
    /* box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); */
}

/* ===== Tablet: 4 cột ===== */
@media (max-width: 992px) {
    .category-card {
        flex: 0 0 calc(25% - 0.75rem);
        max-width: calc(25% - 0.75rem);
    }
}

/* ===== Mobile: scroll ngang, 2 hàng ===== */
@media (max-width: 768px) {
    .category-stripold {
        display: grid;
        /* dùng grid để xuống 2 hàng trong khối scroll */
        grid-auto-flow: column;
        /* cuộn ngang */
        grid-template-rows: repeat(2, 1fr);
        /* 2 hàng */
        grid-auto-columns: 18vw;
        /* mỗi card chiếm khoảng 20% chiều ngang */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
        padding-bottom: 0.5rem;

    }

    .category-strip {
        display: grid;
        grid-template-rows: auto auto;
        /* Ép cứng 2 hàng */
        /* Chia làm 8 cột (vì 16 items / 2). minmax giúp các thẻ không bị bóp méo */
        grid-template-columns: repeat(8, minmax(71px, 1fr));
        gap: 5px;
        /* Khoảng cách giữa các icon */
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Ẩn scrollbar Firefox */
    }

    .category-card {
        width: 100%;
        max-width: none;
        white-space: break-spaces;
    }

    .category-card img {
        width: 60px;
    }

    .category-card p {
        font-size: 0.8rem !important;
        /* ~12px */
        line-height: 1.2;
    }
}