/* ==========================================================
   MAHERA JEWELS - PRODUCT LISTING
   Icon subcategory sidebar + pill-style filter dropdown panel
========================================================== */

.mj-listing-page {
    position: relative;
    width: 100%;
    padding: 18px 24px 60px;
    background: #fff;
    color: #171717;
}

.mj-listing-wrapper {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: start;
    gap: 20px;
    width: 100%;
    max-width: 1196px;
    margin: 0 auto;
}

.mj-listing-wrapper.mj-listing-wrapper--no-nav {
    grid-template-columns: minmax(0, 1fr);
}

/* ==========================================================
   CATEGORY ICON NAV (left sidebar)
========================================================== */

.mj-category-nav {
    position: sticky;
    top: 96px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    min-width: 0;
}

.mj-category-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border-left: 3px solid transparent;
    border-radius: 8px;
    color: #555;
    text-align: center;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.mj-category-nav-item:hover {
    background: #f7f3f1;
}

.mj-category-nav-item.is-active {
    border-left-color: var(--mj-primary);
    background: #f7f3f1;
    color: var(--mj-primary);
    font-weight: 700;
}

.mj-category-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    overflow: hidden;
    border-radius: 50%;
    background: #f1ece9;
}

.mj-category-nav-item.is-active .mj-category-nav-icon {
    box-shadow: 0 0 0 2px var(--mj-primary);
}

.mj-category-nav-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mj-category-nav-fallback {
    color: #9a8c86;
    font-size: 18px;
    font-weight: 700;
}

.mj-category-nav-label {
    font-size: 11px;
    line-height: 1.3;
    word-break: break-word;
}

/* ==========================================================
   PRODUCT TOOLBAR + FILTER PILLS
========================================================== */

.mj-products-area {
    width: 100%;
    min-width: 0;
}

.mj-listing-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 39px;
    margin-bottom: 13px;
}

.mj-product-count {
    color: #333;
    font-size: 12px;
    font-weight: 500;
}

.mj-filter-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
}

.mj-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 37px;
    padding: 0 14px;
    border: 1px solid #e8e2df;
    border-radius: 20px;
    outline: none;
    background: #fff;
    color: #333;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.mj-filter-pill:hover {
    border-color: var(--mj-primary);
    color: var(--mj-primary);
}

.mj-filter-pill.is-active,
.mj-filter-pill.has-value {
    border-color: var(--mj-primary);
    background: #f7f3f1;
    color: var(--mj-primary);
}

.mj-filter-pill-icon {
    font-size: 13px;
    line-height: 1;
}

.mj-filter-pill-chevron {
    font-size: 11px;
    line-height: 1;
    transition: transform .15s ease;
}

.mj-filter-pill.is-active .mj-filter-pill-chevron {
    transform: rotate(180deg);
}

.mj-filter-pill--all {
    position: relative;
    border-color: var(--mj-primary);
    color: var(--mj-primary);
}

.mj-filter-pill-dot {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e0432b;
}

/* ==========================================================
   SHARED FILTER DROPDOWN PANEL
========================================================== */

.mj-filter-panel {
    margin-bottom: 18px;
    overflow: hidden;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .07);
}

.mj-filter-panel[hidden] {
    display: none;
}

.mj-filter-panel-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding: 0 16px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    font-weight: 700;
}

.mj-filter-panel-header button {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #777;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.mj-filter-panel-body {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 20px;
}

.mj-filter-panel-section {
    display: flex;
    flex: 1 1 200px;
    flex-direction: column;
    gap: 11px;
    min-width: 180px;
}

.mj-filter-panel-section[hidden] {
    display: none;
}

.mj-filter-panel-section-title {
    margin: 0;
    color: #171717;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.mj-filter-option {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 19px;
    color: #777;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    cursor: pointer;
}

.mj-filter-option:hover {
    color: var(--mj-primary);
}

.mj-filter-option input[type="checkbox"],
.mj-filter-option input[type="radio"] {
    position: relative;
    flex: 0 0 13px;
    width: 13px;
    height: 13px;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #aaa;
    background: #fff;
    cursor: pointer;
}

.mj-filter-option input[type="checkbox"] {
    border-radius: 2px;
}

.mj-filter-option input[type="radio"] {
    border-radius: 50%;
}

.mj-filter-option input:checked {
    border-color: var(--mj-primary);
    background: var(--mj-primary);
}

.mj-filter-option input[type="checkbox"]:checked::after {
    position: absolute;
    top: 0;
    left: 3px;
    width: 4px;
    height: 7px;
    border: solid #fff;
    border-width: 0 1.5px 1.5px 0;
    content: "";
    transform: rotate(45deg);
}

.mj-filter-option input[type="radio"]:checked::after {
    position: absolute;
    inset: 2.5px;
    border-radius: 50%;
    background: #fff;
    content: "";
}

/* ==========================================================
   PRICE RANGE SLIDER
========================================================== */

.mj-price-values {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #444;
    font-size: 12px;
    font-weight: 600;
}

.mj-range-slider {
    position: relative;
    height: 24px;
    margin: 4px 7px 0;
}

.mj-range-track,
.mj-range-selected {
    position: absolute;
    top: 10px;
    height: 3px;
    border-radius: 10px;
}

.mj-range-track {
    right: 0;
    left: 0;
    background: #dedede;
}

.mj-range-selected {
    left: var(--min-percent);
    right: calc(100% - var(--max-percent));
    background: var(--mj-primary);
}

.mj-range-slider input[type="range"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 22px;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    background: none;
    pointer-events: none;
}

.mj-range-slider input[type="range"]::-webkit-slider-runnable-track {
    height: 3px;
    background: transparent;
}

.mj-range-slider input[type="range"]::-moz-range-track {
    height: 3px;
    background: transparent;
}

.mj-range-slider input[type="range"]::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    margin-top: -5.5px;
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--mj-primary);
    box-shadow: 0 0 0 1px var(--mj-primary);
    cursor: grab;
    pointer-events: auto;
}

.mj-range-slider input[type="range"]::-moz-range-thumb {
    width: 11px;
    height: 11px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--mj-primary);
    box-shadow: 0 0 0 1px var(--mj-primary);
    cursor: grab;
    pointer-events: auto;
}

/* ==========================================================
   FILTER ACTION BUTTONS
========================================================== */

.mj-filter-actions {
    display: flex;
    flex: 1 1 100%;
    gap: 10px;
    padding-top: 6px;
    border-top: 1px solid #eee;
}

.mj-apply-filter-btn,
.mj-reset-filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    min-height: 38px;
    padding: 0 18px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.mj-apply-filter-btn {
    border: 1px solid var(--mj-primary);
    background: var(--mj-primary);
    color: #fff;
}

.mj-apply-filter-btn:hover {
    background: var(--mj-primary-deep);
}

.mj-reset-filter-btn {
    border: 1px solid #dedede;
    background: #f7f7f7;
    color: #333;
}

.mj-reset-filter-btn:hover {
    border-color: var(--mj-primary);
    color: var(--mj-primary);
}

/* ==========================================================
   PRODUCT GRID AND CARDS
========================================================== */

.mj-product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
    gap: 17px;
}

.mj-product-grid .product-card {
    width: 100%;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    background: #fff;
    box-shadow: none;
    transition: transform .2s ease, box-shadow .2s ease;
}

.mj-product-grid .product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 18px rgba(0, 0, 0, .07);
}

.mj-product-grid .product-card-image {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1.32;
    overflow: hidden;
    background: #f8f6f3;
}

.mj-product-grid .product-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mj-product-grid .product-image-hover {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .25s ease;
}

@media (hover: hover) and (pointer: fine) {
    .mj-product-grid .product-card-image.has-hover-image:hover .product-image-hover {
        opacity: 1;
    }
}

.mj-product-grid .product-card-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding: 12px 11px 13px;
}

.mj-product-grid .product-brand {
    color: #777;
    font-size: 10px;
    line-height: 1.4;
}

.mj-product-grid .product-name {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: #171717;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    text-decoration: none;
}

.mj-product-grid .product-weight {
    margin-top: 3px;
    font-size: 11.5px;
}

.mj-product-grid .product-price {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.mj-product-grid .product-current-price {
    color: #171717;
    font-size: 15px;
    font-weight: 700;
}

.mj-product-grid .product-cta {
    margin-top: 5px;
    color: var(--mj-primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.mj-product-grid .product-top-selling-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    padding: 5px 8px;
    border-radius: 4px;
    background: var(--mj-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
}

/* ==========================================================
   EMPTY STATE AND LOAD MORE
========================================================== */

.mj-empty-products {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #777;
    text-align: center;
}

.mj-empty-products h3 {
    margin: 0 0 8px;
    color: #333;
    font-size: 18px;
}

.mj-empty-products p {
    margin: 0;
    font-size: 13px;
}

.mj-load-more-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 35px 15px;
}

.mj-load-more-btn {
    min-width: 180px;
    min-height: 44px;
    padding: 12px 30px;
    border: 1px solid var(--mj-primary);
    border-radius: 30px;
    background: #fff;
    color: var(--mj-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, opacity .2s ease;
}

.mj-load-more-btn:hover:not(:disabled) {
    background: var(--mj-primary);
    color: #fff;
}

.mj-load-more-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ==========================================================
   TABLET
========================================================== */

@media (max-width: 1100px) and (min-width: 768px) {
    .mj-listing-wrapper {
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 15px;
    }

    .mj-product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 13px;
    }
}

/* ==========================================================
   MOBILE
========================================================== */

@media (max-width: 767px) {
    .mj-listing-page {
        padding: 12px 12px 42px;
    }

    .mj-listing-wrapper {
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: none;
        padding: 0;
    }

    .mj-category-nav {
        position: static;
        flex-direction: row;
        gap: 14px;
        margin-bottom: 14px;
        padding-bottom: 4px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .mj-category-nav::-webkit-scrollbar {
        display: none;
    }

    .mj-category-nav-item {
        flex: 0 0 auto;
        width: 68px;
    }

    .mj-category-nav-icon {
        width: 46px;
        height: 46px;
    }

    .mj-products-area {
        width: 100%;
    }

    .mj-listing-toolbar {
        min-height: 30px;
        margin-bottom: 12px;
    }

    .mj-product-count {
        font-size: 12px;
    }

    .mj-filter-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .mj-filter-pills::-webkit-scrollbar {
        display: none;
    }

    .mj-filter-pill {
        flex: 0 0 auto;
    }

    .mj-filter-panel {
        position: fixed;
        z-index: 10002;
        right: 0;
        bottom: 0;
        left: 0;
        margin: 0;
        max-height: 78dvh;
        display: flex;
        flex-direction: column;
        border: 0;
        border-radius: 18px 18px 0 0;
        transform: translateY(105%);
        transition: transform .25s ease;
    }

    .mj-filter-panel:not([hidden]) {
        transform: translateY(0);
    }

    .mj-filter-panel-header {
        display: flex;
    }

    .mj-filter-panel-body {
        flex-direction: column;
        flex-wrap: nowrap;
        overflow-y: auto;
        gap: 18px;
        padding: 16px;
    }

    .mj-filter-panel-section {
        min-width: 0;
    }

    .mj-filter-option {
        min-height: 30px;
        font-size: 13px;
    }

    .mj-filter-option input[type="checkbox"],
    .mj-filter-option input[type="radio"] {
        flex-basis: 15px;
        width: 15px;
        height: 15px;
    }

    .mj-filter-actions {
        position: sticky;
        bottom: 0;
        padding: 12px 0;
        background: #fff;
    }

    .mj-apply-filter-btn,
    .mj-reset-filter-btn {
        flex: 1 1 0;
        min-height: 44px;
    }

    /* Two product cards per row, matching the mobile storefront. */
    .mj-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px;
    }

    .mj-product-grid .product-card-image {
        aspect-ratio: 1 / 1.2;
    }

    .mj-product-grid .product-card-body {
        gap: 4px;
        padding: 9px;
    }

    .mj-product-grid .product-brand {
        font-size: 9px;
    }

    .mj-product-grid .product-name {
        font-size: 11px;
        line-height: 1.4;
    }

    .mj-product-grid .product-weight {
        font-size: 10.5px;
    }

    .mj-product-grid .product-current-price {
        font-size: 13px;
    }

    .mj-product-grid .product-cta {
        font-size: 11px;
    }

    .mj-load-more-wrapper {
        padding: 26px 10px 18px;
    }

    .mj-load-more-btn {
        min-width: 160px;
        min-height: 42px;
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .mj-listing-page {
        padding-right: 9px;
        padding-left: 9px;
    }

    .mj-product-grid {
        gap: 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mj-filter-panel,
    .mj-product-grid .product-card {
        transition: none;
    }
}
