/* ═══════════════════════════════════════════════════════════════════════════
   catalog.css — стили листинга каталога:
     - шапка листинга, переключатель видов (grid1/grid2/table)
     - таблица (view=table)
     - сайдбар фильтров (.cf-*) + noUiSlider override
     - сортировка <select>
     - AJAX-скелетон + «Показать ещё»
     - чипы быстрых/активных фильтров (Этап 5)
   Подключается ДО nouislider.min.css (тот грузится в $FOOTER из logic.php),
   поэтому override использует .catalog-filters .cf-slider … для специфичности.
   ═══════════════════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════════════════════
   Catalog view switcher + view modes (grid1 / grid2 / table)
   ═══════════════════════════════════════════════════════════════════════════ */

.catalog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.catalog-head .catalog-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}
.catalog-head-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.catalog-total {
    color: #888;
    font-size: 14px;
    white-space: nowrap;
}
.catalog-view-switch {
    display: inline-flex;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.catalog-view-btn {
    border: 0;
    background: #fff;
    padding: 6px 10px;
    color: #666;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.catalog-view-btn + .catalog-view-btn {
    border-left: 1px solid #e5e5e5;
}
.catalog-view-btn:hover {
    background: #f5f5f5;
    color: #1a5276;
}
.catalog-view-btn.active {
    background: #1a5276;
    color: #fff;
}

/* view=grid1: больше места, 3 в ряд на десктопе, 1 на мобиле — карточка card2 поменяет col через .card2-col */
.catalog-view-grid1 .card2-col { /* col-12 col-md-4 уже выставляет PHP, тут — мелкие правки */
}

/* view=table: список как таблица */
.catalog-table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 10px;
}
.catalog-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.catalog-table thead th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: #777;
    background: #f7f9fc;
    border-bottom: 1px solid #eef0f3;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.catalog-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f3f6;
    vertical-align: middle;
}
.catalog-table tbody tr:hover {
    background: #fafbfd;
}
.catalog-table-img img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}
.catalog-table-name a {
    color: #1a5276;
    font-weight: 500;
    text-decoration: none;
}
.catalog-table-name a:hover {
    text-decoration: underline;
}
.catalog-table-brand {
    color: #888;
    font-size: 12px;
    margin-bottom: 2px;
}
.catalog-table-price {
    white-space: nowrap;
    font-size: 15px;
}
.catalog-table-act {
    white-space: nowrap;
    text-align: right;
}
.catalog-table-act .btn-icon {
    border: 1px solid #e5e5e5;
    background: #fff;
    color: #666;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.catalog-table-act .btn-icon + .btn-icon { margin-left: 4px; }
.catalog-table-act .btn-icon:hover { background: #f5f5f5; color: #1a5276; }
.catalog-table-act .btn-icon.active,
.catalog-table-act .btn-icon:has(.fa-heart),
.catalog-table-act .btn-icon:has(.fa-check) { background: #1a5276; color: #fff; border-color: #1a5276; }
.catalog-table-award {
    text-decoration: none;
    margin-left: 6px;
}

@media (max-width: 760px) {
    .catalog-head { gap: 8px; }
    .catalog-view-btn { padding: 5px 8px; font-size: 13px; }
    .catalog-table thead th,
    .catalog-table tbody td { padding: 8px; }
    .catalog-table-img img { width: 56px; height: 42px; }
    .catalog-table-act .btn-icon { width: 28px; height: 28px; }
}



/* ═══════════════════════════════════════════════════════════════════════════
   Catalog filters sidebar — со счётчиками и disabled
   ═══════════════════════════════════════════════════════════════════════════ */

.catalog-filters {
    font-size: 14px;
    color: #1f2937;
}
.cf-group {
    border-top: 1px solid #eef0f3;
    padding: 14px 0 10px;
}
.cf-group:first-child {
    border-top: 0;
    padding-top: 4px;
}
.cf-title {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin: 0 0 10px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.cf-title small {
    font-weight: 400;
    color: #6b7280;
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
}
.cf-total {
    margin-left: auto;
    color: #6b7280;
    font-weight: 400;
    font-size: 12px;
}
.cf-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cf-list-scroll {
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}
.cf-list li {
    margin: 0;
}
.cf-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    user-select: none;
    margin: 0;
}
.cf-item input[type="checkbox"] {
    flex-shrink: 0;
    margin: 0;
}
.cf-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cf-cnt {
    flex-shrink: 0;
    color: #9ca3af;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.cf-child {
    padding-left: 18px;
    position: relative;
}
.cf-child::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    width: 8px;
    height: 1px;
    background: #d1d5db;
}
.cf-child .cf-name {
    color: #4b5563;
}
.cf-search {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    margin-bottom: 8px;
    background: #fff;
}
.cf-search:focus {
    outline: none;
    border-color: #1a5276;
}
.cf-slider {
    margin: 14px 6px 12px;
}
.cf-range-inputs {
    display: flex;
    gap: 6px;
}
.cf-range-inputs .form-control {
    font-size: 13px;
    padding: 4px 8px;
    height: auto;
}
.cf-toggle {
    font-weight: 500;
}

/* Сортировка в шапке */
.catalog-sort-select {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 6px 10px;
    background: #fff;
    font-size: 14px;
    color: #1f2937;
    cursor: pointer;
}
.catalog-sort-select:focus {
    outline: none;
    border-color: #1a5276;
}
@media (max-width: 760px) {
    .catalog-sort-select {
        font-size: 13px;
        padding: 5px 8px;
    }
}


/* ── noUiSlider override: брендовый стиль ─────────────────────────────────
 * specificity ≥ 0,3,0 чтобы перекрыть .noUi-horizontal .noUi-handle (0,2,0)
 * из nouislider.min.css, который грузится позже из catalog/logic.php $FOOTER.
 * ─────────────────────────────────────────────────────────────────────── */
.catalog-filters .cf-slider.noUi-target {
    height: 4px;
    background: #e5e7eb;
    border: 0;
    box-shadow: none;
    border-radius: 999px;
    margin: 18px 0 14px;
}
.catalog-filters .cf-slider .noUi-connect {
    background: #1a5276;
}
.catalog-filters .cf-slider .noUi-handle {
    width: 18px;
    height: 18px;
    top: -7px;
    right: -9px;            /* центрирует handle относительно конца track */
    left: auto;             /* перекрываем стандартный left из nouislider */
    border-radius: 50%;
    background: #fff;
    border: 2px solid #1a5276;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
    cursor: grab;
    transform: none;
}
.catalog-filters .cf-slider .noUi-handle::before,
.catalog-filters .cf-slider .noUi-handle::after {
    display: none;
}
.catalog-filters .cf-slider .noUi-handle.noUi-active {
    cursor: grabbing;
    box-shadow: 0 0 0 4px rgba(26,82,118,.18);
}

.cf-range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}
.cf-range-inputs .form-control {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 13px;
    height: 30px;
    min-width: 0;
    flex: 1 1 0;
    text-align: center;
    background: #fff;
    color: #1f2937;
}
.cf-range-inputs .form-control:focus {
    outline: none;
    border-color: #1a5276;
    box-shadow: 0 0 0 3px rgba(26,82,118,.12);
}

/* ── Нижний отступ страницы каталога ──────────────────────────────────── */
.main-content {
    padding-bottom: 100px;
}


/* ── AJAX: скелетон при загрузке + кнопка «Показать ещё» ───────────── */
.catalog-grid.is-loading {
    position: relative;
    pointer-events: none;
}
.catalog-grid.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.65);
    backdrop-filter: blur(2px);
    z-index: 5;
    border-radius: 8px;
}
.catalog-grid.is-loading::before {
    content: "";
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border: 3px solid #e5e7eb;
    border-top-color: #1a5276;
    border-radius: 50%;
    z-index: 6;
    animation: catalog-spin 0.7s linear infinite;
}
@keyframes catalog-spin {
    to { transform: translateX(-50%) rotate(360deg); }
}

.catalog-load-more {
    display: block;
    margin: 16px auto;
    padding: 10px 28px;
    background: #fff;
    color: #1a5276;
    border: 1.5px solid #1a5276;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.catalog-load-more:hover {
    background: #1a5276;
    color: #fff;
}
.catalog-load-more:disabled {
    opacity: .6;
    cursor: wait;
}


/* ═══════════════════════════════════════════════════════════════════════════
   Этап 5 — Чипы быстрых и активных фильтров
   ═══════════════════════════════════════════════════════════════════════════ */

.catalog-chips {
    margin: 0 0 12px;
}
.catalog-chips:empty {
    display: none;
}

/* ── Активные чипы (снимаемые) ─────────────────────────────────────────── */
.catalog-chips-active {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.chip-active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 12px;
    background: #1a5276;
    color: #fff;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.2;
    text-decoration: none;
    transition: background .15s ease;
    cursor: pointer;
    border: 0;
}
.chip-active:hover {
    background: #134059;
    color: #fff;
    text-decoration: none;
}
.chip-active .chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}
.chip-active:hover .chip-x {
    background: rgba(255,255,255,.32);
}
.chip-clear {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    background: #fff;
    color: #b91c1c;
    border: 1px solid #fca5a5;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}
.chip-clear:hover {
    background: #fef2f2;
    color: #991b1b;
    text-decoration: none;
}

/* ── Быстрые чипы (горизонтальный скролл) ──────────────────────────────── */
.catalog-chips-quick {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    margin-bottom: 6px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.catalog-chips-quick::-webkit-scrollbar {
    height: 4px;
}
.catalog-chips-quick::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}
.chip-quick {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #f3f4f6;
    color: #1f2937;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.chip-quick:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    color: #1f2937;
    text-decoration: none;
}
.chip-quick .chip-cnt {
    color: #6b7280;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
    .chip-active, .chip-clear, .chip-quick { font-size: 12px; padding: 4px 10px; }
}
