#categories {
    position: relative;
    margin-bottom: 20px;
}

#categories .categories__viewport {
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 0;
    cursor: grab;
    touch-action: pan-x;
}

#categories .categories__viewport::-webkit-scrollbar {
    display: none;
}

#categories .categories__track {
    display: flex;
    gap: 10px;
}

#categories .cat-nav {
    position: absolute;
    top: 0;
    display: flex;
    z-index: 3;
    align-items: center;
    height: 100%;
    width: 60px;
}

#categories .cat-nav button {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #f5f5f5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    border: 0;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.22s ease;
    font: inherit;
    color: inherit;
}

#categories .cat-nav button:hover {
    background: #ececec;
}

#categories .cat-nav.is-hidden {
    display: none !important;
}

#categories .cat-nav.prev {
    left: 0;
    justify-content: flex-start;
    background: linear-gradient(90deg, rgba(255, 255, 255, 1) 30%, rgba(255, 255, 255, 0) 100%);
}

#categories .cat-nav.next {
    right: 0;
    justify-content: flex-end;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 70%);
}

#categories .cat-nav svg {
    width: 20px;
    height: 20px;
    display: block;
    flex-shrink: 0;
}

#categories a.category-card,
#categories .category-card {
    min-width: 150px;
    height: 65px;
    border-radius: 22px;
    background: #f5f5f5;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 2px 16px 2px 12px;
    flex: 0 0 auto;
    transition: transform 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
    border: 1px solid transparent;
    white-space: nowrap;
    text-decoration: none;
    color: #1f1f1f;
    cursor: pointer;
}

#categories a.category-card:hover,
#categories .category-card:hover {
    background: #ececec;
}

#categories a.category-card:hover .cat-img,
#categories .category-card:hover .cat-img {
    filter: brightness(0.95);
}

#categories .cat-img {
    width: 43px;
    height: 54px;
    max-width: 43px;
    border-radius: 12px;
    background: url('/static/images/category_placeholder.svg') center center no-repeat;
    flex: 0 0 54px;
    position: relative;
    overflow: hidden;
    display: block;
    background-size: contain;
    background-position: center;
    transition: all 0.22s ease;
}

#categories .cat-name {
    font-size: 16px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

@media (max-width: 640px) {
    #categories a.category-card,
    #categories .category-card {
        min-width: 120px;
        padding: 8px 12px;
        gap: 10px;
    }
    #categories .cat-img {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
    }
    #categories .cat-name {
        font-size: 14px;
    }
}

@media (max-width: 1024px) {
    #categories {
        display: none;
    }
}



