/* ===== PRODUCTS PAGE ===== */

/* Layout */
.products-page {
    padding: 32px 0 48px;
}

.products-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .products-layout {
        grid-template-columns: 200px 1fr;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .products-layout {
        grid-template-columns: 1fr;
    }
}

.products-layout--no-sidebar {
    grid-template-columns: 1fr;
}

/* ===== SEARCH FILTER SIDEBAR ===== */
.search-filter-sidebar {
    position: sticky;
    top: 80px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.sf-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.sf-section:last-child {
    border-bottom: none;
}

.sf-title {
    font-size: 13px;
    font-weight: 600;
    color: #222;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sf-title.sf-collapsible {
    cursor: pointer;
    user-select: none;
}

.sf-title.sf-collapsible .sf-arr {
    font-size: 11px;
    color: #aaa;
    transition: transform 0.2s;
}

.sf-title.sf-collapsible.collapsed .sf-arr {
    transform: rotate(-90deg);
}

.sf-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    font-size: 13px;
    color: #222;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.sf-input:focus {
    border-color: var(--success);
}

.sf-price-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sf-price-input {
    width: 0;
    flex: 1;
}

.sf-price-sep {
    color: #aaa;
    font-size: 13px;
    flex-shrink: 0;
}

.sf-select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    font-size: 13px;
    color: #222;
    outline: none;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s;
}

.sf-select:focus {
    border-color: var(--success);
}

.sf-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sf-list.collapsed {
    display: none;
}

.sf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #444;
    cursor: pointer;
}

.sf-checkbox-label input[type="checkbox"] {
    accent-color: var(--success);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
}

.sf-count {
    font-style: normal;
    color: #aaa;
    font-size: 12px;
}

.sf-actions {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sf-btn-apply {
    width: 100%;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.sf-btn-apply:hover {
    opacity: 0.88;
}

.sf-btn-reset {
    width: 100%;
    display: block;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 0;
    font-size: 13px;
    color: #666;
    text-decoration: none;
    transition: background 0.15s;
}

.sf-btn-reset:hover {
    background: #f5f5f0;
}

/* ===== CATEGORY SIDEBAR ===== */
.products-sidebar {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow: hidden;
    user-select: none;
}

.products-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.products-sidebar > ul > li {
    border-bottom: 1px solid var(--border);
}

.products-sidebar > ul > li:last-child {
    border-bottom: none;
}

.ps-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #222;
    transition: background 0.15s;
    user-select: none;
}

.ps-item:hover {
    background: #f7f7f5;
}

.ps-item.active {
    background: #f0f9f0;
    color: var(--success);
    font-weight: 600;
}

.ps-item .ps-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    font-size: 18px;
    background: #f5f5f0;
}

.ps-item .ps-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ps-item .ps-label {
    flex: 1;
    line-height: 1.3;
}

.ps-item .ps-arr {
    color: #bbb;
    font-size: 12px;
    transition: transform 0.2s;
}

.ps-item.open .ps-arr {
    transform: rotate(90deg);
}

/* Sub items */
.ps-sub {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    background: #fafaf8;
}

.ps-sub.open {
    display: block;
}

.ps-sub li {
    /*padding: 9px 16px 9px 58px;*/
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-top: 1px solid #f0f0ec;
}

.ps-sub li:hover {
    background: #f0f9f0;
    color: var(--success);
}

.ps-sub li.active {
    color: var(--success);
    font-weight: 600;
}

.ps-sub li a {
    display: flex;
    padding: 9px 16px 9px 58px;
}

/* ===== PRODUCTS SEARCH BAR ===== */
.products-search-bar {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}

.psb-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 14px;
    font-size: 15px;
    color: #222;
    background: transparent;
}

.psb-btn {
    flex-shrink: 0;
    background: var(--success);
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: opacity 0.15s;
}

.psb-btn:hover {
    opacity: 0.88;
}

/* ===== PRODUCTS MAIN ===== */
.products-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Toolbar */
.products-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.products-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.products-title {
    font-size: 22px;
    font-weight: 700;
    color: #111;
    margin: 0;
}

.products-count {
    font-size: 13px;
    color: #888;
}

.products-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.products-sort label {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}

.sort-select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 32px 7px 12px;
    font-size: 13px;
    color: #222;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

.sort-select:focus {
    border-color: var(--success);
}

/* Product grid for products page — 4 cols */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1280px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Stars */
.product-card .stars {
    display: flex;
    align-items: baseline;
    gap: 2px;
    color: #f5a623;
    font-size: 12px;
}

.product-card .stars .rc {
    color: #888;
    font-size: 11px;
    margin-left: 2px;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 0;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #fff;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    padding: 0 6px;
    text-decoration: none;
}

.page-btn:hover {
    background: #f5f5f0;
    border-color: #ccc;
}

.page-btn.active {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
    font-weight: 700;
}

.page-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.page-dots {
    font-size: 14px;
    color: #888;
    padding: 0 2px;
}

/* ===== MOBILE: hide sidebar, show as horizontal scroll ===== */
@media (max-width: 768px) {
    .products-sidebar {
        display: none;
    }

    .products-mobile-cats {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding: 0 0 8px;
        scrollbar-width: none;
    }

    .products-mobile-cats::-webkit-scrollbar {
        display: none;
    }

    .pmc-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
        padding: 8px 12px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border);
        font-size: 12px;
        cursor: pointer;
        white-space: nowrap;
        transition: background 0.15s, border-color 0.15s;
        background: #fff;
        color: #333;
    }

    .pmc-item.active {
        background: var(--success);
        border-color: var(--success);
        color: #fff;
    }

    .pmc-item .pmc-icon {
        font-size: 20px;
    }

    .products-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (min-width: 769px) {
    .products-mobile-cats {
        display: none;
    }
}
