/* assets/css/category.css — Стили страницы категории (каталога), фильтров и сортировки */

/* Сетка каталога */
.catalog-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-top: 1.5rem;
    padding-bottom: 3rem;
    overflow-x: visible;
}

@media (min-width: 1024px) {
    .catalog-layout {
        grid-template-columns: 18rem 1fr;
        /* Колонка фильтров слева */
    }
}

/* Боковая панель фильтров */
.filters-sidebar {
    background-color: #FFFFFF;
    border: 1px solid var(--color-border-very-light);
    border-radius: var(--border-radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    height: fit-content;
}

/* Заголовки и группы фильтра */
.filters-title {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--color-text-dark);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-b: 1px solid var(--color-border-very-light);
}

.filter-group {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border-very-light);
    padding-bottom: 1.25rem;
}

.filter-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.filter-group-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-light);
    margin-bottom: 0.75rem;
}

/* Фильтр цены */
.price-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.price-inputs input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background-color: var(--color-bg-main);
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius-md);
    font-size: 0.875rem;
    color: var(--color-text-dark);
    text-align: center;
}

.price-inputs input:focus {
    outline: none;
    border-color: var(--color-ozon-blue);
    background-color: #FFFFFF;
}

.price-divider {
    color: var(--color-text-light);
    font-weight: 500;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    max-height: 12rem;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.checkbox-list::-webkit-scrollbar {
    width: 4px;
}

.checkbox-list::-webkit-scrollbar-thumb {
    background: var(--color-border-light);
    border-radius: 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-slate);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--color-ozon-blue);
    cursor: pointer;
}

/* Сортировка и заголовок */
.catalog-content-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .catalog-content-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.category-title-info h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-text-dark);
}

.category-title-info p {
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-top: 0.125rem;
}

/* Сортировщик */
.sorter-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sorter-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    background-color: #FFFFFF;
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius-lg);
    font-size: 0.875rem;
    color: var(--color-text-slate);
    cursor: pointer;
    font-weight: 500;
    outline: none;
    transition: all 0.15s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

.sorter-select:focus {
    border-color: var(--color-ozon-blue);
}

/* Мобильная кнопка фильтра */
.btn-mobile-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #FFFFFF;
    border: 1px solid var(--color-border-light);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-slate);
    cursor: pointer;
}

@media (min-width: 1024px) {
    .btn-mobile-filter {
        display: none;
    }
}

/* Сетка карточек товаров */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Карточка товара (Marketplace Ozon style) */
.product-card {
    background-color: #FFFFFF;
    border: 1px solid var(--color-border-very-light);
    border-radius: var(--border-radius-xl);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.2s ease;
}

.product-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--color-border-light);
    transform: translateY(-2px);
}

/* Верхняя часть (Фото и бейджи) */
.product-card-top {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    background-color: var(--color-bg-main);
    margin-bottom: 0.75rem;
}

.product-card-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card-badges {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Кнопка избранного */
.btn-fav {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    width: 2rem;
    height: 2rem;
    border-radius: var(--border-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-light);
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.btn-fav:hover {
    color: var(--color-ozon-magenta);
    transform: scale(1.1);
}

.btn-fav.active {
    color: var(--color-ozon-magenta);
    background-color: #FFFFFF;
}

/* Описание карточки */
.product-card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Цены Ozon-стиль */
.product-card-prices {
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-bottom: 0.375rem;
}

.price-main {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--color-ozon-magenta);
}

.price-old {
    font-size: 0.75rem;
    color: var(--color-text-light);
    text-decoration: line-through;
}

/* Рейтинг */
.product-card-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #FBBF24;
    /* Золотой */
    margin-bottom: 0.375rem;
}

.product-card-rating span {
    color: var(--color-text-light);
    font-weight: 400;
}

/* Название */
.product-card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-slate);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.25rem;
}

.product-card-title:hover {
    color: var(--color-ozon-blue);
}

/* Кнопка Быстрой покупки */
.product-card-bottom {
    margin-top: auto;
}

.product-card-bottom .btn {
    width: 100%;
    font-size: 0.75rem;
    padding: 0.5rem;
}

/* Боковая мобильная шторка фильтров */
.mobile-filter-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 85vw;
    max-width: 20rem;
    background-color: #FFFFFF;
    box-shadow: var(--shadow-xl);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.mobile-filter-drawer.active {
    transform: translateX(0);
}

.mobile-filter-header {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border-very-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--color-bg-main);
}

.mobile-filter-body {
    overflow-y: auto;
    padding: 1rem;
}

.mobile-filter-footer {
    padding: 1rem;
    border-top: 1px solid var(--color-border-very-light);
}

.mobile-filter-footer .btn {
    width: 45%;
}

@media (min-width: 1024px) {
    .mobile-filter-drawer {
        position: static !important;
        transform: none !important;
        width: auto !important;
        height: auto !important;
        box-shadow: var(--shadow-sm) !important;
        border: 1px solid var(--color-border-very-light) !important;
        border-radius: var(--border-radius-xl) !important;
        background-color: #FFFFFF !important;
        z-index: 1 !important;
        display: flex !important;
        padding: 1.5rem !important;
    }

    .mobile-filter-header {
        display: none !important;
    }

    .mobile-filter-body {
        overflow: visible !important;
        padding: 0 !important;
    }

    .mobile-filter-footer {
        padding: 0 !important;
        border-top: none !important;
        margin-top: 1.5rem;
    }
}

/* ==========================================================================
   Подкатегории на странице категории (Сетка и Слайдер)
   ========================================================================== */
.subcategory-section {
    margin-bottom: 2.25rem;
    margin-top: 0.5rem;
}

.subcategory-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 640px) {
    .subcategory-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .subcategory-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.subcategory-scroll-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.subcategory-scroll-container::-webkit-scrollbar {
    height: 6px;
}

.subcategory-scroll-container::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 3px;
}

.subcategory-scroll-container::-webkit-scrollbar-thumb {
    background: var(--color-border-light);
    border-radius: 3px;
}

.subcategory-card {
    background: #FFFFFF;
    border: 1px solid var(--color-border-very-light);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.subcategory-scroll-container .subcategory-card {
    flex: 0 0 13rem;
    /* Фиксированная ширина в карусели */
}

@media (min-width: 640px) {
    .subcategory-scroll-container .subcategory-card {
        flex: 0 0 15rem;
    }
}

.subcategory-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-ozon-blue);
}

.subcategory-card-img-box {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background-color: var(--color-bg-main);
    border-bottom: 1px solid var(--color-border-very-light);
    position: relative;
}

.subcategory-card-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.subcategory-card:hover .subcategory-card-img-box img {
    transform: scale(1.04);
}

.subcategory-card-body {
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-grow: 1;
    min-height: 3.25rem;
}

.subcategory-card-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-text-dark);
    line-height: 1.35;
    transition: color 0.2s ease;
}

.subcategory-card:hover .subcategory-card-title {
    color: var(--color-ozon-blue);
}

/* ==========================================================================
   Улучшения карусели подкатегорий (Стрелки навигации и Градиенты)
   ========================================================================== */
.subcategory-carousel-wrapper {
    position: relative;
    width: 100%;
}

/* Градиентные маски по бокам */
.carousel-fade-left,
.carousel-fade-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3.5rem;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.3s ease;
    opacity: 1;
}

.carousel-fade-left {
    left: 0;
    background: linear-gradient(to right, var(--color-bg-main) 0%, transparent 100%);
}

.carousel-fade-right {
    right: 0;
    background: linear-gradient(to left, var(--color-bg-main) 0%, transparent 100%);
}

/* Кнопки-стрелки навигации */
.subcat-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: #FFFFFF;
    border: 1px solid var(--color-border-very-light);
    color: var(--color-text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease-in-out;
}

.subcat-arrow:hover {
    background-color: var(--color-ozon-blue);
    border-color: var(--color-ozon-blue);
    color: #FFFFFF;
    transform: translateY(-50%) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.subcat-arrow-left {
    left: -1.25rem;
}

.subcat-arrow-right {
    right: -1.25rem;
}

.subcat-arrow i {
    font-size: 1.25rem;
}

/* Состояния скрытия для стрелок и градиентов */
.subcat-arrow.hidden-arrow,
.carousel-fade-left.hidden-fade,
.carousel-fade-right.hidden-fade {
    opacity: 0;
    pointer-events: none;
}

/* Адаптивность для мобильных: скрываем стрелки */
@media (max-width: 768px) {
    .subcat-arrow {
        display: none !important;
    }

    .carousel-fade-left,
    .carousel-fade-right {
        width: 1.5rem;
        /* Уменьшаем ширину маски на мобильных */
    }
}

/* ==========================================================================
   Главная витрина категорий (в стиле Ozon-бабблов)
   ========================================================================== */
.root-categories-showcase {
    margin-bottom: 2.5rem;
    margin-top: 0.5rem;
}

.bubbles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    justify-items: center;
}

@media (min-width: 640px) {
    .bubbles-grid {
        gap: 1.5rem;
    }
}

.bubble-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    width: 100%;
    text-align: center;
    transition: transform 0.2s ease-in-out;
}

@media (min-width: 768px) {
    .bubble-card {
        gap: 0.75rem;
    }
}

.bubble-card:hover {
    transform: translateY(-4px);
}

.bubble-img-wrapper {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: var(--color-border-very-light);
    /* #F1F5F9 */
    border: 2px solid var(--color-border-very-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

@media (min-width: 640px) {
    .bubble-img-wrapper {
        width: 90px;
        height: 90px;
    }
}

@media (min-width: 1024px) {
    .bubble-img-wrapper {
        width: 110px;
        height: 110px;
    }
}

.bubble-card:hover .bubble-img-wrapper {
    border-color: var(--color-ozon-blue);
    box-shadow: 0 4px 12px rgba(0, 91, 255, 0.15);
}

.bubble-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease-in-out;
}

.bubble-card:hover .bubble-img-wrapper img {
    transform: scale(1.08);
}

.bubble-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-dark);
    line-height: 1.25;
    transition: color 0.2s ease-in-out;
    max-width: 90px;
}

@media (min-width: 640px) {
    .bubble-title {
        font-size: 0.8125rem;
        max-width: 120px;
    }
}

@media (min-width: 1024px) {
    .bubble-title {
        font-size: 0.9375rem;
        max-width: 150px;
    }
}

.bubble-card:hover .bubble-title {
    color: var(--color-ozon-blue);
}