/* Product List V3 FINAL - independent layout; works with precompiled Mana Tailwind CSS. */
.product-list-v3 {
    --pl-bg: #faf8f4;
    --pl-card: #fff;
    --pl-soft: #f5efe7;
    --pl-border: #e9e1d6;
    --pl-ink: #292724;
    --pl-muted: #756f68;
    --pl-accent: #b79b78;
    --pl-deep: #8a6b46;
    --pl-ring: rgba(183,155,120,.18);
    color: var(--pl-ink);
    width: 100%;
    overflow: clip
}

.dark .product-list-v3 {
    --pl-bg: #151515;
    --pl-card: #222120;
    --pl-soft: #2b2927;
    --pl-border: #3d3832;
    --pl-ink: #f4eee5;
    --pl-muted: #b9afa4;
    --pl-accent: #cbb08e;
    --pl-deep: #d5b58d;
    --pl-ring: rgba(203,176,142,.16)
}

.product-list-v3, .product-list-v3 * {
    box-sizing: border-box
}

    .product-list-v3 .container {
        width: 100%;
        max-width: 1320px;
        margin-inline: auto;
        padding-inline: clamp(16px,2.8vw,32px)
    }

    .product-list-v3 .product-list-heading {
        padding: 22px 26px;
        border: 1px solid var(--pl-border);
        border-radius: 22px;
        background: var(--pl-card);
        margin-bottom: 26px;
        box-shadow: 0 8px 24px #2b22170a
    }

        .product-list-v3 .product-list-heading nav {
            background: var(--pl-soft) !important;
            border: 1px solid var(--pl-border) !important;
            color: var(--pl-muted) !important
        }

            .product-list-v3 .product-list-heading nav a:hover, .product-list-v3 .product-list-heading nav span {
                color: var(--pl-deep) !important
            }

        .product-list-v3 .product-list-heading h1 {
            color: var(--pl-ink) !important;
            font-size: clamp(25px,2.5vw,36px);
            line-height: 1.5
        }

        .product-list-v3 .product-list-heading p {
            color: var(--pl-muted) !important
        }

        .product-list-v3 .product-list-heading .bg-blue-500.rounded-full {
            background: var(--pl-accent) !important;
            filter: none !important
        }

        .product-list-v3 .product-list-heading .overflow-x-auto {
            background: var(--pl-soft) !important;
            border: 1px solid var(--pl-border) !important;
            box-shadow: none !important;
            border-radius: 16px !important;
            max-width: 100%
        }

    .product-list-v3 .product-sort-btn {
        color: var(--pl-muted) !important;
        border-radius: 10px !important
    }

        .product-list-v3 .product-sort-btn:hover {
            background: var(--pl-card) !important;
            color: var(--pl-ink) !important
        }

        .product-list-v3 .product-sort-btn.bg-blue-600 {
            background: var(--pl-ink) !important;
            color: var(--pl-card) !important;
            box-shadow: none !important
        }

.dark .product-list-v3 .product-sort-btn.bg-blue-600 {
    background: var(--pl-accent) !important;
    color: #191713 !important
}
/* Critical: explicit grid layout. No reliance on missing lg:grid-cols-* utility. */
.product-list-v3 .product-list-layout {
    display: grid !important;
    grid-template-columns: minmax(245px,285px) minmax(0,1fr) !important;
    align-items: start;
    gap: 26px;
    width: 100%;
    direction: rtl
}

.product-list-v3 .product-list-sidebar {
    display: block !important;
    grid-column: 1 !important;
    min-width: 0;
    width: 100%
}

.product-list-v3 .product-list-results {
    grid-column: 2 !important;
    min-width: 0;
    width: 100%
}

.product-list-v3 .product-list-sidebar form {
    position: static !important;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px
}

.product-list-v3 .product-list-grid {
    display: grid !important;
    grid-template-columns: repeat(3,minmax(0,1fr)) !important;
    gap: 18px;
    align-items: stretch
}

.product-list-v3 .product-filter-card {
    display: block;
    width: 100%;
    min-width: 0;
    background: var(--pl-card);
    border: 1px solid var(--pl-border);
    border-radius: 17px;
    padding: 15px;
    box-shadow: 0 4px 15px #2b221707
}

.product-list-v3 .product-filter-card-title, .product-list-v3 .product-filter-summary {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--pl-ink);
    font-size: 13px;
    font-weight: 800
}

.product-list-v3 .product-filter-summary {
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
    user-select: none;
    min-height: 24px
}

    .product-list-v3 .product-filter-summary::-webkit-details-marker {
        display: none
    }

.product-list-v3 .product-filter-chevron {
    color: var(--pl-muted);
    transition: transform .2s;
    line-height: 1
}

.product-list-v3 details[open] > .product-filter-summary .product-filter-chevron {
    transform: rotate(180deg)
}

.product-list-v3 .product-filter-dot {
    width: 7px;
    height: 7px;
    flex: none;
    border-radius: 50%;
    background: var(--pl-accent) !important
}

.product-list-v3 .product-filter-options {
    max-height: 230px;
    overflow-y: auto;
    padding-left: 3px
}

.product-list-v3 .product-filter-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 38px;
    padding: 7px 8px;
    border-radius: 10px;
    color: var(--pl-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer
}

    .product-list-v3 .product-filter-option:hover {
        background: var(--pl-soft);
        color: var(--pl-ink)
    }

.product-list-v3 .product-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 23px;
    padding: 0 7px;
    border-radius: 8px;
    background: var(--pl-soft);
    color: var(--pl-muted);
    font-size: 10px;
    font-weight: 700
}

.product-list-v3 .product-search-input {
    display: block;
    width: 100%;
    height: 43px;
    margin-top: 12px;
    padding: 0 13px;
    border-radius: 11px;
    border: 1px solid var(--pl-border);
    background: var(--pl-card);
    color: var(--pl-ink);
    outline: none;
    font-size: 12px
}

    .product-list-v3 .product-search-input:focus {
        border-color: var(--pl-accent);
        box-shadow: 0 0 0 3px var(--pl-ring)
    }

    .product-list-v3 .product-search-input::placeholder {
        color: var(--pl-muted)
    }

.product-list-v3 .product-radio, .product-list-v3 .product-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--pl-deep);
    cursor: pointer;
    flex: none
}

.product-list-v3 .product-price-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    width: 100%;
    padding: 10px 9px;
    border: 1px solid var(--pl-border);
    border-radius: 11px;
    background: var(--pl-card)
}

    .product-list-v3 .product-price-box:focus-within {
        border-color: var(--pl-accent);
        box-shadow: 0 0 0 3px var(--pl-ring)
    }

    .product-list-v3 .product-price-box > span {
        display: flex;
        align-items: center;
        gap: 4px;
        color: var(--pl-muted);
        font-size: 11px;
        font-weight: 700;
        white-space: nowrap
    }

    .product-list-v3 .product-price-box small {
        font-size: 10px;
        font-weight: 500
    }

.product-list-v3 .product-price-display {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--pl-ink) !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.8;
    text-align: right;
    direction: ltr;
    font-variant-numeric: tabular-nums
}

    .product-list-v3 .product-price-display::placeholder {
        color: var(--pl-muted);
        opacity: .7;
        font-size: 10px
    }

.product-list-v3 .product-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
    min-height: 40px;
    color: var(--pl-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer
}

.product-list-v3 .product-switch-input {
    position: absolute;
    opacity: 0;
    pointer-events: none
}

.product-list-v3 .product-switch {
    position: relative;
    width: 39px;
    height: 22px;
    flex: none;
    border-radius: 30px;
    background: #c9c3bb;
    transition: background .2s
}

    .product-list-v3 .product-switch:after {
        content: "";
        position: absolute;
        right: 3px;
        top: 3px;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: white;
        box-shadow: 0 1px 4px #0002;
        transition: transform .2s
    }

.product-list-v3 .product-switch-input:checked + .product-switch {
    background: var(--pl-deep)
}

    .product-list-v3 .product-switch-input:checked + .product-switch:after {
        transform: translateX(-17px)
    }

.product-list-v3 .product-page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--pl-border);
    border-radius: 12px;
    background: var(--pl-card);
    color: var(--pl-muted);
    font-size: 12px;
    font-weight: 800
}

    .product-list-v3 .product-page-button:hover, .product-list-v3 .product-page-button-active {
        background: var(--pl-ink);
        border-color: var(--pl-ink);
        color: var(--pl-card)
    }

.product-list-v3 .product-filter-options {
    scrollbar-width: thin;
    scrollbar-color: var(--pl-border) transparent
}
/* Product cards: replace absolute decorative background with real card surface. */
.product-list-v3 .product-list-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 390px;
    padding: 0 !important;
    border: 1px solid var(--pl-border);
    border-radius: 19px;
    background: var(--pl-card);
    overflow: hidden;
    box-shadow: 0 7px 24px #2b22170a;
    isolation: isolate;
    transition: border-color .2s,box-shadow .2s
}

    .product-list-v3 .product-list-card:hover {
        border-color: var(--pl-accent);
        box-shadow: 0 14px 30px #2b22171a
    }

    .product-list-v3 .product-list-card > div:first-child {
        display: none !important
    }

    .product-list-v3 .product-list-card > div:nth-child(2) {
        position: relative !important;
        z-index: 1;
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
        padding: 17px !important;
        transform: none !important
    }

    .product-list-v3 .product-list-card a:has(img) {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 185px;
        margin-bottom: 16px
    }

    .product-list-v3 .product-list-card img {
        display: block;
        max-width: 100%;
        width: 100%;
        height: 185px;
        object-fit: contain
    }

    .product-list-v3 .product-list-card h3 {
        color: var(--pl-ink) !important
    }

        .product-list-v3 .product-list-card h3:hover, .product-list-v3 .product-list-card .text-blue-500 {
            color: var(--pl-deep) !important
        }

    .product-list-v3 .product-list-card .text-gray-900, .product-list-v3 .product-list-card .dark\:text-white {
        color: var(--pl-ink) !important
    }

    .product-list-v3 .product-list-card .text-gray-400 {
        color: var(--pl-muted) !important
    }

    .product-list-v3 .product-list-card button[data-add-to-cart], .product-list-v3 button[data-open-product-filter] {
        background: var(--pl-ink) !important;
        color: var(--pl-card) !important;
        box-shadow: none !important
    }

.dark .product-list-v3 .product-list-card button[data-add-to-cart], .dark .product-list-v3 button[data-open-product-filter] {
    background: var(--pl-accent) !important;
    color: #191713 !important
}

.product-list-v3 .product-list-sidebar button[type=submit], .product-list-v3 #product-mobile-filter button[type=submit] {
    background: var(--pl-ink) !important;
    color: var(--pl-card) !important;
    box-shadow: none !important
}

.dark .product-list-v3 .product-list-sidebar button[type=submit], .dark .product-list-v3 #product-mobile-filter button[type=submit] {
    background: var(--pl-accent) !important;
    color: #191713 !important
}

.product-list-v3 #product-mobile-filter {
    background: var(--pl-card) !important;
    border-color: var(--pl-border) !important
}

    .product-list-v3 #product-mobile-filter h2 {
        color: var(--pl-ink) !important
    }

    .product-list-v3 #product-mobile-filter form {
        height: 100%;
        display: flex;
        flex-direction: column
    }

    .product-list-v3 #product-mobile-filter .product-filter-card {
        box-shadow: none
    }

@media(max-width:1199px) {
    .product-list-v3 .product-list-grid {
        grid-template-columns: repeat(2,minmax(0,1fr)) !important
    }
}

@media(max-width:1023px) {
    .product-list-v3 .product-list-layout {
        display: block !important
    }

    .product-list-v3 .product-list-sidebar {
        display: none !important
    }

    .product-list-v3 .product-list-results {
        width: 100%
    }

    .product-list-v3 .product-list-heading {
        padding: 17px
    }
}

@media(max-width:639px) {
    .product-list-v3 .product-list-grid {
        grid-template-columns: repeat(2,minmax(0,1fr)) !important;
        gap: 10px
    }

    .product-list-v3 .product-list-card {
        min-height: 310px;
        border-radius: 14px
    }

        .product-list-v3 .product-list-card > div:nth-child(2) {
            padding: 11px !important
        }

        .product-list-v3 .product-list-card img {
            height: 135px
        }

        .product-list-v3 .product-list-card a:has(img) {
            min-height: 135px
        }

    .product-list-v3 .product-list-heading h1 {
        font-size: 25px
    }

    .product-list-v3 .product-price-display {
        font-size: 12px !important
    }
}

@media(max-width:370px) {
    .product-list-v3 .product-list-grid {
        grid-template-columns: 1fr !important
    }
}

@media(prefers-reduced-motion:reduce) {
    .product-list-v3 * {
        transition-duration: .01ms !important
    }
}

/* Final layout safeguards */
.product-list-v3 { padding-block: 32px 60px; background: var(--pl-bg); }
.product-list-v3 .product-list-layout { direction: rtl; }
.product-list-v3 .product-list-results { min-width: 0; }
.product-list-v3 .product-list-card { width: 100%; }
.product-list-v3 .product-list-card > div:nth-child(2) { height: 100%; }
.product-list-v3 .product-list-card img { max-height: 185px; }
.product-list-v3 .product-price-display { unicode-bidi: plaintext; }
.product-list-v3 .product-filter-card input:not([type=checkbox]):not([type=radio]):not([type=hidden]) { max-width: 100%; }
@media(min-width:1024px){.product-list-v3 .product-list-layout {grid-template-columns: minmax(245px,285px) minmax(0,1fr)!important}.product-list-v3 .product-list-sidebar {display:block!important}.product-list-v3 #product-mobile-filter {display:none!important}}
@media(max-width:1023px){.product-list-v3 .product-list-sidebar {display:none!important}.product-list-v3 .product-list-layout {display:block!important}}


/* ===== Price filter: final compact, readable RTL design ===== */
.product-list-v3 .product-price-content { margin-top: 15px; }
.product-list-v3 .product-price-fields {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
    direction: rtl;
}
.product-list-v3 .product-price-box {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    padding: 12px 11px !important;
    min-height: 90px;
    border: 1px solid var(--pl-border) !important;
    border-radius: 12px !important;
    background: var(--pl-card) !important;
    box-shadow: none !important;
    overflow: hidden;
}
.product-list-v3 .product-price-box:focus-within {
    border-color: var(--pl-accent) !important;
    box-shadow: 0 0 0 2px var(--pl-ring) !important;
}
.product-list-v3 .product-price-box > span {
    color: var(--pl-muted) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    display: flex;
    gap: 4px;
    white-space: nowrap;
    direction: rtl;
}
.product-list-v3 .product-price-box small {
    font-size: 10px !important;
    font-weight: 500 !important;
}
.product-list-v3 .product-price-display {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 32px !important;
    padding: 0 2px !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    color: var(--pl-ink) !important;
    font-family: inherit !important;
    font-size: 13px !important;
    font-weight: 750 !important;
    text-align: right !important;
    direction: ltr !important;
    unicode-bidi: normal !important;
    letter-spacing: 0 !important;
    font-variant-numeric: tabular-nums;
}
.product-list-v3 .product-price-display::placeholder {
    color: var(--pl-muted) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    opacity: .8;
}
.product-list-v3 .product-price-range {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 5px 8px;
    margin-top: 12px;
    color: var(--pl-muted);
    font-size: 10px;
    font-weight: 600;
}
.dark .product-list-v3 .product-price-box {
    background: #292725 !important;
}
@media (max-width: 380px) {
    .product-list-v3 .product-price-fields { gap: 7px; }
    .product-list-v3 .product-price-box { padding: 9px 8px !important; }
    .product-list-v3 .product-price-display { font-size: 12px !important; }
}

/* =============================================================
   PRICE FILTER — clean compact rows, no oversized input boxes
   All price styling lives here (no inline <style> in Razor).
   ============================================================= */
.product-list-v3 .product-price-content {
    margin-top: 14px;
}
.product-list-v3 .product-price-rows {
    display: flex !important;
    flex-direction: column !important;
    gap: 9px;
}
.product-list-v3 .product-price-row {
    display: grid !important;
    grid-template-columns: 88px minmax(0,1fr) !important;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    width: 100%;
    padding: 7px 11px !important;
    background: var(--pl-soft) !important;
    border: 1px solid var(--pl-border) !important;
    border-radius: 11px;
    box-shadow: none !important;
    cursor: text;
}
.product-list-v3 .product-price-row:focus-within {
    background: var(--pl-card) !important;
    border-color: var(--pl-accent) !important;
    box-shadow: 0 0 0 2px var(--pl-ring) !important;
}
.product-list-v3 .product-price-label {
    font-size: 11px !important;
    line-height: 1.5;
    font-weight: 700;
    color: var(--pl-muted) !important;
    white-space: nowrap;
    text-align: right;
}
.product-list-v3 .product-price-row .product-price-display {
    display: block !important;
    min-width: 0 !important;
    width: 100% !important;
    height: 30px !important;
    margin: 0 !important;
    padding: 0 2px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    color: var(--pl-ink) !important;
    font-size: 13px !important;
    font-weight: 750 !important;
    font-family: inherit !important;
    direction: ltr !important;
    text-align: left !important;
    font-variant-numeric: tabular-nums;
    letter-spacing: normal !important;
}
.product-list-v3 .product-price-row .product-price-display::placeholder {
    color: var(--pl-muted) !important;
    opacity: .8;
    font-size: 11px !important;
    font-weight: 500 !important;
}
.product-list-v3 .product-price-range {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 10px;
    margin-top: 12px;
    color: var(--pl-muted);
    font-size: 10px;
    font-weight: 600;
}
.dark .product-list-v3 .product-price-row {
    background: var(--pl-soft) !important;
}
@media (max-width: 380px) {
    .product-list-v3 .product-price-row {
        grid-template-columns: 76px minmax(0,1fr) !important;
        padding: 6px 8px !important;
    }
}





/* ============================================
   Product List V3 - Discount Badge Fix
   Based on actual PublicProductList markup
   ============================================ */

/* کارت محصول: مرجع موقعیت نشان تخفیف */
.product-list-v3 .product-list-card {
    position: relative !important;
    overflow: hidden !important;
}

    /* محتوای اصلی کارت */
    .product-list-v3 .product-list-card > div:nth-child(2) {
        position: relative !important;
    }

        /* والد واقعی نشان تخفیف */
        .product-list-v3 .product-list-card > div:nth-child(2) > div.absolute {
            position: absolute !important;
            top: 12px !important;
            right: 12px !important;
            left: auto !important;
            bottom: auto !important;
            z-index: 30 !important;
            transform: none !important;
            margin: 0 !important;
        }

            /* خود نشان درصد تخفیف */
            .product-list-v3 .product-list-card > div:nth-child(2) > div.absolute > div {
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                min-width: 52px !important;
                height: 30px !important;
                padding: 4px 9px !important;
                background: #e84658 !important;
                color: #ffffff !important;
                border: 0 !important;
                border-radius: 9px !important;
                font-size: 12px !important;
                font-weight: 800 !important;
                line-height: 1 !important;
                white-space: nowrap !important;
                box-shadow: 0 4px 12px rgba(232, 70, 88, .18) !important;
            }

    /* قیمت قبل از تخفیف */
    .product-list-v3 .product-list-card .line-through {
        color: #928a82 !important;
        font-size: 11px !important;
        text-decoration: line-through !important;
        opacity: 1 !important;
    }

    /* قیمت نهایی */
    .product-list-v3 .product-list-card .tabular-nums.font-black {
        color: var(--pl-ink) !important;
        font-weight: 900 !important;
    }

/* حالت موبایل */
@media (max-width: 639px) {
    .product-list-v3 .product-list-card > div:nth-child(2) > div.absolute {
        top: 8px !important;
        right: 8px !important;
    }

        .product-list-v3 .product-list-card > div:nth-child(2) > div.absolute > div {
            min-width: 42px !important;
            height: 27px !important;
            font-size: 11px !important;
            padding: 3px 7px !important;
        }
}


/* ============================================
   PRODUCT LIST V3 - SEARCH ICON FIX
   Desktop + Mobile / Light + Dark
   ============================================ */

/* والد ورودی جستجو */
.product-list-v3 .product-filter-card > .relative:has(.product-search-input) {
    position: relative !important;
    width: 100%;
    margin-top: 12px;
}

/* خود کادر جستجو */
.product-list-v3 .product-search-input {
    width: 100% !important;
    height: 46px !important;
    margin-top: 0 !important;
    padding: 0 15px 0 44px !important;
    border: 1px solid var(--pl-border) !important;
    border-radius: 12px !important;
    background: var(--pl-card) !important;
    color: var(--pl-ink) !important;
    direction: rtl;
    text-align: right;
    font-family: inherit;
    font-size: 12px;
}

/* آیکون ذره‌بین: سمت چپ کادر */
.product-list-v3 .product-filter-card > .relative:has(.product-search-input) > svg {
    position: absolute !important;
    top: 70% !important;
    left: 14px !important;
    right: auto !important;
    width: 18px !important;
    height: 18px !important;
    transform: translateY(-50%) !important;
    color: var(--pl-muted) !important;
    pointer-events: none;
    z-index: 2;
}

/* اگر دکمه پاک‌کردن جستجو وجود داشته باشد */
.product-list-v3 .product-filter-card > .relative:has(.product-search-input):has([data-clear-search]) > svg {
    left: 47px !important;
}

.product-list-v3 .product-filter-card > .relative:has(.product-search-input) [data-clear-search] {
    position: absolute !important;
    top: 50% !important;
    left: 9px !important;
    right: auto !important;
    transform: translateY(-50%) !important;
    z-index: 3;
}

/* فضای کافی برای آیکون و دکمه پاک‌کردن */
.product-list-v3 .product-filter-card > .relative:has([data-clear-search]) .product-search-input {
    padding-left: 76px !important;
}

/* حالت فوکوس */
.product-list-v3 .product-search-input:focus {
    border-color: var(--pl-accent) !important;
    box-shadow: 0 0 0 3px var(--pl-ring) !important;
    outline: none !important;
}
