/* =====================================================================
 * ТАБЛИЦА КАТАЛОГА И ЖИВОЙ ПОИСК
 *
 * Подключается после content.css (см. inc/assets.php).
 * ===================================================================== */

/* ---------------------------------------------------------------------
 * 1. ФИЛЬТРЫ НАД ТАБЛИЦЕЙ
 * ------------------------------------------------------------------ */

.ho-table {
    margin-bottom: 32px;
}

.ho-table__filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px 16px;
    align-items: end;
    padding: 16px;
    margin-bottom: 18px;
    border: 1px solid var(--ho-border);
    border-radius: 12px;
    background: var(--ho-bg-soft);
}

.ho-table__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: var(--ho-fs-xs);
    color: var(--ho-muted);
}

.ho-table__field > span {
    font-weight: 500;
}

.ho-table__field input[type="search"],
.ho-table__field select {
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--ho-border);
    border-radius: 8px;
    background: var(--ho-bg);
    color: var(--ho-text);
    font: inherit;
    font-size: var(--ho-fs-sm);
}

.ho-table__field input[type="search"]:focus,
.ho-table__field select:focus {
    outline: 2px solid var(--ho-accent);
    outline-offset: 1px;
}

.ho-table__field--check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    font-size: var(--ho-fs-sm);
    color: var(--ho-text);
}

.ho-table__field--check input {
    width: 18px;
    height: 18px;
    accent-color: var(--ho-accent);
}

.ho-table__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    grid-column: span 2;
}

.ho-table__actions .ho-btn {
    min-height: 44px;
    padding: 10px 22px;
}

.ho-table__reset {
    font-size: var(--ho-fs-sm);
    color: var(--ho-link-legal);
    text-decoration: underline;
}

.ho-table__found {
    grid-column: 1 / -1;
    margin: 0;
    font-size: var(--ho-fs-sm);
    color: var(--ho-muted);
}

/* ---------------------------------------------------------------------
 * 2. САМА ТАБЛИЦА
 * ------------------------------------------------------------------ */

.ho-table__scroll {
    overflow-x: auto;
    /* Таблица шире контейнера и уезжает за вьюпорт: без contain браузер
       учитывает её ширину в scrollWidth документа и появляется «фантомный»
       горизонтальный скролл всей страницы. contain: paint это убирает,
       а внутренняя прокрутка таблицы остаётся. */
    contain: paint;
    border: 1px solid var(--ho-border);
    border-radius: 12px;
    background: var(--ho-bg);
    -webkit-overflow-scrolling: touch;
}

.ho-table__table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    font-size: var(--ho-fs-sm);
}

.ho-table__table th,
.ho-table__table td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--ho-border-light);
}

.ho-table__table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--ho-blue);
    color: #fff;
    font-size: var(--ho-fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.ho-table__table tbody tr:hover {
    background: var(--ho-accent-soft);
}

.ho-table__table tbody tr:last-child td {
    border-bottom: 0;
}

.ho-table__cell-check {
    width: 44px;
    text-align: center;
}

.ho-table__cell-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--ho-accent);
}

.ho-table__product {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 240px;
}

.ho-table__thumb {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    overflow: hidden;
    border: 1px solid var(--ho-border-light);
    border-radius: 8px;
    background: var(--ho-bg-soft);
}

.ho-table__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ho-table__thumb-empty {
    color: var(--ho-muted-light);
}

.ho-table__product-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ho-table__title {
    color: var(--ho-dark);
    font-weight: 500;
    line-height: 1.35;
}

.ho-table__title:hover {
    color: var(--ho-accent);
}

.ho-table__desc {
    font-size: var(--ho-fs-xs);
    color: var(--ho-muted);
}

.ho-table__attr {
    white-space: nowrap;
}

.ho-table__muted {
    color: var(--ho-muted-light);
}

.ho-table__price {
    font-size: var(--ho-fs-base);
    font-weight: 700;
    white-space: nowrap;
}

.ho-table__price del {
    display: block;
    font-size: var(--ho-fs-xs);
    color: var(--ho-muted-light);
    font-weight: 400;
}

.ho-table__price ins {
    text-decoration: none;
    color: var(--ho-accent);
}

.ho-table__price--request {
    font-size: var(--ho-fs-sm);
    font-weight: 500;
    color: var(--ho-muted);
}

.ho-table__stock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--ho-fs-xs);
    white-space: nowrap;
}

.ho-table__stock::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ho-success);
}

.ho-table__stock--order::before {
    background: var(--ho-muted-light);
}

.ho-table__qty {
    width: 72px;
    min-height: 40px;
    padding: 6px 8px;
    border: 1px solid var(--ho-border);
    border-radius: 8px;
    font: inherit;
    font-size: var(--ho-fs-sm);
    text-align: center;
}

.ho-table__cell-order .ho-btn {
    min-height: 40px;
    padding: 8px 16px;
    font-size: var(--ho-fs-xs);
    white-space: nowrap;
}

/* ---------------------------------------------------------------------
 * 3. НИЖНЯЯ ПАНЕЛЬ ТАБЛИЦЫ
 * ------------------------------------------------------------------ */

.ho-table__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding-top: 16px;
}

.ho-table__foot .ho-btn[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

.ho-table__status {
    font-size: var(--ho-fs-sm);
}

.ho-table__status.is-success {
    color: var(--ho-success);
}

.ho-table__status.is-error {
    color: var(--ho-danger);
}

.ho-table__pagination {
    margin-top: 24px;
}

/* ---------------------------------------------------------------------
 * 4. ПОДСКАЗКИ ЖИВОГО ПОИСКА
 * ------------------------------------------------------------------ */

.ho-search {
    position: relative;
}

.ho-suggest {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 40;
    max-height: 420px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--ho-border);
    border-radius: 12px;
    background: var(--ho-bg);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .16);
}

.ho-suggest[hidden] {
    display: none;
}

.ho-suggest__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--ho-text);
}

.ho-suggest__item:hover,
.ho-suggest__item.is-active {
    background: var(--ho-bg-soft);
}

.ho-suggest__thumb {
    flex: 0 0 auto;
    display: block;
    width: 44px;
    height: 44px;
    overflow: hidden;
    border: 1px solid var(--ho-border-light);
    border-radius: 6px;
    background: var(--ho-bg-soft);
}

.ho-suggest__thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ho-suggest__body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ho-suggest__title {
    font-size: var(--ho-fs-sm);
    line-height: 1.3;
}

.ho-suggest__sku {
    font-size: var(--ho-fs-xs);
    color: var(--ho-muted-light);
}

.ho-suggest__price {
    margin-left: auto;
    font-size: var(--ho-fs-sm);
    font-weight: 700;
    white-space: nowrap;
}

.ho-suggest__all {
    display: block;
    padding: 10px;
    font-size: var(--ho-fs-sm);
    text-align: center;
    color: var(--ho-link-legal);
    text-decoration: underline;
}

.ho-suggest__empty {
    padding: 14px 10px;
    font-size: var(--ho-fs-sm);
    color: var(--ho-muted);
    text-align: center;
}
