﻿/* --- BREADCRUMBS --- */
.breadcrumbs {
    padding: 24px 0 32px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crumb-link {
    color: var(--b500);
    text-decoration: none;
    transition: color 0.2s ease;
}

@media (hover: hover) {
    .crumb-link:hover {
        color: var(--p700);
    }
}

.crumb-sep {
    color: var(--b400);
}

.crumb-current {
    font-weight: 600;
    color: var(--b700);
}

/* --- LAYOUT (Grid вместо Flex) --- */
.products-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 40px;
    padding-bottom: 80px;
}

/* --- FILTERS SIDEBAR --- */
.products-sidebar {
    position: sticky;
    align-self: start;
    top: calc(var(--header-height) + 24px);
    max-height: calc(100vh - var(--header-height) - 48px);
    overflow-y: auto;
    scrollbar-width: none;
}

    .products-sidebar::-webkit-scrollbar {
        display: none;
    }

.products-main {
    width: 100%;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--b700);
    margin-bottom: 0;
}

/* --- FILTERS SIDEBAR ACCORDION --- */
.filter-group {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--b200);
    padding-bottom: 24px;
}

button.filter-header {
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 16px;
}

.filter-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--b700);
}

.filter-chevron {
    width: 20px;
    height: 20px;
    color: var(--b500);
    transition: transform 0.3s ease;
}

.filter-group.open .filter-chevron {
    transform: rotate(180deg);
}

.filter-body {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.filter-group.open .filter-body {
    display: flex;
}

/* --- CUSTOM CHECKBOXES --- */
.custom-control {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    position: relative;
    z-index: 2;
}

    .custom-control input {
        position: absolute;
        opacity: 0;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

        /* Здесь focus-visible уместен, так как срабатывает только при навигации с клавиатуры */
        .custom-control input:focus-visible ~ .control-indicator {
            outline: 2px solid var(--p700);
            outline-offset: 2px;
        }

.control-indicator {
    width: 20px;
    height: 20px;
    border: 1px solid var(--b400);
    border-radius: 4px;
    background-color: #fff;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.control-label {
    font-size: 14px;
    color: var(--b600);
}

.custom-control input:checked ~ .control-indicator {
    background-color: var(--p700);
    border-color: var(--p700);
}

    .custom-control input:checked ~ .control-indicator::after {
        content: '';
        width: 5px;
        height: 10px;
        border: solid white;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg);
        margin-bottom: 2px;
    }

@media (hover: hover) {
    .custom-control:hover .control-indicator {
        border-color: var(--p700);
    }
}

/* --- SIDEBAR ACTIONS --- */
.sidebar-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

    .sidebar-actions .btn,
    .sidebar-actions .btn-clear-filters {
        flex: 1;
        display: inline-flex;
        justify-content: center;
        align-items: center;
    }

.btn-clear-filters {
    background-color: var(--b200);
    color: var(--b700);
    padding: 10px;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
    gap: 8px;
    text-decoration: none;
}

@media (hover: hover) {
    .btn-clear-filters:hover {
        background-color: var(--error);
        color: white;
    }
}

/* --- PRODUCTS GRID (Резиновая сетка) --- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 40px;
}

.products-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px;
    color: var(--b600);
    font-size: 16px;
    background-color: var(--b200);
    border-radius: var(--radius-btn);
}

/* --- CATALOG CARD --- */
.catalog-card {
    position: relative; /* Важно для Stretched Link */
    display: flex;
    flex-direction: column;
    text-align: left;
    height: 100%;
    outline: none;
    transition: box-shadow 0.2s ease;
    /* ИСПРАВЛЕНО: Убран синий бордер (focus-within) и hover-эффект подъема */
}

.c-img-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    /*background-color: var(--b200);*/
    border-radius: var(--radius-btn);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.c-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
}

.c-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.c-meta {
    font-size: 12px;
    font-weight: 700;
    color: var(--b700);
    margin-bottom: 4px;
    line-height: 1.5;
}

.c-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--b700);
    line-height: 1.4;
    margin-bottom: 8px;
    display: block;
}

/* Растягиваем ссылку внутри заголовка на всю карточку */
.c-title-link {
    color: inherit;
    text-decoration: none;
}

    .c-title-link::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 1; /* Растягивает кликабельную зону */
    }

.c-desc {
    font-size: 14px;
    color: var(--b500);
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.5;
}

.c-footer {
    margin-top: auto; /* Прижимает футер к нижнему краю */
    display: flex;
    align-items: center;
}

.c-link {
    font-size: 16px;
    font-weight: 600;
    color: var(--b700);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    position: relative;
    z-index: 2; /* Оставляем поверх невидимой ссылки */
    pointer-events: none; /* Пропускаем клик мыши насквозь! */
}

    .c-link svg {
        transition: transform 0.2s ease;
    }

/* Подсветка текста ссылки при наведении на всю карточку */
@media (hover: hover) {
    .catalog-card:hover .c-link {
        color: var(--p700);
    }

        .catalog-card:hover .c-link svg {
            transform: translateX(4px); /* Легкий сдвиг стрелочки вправо */
        }
}

/* --- MOBILE SPECIFIC ELEMENTS --- */
.page-header-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.btn-filter-mobile {
    display: none;
    color: var(--b700);
}

.c-arrow-mobile {
    display: none;
    pointer-events: none; /* Тоже пропускает клик */
}

.sidebar-mobile-header {
    display: none;
}

/* --- АДАПТИВ (Планшеты и Мобильные) --- */
@media (max-width: 992px) {
    .products-layout {
        display: flex;
        flex-direction: column;
        padding-bottom: 40px;
    }

    .btn-filter-mobile {
        display: block;
    }

    .products-grid {
        gap: 24px;
    }

    /* Смена ориентации карточки */
    .catalog-card {
        flex-direction: row;
        align-items: center;
    }

    .c-img-wrapper {
        width: 90px;
        height: 90px;
        flex-shrink: 0;
        margin-bottom: 0;
    }

    .c-info {
        justify-content: center;
        gap: 4px;
        padding: 0 16px;
    }

    .c-meta {
        margin-bottom: 0;
    }

    .c-title {
        font-size: 16px;
        line-height: 1.3;
        margin-bottom: 0;
    }

    .c-desc {
        font-size: 12px;
        margin-bottom: 0;
    }

    .c-footer {
        display: none; /* Скрываем текстовую ссылку "View product" на мобильных */
    }

    .c-arrow-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--b700);
        width: 24px;
        height: 24px;
        flex-shrink: 0;
    }

    /* Мобильный сайдбар */
    .products-sidebar {
        display: block;
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        max-width: 320px;
        height: 100dvh;
        background-color: #fff;
        z-index: 2000;
        padding: 24px;
        overflow-y: auto;
        transition: right 0.3s ease-in-out;
        box-shadow: -4px 0 15px rgba(0,0,0,0.1);
    }

        .products-sidebar.active {
            right: 0;
        }

    .sidebar-mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 32px;
        padding-bottom: 16px;
        border-bottom: 1px solid var(--b200);
    }
}
