/* Страница каталога авто */

.catalog-page {
    background: #eef1f5;
    min-height: 100vh;
    padding-top: var(--header-height, 80px);
}

.catalog {
    max-width: var(--container-max-width, 1200px);
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.catalog__crumbs {
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 12px;
}

.catalog__crumbs a {
    color: #9ca3af;
    text-decoration: none;
}

.catalog__crumbs a:hover {
    color: #0074FE;
}

.catalog__title {
    font-size: 32px;
    font-weight: 900;
    color: #0D1E3B;
    margin: 0 0 20px;
    line-height: 1.15;
}

/* ИИ-строка поиска (вход в чат) */
.catalog__ai {
    margin-bottom: 10px;
}

.ai-searchbar {
    position: relative;
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 999px;
    height: 62px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
    padding: 0 8px 0 22px;
}

.ai-searchbar__icon {
    flex-shrink: 0;
    color: #0074FE;
    display: flex;
}

.ai-searchbar__input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    font-family: inherit;
    color: #0D1E3B;
    padding: 0 14px;
}

/* placeholder-заглушка "." невидима — печатаем анимацию через ghost */
.ai-searchbar__input::placeholder {
    color: transparent;
}

/* Ghost поверх инпута: печатающийся пример + мигающая каретка */
.ai-searchbar__ghost {
    position: absolute;
    left: 58px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    font-size: 16px;
    color: #9ca3af;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    max-width: calc(100% - 120px);
}

.ai-searchbar__ghost.is-hidden {
    display: none;
}

.ai-searchbar__cursor {
    display: inline-block;
    width: 2px;
    height: 1.05em;
    background: #0074FE;
    vertical-align: -2px;
    margin-left: 1px;
    animation: aiSearchBlink 1.05s steps(1) infinite;
}

@keyframes aiSearchBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.ai-searchbar__submit {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    border: none;
    background: #0074FE;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast, all .15s ease);
}

.ai-searchbar__submit:hover {
    background: #0056BE;
}

.catalog__ai-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 24px;
}

.catalog__ai-hint {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    padding-left: 4px;
}

.catalog__ai-history {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 14px;
    color: #374151;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
}

.catalog__ai-history:hover {
    color: #0074FE;
    border-color: #0074FE;
    background: #f5f9ff;
}

@media (max-width: 560px) {
    .catalog__ai-row {
        justify-content: flex-start;
    }
}

/* Панель фильтров */
.filters {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
    padding: 22px 24px;
    margin-bottom: 24px;
}

.filters__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.filters__head-title {
    font-size: 18px;
    font-weight: 700;
    color: #0D1E3B;
    margin: 0;
}

.filters__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.field__label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.field__manual {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--color-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.field__pair--manual {
    margin-top: 8px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field__label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.field__control,
.select {
    height: 46px;
    border: 1px solid #E5E7EB;
    background: #f2f5f9;
    border-radius: 12px;
    padding: 0 14px;
    font-size: 14px;
    font-family: inherit;
    color: #0D1E3B;
    outline: none;
    transition: var(--transition-fast, all .15s ease);
}

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M6 8 0 2l1.4-1.4L6 5.2 10.6.6 12 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 34px;
    cursor: pointer;
}

.field__control:focus,
.select:focus {
    background-color: #fff;
    border-color: #0074FE;
}

.field__pair {
    display: flex;
    gap: 8px;
}

/* Класс перебивает браузерный [hidden]{display:none} по специфичности,
   а ручные поля года скрываются именно атрибутом. */
.field__pair[hidden] {
    display: none;
}

.field__pair .field__control {
    width: 100%;
    min-width: 0;
}

/* Расширенные параметры */
.filters__adv {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height .3s ease, opacity .3s ease;
}

.filters__adv.is-open {
    max-height: 1000px;
    opacity: 1;
    margin-top: 18px;
}

.filters__adv-title {
    font-size: 14px;
    font-weight: 700;
    color: #0D1E3B;
    margin: 0 0 12px;
}

.filters__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #eef1f5;
}

.filters__toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #0074FE;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.filters__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #0074FE;
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
}

.filters__reset {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.filters__reset:hover {
    color: #0074FE;
}

/* Строка результатов */
.results__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.results__count {
    font-size: 16px;
    color: #0D1E3B;
}

.results__count b {
    font-weight: 700;
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: #f2f5f9;
    border-radius: 10px;
    padding: 4px;
}

.view-toggle__btn {
    width: 40px;
    height: 34px;
    border: none;
    background: none;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-toggle__btn.is-active {
    background: #0074FE;
    color: #fff;
}

.sort-select {
    max-width: 220px;
}

/* Грид */
.results--grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.results--list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Карточка грида */
.gcard {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: transform .2s ease, box-shadow .2s ease;
}

.gcard:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
}

.gcard__photo {
    height: 194px;
    background-color: var(--car-placeholder-bg);
    overflow: hidden;
}

.gcard__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gcard__photo--empty {
    background-image: var(--car-placeholder);
    background-repeat: no-repeat;
    background-position: center;
    background-size: auto 72%;
}

.gcard__photo--empty img {
    visibility: hidden;
}

.fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, .92);
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
    z-index: 2;
}

.fav-btn.is-active {
    color: #EF4444;
}

.gcard__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.gcard__price {
    font-size: 22px;
    font-weight: 900;
    color: #0D1E3B;
    margin: 0 0 2px;
}

.gcard__delivery {
    font-size: 12px;
    color: #9ca3af;
    margin: 0 0 10px;
}

.gcard__name {
    font-size: 17px;
    font-weight: 700;
    color: #0D1E3B;
    margin: 0 0 4px;
}

.gcard__gen {
    font-size: 13px;
    color: #9ca3af;
    margin: 0 0 12px;
}

.gcard__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.gcard__chip {
    font-size: 12px;
    color: #374151;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 4px 8px;
}

.gcard__more {
    margin-top: auto;
    text-align: center;
    background: #f2f5f9;
    color: #0074FE;
    border-radius: 10px;
    padding: 10px;
    font-weight: 500;
    font-size: 14px;
}

/* Карточка списка */
.lcard {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    overflow: hidden;
    display: grid;
    grid-template-columns: 264px 1fr 250px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .2s ease;
}

.lcard:hover {
    box-shadow: 0 10px 24px rgba(0, 0, 0, .12);
}

.lcard__photo {
    align-self: stretch;
    min-height: 192px;
    background-color: var(--car-placeholder-bg);
    overflow: hidden;
}

.lcard__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lcard__photo--empty {
    background-image: var(--car-placeholder);
    background-repeat: no-repeat;
    background-position: center;
    background-size: auto 72%;
}

.lcard__photo--empty img {
    visibility: hidden;
}

.lcard__mid {
    padding: 18px 20px;
}

.lcard__name {
    font-size: 20px;
    font-weight: 700;
    color: #0D1E3B;
    margin: 0 0 4px;
}

.lcard__sub {
    font-size: 13.5px;
    color: #9ca3af;
    margin: 0 0 16px;
}

.lcard__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
}

.stat__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #b6bcc6;
    margin: 0 0 2px;
}

.stat__value {
    font-size: 14px;
    font-weight: 500;
    color: #0D1E3B;
    margin: 0;
}

.lcard__side {
    border-left: 1px solid #eef1f5;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    text-align: right;
    position: relative;
}

.lcard__price {
    font-size: 26px;
    font-weight: 900;
    color: #0D1E3B;
    margin: 0;
}

.lcard__delivery {
    font-size: 12px;
    color: #9ca3af;
    margin: 4px 0 0;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination__btn {
    min-width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid #E5E7EB;
    background: #fff;
    color: #0D1E3B;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.pagination__btn.is-active {
    background: #0074FE;
    color: #fff;
    border-color: #0074FE;
}

.pagination__btn:disabled {
    opacity: .5;
    cursor: default;
}

/* Пустое состояние / загрузка */
.results__empty,
.results__loading {
    text-align: center;
    padding: 64px 24px;
    color: #6b7280;
}

.results__empty h3 {
    font-size: 20px;
    color: #0D1E3B;
    margin: 0 0 16px;
}

@media (max-width: 1024px) {
    .results--grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lcard {
        grid-template-columns: 220px 1fr;
    }

    .lcard__side {
        grid-column: 1 / -1;
        border-left: none;
        border-top: 1px solid #eef1f5;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
}

@media (max-width: 640px) {
    .catalog {
        padding: 20px 14px 48px;
    }

    .results--grid {
        grid-template-columns: 1fr;
    }

    .lcard {
        grid-template-columns: 1fr;
    }

    .lcard__photo {
        align-self: auto;
        height: 200px;
        min-height: 0;
    }
}

.field--check {
    display: flex;
    align-items: flex-end;
}

.field__check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--color-gray-700, #334155);
    cursor: pointer;
    padding: 10px 0;
}

.field__check input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.price-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
}

.price-badge--far-below {
    background: var(--price-badge-far-below);
}

.price-badge--below {
    background: var(--price-badge-below);
}

.price-badge--low {
    background: var(--price-badge-low);
}

.price-badge--market {
    background: var(--price-badge-market);
    color: var(--color-gray-900);
}

.price-badge--above {
    background: var(--price-badge-above);
    color: var(--color-gray-900);
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 8px;
}

.lcard__side .card-badges {
    justify-content: flex-end;
    margin: 8px 0 0;
}

.accident-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 8px;
    background: rgba(34, 197, 94, .12);
    color: #16A34A;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
}
