.categories-section {
    position: relative;
}
.categories-section .swiper-container-wrapper {
    position: relative;
    margin: 0 -15px;
    padding: 0 15px;
}
.categories-section .categories-swiper {
    padding: 0;
    position: relative;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overflow: hidden;
}
.categories-section .swiper-slide {
    height: auto;
}

/* Сетка категорий - 2 ряда по 4 */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 15px;
    height: 100%;
    padding: 5px;
}

/* Карточка категории */
.categories-section .category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    background: #fff;
    transition: all 0.3s ease;
    color: #212529;
    text-align: center;
    min-height: 100px;
    position: relative;
    z-index: 1;
}
.categories-section .category-card:hover {
    background: #eff3f6;
    text-decoration: none;
}

/* Иконка категории */
.categories-section .category-icon {
    font-size: 24px;
    margin-bottom: 8px;
    color: #6c757d;
}
.categories-section .category-icon i {
    display: block;
}

/* Название категории */
.categories-section .category-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
}

/* Переопределяем стили Swiper для кнопок */
.categories-section .swiper-container-wrapper .swiper-button-next,
.categories-section .swiper-container-wrapper .swiper-button-prev {
    color: #6c757d;
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    position: absolute;
    top: 50% !important;
    transform: translateY(-50%);
    z-index: 10;
    margin-top: 0 !important;
}

/* Убираем стандартные отступы Swiper */
.categories-section .swiper-horizontal .swiper-container-wrapper .swiper-button-next,
.categories-section .swiper-horizontal .swiper-container-wrapper .swiper-button-prev,
.categories-section .swiper-horizontal ~ .swiper-container-wrapper .swiper-button-next,
.categories-section .swiper-horizontal ~ .swiper-container-wrapper .swiper-button-prev {
    margin-top: 0 !important;
    top: 50% !important;
}

.categories-section .swiper-container-wrapper .swiper-button-next:hover,
.categories-section .swiper-container-wrapper .swiper-button-prev:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.categories-section .swiper-container-wrapper .swiper-button-next:after,
.categories-section .swiper-container-wrapper .swiper-button-prev:after {
    font-size: 16px;
    font-weight: bold;
}

.categories-section .swiper-container-wrapper .swiper-button-prev {
    left: 5px;
}

.categories-section .swiper-container-wrapper .swiper-button-next {
    right: 5px;
}

.categories-section .swiper-button-next, 
.categories-section .swiper-button-prev {
    svg {
        height: 50%;
        object-fit: contain;
        transform-origin: center;
        width: 50%;
        fill: currentColor;
        pointer-events: none;
    }
}

/* Стили для пагинации */
.categories-section .swiper-pagination {
    position: relative;
    bottom: 0;
    margin-top: 15px;
}
.categories-section .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #6c757d;
    opacity: 0.3;
}
.categories-section .swiper-pagination-bullet-active {
    opacity: 1;
    background: #6c757d;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .categories-section .swiper-container-wrapper .swiper-button-next,
    .categories-section .swiper-container-wrapper .swiper-button-prev {
        display: none;
    }
    
    .categories-section .swiper-container-wrapper {
        margin: 0;
        padding: 0;
        overflow: hidden; /* Важно: скрываем переполнение */
    }
    
    .categories-section .categories-swiper {
        overflow: hidden; /* Важно: скрываем переполнение */
        padding: 0; /* Добавляем отступы по бокам */
    }
    
    .categories-section .swiper-slide {
        padding-right: 0; /* Убираем отступ справа */
    }
    
    /* На мобильных - 2 ряда по 2 категории */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 12px;
        padding: 3px;
    }
    
    .categories-section .category-card {
        padding: 12px 8px;
        min-height: 90px;
    }
    
    .categories-section .category-icon {
        font-size: 20px;
        margin-bottom: 6px;
    }
    
    .categories-section .category-name {
        font-size: 11px;
    }
    
    /* Показываем пагинацию только на мобильных */
    .categories-section .swiper-pagination {
        display: block;
    }
}

/* Для десктопа скрываем пагинацию */
@media (min-width: 769px) {
    .categories-section .swiper-pagination {
        display: none;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .categories-grid {
        gap: 8px;
        padding: 2px;
    }
    
    .categories-section .category-card {
        padding: 10px 6px;
        min-height: 80px;
    }
    
    .categories-section .category-icon {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .categories-section .category-name {
        font-size: 10px;
    }
}