/* ==========================================================================
   Part Search Redesign — Hybrid Card-Row Layout
   omega-auto-parts.kz
   ========================================================================== */

/* --- Layout: sidebar + main --- */
.ps-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.ps-sidebar {
    width: 260px;
    min-width: 260px;
    flex-shrink: 0;
}
.ps-main {
    flex: 1;
    min-width: 0;
}

/* --- Sidebar Filters --- */
.ps-filters {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 16px;
    position: sticky;
    top: 10px;
}
.ps-filters__title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e7b035;
}
.ps-filter-group {
    margin-bottom: 16px;
}
.ps-filter-group__label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.ps-filter-group .slider_container {
    padding: 0 4px;
}
.ps-filter-group .slider_ranges {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}
.ps-filter-group .slider_ranges input {
    width: 100%;
    text-align: center;
    font-size: 12px;
    padding: 3px 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.ps-filter-group .slider_ranges span {
    color: #999;
    font-size: 12px;
}
.ps-filter-checks {
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}
.ps-filter-checks::-webkit-scrollbar {
    width: 4px;
}
.ps-filter-checks::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}
.ps-filter-check {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    cursor: pointer;
    font-size: 13px;
    color: #444;
}
.ps-filter-check input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}
.ps-filter-check__count {
    color: #999;
    font-size: 11px;
    margin-left: auto;
}
.ps-filters__reset {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 12px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #888;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}
.ps-filters__reset:hover {
    border-color: #e7b035;
    color: #333;
}

/* --- Sort Bar --- */
.ps-sort-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8f8f8;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #666;
    flex-wrap: wrap;
}
.ps-sort-bar__label {
    font-weight: 600;
    color: #333;
    margin-right: 4px;
}
.ps-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #555;
    transition: all 0.15s;
    white-space: nowrap;
}
.ps-sort-btn:hover {
    border-color: #e7b035;
    color: #333;
}
.ps-sort-btn.active {
    background: #e7b035;
    border-color: #e7b035;
    color: #fff;
    font-weight: 600;
}
.ps-sort-btn .sort-arrow {
    font-size: 10px;
    opacity: 0.7;
}
.ps-sort-bar__count {
    margin-left: auto;
    color: #999;
    font-size: 12px;
}

/* --- Section Headers --- */
.ps-section {
    margin-bottom: 20px;
}
.ps-section__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 2px solid #e7b035;
}
.ps-section__title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin: 0;
}
.ps-section__count {
    font-size: 13px;
    color: #999;
    font-weight: 400;
}
.ps-section__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}
.ps-section__badge--required { background: #5cb85c; }
.ps-section__badge--replacement { background: #f0ad4e; }
.ps-section__badge--quick { background: #5bc0de; }
.ps-section__badge--analog { background: #6c757d; }
.ps-section__badge--name { background: #337ab7; }

/* --- Product Card (Hybrid Row) --- */
.ps-card {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    margin-bottom: 6px;
    transition: box-shadow 0.15s, border-color 0.15s;
    overflow: hidden;
    position: relative;
}



/* Color strip (warehouse indicator) */
.ps-card__color {
    width: 4px;
    flex-shrink: 0;
}

/* Card body */
.ps-card__body {
    display: flex;
    align-items: center;
    flex: 1;
    padding: 10px 14px;
    gap: 16px;
    min-width: 0;
}

/* === Product Image === */
.ps-card__image {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
}
.ps-card__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.ps-card__no-image {
    color: #d0d0d0;
    font-size: 22px;
}

/* === LEFT: Info block (наименование, подпись, описание, стикеры) === */
.ps-card__info {
    flex: 1;
    min-width: 0;
}
.ps-card__name {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    margin-bottom: 3px;
}
.ps-card__name a {
    color: #333;
    text-decoration: none;
    transition: color 0.15s;
}
.ps-card__name a:hover {
    color: #1b6bb1;
    text-decoration: underline;
}

/* Subtitle: Склад */
.ps-card__subtitle {
    font-size: 12px;
    color: #888;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ps-card__storage {
    color: #999;
}

/* Description */
.ps-card__desc {
    font-size: 11px;
    color: #999;
    line-height: 1.3;
    margin-bottom: 3px;
}

/* Meta info (аналог, марка, модель) */
.ps-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-bottom: 3px;
}
.ps-card__meta-item {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
}
.ps-card__meta-item b {
    color: #999;
    font-weight: 500;
}

/* Stickers (Супер цена, Хит, Новинка) */
.ps-card__stickers {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.ps-sticker {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid;
}
.ps-sticker--promo {
    background: #b85c5c;
    color: #fff;
    border-color: #b85c5c;
}
.ps-sticker--hit {
    background: #FFA500;
    color: #fff;
    border-color: #FFA500;
}
.ps-sticker--new {
    background: #1edb71;
    color: #fff;
    border-color: #1edb71;
}
.ps-sticker--discount {
    background: #e3f2fd;
    color: #1b6bb1;
    border-color: #90caf9;
}

/* Meta (legacy, kept for catalog cards) */
.ps-card__meta {
    font-size: 11px;
    color: #999;
    margin-top: 3px;
}

/* Icons (only min-order warning now) */
.ps-card__icons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.ps-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: #f5f5f5;
    color: #777;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}
.ps-card__icon:hover {
    background: #e7b035;
    color: #fff;
}

/* === RIGHT: Stock + Price + Cart — одна строка === */
.ps-card__right {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Exist (inline) */
.ps-card__exist {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}
.ps-card__exist--high { color: #388e3c; }
.ps-card__exist--medium { color: #f57f17; }
.ps-card__exist--low { color: #e53935; }
.ps-card__exist--order { color: #e67e22; font-weight: 500; font-size: 13px; }

/* Price (inline) */
.ps-card__price {
    font-size: 17px;
    font-weight: 700;
    color: var(--oap-text-1, #222);
    white-space: nowrap;
}
.ps-card__price--promo {
    color: #c62828;
}

/* Cart block — inline row */
.ps-card__cart {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.ps-card__cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--oap-accent, #1b6bb1);
    color: #fff;
    border: none;
    border-radius: var(--oap-r, 4px);
    font-size: 0;
    cursor: pointer;
    transition: background 0.15s;
    overflow: hidden;
    line-height: 1;
    flex-shrink: 0;
}
.ps-card__cart-btn::before {
    font-family: 'Material Icons';
    content: 'shopping_cart';
    font-size: 18px;
    color: #fff;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
}
.ps-card__cart-btn:hover {
    background: var(--oap-accent-dk, #155a96);
    box-shadow: 0 2px 6px rgba(27, 107, 177, 0.25);
}
/* Disabled state (На заказ) */
.ps-card__cart--disabled {
    opacity: 0.5;
}
.ps-card__cart--disabled .ps-card__cart-btn {
    background: #bbb;
    cursor: default;
}
.ps-card__cart--disabled .ps-card__qty {
    background: #f0f0f0;
    border-color: #d0d0d0;
}
.ps-card__qty {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: none;
    border-radius: 0;
    overflow: visible;
    background: none;
    font-weight: 400;
}
.ps-card__qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 32px;
    background: #eee;
    border: none;
    color: #555;
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}
.ps-card__qty-btn:first-child {
    border-radius: var(--oap-r, 4px) 0 0 var(--oap-r, 4px);
}
.ps-card__qty-btn:last-child {
    border-radius: 0 var(--oap-r, 4px) var(--oap-r, 4px) 0;
}
.ps-card__qty-btn:hover {
    background: #ddd;
}
.ps-card__qty-btn .material-icons {
    font-size: 16px;
}
.ps-card__qty-input {
    width: 36px;
    height: 32px;
    text-align: center;
    border: none;
    font-size: 13px;
    font-weight: 400;
    padding: 0;
    background: #fff;
    color: #222;
    outline: none;
    -moz-appearance: textfield;
}
.ps-card__qty-input::-webkit-outer-spin-button,
.ps-card__qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- Highlighting --- */
.ps-highlight {
    background: linear-gradient(to bottom, transparent 50%, #ffe082 50%);
    padding: 0 1px;
    border-radius: 2px;
    font-weight: 600;
    color: #333;
}

/* --- Show More Button --- */
.ps-show-more {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    background: #fafafa;
    border: 1px dashed #ddd;
    border-radius: 6px;
    color: #666;
    font-size: 13px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}
.ps-show-more:hover {
    background: #f0f0f0;
    border-color: #ccc;
    color: #333;
}

/* --- Loading States --- */
.ps-loading {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}
.ps-loading__spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: #e7b035;
    border-radius: 50%;
    animation: ps-spin 0.8s linear infinite;
}
@keyframes ps-spin {
    to { transform: rotate(360deg); }
}
.ps-loading__text {
    margin-top: 10px;
    font-size: 14px;
}

/* --- Empty State --- */
.ps-empty {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}
.ps-empty__icon {
    font-size: 48px;
    margin-bottom: 12px;
    color: #ddd;
}
.ps-empty__text {
    font-size: 16px;
    color: #666;
    margin-bottom: 16px;
}
.ps-empty__action {
    display: inline-block;
    padding: 10px 24px;
    background: #e7b035;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
}
.ps-empty__action:hover {
    background: #d4a030;
    color: #fff;
    text-decoration: none;
}

/* --- Manufacturer Selection --- */
.ps-manufacturers {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
}
.ps-manufacturers__title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}
.ps-mfr-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.15s;
}
.ps-mfr-item:hover {
    background: #f8f6f0;
    border-color: #e7b035;
}
.ps-mfr-item__name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}
.ps-mfr-item__desc {
    font-size: 12px;
    color: #888;
}
.ps-mfr-item__btn {
    padding: 4px 14px;
    background: #e7b035;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.ps-mfr-item__btn:hover {
    background: #d4a030;
}

/* --- Search Input on Results Page --- */
.ps-search-box {
    margin-bottom: 16px;
}
.ps-search-box .form-control {
    border-radius: 6px 0 0 6px;
    border: 2px solid #e5e5e5;
    height: 42px;
    font-size: 14px;
}
.ps-search-box .form-control:focus {
    border-color: #e7b035;
    box-shadow: none;
}
.ps-search-box .btn {
    border-radius: 0 6px 6px 0;
    height: 42px;
    background: #e7b035;
    border-color: #e7b035;
    color: #fff;
    font-weight: 600;
}
.ps-search-box .btn:hover {
    background: #d4a030;
}

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

/* Tablet: hide sidebar, stack filters above */
@media screen and (max-width: 991px) {
    .ps-layout {
        flex-direction: column;
    }
    .ps-sidebar {
        width: 100%;
        min-width: unset;
    }
    .ps-filters {
        position: static;
    }
    .ps-filters--collapsed .ps-filter-group,
    .ps-filters--collapsed .ps-filters__reset {
        display: none;
    }
    .ps-filters__toggle {
        display: block;
    }
}
@media screen and (min-width: 992px) {
    .ps-filters__toggle {
        display: none;
    }
}
.ps-filters__toggle {
    background: none;
    border: none;
    color: #e7b035;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin-bottom: 10px;
}

/* Mobile: vertical card layout */
@media screen and (max-width: 767px) {
    .ps-card__body {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 10px;
        gap: 8px;
    }
    .ps-card__image {
        width: 45px;
        height: 45px;
    }
    .ps-card__info {
        flex: 1;
        min-width: 0;
    }
    .ps-card__right {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }
    .ps-card__stock {
        flex-direction: row;
        gap: 12px;
        min-width: unset;
    }
    .ps-card__price-block {
        min-width: unset;
        text-align: left;
    }
    .ps-card__price {
        font-size: 15px;
    }
    .ps-card__cart {
        min-width: unset;
        flex-direction: row;
        gap: 6px;
        width: 100%;
    }
    .ps-card__cart-btn {
        flex: none;
    }
    .ps-card__meta {
        display: none;
    }
    .ps-card__cart {
        width: auto;
    }
    .ps-sort-bar {
        font-size: 11px;
    }
    .ps-sort-btn {
        padding: 3px 8px;
        font-size: 11px;
    }
    .ps-section__title {
        font-size: 13px;
    }
    .ps-card__subtitle {
        white-space: normal;
    }
    .ps-card__desc {
        -webkit-line-clamp: 1;
    }
}

/* Desktop: full row */
@media screen and (min-width: 768px) {
    .ps-card__body {
        flex-wrap: nowrap;
    }
}
