.category-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 1030;
    display: flex;
    align-items: stretch;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@media (max-width: 991.98px) {
    body:has(.sticky-bottom-nav) .category-page {
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
        height: auto;
    }

    body.categories-page > footer {
        display: none;
    }

    body.categories-page .desktop-header {
        display: none !important;
    }

    body.categories-page {
        overflow: hidden;
    }

    body.categories-page .sticky-bottom-nav {
        z-index: 2100;
    }
}

.category-page-content {
    background: #fff;
    width: 100%;
    max-width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.category-page-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 12px;
    height: 56px;
    padding: 8px 16px;
    background: #fff;
}

.category-page-header__back {
    display: flex;
    flex-shrink: 0;
    color: #171717;
    -webkit-tap-highlight-color: transparent;
}

.category-page-header__search {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 4px;
    height: 40px;
    padding: 8px 4px;
    border: 0;
    border-radius: 4px;
    background: #f5f5f5;
    color: #616161;
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.category-page-header__search svg {
    flex-shrink: 0;
}

.category-page-header__search-text {
    font-size: 12px;
    color: #9e9e9e;
}

.category-page-header__search-logo {
    display: block;
    width: 56px;
    height: auto;
}

@media (min-width: 992px) {
    .category-page {
        display: none;
    }
}

.category-page-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* چیدمان خانومی: ستون دسته‌های اصلی در راست، زیردسته‌ها به‌صورت ردیف‌های متنی */
.categories-browser {
    display: flex;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #fff;
}

.categories-sidebar {
    flex: 0 0 104px;
    width: 104px;
    display: flex;
    flex-direction: column;
    padding-bottom: 48px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.categories-sidebar::-webkit-scrollbar {
    display: none;
}

.categories-side-item {
    display: flex;
    flex: 0 0 96px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 104px;
    height: 96px;
    margin: 0;
    padding: 0 6px;
    border: 1px solid #eee;
    border-right: 0;
    border-bottom: 0;
    background: #fafafa;
    font: inherit;
    color: #171717;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.categories-side-item:first-child {
    border-top: 0;
}

.categories-side-item.is-active {
    border-color: transparent;
    background: #fff;
}

.categories-side-item.is-after-active {
    border-top-left-radius: 6px;
}

.categories-side-item.is-before-active {
    border-bottom-left-radius: 6px;
}

.categories-side-icon {
    display: block;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.categories-side-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.6;
    word-break: break-word;
}

.categories-body {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 8px 56px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.categories-body::-webkit-scrollbar {
    display: none;
}

.categories-main-panel {
    display: none;
    flex-direction: column;
}

.categories-main-panel.is-active {
    display: flex;
}

.categories-main-panel[hidden] {
    display: none !important;
}

.categories-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 10px 8px;
    border: 0;
    background: transparent;
    font: inherit;
    color: #171717;
    text-align: right;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.categories-row__label {
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 24px;
}

.categories-row__icon {
    flex-shrink: 0;
    transition: transform .2s ease;
}

.categories-row--all {
    color: var(--primary-color, #ef4056);
}

.categories-group-toggle[aria-expanded="true"] .categories-row__icon {
    transform: rotate(180deg);
}

.categories-leaves {
    display: flex;
    flex-direction: column;
}

.categories-leaves[hidden] {
    display: none;
}

.categories-leaf {
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.7;
    color: #81858b;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.categories-leaf--all {
    color: #171717;
}

@media (min-width: 768px) {
    .categories-body {
        padding-top: 0;
    }
}
