/*
 * Product Listing Styles
 * Enqueued only on shop, product taxonomy, and product search pages.
 */

/* Header Area */
.jro-listing-page-header {
    margin-bottom: var(--jro-spacing-xl);
    padding-bottom: var(--jro-spacing-md);
    border-bottom: 1px solid var(--jro-border);
}
.jro-listing-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 var(--jro-spacing-xs) 0;
    color: var(--jro-text-primary);
}
.jro-listing-context {
    color: var(--jro-text-muted);
    font-size: 0.875rem;
}

/* Layout */
.jro-listing-layout {
    display: flex;
    gap: var(--jro-spacing-xl);
    margin-bottom: 80px;
    align-items: flex-start;
}

/* Sidebar */
.jro-listing-sidebar {
    width: 280px;
    flex-shrink: 0;
}
/* Structural Placeholder for Sidebar */
.jro-sidebar-placeholder-module {
    margin-bottom: var(--jro-spacing-lg);
}
.jro-sidebar-placeholder-module:last-child {
    margin-bottom: 0;
}
.jro-sidebar-placeholder-title {
    font-weight: 600;
    margin-bottom: var(--jro-spacing-sm);
    color: var(--jro-text-primary);
}
.jro-sidebar-placeholder-item {
    height: 24px;
    background-color: var(--jro-card);
    border-radius: 4px;
    margin-bottom: 8px;
    border: 1px dashed var(--jro-border);
}

/* Main Content */
.jro-listing-main {
    flex: 1;
    min-width: 0; /* Prevents flex blowout */
}

/* Toolbar */
.jro-listing-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--jro-spacing-lg);
    padding: var(--jro-spacing-sm) var(--jro-spacing-md);
    background-color: var(--jro-surface-elevated);
    border: 1px solid var(--jro-border);
    border-radius: var(--jro-border-radius-md);
}
.jro-listing-result-count {
    color: var(--jro-text-secondary);
    font-size: 0.875rem;
    margin: 0;
}
.jro-listing-ordering {
    display: flex;
    align-items: center;
    gap: var(--jro-spacing-sm);
}
.jro-listing-ordering select {
    background-color: var(--jro-bg);
    border: 1px solid var(--jro-border);
    color: var(--jro-text-primary);
    padding: 8px 12px;
    border-radius: var(--jro-border-radius-md);
    height: 44px;
    font-family: var(--jro-font-family);
}

/* Mobile Filter Toggle */
.jro-filter-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--jro-surface-elevated);
    border: 1px solid var(--jro-border);
    color: var(--jro-text-primary);
    height: 44px;
    padding: 0 16px;
    border-radius: var(--jro-border-radius-md);
    cursor: pointer;
    font-weight: 500;
}
.jro-filter-toggle svg {
    width: 18px;
    height: 18px;
}

/* Responsive Grid Overrides if needed */
/* Base Grid (1440px and up) */
.jro-listing-main ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.jro-listing-main ul.products::before,
.jro-listing-main ul.products::after {
    display: none !important;
}
.jro-listing-main ul.products li.product {
    margin: 0 !important;
    width: 100% !important;
    clear: none !important;
}

@media (max-width: 1199px) {
    .jro-listing-main ul.products {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .jro-listing-layout {
        gap: 16px;
    }
    .jro-listing-sidebar {
        width: 180px;
    }
    .jro-listing-main ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 12px;
    }
}

@media (max-width: 767px) {
    .jro-listing-layout {
        flex-direction: column;
    }
    .jro-listing-sidebar {
        width: 100%;
        display: none;
        margin-bottom: var(--jro-spacing-lg);
    }
    .jro-listing-sidebar.is-open {
        display: block;
    }
    .jro-filter-toggle {
        display: inline-flex;
    }
    .jro-listing-main ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 576px) {
    .jro-listing-toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas: 
            "count count"
            "filters sort";
        gap: var(--jro-spacing-sm) var(--jro-spacing-md);
        align-items: center;
        padding: var(--jro-spacing-md);
    }
    .jro-listing-result-count {
        grid-area: count;
        text-align: left;
    }
    .jro-filter-toggle {
        grid-area: filters;
        width: 100%;
    }
    .jro-listing-ordering {
        grid-area: sort;
        width: 100%;
    }
    .jro-listing-ordering form.woocommerce-ordering {
        margin: 0;
        width: 100%;
    }
    .jro-listing-ordering select {
        width: 100%;
    }
}

/* Product Card Styles */
.jro-product-card {
    background-color: var(--jro-card);
    border: 1px solid rgba(247, 247, 247, 0.18);
    border-radius: var(--jro-border-radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.jro-card-compatibility-strip {
    background-color: var(--jro-maroon);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.jro-card-compatibility-strip svg {
    width: 14px;
    height: 14px;
}
.jro-product-image-wrapper {
    background-color: #fff;
    padding: 10px;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.jro-product-image-wrapper a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.jro-product-image-wrapper img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.jro-product-details {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
}
.jro-product-title {
    font-size: 0.9375rem;
    font-weight: 500;
    margin: 0 0 6px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.jro-product-title a {
    color: var(--jro-text-primary);
    text-decoration: none;
}
.jro-product-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--jro-text-primary);
    margin: 0 0 6px 0;
}
.jro-product-stock {
    font-size: 0.75rem;
    margin: 0 0 10px 0;
}
.jro-stock-in {
    color: var(--jro-success);
    display: flex;
    align-items: center;
    gap: 4px;
}
.jro-stock-in svg {
    width: 14px;
    height: 14px;
}
.jro-stock-out {
    color: var(--jro-error);
    display: flex;
    align-items: center;
    gap: 4px;
}
.jro-stock-out svg {
    width: 14px;
    height: 14px;
}
.jro-product-action {
    margin-top: 0;
    width: 100%;
}
.jro-product-action .button,
.woocommerce ul.products li.product .button.jro-btn-add-to-cart,
.jro-btn-add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    background-color: #9E1735;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    padding: 10px 14px;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}
.jro-product-action .button:hover,
.jro-product-action .button:focus,
.woocommerce ul.products li.product .button.jro-btn-add-to-cart:hover,
.woocommerce ul.products li.product .button.jro-btn-add-to-cart:focus,
.jro-btn-add-to-cart:hover,
.jro-btn-add-to-cart:focus {
    background-color: #B51D3D;
    color: #fff;
    outline: none;
}
.jro-product-action .button:active,
.woocommerce ul.products li.product .button.jro-btn-add-to-cart:active,
.jro-btn-add-to-cart:active {
    background-color: #651024;
}

/* Price Filter Form */
.jro-price-range-wrapper {
    position: relative;
    height: 30px;
    margin-bottom: var(--jro-spacing-md);
}
.jro-price-slider-track {
    position: absolute;
    width: 100%;
    height: 4px;
    background-color: var(--jro-border);
    top: 50%;
    transform: translateY(-50%);
    border-radius: 2px;
}
.jro-price-slider-range {
    position: absolute;
    height: 100%;
    background-color: var(--jro-maroon);
    border-radius: 2px;
}
.jro-price-range-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    background: none;
    margin: 0;
}
.jro-price-range-input::-webkit-slider-thumb {
    pointer-events: auto;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--jro-maroon);
    cursor: pointer;
}
.jro-price-range-input::-moz-range-thumb {
    pointer-events: auto;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--jro-maroon);
    cursor: pointer;
}
.jro-price-displays {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--jro-text-primary);
    margin-bottom: var(--jro-spacing-md);
}

/* Sidebar Filter Modules */
.jro-sidebar-module {
    margin-bottom: var(--jro-spacing-md);
    background-color: var(--jro-surface-elevated);
    border: 1px solid var(--jro-border);
    border-radius: var(--jro-border-radius-lg);
    padding: var(--jro-spacing-md);
}
.jro-sidebar-module:last-child {
    margin-bottom: 0;
}
.jro-sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--jro-spacing-md);
    color: var(--jro-text-primary);
    padding-bottom: var(--jro-spacing-xs);
    border-bottom: 1px solid var(--jro-border);
}

/* Category List */
.jro-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.jro-category-list li {
    margin-bottom: 8px;
}
.jro-category-list li:last-child {
    margin-bottom: 0;
}
.jro-category-link {
    display: block;
    color: var(--jro-text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    padding: 6px 0;
    transition: color 0.2s ease;
}
.jro-category-link:hover {
    color: var(--jro-text-primary);
}
.jro-category-link.is-active {
    color: var(--jro-maroon);
    font-weight: 600;
}

/* Vehicle Filter Form */
.jro-vehicle-filter-form {
    display: flex;
    flex-direction: column;
    gap: var(--jro-spacing-md);
}
.jro-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.jro-filter-label {
    font-size: 0.875rem;
    color: var(--jro-text-secondary);
    font-weight: 500;
}
.jro-filter-select {
    background-color: var(--jro-bg);
    border: 1px solid var(--jro-border);
    color: var(--jro-text-primary);
    padding: 8px 12px;
    border-radius: var(--jro-border-radius-md);
    height: 44px;
    font-family: var(--jro-font-family);
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2212%22%20height%3D%228%22%20viewBox%3D%220%200%2012%208%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M1%201.5L6%206.5L11%201.5%22%20stroke%3D%22%23B8BBC2%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
}
.jro-filter-select:focus {
    outline: 2px solid var(--jro-maroon);
    outline-offset: -1px;
}

/* Filter Actions */
.jro-filter-actions {
    display: flex;
    flex-direction: column;
    gap: var(--jro-spacing-sm);
    margin-top: var(--jro-spacing-sm);
}
.jro-btn-apply {
    background-color: var(--jro-maroon);
    color: #fff;
    border: none;
    border-radius: var(--jro-border-radius-md);
    height: 44px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.jro-btn-apply:hover {
    background-color: var(--jro-maroon-hover);
}
.jro-btn-apply:focus {
    outline: 2px solid #fff;
    outline-offset: -4px;
}
.jro-btn-reset {
    color: var(--jro-text-muted);
    text-align: center;
    text-decoration: none;
    font-size: 0.875rem;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--jro-border-radius-md);
    transition: color 0.2s ease, background-color 0.2s ease;
}
.jro-btn-reset:hover {
    color: var(--jro-text-primary);
    background-color: var(--jro-card);
}

/* Active Filters */
.jro-active-filters {
    margin-bottom: var(--jro-spacing-md);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--jro-spacing-sm);
}
.jro-active-filters-label {
    font-size: 0.875rem;
    color: var(--jro-text-secondary);
    font-weight: 500;
    margin-right: 4px;
}
.jro-active-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.jro-active-filter-chip {
    display: inline-flex;
}
.jro-active-filter-remove {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: var(--jro-surface-elevated);
    border: 1px solid var(--jro-border);
    border-radius: 16px;
    padding: 4px 12px;
    color: var(--jro-text-primary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
.jro-active-filter-remove:hover {
    border-color: var(--jro-maroon);
    background-color: var(--jro-card);
}
.jro-icon-close {
    width: 14px;
    height: 14px;
    stroke: var(--jro-text-muted);
}
.jro-active-filter-remove:hover .jro-icon-close {
    stroke: var(--jro-maroon);
}
.jro-active-filter-clear-all {
    display: flex;
    align-items: center;
}
.jro-btn-clear-all {
    color: var(--jro-text-muted);
    font-size: 0.8125rem;
    text-decoration: underline;
    margin-left: 8px;
    transition: color 0.2s ease;
}
.jro-btn-clear-all:hover {
    color: var(--jro-text-primary);
}

/* Additional Focus States */
.jro-category-link:focus-visible {
    outline: 2px solid var(--jro-maroon);
    outline-offset: 2px;
    border-radius: 2px;
}
.jro-active-filter-remove:focus-visible {
    outline: 2px solid var(--jro-maroon);
    outline-offset: 2px;
}
.jro-btn-clear-all:focus-visible {
    outline: 2px solid var(--jro-maroon);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Search Within Form */
.jro-search-within-wrapper {
    margin-bottom: var(--jro-spacing-xl);
    max-width: 100%;
}
.jro-search-within-form {
    display: flex;
    position: relative;
}


/* Context Header */
.jro-listing-context-header {
    text-align: center;
    margin-bottom: var(--jro-spacing-xl);
    padding: var(--jro-spacing-xl) 0;
}
.jro-listing-hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--jro-text-primary);
    margin: 0 0 var(--jro-spacing-sm) 0;
    line-height: 1.2;
}
.jro-hero-brand {
    font-weight: 700;
}
.jro-hero-model {
    font-weight: 700;
    color: var(--jro-maroon);
}
.jro-hero-divider {
    color: var(--jro-maroon);
    font-weight: 400;
    margin: 0 8px;
}
.jro-hero-year {
    font-weight: 700;
    color: var(--jro-text-primary);
}
.jro-listing-hero-variant {
    font-size: 1.125rem;
    color: var(--jro-text-secondary);
    margin-bottom: var(--jro-spacing-sm);
}
.jro-listing-hero-subtitle {
    font-size: 1.125rem;
    color: var(--jro-text-primary);
    font-weight: 600;
    margin-bottom: var(--jro-spacing-xs);
}
.jro-listing-hero-count {
    font-size: 0.875rem;
    color: var(--jro-text-muted);
}
@media (max-width: 767px) {
    .jro-listing-hero-title {
        font-size: 2rem;
    }
}

/* WooCommerce No Products Found State */
.woocommerce-no-products-found {
    margin: var(--jro-spacing-xl) 0;
    width: 100%;
}

