/**
 * unified-search.css — Стили для единой страницы поиска
 * omega-auto-parts.kz
 *
 * Расширяет part-search.css стилями для:
 *  - Layout (sidebar + main)
 *  - Каталожных карточек (с фото)
 *  - Прогресс-индикатора (в сайдбаре)
 *  - Фильтра
 *  - Таблицы выбора производителя
 *  - Empty states
 *  - Адаптив
 */

/* ======================== LAYOUT ======================== */

.us-layout {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    align-items: flex-start;
}

.us-sidebar {
    width: 260px;
    min-width: 260px;
    flex-shrink: 0;
}

/* Hide sidebar scrollbar but keep scroll functional */
.us-sidebar::-webkit-scrollbar { width: 3px; }
.us-sidebar::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.us-main {
    flex: 1;
    min-width: 0;
    padding-bottom: 20px;
}

/* ======================== SIDEBAR TOGGLE (mobile) ======================== */

.us-sidebar__toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 15px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    color: #333;
    transition: border-color 0.2s, color 0.2s;
}

.us-sidebar__toggle:hover {
    border-color: #1b6bb1;
    color: #1b6bb1;
}

.us-sidebar__arrow {
    transition: transform 0.2s;
}

/* ======================== SEARCH BOX ======================== */

.us-search-box {
    margin-bottom: 15px;
}

.us-search-box .input-group {
    max-width: 600px;
}

.us-search-box .form-control {
    border-radius: 6px 0 0 6px;
    border: 2px solid #e5e5e5;
    height: 42px;
    font-size: 14px;
}

.us-search-box .form-control:focus {
    border-color: #e7b035;
    box-shadow: none;
}

.us-search-box .btn {
    border-radius: 0 6px 6px 0;
    height: 42px;
}

/* ======================== PROGRESS (SIDEBAR) ======================== */

.us-progress-sidebar {
    margin-bottom: 12px;
}

.us-progress-list {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    transition: opacity 0.5s;
}

.us-progress-list__title {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e7b035;
}

.us-progress-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    font-size: 12px;
    line-height: 1.3;
    transition: color 0.2s;
}

.us-progress-item__status {
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    font-size: 12px;
}

.us-progress-item__label {
    flex: 1;
    min-width: 0;
}

.us-progress-item--pending {
    color: #999;
}

.us-progress-item--loading {
    color: #1b6bb1;
}

.us-progress-item--done {
    color: #5cb85c;
}

.us-progress-item--error {
    color: #d9534f;
}

/* ======================== LOADING ======================== */

.us-loading {
    text-align: center;
    padding: 40px 20px;
}

.us-loading__spinner {
    margin-bottom: 10px;
}

.us-loading__text {
    color: #888;
    font-size: 14px;
}

/* ======================== SECTIONS ======================== */

.us-section {
    margin-bottom: 16px;
}

.us-section__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #fff;
    border-bottom: 2px solid #e7b035;
    margin-bottom: 0;
}

.us-section__title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

.us-section__title .fa {
    color: #999;
    margin-right: 3px;
}

.us-section__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    background: #1b6bb1;
    color: #fff;
}

.us-section__body {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.us-section--loading .us-section__header {
    color: #888;
    border-bottom-color: #e0e0e0;
    background: #fafafa;
}

/* ======================== EMPTY STATES ======================== */

.us-section--empty {
    margin-bottom: 16px;
}

.us-section--empty .us-section__header {
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-bottom: 2px solid #e0e0e0;
    border-radius: 6px 6px 0 0;
}

.us-section__empty-msg {
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-top: none;
    border-radius: 0 0 6px 6px;
    color: #999;
    font-size: 13px;
}

.us-section__empty-msg .fa {
    color: #f0ad4e;
    margin-right: 5px;
}

/* ======================== CATALOG CARD ======================== */

.ps-card--catalog {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
    transition: background 0.15s;
}

.ps-card--catalog:hover {
    background: #f0f6ff;
    box-shadow: none;
}

.ps-card--catalog .ps-card__body {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

.ps-card--catalog:last-child .ps-card__body {
    border-bottom: none;
}

.ps-card__image {
    width: 100px;
    min-width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
    border: 1px solid #eee;
    background: #fafafa;
}

.ps-card__image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ps-card__no-image {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 24px;
    background: #fafafa;
    border-radius: 4px;
}

.ps-card__info--catalog {
    flex: 1;
    min-width: 0;
}

.ps-card__info--catalog .ps-card__name a {
    color: #333;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
}

.ps-card__info--catalog .ps-card__name a:hover {
    color: #1b6bb1;
    text-decoration: underline;
}

.ps-card__category {
    font-size: 11px;
    color: #999;
    margin-top: 3px;
}

.ps-card__category .fa {
    margin-right: 2px;
}

.ps-card__price--na {
    color: #999;
    font-size: 12px;
}

.ps-card__price--order {
    color: #1b6bb1;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.ps-card__price--order .fa {
    margin-right: 3px;
}

.ps-card__detail-btn {
    display: inline-block;
    padding: 6px 14px;
    background: #1b6bb1;
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
}

.ps-card__detail-btn:hover {
    background: #155a96;
    color: #fff;
    text-decoration: none;
}

/* ======================== MANUFACTURER SELECTION ======================== */

.us-mfr-selection {
    margin-bottom: 20px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.us-mfr-selection h4 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 700;
    color: #333;
    border-bottom: 2px solid #e7b035;
    padding-bottom: 8px;
}

.us-mfr-selection p {
    margin: 0 0 10px;
    color: #666;
}

.us-mfr-selection .table {
    margin-bottom: 0;
}

.us-mfr-selection .btn-primary {
    background: #1b6bb1;
    border-color: #1b6bb1;
}

.us-mfr-selection .btn-primary:hover {
    background: #155a96;
    border-color: #155a96;
}

/* ======================== FILTER ======================== */

/* === ФИЛЬТРЫ ПОИСКА — стиль как в каталоге (oap-catalogue-redesign.css) === */
#us-filter-area {
    background: #fff;
    border: 1px solid var(--oap-border, #e0e0e0);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.us-filter-loading,
.us-filter-empty {
    padding: 10px 0;
    color: #999;
    text-align: center;
    font-size: 12px;
}

.us-filter-loading .fa {
    margin-right: 4px;
}

.us-filter__block {
    margin: 0 0 2px;
    padding: 0;
    border: none;
    background: transparent;
}
.us-filter__block + .us-filter__block {
    border-top: 1px solid #ebebeb;
}

/* Заголовки — как .one_property h4 в каталоге */
.us-filter__block-title {
    padding: 6px 0 4px;
    font-weight: 500;
    font-size: 12px;
    color: var(--oap-text-1, #424242);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    background: transparent;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0 4px;
}
.us-filter__block:first-child .us-filter__block-title {
    margin-top: 4px;
}

.us-filter__block-title:hover {
    color: var(--oap-accent, #1b6bb1);
}

.us-filter__count {
    color: #9e9e9e;
    font-weight: 400;
    font-size: 11px;
    margin-left: 4px;
}

.us-filter__chevron {
    color: #bbb;
    font-size: 10px;
    transition: transform 0.2s;
}

.us-filter__block-body {
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}
.us-filter__block-body::-webkit-scrollbar { width: 3px; }
.us-filter__block-body::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* Опции — как .list_div > div в каталоге */
.us-filter__option {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
    font-size: 13px;
    cursor: pointer;
    color: var(--oap-text-1, #424242);
}
.us-filter__option:hover {
    color: var(--oap-accent, #1b6bb1);
}

/* Чекбоксы — accent-color как в каталоге */
.us-filter__option input[type="checkbox"] {
    accent-color: var(--oap-accent, #1b6bb1);
    width: 15px;
    height: 15px;
    vertical-align: middle;
    margin: 0 4px 0 0;
    flex-shrink: 0;
    cursor: pointer;
}

/* Counts — как .match_products_count */
.us-filter__opt-count {
    font-size: 11px;
    color: #9e9e9e;
    margin-left: 2px;
}

/* Поиск внутри фильтра */
.us-filter__search {
    width: 100%;
    padding: 4px 8px;
    margin-bottom: 6px;
    border: 1px solid var(--oap-border, #ddd);
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    outline: none;
    box-sizing: border-box;
    background: #fafafa;
}
.us-filter__search:focus {
    border-color: var(--oap-accent, #1b6bb1);
}
.us-filter__search::placeholder {
    color: #bbb;
}

.us-filter__storage-color {
    display: inline-block;
    width: 16px;
    height: 6px;
    border-radius: 2px;
    border: 1px solid #ddd;
    margin-right: 3px;
    vertical-align: middle;
}

/* Ещё варианты — как в каталоге */
.us-filter__show-all {
    display: block;
    padding: 4px 0;
    font-size: 12px;
    color: var(--oap-accent, #1b6bb1);
    cursor: pointer;
    text-decoration: none;
}
.us-filter__show-all:hover {
    text-decoration: underline;
}

/* Кнопка сброса — как .btn-sidebar-reset в каталоге */
.us-filter__actions {
    padding: 8px 0 0;
    margin-top: 8px;
}
.us-filter__actions .btn {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--oap-border, #ddd) !important;
    border-radius: 6px;
    background: #f5f5f5 !important;
    color: var(--oap-text-1, #424242) !important;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.us-filter__actions .btn:hover {
    background: #e3f2fd !important;
    border-color: var(--oap-accent, #1b6bb1) !important;
    color: var(--oap-accent, #1b6bb1) !important;
}

/* ======================== TOGGLE (ТОЛЬКО В НАЛИЧИИ) ======================== */

.us-filter__toggle {
    padding: 8px 0 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.us-filter__toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #444;
    margin: 0;
}

.us-filter__toggle-label input[type="checkbox"] {
    display: none;
}

.us-filter__toggle-switch {
    position: relative;
    width: 34px;
    height: 18px;
    background: #ccc;
    border-radius: 9px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.us-filter__toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.us-filter__toggle-label input:checked + .us-filter__toggle-switch {
    background: #5cb85c;
}

.us-filter__toggle-label input:checked + .us-filter__toggle-switch::after {
    transform: translateX(16px);
}

.us-filter__toggle-text {
    flex: 1;
    line-height: 1.3;
}

/* ======================== CHIPS (АКТИВНЫЕ ФИЛЬТРЫ) ======================== */

.us-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 8px;
}

.us-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e8f0fe;
    border: 1px solid #c5d9f1;
    border-radius: 14px;
    padding: 3px 8px 3px 10px;
    font-size: 12px;
    line-height: 1.3;
    color: #1b6bb1;
    white-space: nowrap;
    max-width: 200px;
}

.us-chip__label {
    color: #888;
    font-size: 11px;
}

.us-chip__value {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.us-chip__remove {
    background: none;
    border: none;
    color: #1b6bb1;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.us-chip__remove:hover {
    opacity: 1;
}

.us-chips__clear {
    background: none;
    border: none;
    color: #999;
    font-size: 11px;
    cursor: pointer;
    padding: 3px 6px;
    text-decoration: underline;
    transition: color 0.15s;
}

.us-chips__clear:hover {
    color: #d9534f;
}

/* ======================== SORT BAR ======================== */

.ps-sort-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 12px;
}

.ps-sort-bar__label {
    font-size: 12px;
    color: #888;
    margin-right: 4px;
    white-space: nowrap;
}

.ps-sort-btn {
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.ps-sort-btn:hover {
    border-color: #1b6bb1;
    color: #1b6bb1;
}

.ps-sort-btn.active {
    background: #1b6bb1;
    border-color: #1b6bb1;
    color: #fff;
}

.ps-sort-btn .sort-arrow {
    font-size: 9px;
    margin-left: 2px;
}

.ps-sort-bar__count {
    margin-left: auto;
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

/* ======================== RESPONSIVE ======================== */

/* Tablet: sidebar → full width, toggle visible */
@media (max-width: 991px) {
    .us-layout {
        flex-direction: column;
    }

    .us-sidebar {
        width: 100%;
        min-width: 0;
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    .us-sidebar__toggle {
        display: flex;
    }

    .us-sidebar__body {
        display: none;
    }

    .us-sidebar__body.open {
        display: block;
    }

    .us-progress-sidebar {
        margin-bottom: 10px;
    }
}

/* Desktop: hide toggle */
@media (min-width: 992px) {
    .us-sidebar__toggle {
        display: none;
    }
}

/* Mobile: compact cards */
@media (max-width: 600px) {
    .ps-card--catalog .ps-card__body {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px;
    }

    .ps-card__image {
        width: 50px;
        min-width: 50px;
        height: 50px;
    }

    .ps-card__detail-btn {
        width: 100%;
        text-align: center;
    }

    .us-search-box .input-group {
        max-width: 100%;
    }

    .us-section__header {
        padding: 8px 10px;
    }

    .us-section__title {
        font-size: 13px;
    }

    /* Touch-friendly filter checkboxes */
    .us-filter__option {
        padding: 5px 0;
        min-height: 32px;
    }

    .us-filter__option input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }

    .us-filter__range-inputs input {
        width: 100%;
    }

    /* Chips */
    .us-chip {
        max-width: 160px;
        font-size: 11px;
    }

    /* Sort bar */
    .ps-sort-bar {
        padding: 6px 8px;
        gap: 3px;
    }

    .ps-sort-btn {
        padding: 3px 7px;
        font-size: 11px;
    }

    .ps-sort-bar__label {
        display: none;
    }
}

/* Footer: счётчик + показать ещё */
.us-section__footer {
    text-align: center;
    padding: 12px 0;
    margin-top: 6px;
}
.us-section__counter {
    font-size: 13px;
    color: #888;
}
.us-load-more {
    margin-left: 10px;
    padding: 8px 28px !important;
    font-size: 14px !important;
    font-weight: 600;
    background: #1b6bb1 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer;
    transition: background 0.15s;
}
.us-load-more:hover {
    background: #155a96 !important;
    color: #fff !important;
}
/* Общий счётчик сверху */
.us-catalog-summary {
    padding: 10px 14px;
    margin-bottom: 8px;
    background: #f5f8fc;
    border: 1px solid #e0e8f0;
    border-radius: 6px;
}
.us-catalog-summary__text {
    font-size: 14px;
    font-weight: 600;
    color: #1b6bb1;
}
.us-loading-inline {
    font-size: 13px;
    color: #888;
    margin-left: 8px;
}
