/* catalog.css — страница полного каталога автозапчастей */

.catalog-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 5% 50px;
    background: var(--bg-main);
}

.catalog-hero {
    margin-bottom: 26px;
}

.catalog-hero h1 {
    font-family: 'Gilroy-SemiBold', sans-serif;
    font-size: 28px;
    color: #111827;
    margin-bottom: 6px;
}

.catalog-hero p {
    color: #6b7280;
    font-size: 14px;
}

/* Шапка с каруселью брендов: колонки совпадают с .catalog-layout,
   поэтому карусель стоит справа от заголовка и ровно над результатами */
.catalog-hero--with-brands {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 28px;
    align-items: center;
}

.catalog-hero--with-brands h1 { margin-bottom: 4px; }

/* ---------- Карусель брендов ---------- */
.brand-carousel {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.brand-carousel-track {
    position: relative;
    display: flex;
    gap: 10px;
    flex: 1;
    min-width: 0;
    padding: 6px 2px 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    /* Мягко гасим плашки у краёв, чтобы было видно, что ряд прокручивается */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}

.brand-carousel-track::-webkit-scrollbar { display: none; }

.brand-carousel.is-static .brand-carousel-track {
    -webkit-mask-image: none;
            mask-image: none;
}

.brand-carousel.is-static .brand-carousel-arrow { visibility: hidden; }

/* Плашка — уменьшенная вдвое .brand-card с главной */
.brand-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 88px;
    height: 64px;
    padding: 8px;
    border: 2px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    scroll-snap-align: start;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.brand-chip img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.brand-chip-name {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    color: #4b5563;
    overflow-wrap: anywhere;
}

.brand-chip:hover {
    border-color: #ff6b00;
    box-shadow: 0 4px 10px rgba(255, 107, 0, 0.15);
    transform: translateY(-3px);
}

.brand-chip.active {
    border-color: #ff6b00;
    background: #fff7ed;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.18);
}

.brand-chip:focus-visible {
    outline: 2px solid rgba(30, 60, 114, 0.4);
    outline-offset: 2px;
}

.brand-carousel-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    background: #fff;
    color: #4b5563;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.brand-carousel-arrow:hover:not(:disabled) {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.brand-carousel-arrow:disabled {
    opacity: 0.35;
    cursor: default;
}

@media (prefers-reduced-motion: reduce) {
    .brand-chip { transition: none; }
    .brand-chip:hover { transform: none; }
}

.catalog-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 28px;
    align-items: start;
}

/* Фильтры */
.catalog-filters {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px;
    position: sticky;
    top: 20px;
}

.filter-block {
    margin-bottom: 20px;
}

.filter-block:last-of-type {
    margin-bottom: 16px;
}

.filter-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
    margin-bottom: 8px;
}

.catalog-filters input[type="text"],
.catalog-filters input[type="number"],
.catalog-filters select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.catalog-filters input:focus,
.catalog-filters select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.12);
}

.filter-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-height: 190px;
    overflow-y: auto;
    padding-right: 4px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.filter-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-blue);
    cursor: pointer;
}

.filter-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-price-row input {
    min-width: 0;
}

.filter-price-sep {
    color: #9ca3af;
    flex-shrink: 0;
}

.btn-apply-filters {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-light) 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.btn-apply-filters:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 14px rgba(30, 60, 114, 0.25);
}

.btn-reset-filters {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 13px;
    color: #6b7280;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.btn-reset-filters:hover {
    color: var(--primary-blue);
}

/* Результаты */
.catalog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.catalog-count {
    font-size: 14px;
    font-weight: 600;
    color: #4b5768;
}

.catalog-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
}

.catalog-sort select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    color: #111827;
    background: #fff;
    cursor: pointer;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
}

/* Значок наличия на карточке товара */
.stock-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    z-index: 2;
}

.stock-badge.in-stock { background: #e6f4ea; color: #137333; }
.stock-badge.low-stock { background: #fef7e0; color: #b06000; }
.stock-badge.out-of-stock { background: #fce8e6; color: #c5221f; }

.catalog-grid .btn-buy:disabled {
    background: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    pointer-events: none;
}

/* Пагинация */
.catalog-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 34px;
}

.page-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
}

.page-btn:hover {
    background: var(--primary-blue);
    color: #fff;
    border-color: var(--primary-blue);
}

.page-info {
    font-size: 14px;
    color: #6b7280;
    font-weight: 600;
}

/* Пусто */
.catalog-empty {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
}

.catalog-empty i {
    font-size: 46px;
    color: #94a3b8;
    margin-bottom: 16px;
}

.catalog-empty h3 {
    font-size: 20px;
    color: #111827;
    margin-bottom: 8px;
}

.catalog-empty p {
    color: #6b7280;
    margin-bottom: 18px;
}

.catalog-empty .btn-reset-filters {
    margin-top: 0;
}

@media (max-width: 900px) {
    .catalog-layout {
        grid-template-columns: 1fr;
    }

    .catalog-hero--with-brands {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .catalog-filters {
        position: static;
    }
}

@media (max-width: 480px) {
    .catalog-page {
        padding: 20px 4% 40px;
    }

    .catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    /* На телефоне карусель листается свайпом — стрелки только занимают место */
    .brand-carousel-arrow { display: none; }
}
