/* ─────────────────────────────────────────────
   Каталог подбора запчастей.
   Вёрстка по макету дизайнера (Figma, фреймы 3325:3520 — список
   и 3325:4463 — тот же экран для неавторизованного гостя).
   Токены --lk-* и сетка .head-blocks (1280 / 728 / 300) — в global.css.
   ───────────────────────────────────────────── */

.cat *,
.cat *::before,
.cat *::after {
    box-sizing: border-box;
}

.cat {
    background: #F5F5F5;
    padding: 58px 0 60px;
    font-family: Inter, sans-serif;
    color: var(--lk-dark);
}

.cat-wrap {
    width: 1280px;
    margin: 0 auto;
}

.cat h1 {
    margin: 0;
    font-family: Tektur, sans-serif;
    font-size: 28px;
    font-weight: 400;
    line-height: 36px;
    text-transform: uppercase;
    color: var(--lk-dark);
}

/* ── «Сбросить всё» над панелью подбора ── */

.cat-reset-row {
    display: flex;
    justify-content: flex-end;
    margin: 9px 0 3px;
}

.cat-reset {
    font-size: 12px;
    color: #8A7A12;
    text-decoration: none;
}

.cat-reset:hover {
    text-decoration: underline;
}

/* ─────────────────────────────────────────────
   Панель подбора
   ───────────────────────────────────────────── */

.cat-finder {
    background: #FAFAF7;
    border: 1px solid #E8E8E8;
    border-radius: 10px;
    overflow: hidden;
}

/* ── Строка «Из моей техники» ── */

.cat-garage {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 66px;
    padding: 0 24px;
    border-bottom: 1px solid #E8E8E8;
    overflow-x: auto;
}

.cat-garage__label {
    flex: 0 0 auto;
    font-size: 12px;
    color: #7A7A7A;
}

.cat-garage__chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 33px;
    padding: 0 14px;
    border: 1px solid #DCDCDC;
    border-radius: 20px;
    background: #FFFFFF;
    font-family: inherit;
    font-size: 12px;
    color: #6B6B6B;
    cursor: pointer;
}

.cat-garage__chip.active {
    height: 31px;
    border-color: var(--lk-dark);
    background: var(--lk-dark);
    color: #FFFFFF;
}

.cat-garage__chip.active::after {
    content: '✓';
    color: var(--lk-yellow);
}

/* ── Поля подбора ── */

.cat-fields {
    padding: 22px 24px 24px;
}

.cat-row {
    display: flex;
    gap: 10px;
}

.cat-row + .cat-row {
    margin-top: 21px;
}

.cat-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.cat-field label {
    font-size: 12px;
    color: #7A7A7A;
}

.cat-field label .req {
    color: #C04A4A;
}

.cat-field input,
.cat-field select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid #D5D5D5;
    border-radius: 6px;
    background: #FFFFFF;
    font-family: inherit;
    font-size: 14px;
    color: var(--lk-dark);
    appearance: none;
}

/* Обязательные поля подбора — с чёрной обводкой, как в макете */
.cat-field.key input,
.cat-field.key select {
    border-color: var(--lk-dark);
}

.cat-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0h8L4 5z' fill='%238A8A8A'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    padding-right: 38px;
}

.cat-field input::placeholder {
    color: #B0B0B0;
}

.cat-field input.mono {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 13px;
}

/* Ширины колонок повторяют макет: 326 / 449 / 326 / 100 */
.cat-field.w-type   { flex: 0 0 326px; }
.cat-field.w-model  { flex: 1 1 auto; }
.cat-field.w-serial { flex: 0 0 326px; }
.cat-field.w-year   { flex: 0 0 100px; }
.cat-field.w-node   { flex: 0 0 326px; }
.cat-field.w-part   { flex: 1 1 auto; }

/* ── Нижняя полоса панели ── */

.cat-finder__bar {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 83px;
    padding: 0 24px;
    border-top: 1px solid #ECECEC;
    background: #FFFFFF;
}

.cat-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.cat-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cat-toggle__track {
    flex: 0 0 auto;
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 20px;
    background: #DCDCDC;
    transition: background .15s;
}

.cat-toggle__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 10px;
    background: var(--lk-dark);
    transition: left .15s;
}

.cat-toggle input:checked + .cat-toggle__track {
    background: var(--lk-yellow);
}

.cat-toggle input:checked + .cat-toggle__track::after {
    left: 23px;
}

.cat-toggle__text b {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.cat-toggle__text span {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: #8A8A8A;
}

.cat-finder__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ─────────────────────────────────────────────
   Кнопки
   ───────────────────────────────────────────── */

.cat-btn,
.cat-btn-ghost,
.cat-btn-dark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 41px;
    padding: 0 26px;
    border: none;
    border-radius: 6px;
    background: var(--lk-yellow);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--lk-dark);
    text-decoration: none;
    cursor: pointer;
}

.cat-btn-ghost {
    height: 42px;
    padding: 0 20px;
    border: 1px solid #D5D5D5;
    background: transparent;
    font-size: 13px;
    font-weight: 400;
    color: #3A3A3A;
}

.cat-btn-dark {
    height: 40px;
    padding: 0 18px;
    background: var(--lk-dark);
    font-size: 13px;
    font-weight: 400;
    color: #FFFFFF;
}

/* ─────────────────────────────────────────────
   Результаты: сайдбар фильтров + список
   ───────────────────────────────────────────── */

.cat-results-title {
    margin: 40px 0 0;
    font-family: Tektur, sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 20px;
    text-transform: uppercase;
}

.cat-results {
    display: flex;
    margin-top: 20px;
    border-top: 1px solid var(--lk-border);
}

.cat-side {
    flex: 0 0 228px;
    padding: 22px 25px 40px 0;
    border-right: 1px solid var(--lk-border);
}

.cat-side h2 {
    margin: 0 0 24px;
    font-family: Tektur, sans-serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 17px;
    text-transform: uppercase;
}

.cat-side h3 {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--lk-label);
}

.cat-side__group + .cat-side__group {
    margin-top: 36px;
}

.cat-check {
    display: flex;
    align-items: center;
    gap: 9px;
    height: 25px;
    cursor: pointer;
}

.cat-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cat-check__box {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1px solid #CFCFCF;
    border-radius: 3px;
    background: #FFFFFF;
    font-size: 11px;
    line-height: 1;
    color: transparent;
}

.cat-check input:checked + .cat-check__box {
    border-color: var(--lk-dark);
    background: var(--lk-dark);
    color: var(--lk-yellow);
}

.cat-check__label {
    flex: 1 1 auto;
    font-size: 13px;
    color: #6B6B6B;
}

.cat-check input:checked ~ .cat-check__label {
    color: var(--lk-dark);
}

.cat-check__count {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--lk-label);
}

/* ── Диапазон цены ── */

.cat-price {
    display: flex;
    gap: 0;
}

.cat-price input {
    width: 50%;
    height: 35px;
    padding: 0 11px;
    border: 1px solid #D5D5D5;
    background: #FFFFFF;
    font-family: inherit;
    font-size: 12px;
    color: var(--lk-dark);
}

.cat-price input:first-child {
    border-radius: 5px 0 0 5px;
}

.cat-price input:last-child {
    border-left: none;
    border-radius: 0 5px 5px 0;
}

/* Двойной ползунок: две дорожки друг поверх друга, видна только нижняя */
.cat-slider {
    position: relative;
    height: 14px;
    margin-top: 6px;
}

.cat-slider__track {
    position: absolute;
    top: 5px;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 4px;
    background: #E6E6E6;
}

.cat-slider__fill {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 4px;
    background: var(--lk-yellow);
}

.cat-slider input[type=range] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 14px;
    margin: 0;
    background: none;
    appearance: none;
    pointer-events: none;
}

.cat-slider input[type=range]::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 7px;
    background: var(--lk-dark);
    pointer-events: auto;
    cursor: pointer;
}

.cat-slider input[type=range]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 7px;
    background: var(--lk-dark);
    pointer-events: auto;
    cursor: pointer;
}

.cat-side__apply {
    width: 100%;
    margin-top: 18px;
    height: 35px;
    padding: 0;
    font-size: 13px;
}

/* ─────────────────────────────────────────────
   Список
   ───────────────────────────────────────────── */

.cat-list {
    flex: 1 1 auto;
    min-width: 0;
    padding: 22px 0 0 30px;
}

.cat-list__head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #E4E4E0;
    border-radius: 20px;
    background: #F4F4F1;
    font-size: 12px;
    color: #3A3A3A;
    text-decoration: none;
}

.cat-chip::after {
    content: '×';
    color: var(--lk-label);
}

.cat-chip.accent {
    border-color: var(--lk-yellow);
    background: #FFFBEA;
    color: #8A7A12;
}

.cat-chip.accent::after {
    color: #B8A41A;
}

.cat-sort {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #8A8A8A;
}

.cat-sort select {
    height: 31px;
    padding: 0 12px;
    border: 1px solid var(--lk-border-strong);
    border-radius: 6px;
    background: #FFFFFF;
    font-family: inherit;
    font-size: 12px;
    color: var(--lk-dark);
}

.cat-list__note {
    margin: 17px 0 0;
    font-size: 12px;
    color: var(--lk-label);
}

.cat-list__empty {
    margin: 40px 0;
    font-size: 14px;
    color: #6B6B6B;
}

/* ── Карточка позиции ── */

/* Колонки карточки стоят встык, как в макете: отступ даёт только фото */
.cat-card {
    position: relative;
    display: flex;
    gap: 0;
    min-height: 167px;
    margin-top: 10px;
    padding: 16px;
    border: 1px solid #E6E6E6;
    border-radius: 10px;
    background: #FFFFFF;
}

.cat-card__photo {
    flex: 0 0 159px;
    margin-right: 23px;
    height: 132px;
    border-radius: 6px;
    background: #EDEDED;
    object-fit: cover;
}

.cat-card__body {
    flex: 1 1 auto;
    min-width: 0;
}

.cat-card__top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cat-card__art {
    font-size: 10px;
    color: #6B6B6B;
}

.cat-badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 8px;
    border-radius: 3px;
    background: #E8E8E4;
    font-size: 10px;
    font-weight: 600;
    color: #5A5A5A;
}

.cat-badge.original {
    background: var(--lk-dark);
    color: var(--lk-yellow);
}

.cat-card__name {
    display: block;
    margin-top: 11px;
    font-size: 16px;
    font-weight: 600;
    line-height: 20px;
    color: var(--lk-dark);
    text-decoration: none;
}

a.cat-card__name:hover {
    text-decoration: underline;
}

.cat-card__stock {
    margin-top: 9px;
    font-size: 12px;
    color: #3F7A4E;
}

.cat-card__stock.order {
    color: #8A8A8A;
}

.cat-card__meta {
    margin-top: 10px;
    font-size: 12px;
    color: #8A8A8A;
}

.cat-card__fit {
    margin-top: 10px;
    font-size: 12px;
    line-height: 15px;
    color: #8A7A12;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cat-card__price {
    flex: 0 0 175px;
    padding-top: 32px;
}

.cat-card__sum {
    font-family: Tektur, sans-serif;
    font-size: 21px;
    line-height: 27px;
}

.cat-card__sum.ask {
    font-size: 15px;
    color: #6B6B6B;
}

.cat-card__vat {
    margin-top: 8px;
    font-size: 12px;
    color: #8A8A8A;
}

.cat-card__discount {
    margin-top: 6px;
    font-size: 12px;
    color: #3F7A4E;
}

.cat-card__buy {
    flex: 0 0 172px;
}

/* ── Счётчик количества ── */

.cat-qty {
    display: flex;
    align-items: center;
    height: 38px;
    border: 1px solid var(--lk-border-strong);
    border-radius: 6px;
    overflow: hidden;
    background: #FFFFFF;
}

.cat-qty button {
    flex: 0 0 55px;
    height: 100%;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 15px;
    color: #8A8A8A;
    cursor: pointer;
}

.cat-qty input {
    flex: 1 1 auto;
    width: 100%;
    height: 36px;
    border: none;
    border-left: 1px solid var(--lk-border);
    border-right: 1px solid var(--lk-border);
    font-family: inherit;
    font-size: 14px;
    text-align: center;
    color: var(--lk-dark);
    appearance: textfield;
    -moz-appearance: textfield;
}

.cat-qty input::-webkit-outer-spin-button,
.cat-qty input::-webkit-inner-spin-button {
    appearance: none;
    margin: 0;
}

.cat-card__order {
    width: 100%;
    margin-top: 9px;
    height: 39px;
    padding: 0;
}

.cat-fav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 9px;
    height: 37px;
    padding: 0;
    border: 1px solid var(--lk-border-strong);
    border-radius: 6px;
    background: #FFFFFF;
    font-family: inherit;
    font-size: 12px;
    color: #6B6B6B;
    text-decoration: none;
    cursor: pointer;
}

.cat-fav.on {
    border-color: var(--lk-yellow);
    background: #FFFBEA;
    color: #8A7A12;
}

/* ── Пагинация ── */

.cat-pages {
    display: flex;
    gap: 8px;
    margin-top: 28px;
}

.cat-pages a,
.cat-pages span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 35px;
    padding: 0 8px;
    border: 1px solid var(--lk-border-strong);
    border-radius: 6px;
    background: #FFFFFF;
    font-size: 13px;
    color: #6B6B6B;
    text-decoration: none;
}

.cat-pages span.current {
    border-color: var(--lk-dark);
    background: var(--lk-dark);
    color: #FFFFFF;
}

/* ── Блок менеджера ── */

.cat-manager {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 96px;
    margin-top: 28px;
    padding: 18px;
    border: 1px solid var(--lk-border);
    border-radius: 10px;
    background: #FAFAF7;
}

.cat-manager__photo {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    border-radius: 26px;
    background: #EDEDED;
    object-fit: cover;
}

.cat-manager__body {
    flex: 1 1 auto;
    min-width: 0;
}

.cat-manager__hint {
    font-size: 12px;
    color: #8A8A8A;
}

.cat-manager__name {
    margin-top: 6px;
    font-family: Tektur, sans-serif;
    font-size: 15px;
    line-height: 20px;
}

.cat-manager__contacts {
    margin-top: 5px;
    font-size: 13px;
    color: #8A7A12;
}

.cat-manager__contacts a {
    color: inherit;
    text-decoration: none;
}

.cat-manager__actions {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
}

/* ─────────────────────────────────────────────
   Гостевой режим: засветка списка + модалка
   ───────────────────────────────────────────── */

.cat-gate {
    position: relative;
}

.cat-gate__veil {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #FFFFFF 26%);
    pointer-events: none;
}

.cat-gate__card {
    position: absolute;
    z-index: 3;
    top: 190px;
    left: 50%;
    transform: translateX(-50%);
    width: 620px;
    padding: 36px 40px 34px;
    border: 1px solid #E4E4E4;
    border-radius: 14px;
    background: #FFFFFF;
    box-shadow: 0 24px 30px rgba(0, 0, 0, .18);
    text-align: center;
}

.cat-gate__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto;
    border-radius: 14px;
    background: var(--lk-dark);
}

.cat-gate__card h2 {
    margin: 17px 0 0;
    font-family: Tektur, sans-serif;
    font-size: 24px;
    font-weight: 400;
    line-height: 28.8px;
    text-transform: uppercase;
}

.cat-gate__card p {
    margin: 16px 0 0;
    font-size: 14px;
    line-height: 22.4px;
    color: #7A7A7A;
}

/* Кнопки стоят парой по центру карточки, ширины из макета: 204 и 240 */
.cat-gate__actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 28px;
}

.cat-gate__actions > * {
    flex: 0 0 auto;
    height: 47px;
    padding: 0;
}

.cat-gate__signup {
    width: 204px;
}

.cat-gate__manager {
    width: 240px;
}

.cat-gate__manager {
    border: 1px solid var(--lk-dark);
    background: transparent;
    font-weight: 600;
    color: var(--lk-dark);
}

.cat-gate__login {
    margin-top: 16px;
    font-size: 13px;
    color: #8A8A8A;
}

.cat-gate__login a {
    font-weight: 500;
    color: #8A7A12;
}

.cat-gate__perks {
    display: flex;
    gap: 16px;
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--lk-border);
    text-align: left;
}

.cat-gate__perks div {
    flex: 1 1 0;
    display: flex;
    gap: 9px;
    font-size: 12px;
    line-height: 18px;
    color: #6B6B6B;
}

.cat-gate__perks div::before {
    content: '✓';
    font-family: Tektur, sans-serif;
    font-size: 14px;
    line-height: 18px;
    color: var(--lk-yellow);
}

/* ─────────────────────────────────────────────
   Планшет: контейнер 728
   ───────────────────────────────────────────── */

@media screen and (max-width: 1280px) {
    .cat {
        padding-top: 40px;
    }

    .cat-wrap {
        width: 728px;
    }

    .cat h1 {
        font-size: 22px;
        line-height: 28px;
    }

    .cat-row {
        flex-wrap: wrap;
    }

    .cat-field.w-type,
    .cat-field.w-model,
    .cat-field.w-serial,
    .cat-field.w-node,
    .cat-field.w-part {
        flex: 1 1 340px;
    }

    .cat-field.w-year {
        flex: 0 0 120px;
    }

    .cat-finder__bar {
        height: auto;
        flex-wrap: wrap;
        padding: 18px 24px;
    }

    .cat-finder__actions {
        width: 100%;
        margin-left: 0;
    }

    .cat-finder__actions .cat-btn {
        flex: 1 1 auto;
    }

    /* Фильтры уезжают лентой над списком */
    .cat-results {
        display: block;
    }

    .cat-side {
        flex: none;
        padding: 22px 0;
        border-right: none;
        border-bottom: 1px solid var(--lk-border);
        columns: 2;
        column-gap: 40px;
    }

    .cat-side__group {
        break-inside: avoid;
    }

    .cat-side__group + .cat-side__group {
        margin-top: 24px;
    }

    .cat-list {
        padding: 22px 0 0;
    }

    .cat-card {
        flex-wrap: wrap;
        row-gap: 16px;
    }

    .cat-card__body {
        flex: 1 1 300px;
    }

    .cat-card__price {
        flex: 0 0 auto;
        padding-top: 0;
    }

    .cat-card__buy {
        flex: 0 0 172px;
        margin-left: auto;
    }

    .cat-gate__card {
        width: 100%;
        max-width: 620px;
        top: 120px;
    }

    .cat-gate__perks {
        flex-wrap: wrap;
    }

    .cat-gate__perks div {
        flex: 1 1 45%;
    }
}

/* ─────────────────────────────────────────────
   Телефон: контейнер 300
   ───────────────────────────────────────────── */

@media screen and (max-width: 728px) {
    .cat-wrap {
        width: 300px;
    }

    .cat h1 {
        font-size: 18px;
        line-height: 24px;
    }

    .cat-garage,
    .cat-fields,
    .cat-finder__bar {
        padding-left: 16px;
        padding-right: 16px;
    }

    .cat-field.w-type,
    .cat-field.w-model,
    .cat-field.w-serial,
    .cat-field.w-year,
    .cat-field.w-node,
    .cat-field.w-part {
        flex: 1 1 100%;
    }

    .cat-row {
        gap: 14px;
    }

    .cat-row + .cat-row {
        margin-top: 14px;
    }

    .cat-finder__actions {
        flex-wrap: wrap;
    }

    .cat-finder__actions > * {
        width: 100%;
    }

    .cat-side {
        columns: 1;
    }

    .cat-sort {
        width: 100%;
        margin-left: 0;
    }

    .cat-card {
        column-gap: 14px;
    }

    .cat-card__photo {
        flex: 0 0 72px;
        margin-right: 0;
        height: 72px;
    }

    .cat-card__body {
        flex: 1 1 140px;
    }

    .cat-card__price,
    .cat-card__buy {
        flex: 1 1 100%;
        margin-left: 0;
    }

    .cat-manager {
        flex-wrap: wrap;
    }

    .cat-manager__actions {
        width: 100%;
    }

    .cat-manager__actions > * {
        flex: 1 1 0;
    }

    .cat-gate__card {
        top: 60px;
        padding: 24px 18px;
    }

    .cat-gate__card h2 {
        font-size: 18px;
        line-height: 23px;
    }

    .cat-gate__actions {
        flex-wrap: wrap;
    }

    .cat-gate__actions > *,
    .cat-gate__signup {
        flex: 1 1 100%;
    }

    .cat-gate__perks div {
        flex: 1 1 100%;
    }
}
