/* ==========================================
   PRODUCTS LISTING PAGE
   ========================================== */
.products-page {
    padding: 10px 0 30px;
    background: #f5f5f5;
    min-height: 60vh;
}

/* ---- Header: breadcrumb title + product count on one line ---- */
.products-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 14px;
}

.products-breadcrumb {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #222;
    line-height: 1.4;
}

    .products-breadcrumb a,
    .products-breadcrumb .breadcrumb-current {
        color: #666;
        text-decoration: none;
        font-weight: 600;
        font-size: 1rem;
        transition: color .2s ease;
    }

        .products-breadcrumb a:hover {
            color: var(--primary, #e53935);
            text-decoration: underline;
        }

    .products-breadcrumb .breadcrumb-sep {
        color: #bbb;
        margin: 0 8px;
        font-weight: 400;
        font-size: 1rem;
    }

    /* Last breadcrumb segment (current page) is visually emphasized to
       indicate the active location, while still matching the same
       font-family/size as the rest of the breadcrumb. */
    .products-breadcrumb .breadcrumb-current:last-child {
        /*color: var(--primary, #e53935);*/
        font-weight: 700;
    }

.products-count {
    margin: 0;
    color: #777;
    font-size: .95rem;
    white-space: nowrap;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    min-height: 48px;
    line-height: 1.5;
}

    .product-title a {
        color: inherit;
        text-decoration: none;
    }

/* Featured product titles are rendered as links to the product detail page.
   Keep them looking like plain text (no underline, inherit color) so they
   visually match the non-linked product cards in the listing page. */
.featured-products .product-title a {
    color: inherit;
    text-decoration: none;
}

.products-page .product-sku {
    color: var(--primary);
    font-size: .8rem;
    margin-top: 4px;
    margin-bottom: 4px;
}

.products-page .product-location {
    color: var(--primary);
    font-size: .8rem;
    margin-top: 4px;
    margin-bottom: 4px;
}

.products-page .product-brand {
    display: flex;
    flex-direction: column;
    color: #888;
    font-size: .9rem;
    margin-bottom: 8px;
    line-height: 1.4;
}

    .products-page .product-brand .fitment-make {
        font-weight: 600;
        color: var(--secondary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .products-page .product-brand .fitment-model {
        font-weight: 600;
        color: var(--secondary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.products-page .product-title {
    font-size: 1rem;
    font-weight: 600;
    min-height: 66px;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Mobile: title and count stack onto two lines, count moves below and
   left-aligns under the title instead of floating to the right. */
@media (max-width: 576px) {
    .products-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .products-breadcrumb {
        font-size: 1.2rem;
    }

        .products-breadcrumb a,
        .products-breadcrumb .breadcrumb-sep {
            font-size: .9rem;
        }

    .products-count {
        white-space: normal;
    }

    /* ---- Product Card mobile fixes ---- */
    /* Tighter padding and a smaller fixed image box so cards don't consume
       excessive vertical space when stacked in a single column. */
    .products-page .product-card {
        padding: 12px;
    }

    .products-page .product-image {
        height: 140px;
        margin-bottom: 12px;
    }

        .products-page .product-image img {
            max-height: 120px;
        }

    /* Drop the fixed min-height (used on desktop to equalize grid rows);
       on mobile the clamp alone keeps titles compact without big gaps. */
    .products-page .product-title {
        min-height: 0;
        -webkit-line-clamp: 2;
        font-size: .95rem;
    }

    .products-page .product-price {
        margin-bottom: 12px;
    }

    .products-page .current-price {
        font-size: 1.3rem;
    }

    .products-page .add-cart-btn {
        height: 42px;
    }
}

/* ---- Two-Column Layout: Filters Sidebar (left) + Product Grid (right) ---- */
.products-page .products-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.products-page .products-sidebar {
    flex: 0 0 260px;
    max-width: 260px;
}

.products-page .products-main {
    flex: 1 1 auto;
    min-width: 0;
}

@media (max-width: 767px) {
    .products-page .products-layout {
        flex-direction: column;
    }

    .products-page .products-sidebar {
        flex: 1 1 auto;
        max-width: 100%;
        width: 100%;
    }
}

/* ---- Filters Panel ---- */
.products-page .filters-panel {
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 8px;
    padding: 20px;
    position: sticky;
    top: 20px;
}

.products-page .filters-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 2px solid #eee;
}

    .products-page .filters-panel-header h2 {
        margin: 0;
        font-size: 1.15rem;
        font-weight: 700;
        color: #222;
    }

.products-page .filters-clear-all,
.products-page .filters-reset {
    font-size: .85rem;
    font-weight: 600;
    color: var(--primary, #e53935);
    text-decoration: underline;
}

    .products-page .filters-clear-all:hover,
    .products-page .filters-reset:hover {
        color: #c62828;
    }

.products-page .filters-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

    .products-page .filters-section-header h3 {
        margin: 0;
        font-size: 1rem;
        font-weight: 700;
        color: #333;
    }

.products-page .category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.products-page .category-list-item {
    border-bottom: 1px solid #f2f2f2;
}

    .products-page .category-list-item:last-child {
        border-bottom: none;
    }

    .products-page .category-list-item a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 10px 4px;
        color: #555;
        text-decoration: none;
        font-size: .92rem;
        transition: color .2s ease;
    }

        .products-page .category-list-item a:hover {
            color: var(--primary, #e53935);
        }

        .products-page .category-list-item a .category-name {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .products-page .category-list-item a .category-count {
            color: #999;
            font-size: .85rem;
            flex-shrink: 0;
        }

    .products-page .category-list-item.active a {
        color: var(--primary, #e53935);
        font-weight: 700;
    }

        .products-page .category-list-item.active a .category-count {
            color: var(--primary, #e53935);
        }

/* ---- Product Card (shared visual style with homepage) ---- */
.products-page .product-card {
    position: relative;
    border: 1px solid #ececec;
    background: #fff;
    padding: 15px;
    height: 100%;
    transition: all .3s ease;
    display: flex;
    flex-direction: column;
}

    .products-page .product-card:hover {
        transform: translateY(-6px);
        box-shadow: 0 12px 30px rgba(0,0,0,.08);
    }

/* Fixed-size image box: guarantees every card renders identically
   regardless of the source image's native width/height, without
   distorting or cropping the photo. */
.products-page .product-image {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

    .products-page .product-image img {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 170px;
        object-fit: contain;
    }

.products-page .product-price {
    margin-bottom: 18px;
}

.products-page .current-price {
    font-size: 1.5rem;
    font-weight: 700;
}

.products-page .old-price {
    color: #999;
    text-decoration: line-through;
    margin-left: 10px;
}

.products-page .add-cart-btn {
    width: 100%;
    height: 48px;
    margin-top: auto;
}

.products-page .badge-sale,
.products-page .badge-new {
    position: absolute;
    top: 12px;
    font-size: .8rem;
    padding: 4px 10px;
    border-radius: 20px;
    z-index: 2;
}

.products-page .badge-sale {
    left: 12px;
    background: #ef2b10;
    color: white;
    font-weight: 700;
}

.products-page .badge-new {
    left: 12px;
    background: #f3f3f3;
    font-weight: 600;
}

/* ---- No Results ----
   Centered, card-styled empty state matching the product-card visual
   language (white bg, subtle border/shadow) instead of a generic alert box. */
.products-page .products-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 8px;
    min-height: 420px;
    padding: 60px 24px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .04);
}

.products-page .products-empty-icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fdecea;
    color: var(--primary, #e53935);
    font-size: 1.6rem;
    margin-bottom: 20px;
}

.products-page .products-empty-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 8px;
}

.products-page .products-empty-text {
    color: #777;
    font-size: .95rem;
    max-width: 420px;
    margin-bottom: 24px;
}

.products-page .products-empty-link {
    display: inline-block;
    padding: 10px 28px;
    border-radius: 4px;
    background: var(--primary, #e53935);
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    transition: background .2s ease, transform .2s ease;
}

    .products-page .products-empty-link:hover {
        background: #c62828;
        color: #fff;
        transform: translateY(-2px);
    }

/* ---- Pagination (themed to match site colors) ---- */
.products-page .pagination {
    gap: 6px;
}

    .products-page .pagination .page-link {
        border: 1px solid #ddd;
        color: #333;
        min-width: 42px;
        height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        font-weight: 600;
        transition: all .2s ease;
    }

        .products-page .pagination .page-link:hover {
            background: var(--primary, #e53935);
            border-color: var(--primary, #e53935);
            color: #fff;
        }

    .products-page .pagination .page-item.active .page-link {
        background: var(--primary, #e53935);
        border-color: var(--primary, #e53935);
        color: #fff;
    }

    .products-page .pagination .page-item.disabled .page-link {
        color: #bbb;
        background: #f9f9f9;
        pointer-events: none;
    }

/* ---- Product Image Hover Popup ----
   Shows the original/full-size product image next to the cursor while
   hovering a product card's thumbnail. Positioned via JS (left/top),
   so only visual/transition styles live here. */
.product-image-popup {
    position: fixed;
    z-index: 1080;
    display: none;
    max-width: 380px;
    max-height: 380px;
    padding: 8px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
    pointer-events: none;
}

    .product-image-popup.is-visible {
        display: block;
    }

    .product-image-popup img {
        display: block;
        max-width: 360px;
        max-height: 360px;
        width: auto;
        height: auto;
        object-fit: contain;
    }

/* Popup is a desktop-hover-only affordance; disable on touch devices
   where there is no real mouse pointer to hover with. */
@media (hover: none) {
    .product-image-popup {
        display: none !important;
    }
}
