.category-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e5ea;
    overflow-wrap: anywhere;
}

.category-heading p {
    color: #596579;
    font-size: 14px;
}

.category-results,
.category-page .product-card {
    min-width: 0;
}

.category-toolbar,
.category-views,
.category-selected,
.category-brands {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-views { margin-left: auto; }
.category-filter-toggle { display: none; }

.category-sort-form {
    position: relative;
    min-width: 200px;
}

.category-sort-form select,
.category-filter-toggle,
.category-brands button {
    min-height: 44px;
    border: 1px solid #d9dfe6;
    border-radius: 10px;
    background: white;
    color: #172033;
    font-size: 14px;
    cursor: pointer;
}

.category-sort-form select {
    appearance: none;
    width: 100%;
    padding: 0 32px 0 12px;
}

.category-sort-form > i {
    position: absolute;
    right: 12px;
    top: 14px;
    font-size: 16px;
    pointer-events: none;
}

.category-selected {
    flex-wrap: wrap;
    min-width: 0;
}

.category-selected button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    min-height: 36px;
    max-width: 100%;
    border-radius: 18px;
    background: #fff1f0;
    color: #ab231a;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.category-selected [data-category-filter-clear] {
    background: transparent;
    text-decoration: underline;
}

.category-brands { margin-top: 12px; }
.category-brands .swiper { flex: 1; min-width: 0; }
.category-brands .swiper:not(.swiper-initialized) { overflow-x: auto; }
.category-brands .swiper:not(.swiper-initialized) .swiper-wrapper { gap: 8px; }

.category-brands > button {
    width: 44px;
    font-size: 19px;
}

.category-brands > button:disabled { color: #98a2b3; }
.category-brands .swiper-button-lock { display: none; }

.category-brands .swiper-slide {
    display: grid;
    place-items: center;
    width: 104px;
    height: 48px;
    padding: 4px 10px;
    overflow: hidden;
    overflow-wrap: anywhere;
    line-height: 18px;
}

.category-brands img {
    width: 100%;
    height: 34px;
    object-fit: contain;
}

.category-brands [aria-pressed="true"] {
    border-color: #dc362e;
    box-shadow: inset 0 0 0 1px #dc362e;
}

.category-page :is(button, select, a):focus-visible,
#category-filters :focus-visible {
    outline: 2px solid #b42318;
    outline-offset: -2px;
}

.category-empty {
    margin: 24px 0;
    padding: 36px 16px;
    background: white;
    border-radius: 12px;
    text-align: center;
}

.category-empty h2 { font-weight: 600; margin-bottom: 12px; }

#category-filters {
    width: min(92vw, 400px);
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    background: white;
    color: #172033;
}

#category-filters::backdrop { background: rgb(15 23 42 / 40%); }
body:has(#category-filters[open]) { overflow: hidden; }

.category-filter-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.category-filter-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 8px 20px;
    border-bottom: 1px solid #e2e5ea;
}

.category-filter-heading h2 {
    margin-right: auto;
    font-weight: 600;
}

.category-filter-heading button { min-width: 44px; min-height: 44px; }
.category-filter-heading i { font-size: 22px; }
.category-filter-heading [data-category-filter-clear] { color: #b42318; font-size: 13px; }

.category-filter-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 8px calc(16px + env(safe-area-inset-bottom));
}

.category-tree > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 0 12px 0 8px;
    font-weight: 600;
    cursor: pointer;
}

.category-tree > summary::-webkit-details-marker { display: none; }
.category-tree[open] > summary i { transform: rotate(180deg); }

.category-page .grid-layout .product-card {
    display: flex;
    flex-direction: column;
}

.category-page .grid-layout .product-content { flex: 1; }
.category-page .product-prices { align-items: baseline !important; }
.category-page .product-prices p { overflow-wrap: anywhere; }
.category-page .category-installment { order: 2; }

.category-page .sale_text {
    white-space: normal;
    line-height: 18px;
    margin-bottom: 4px;
}

.category-page .sale_text > span { display: inline-block; }

@media (max-width: 1024px) {
    .max-container.category-page { padding-inline: 14px !important; }

    .category-heading {
        margin: 18px 0 14px;
        padding: 0;
        border: 0;
    }

    .category-heading h1 {
        font-size: 24px !important;
        line-height: 1.25 !important;
    }

    .category-heading p { font-size: 13px; }

    .category-toolbar {
        display: grid;
        grid-template-columns: minmax(96px, 2fr) minmax(170px, 3fr);
        gap: 10px;
    }

    .category-views,
    .category-brands > button { display: none; }

    .category-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        font-weight: 600;
    }

    .category-filter-toggle i { font-size: 19px; }

    .category-filter-toggle span {
        padding: 1px 6px;
        border-radius: 12px;
        background: #dc362e;
        color: white;
        font-size: 12px;
    }

    .category-sort-form { min-width: 0; }
    .category-selected { grid-column: 1 / -1; grid-row: 2; }
    .category-brands .swiper-slide { width: 82px; height: 44px; font-size: 12px; }
    .category-brands img { height: 30px; }

    .category-page .grid-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px !important;
        margin-top: 16px !important;
    }

    .category-page .grid-layout .product-card {
        border-radius: 12px;
        overflow: hidden;
    }

    .category-page .grid-layout .product-image {
        display: grid;
        grid-template-rows: minmax(26px, auto) auto;
        padding: 8px 12px 18px;
        border-bottom: 0;
    }

    .category-page .product-image > a { grid-row: 2; }
    .category-page .product-image .brand-logo { display: none; }

    .category-page .product-image .badge {
        position: static;
        grid-row: 1;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 3px;
        margin: 0 36px 2px -4px;
        pointer-events: none;
    }

    .category-page .badge span {
        padding: 3px 6px;
        border-radius: 5px;
        font-size: 12px;
        line-height: 16px;
    }

    .category-page .grid-layout .product-tools {
        inset: 0;
        pointer-events: none;
    }

    .category-page .product-tools button {
        position: absolute;
        right: 6px;
        width: 44px;
        height: 44px;
        margin: 0 !important;
        pointer-events: auto;
    }

    .category-page .product-tools .btn-like {
        top: 2px;
        right: 2px;
        border: 0;
        background: rgb(255 255 255 / 92%);
    }

    .category-page .btn-like.liked { color: white; }
    .category-page .product-tools .buy_btn { bottom: -24px; }

    .category-page .product-card:has(.sale_text) .product-image { padding-bottom: 32px; }
    .category-page .product-card:has(.sale_text) .buy_btn { bottom: 0; }
    .category-page .product-content .truncate:has(.sale_text) { padding-right: 0; }
    .category-page .sale_text {
        text-align: center;
        letter-spacing: -0.2px;
    }

    .category-page .grid-layout .product-content {
        padding: 6px 12px 12px;
        gap: 9px;
    }

    .category-page .product-content .truncate {
        padding-right: 40px;
        color: #596579;
        font-size: 12px !important;
        line-height: 18px !important;
    }

    .category-page .product-category-label { min-height: 18px; }

    .category-page .product-content .line-clamp-2 {
        font-size: 15px !important;
        line-height: 21px !important;
        min-height: 42px;
        margin: 3px 0 0 !important;
        overflow-wrap: anywhere;
    }

    .category-page .product-prices p {
        font-size: 17px !important;
        line-height: 23px !important;
        font-weight: 700;
    }

    .category-page .product-prices .line-through {
        color: #637083;
        font-size: 12px !important;
        line-height: 18px !important;
        font-weight: 400;
    }

    .category-page .product-pricing .btn {
        min-height: 44px;
        padding-inline: 6px;
        white-space: normal;
    }

    .category-selected button { min-height: 44px; }
}

@media (min-width: 600px) and (max-width: 1024px) {
    .category-page .grid-layout { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 840px) and (max-width: 1024px) {
    .category-page .grid-layout { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 359px) {
    .category-page .grid-layout { gap: 8px !important; }
    .category-page .grid-layout .product-content { padding-inline: 9px; }
    .category-page .product-prices p { font-size: 15px !important; }
    .category-sort-form select { font-size: 13px; padding-left: 8px; }
}
