/**
 * ==========================================================================
 * catalog.css — Стили страницы «Каталог тканей»
 * ==========================================================================
 * Методология: Mobile First, BEM-like naming
 * Переменные: те же что в product.css и styles.css
 * ==========================================================================
 */

/* --- Переопределение global section padding --- */
.catalog-page section {
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* ==========================================================================
   Заголовок страницы
   ========================================================================== */
.catalog-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 20px;
}

/* ==========================================================================
   Основной layout (фильтр + контент)
   ========================================================================== */
.catalog-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

/* --- Кнопка открытия фильтра (видна только на мобильных) --- */
.filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #d4a574;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    align-self: flex-start;
}

.filter-toggle:hover {
    background: #c08c5a;
}

.filter-toggle__icon {
    font-size: 1.2rem;
}

/* ==========================================================================
   Панель фильтров
   ========================================================================== */
.catalog-filter {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.catalog-filter__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.catalog-filter__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

.catalog-filter__close {
    display: none; /* виден только на мобильных */
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

/* --- Группа фильтров --- */
.filter-group {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.filter-group:last-of-type {
    border-bottom: none;
    margin-bottom: 12px;
}

.filter-group__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group__options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- Чекбокс --- */
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
}

.filter-checkbox__input {
    width: 16px;
    height: 16px;
    accent-color: #d4a574;
    cursor: pointer;
    flex-shrink: 0;
}

.filter-checkbox__label {
    user-select: none;
}

.filter-checkbox:hover .filter-checkbox__label {
    color: #d4a574;
}

/* --- Кнопки фильтра --- */
.catalog-filter__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.btn--sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ==========================================================================
   Контент каталога
   ========================================================================== */
.catalog-content {
    flex: 1;
}

/* --- Счётчик --- */
.catalog-counter {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 16px;
}

.catalog-counter span:first-child {
    font-weight: 700;
    color: #2c3e50;
}

/* ==========================================================================
   Сетка карточек
   ========================================================================== */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* ==========================================================================
   Карточка каталога
   ========================================================================== */
.catalog-card {
    display: block;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.catalog-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.catalog-card--hidden {
    display: none;
}

/* --- Фото --- */
.catalog-card__image {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f8f9fa;
}

.catalog-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.catalog-card:hover .catalog-card__image img {
    transform: scale(1.03);
}

/* --- Информация --- */
.catalog-card__info {
    padding: 10px 12px 14px;
}

.catalog-card__name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.catalog-card__article {
    font-size: 0.8rem;
    color: #d4a574;
    font-weight: 600;
    margin: 0 0 2px;
}

.catalog-card__type {
    font-size: 0.75rem;
    color: #666;
    margin: 0 0 2px;
}

.catalog-card__specs {
    font-size: 0.75rem;
    color: #888;
    margin: 0;
}

/* ==========================================================================
   Пустой каталог
   ========================================================================== */
.catalog-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 1.1rem;
}

/* ==========================================================================
   SEO-текст
   ========================================================================== */
.catalog-seo {
    max-width: 800px;
    margin: 40px auto 0;
    padding: 0 0 40px;
}

.catalog-seo h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 16px;
}

.catalog-seo p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555;
    margin-bottom: 12px;
}

/* ==========================================================================
   Overlay для мобильного фильтра
   ========================================================================== */
.catalog-filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.catalog-filter-overlay--visible {
    display: block;
}

/* ==========================================================================
   Responsive: Tablet (≥ 576px)
   ========================================================================== */
@media (min-width: 576px) {
    .catalog-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }

    .catalog-card__info {
        padding: 12px 14px 16px;
    }

    .catalog-card__name {
        font-size: 0.9rem;
    }

    .catalog-title {
        font-size: 1.8rem;
    }
}

/* ==========================================================================
   Responsive: Desktop (≥ 1024px)
   ========================================================================== */
@media (min-width: 1024px) {
    .catalog-title {
        font-size: 2rem;
        margin-bottom: 24px;
    }

    /* Layout: sidebar + content */
    .catalog-layout {
        flex-direction: row;
        gap: 24px;
    }

    /* Скрыть кнопку фильтра на десктопе */
    .filter-toggle {
        display: none;
    }

    /* Sidebar фильтр */
    .catalog-filter {
        width: 240px;
        flex-shrink: 0;
        position: sticky;
        top: 80px;
        align-self: flex-start;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    .catalog-filter__close {
        display: none !important;
    }

    /* Сетка карточек */
    .catalog-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }

    .catalog-card__info {
        padding: 14px 16px 18px;
    }

    .catalog-card__name {
        font-size: 0.95rem;
    }

    .catalog-card__article {
        font-size: 0.85rem;
    }

    .catalog-card__type,
    .catalog-card__specs {
        font-size: 0.8rem;
    }
}

/* ==========================================================================
   Responsive: Mobile (< 1024px) — фильтр как overlay
   ========================================================================== */
@media (max-width: 1023px) {
    .catalog-filter {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        z-index: 1000;
        border-radius: 0;
        transition: left 0.3s ease;
        overflow-y: auto;
        padding-top: 16px;
    }

    .catalog-filter--open {
        left: 0;
    }

    .catalog-filter__close {
        display: block;
    }
}

/* ==========================================================================
   Responsive: Small mobile (< 400px)
   ========================================================================== */
@media (max-width: 400px) {
    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .catalog-card__info {
        padding: 8px 8px 12px;
    }

    .catalog-card__name {
        font-size: 0.8rem;
    }
}
