/* Category Sidebar */
.category-sidebar {
    width: 250px;
    min-width: 250px;
    position: sticky;
    top: 100px;
    height: calc(100vh - 150px);
    overflow-y: auto;
    padding: 25px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    z-index: 10;
}

/* Стили скроллбара для всех случаев */
.category-sidebar::-webkit-scrollbar {
    width: 8px;
}

.category-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.category-sidebar::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

.category-sidebar::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* Скрываем скроллбар в десктопной версии */
@media (min-width: 1025px) {
    .category-sidebar {
        scrollbar-width: none;
    }

    .category-sidebar::-webkit-scrollbar {
        display: none;
    }
}

/* Индикатор прокрутки для десктопной версии */
@media (min-width: 1025px) {
    .scroll-indicator {
        position: sticky;
        bottom: 20px;
        left: 0;
        right: 0;
        display: flex;
        visibility: var(--scroll-indicator, visible);
        color: var(--secondary);
        font-size: 16px;
        opacity: 0.7;
        animation: bounceArrow 2s infinite;
        z-index: 11;
        cursor: pointer;
        justify-content: center;
        align-items: center;
    }
}

/* Анимация для стрелки */
@keyframes bounceArrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

.category-heading {
    color: var(--secondary);
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary);
    position: relative;
}

.category-heading:after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 50px;
    height: 2px;
    background: var(--primary);
}

.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-item {
    margin-bottom: 12px;
}

.category-button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 15px;
    border: none;
    background: var(--light);
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-medium);
    color: var(--text-dark);
    position: relative;
    overflow: hidden;
}

.category-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: all 0.5s;
}

.category-button:hover:before {
    left: 100%;
}

.category-button:hover {
    background: #f0f0f0;
    transform: translateX(5px);
    box-shadow: var(--shadow-sm);
}

.category-button.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(255, 90, 0, 0.3);
    /* Добавляем плавную анимацию для автоматического переключения */
    transition: all 0.3s ease-in-out;
}

.category-button.active:hover {
    transform: translateX(5px) translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 90, 0, 0.4);
}

/* Плавная анимация для автоматически активируемых кнопок */
.category-button.auto-activated {
    animation: categoryHighlight 0.5s ease-in-out;
}

@keyframes categoryHighlight {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* Category Arrows for Mobile */
.category-arrows {
    display: none;
    position: absolute;
    top: 50%;
    width: 100%;
    transform: translateY(-50%);
    z-index: 11;
    padding: 0 2px;
}

.category-arrow {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    color: var(--secondary);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-medium);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-arrow:hover {
    color: var(--primary);
    transform: scale(1.2);
}

.category-arrow.left {
    left: 2px;
}

.category-arrow.right {
    right: 2px;
}

.category-arrow i {
    font-size: 18px;
}

/* Responsive for Categories */
@media (max-width: 1024px) {
    .category-sidebar {
        position: sticky;
        top: 70px;
        width: 100%;
        height: auto;
        margin-bottom: 20px;
        z-index: 900;
        background: white;
        padding: var(--spacing-sm);
        border-radius: 0;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        overflow: hidden;
    }

    .category-list {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 10px;
        padding-left: 32px;
        padding-right: 32px;
        scrollbar-width: none;
        -ms-overflow-style: none;
        white-space: nowrap;
        box-sizing: border-box;
        /* Плавный скролл для мобильной версии */
        scroll-behavior: smooth;
    }

    .category-list::-webkit-scrollbar {
        display: none;
    }

    .category-item {
        flex: 0 0 auto;
        margin-bottom: 0;
    }

    .category-button {
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
        min-width: auto;
        flex-shrink: 0;
        max-width: 120px;
        text-overflow: ellipsis;
        overflow: hidden;
        /* Улучшенная анимация для мобильной версии */
        transition: all 0.3s ease-in-out;
    }

    .category-button.active {
        /* Более заметное выделение на мобильных */
        transform: scale(1.05);
        box-shadow: 0 2px 8px rgba(255, 90, 0, 0.4);
    }

    .category-arrows {
        display: flex;
    }

    .scroll-indicator {
        display: none;
    }
}

@media (max-width: 768px) {
    .category-sidebar {
        top: 20px;
        padding: 10px;
    }

    .category-list {
        gap: 6px;
        padding-left: 28px;
        padding-right: 28px;
    }

    .category-button {
        padding: 6px 10px;
        font-size: 12px;
        max-width: 100px;
    }

    .category-arrow {
        width: 24px;
        height: 24px;
    }

    .category-arrow.left {
        left: 4px;
    }

    .category-arrow.right {
        right: 24px;
    }

    .category-arrow i {
        font-size: 16px;
    }
}
