:root {
    --bg: #f3f5f9;
    --card: #ffffff;
    --text: #1e1e1e;
    --muted: #6c757d;
    --border: #eceef2;
    --primary: #111827;
    --accent: #2563eb;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.2s ease;
}

[data-theme="dark"] {
    --bg: #0f1115;
    --card: #171a20;
    --text: #ffffff;
    --muted: #9ca3af;
    --border: #374151;
    --primary: #6e00ff;
    --accent: #3b82f6;
}

/* Product Card Base Styles */
.product-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: 22px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: 0.3s;
    margin: 0 auto;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.12);
}

.product-card.is-out-of-stock .product-image,
.product-card[data-mojodi="0"] .product-image {
    position: relative;
}

.product-card.is-out-of-stock::after,
.product-card[data-mojodi="0"]::after {
    content: 'در انتظار شارژ مجدد';
    position: absolute;
    top: 22px;
    left: -49px;
    width: 180px;
    text-align: center;
    background: #593bff;
    color: #fff;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 700;
    transform: rotate(-45deg);
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    white-space: nowrap;
}

/* حالت لیست — روبان گوشه بالا‌چپ کارت (مثل view-large، بدون بیرون‌زدگی) */
.products--list .product-card.is-out-of-stock,
.products--list .product-card[data-mojodi="0"] {
    position: relative !important;
    overflow: hidden !important;
}

.products--list .product-card.is-out-of-stock .product-image::after,
.products--list .product-card[data-mojodi="0"] .product-image::after {
    content: none !important;
    display: none !important;
}

.products--list .product-card.is-out-of-stock::after,
.products--list .product-card[data-mojodi="0"]::after {
    display: block;
    content: 'در انتظار شارژ مجدد';
    position: absolute;
    top: 18px;
    left: -46px;
    right: auto;
    width: 160px;
    text-align: center;
    background: #593bff;
    color: #fff;
    padding: 6px 0;
    font-size: 11px;
    font-weight: 700;
    transform: rotate(-45deg);
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    white-space: nowrap;
}

@media (min-width: 769px) {
    .products--list .product-card.is-out-of-stock::after,
    .products--list .product-card[data-mojodi="0"]::after {
        top: 20px;
        left: -48px;
        width: 170px;
        padding: 7px 0;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .products--list .product-card.is-out-of-stock::after,
    .products--list .product-card[data-mojodi="0"]::after {
        top: 14px;
        left: -42px;
        width: 140px;
        padding: 5px 0;
        font-size: 10px;
    }
}

.product-image img:not(.shegeftangiz-badge) {
    width: 90%;
    display: block;
    object-fit: contain;
    max-height: max-content;
    margin: 0 auto;
}

.product-image.product__media img.shegeftangiz-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    left: auto;
    bottom: auto;
    width: 44px;
    height: 44px;
    max-width: 22%;
    max-height: 22%;
    margin: 0;
    object-fit: contain;
    z-index: 3;
}

.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
}

.icon-group {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* آیکن‌های شبیه اینستاگرام — عدد جلوی آیکن (در RTL سمت راست) */
.icon-group--ig .action-pair {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-direction: row;
}

.icon-group--ig .ig-icon {
    font-size: 22px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.icon-group--ig .ig-icon:hover {
    transform: scale(1.12);
    color: var(--accent);
}

.icon-group--ig .ig-icon.saved,
.icon-group--ig .ig-icon.is-user-saved,
.icon-group--ig .action-pair--user-saved .fa-bookmark {
    color: var(--accent, #667eea) !important;
}

.icon-group--ig .action-pair--user-saved .ig-icon:hover,
.icon-group--ig .ig-icon.is-user-saved:hover {
    color: var(--accent, #667eea) !important;
}

.icon-group--ig .ig-icon.is-saving {
    opacity: 0.55;
    pointer-events: none;
}

.icon-group--ig .ig-icon--sales {
    font-weight: 700;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    cursor: default;
    user-select: none;
}

.action-pair--sales .sales-count {
    opacity: 1;
    max-width: none;
    margin-inline-start: 3px !important;
    vertical-align: middle;
}

.order-sales-icon-tip {
    position: fixed;
    z-index: 10050;
    left: 0;
    top: 0;
    padding: 5px 11px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    color: #fff;
    background: rgba(17, 24, 39, 0.92);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 4px) scale(0.96);
    transition: opacity 0.2s ease, transform 0.2s ease;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.order-sales-icon-tip.is-visible {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

[data-theme="dark"] .order-sales-icon-tip {
    background: rgba(255, 255, 255, 0.94);
    color: #111827;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.icon {
    width: 22px;
    height: 22px;
    cursor: pointer;
    transition: 0.2s;
    color: var(--muted);
}

.icon:hover {
    transform: scale(1.15);
    color: var(--accent);
}

.views {
    font-size: 12px;
    color: var(--muted);
}

.meta {
    font-size: 12px;
    color: var(--muted);
}

.title-row {
    padding: 0 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.title-row .code {
    font-size: 12px;
    color: var(--muted);
    flex: 0 0 auto;
}

.title-row .name {
    font-size: clamp(13px, 2.5vw, 16px);
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

.title-row .name.name-autofit {
    text-overflow: clip;
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 1px 0;
}

.buy-row {
    padding: 2px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.buy-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
}

.price {
    font-weight: 700;
    color: var(--primary);
}

.qty-box {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border-radius: 23px;
    padding: 4px;
    gap: 6px;
    border: 1px solid var(--border);
}

.qty-box input {
    width: 60px;
    height: 36px;
    text-align: center;
    border: none;
    outline: none;
    font-size: 14px;
    font-weight: 600;
    background: transparent;
    color: var(--text);
}

.qty-box input:focus {
    background: #eef2ff;
    border-radius: 8px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 18px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.qty-btn:hover {
    background: var(--accent);
}

.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    cursor: pointer;
    transition: opacity 0.2s;
    font-weight: 600;
}

.product-card .buy-row .btn.add-to-cart,
.product-card .buy-row .btn.add-unit,
.product-card .buy-row .btn.add-carton,
.product-card .buy-row .btn.add-preorder {
    background: #6e00ff !important;
    color: #fff !important;
    border: none;
    box-shadow: none;
    transform: none;
}

.product-card .buy-row .btn.add-to-cart:disabled,
.product-card .buy-row .btn.add-to-cart[aria-disabled="true"] {
    background: #828282 !important;
    color: #fff !important;
    opacity: 1 !important;
    cursor: not-allowed;
    pointer-events: none;
}

.product-card .buy-row .btn.disabled {
    background: var(--accent) !important;
    color: #fff !important;
    opacity: 1 !important;
}

.product-card .add-preorder::before {
    display: none !important;
}

.product-card .add-preorder:hover {
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.85;
}

.product-card .qty-box input.qty-unit,
.product-card .qty-box input.qty-carton,
.product-card .qty-box input.qty-preorder,
.product-card .qty-box input.qty-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

.product-card .qty-box.is-qty-locked {
    pointer-events: none;
}

.product-card .qty-box.is-qty-locked input,
.product-card .qty-box.is-qty-locked input:disabled {
    opacity: 1 !important;
    color: var(--text) !important;
    -webkit-text-fill-color: var(--text) !important;
    background: transparent !important;
}

.product-card .qty-box.is-qty-locked .qty-btn:disabled {
    opacity: 1 !important;
    background: #828282 !important;
    color: #fff !important;
    cursor: not-allowed;
}

.btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    opacity: 0.7;
}

.product-card .buy-row .btn:disabled {
    background: var(--accent) !important;
    opacity: 1 !important;
}

.btn:hover {
    opacity: 0.85;
}

.details {
    padding: 0 18px 16px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.9;
    position: static;
    z-index: 2;
}

.product-card > .buy-row {
    position: relative;
    z-index: 1;
}

.product-card.is-more-open {
    z-index: 9999;
}

.product-category-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 0;
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1.65;
    color: var(--muted);
}

.product-cat-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.product-cat-link:hover,
.product-cat-link:focus-visible {
    text-decoration: underline;
}

.product-cat-sep {
    margin: 0 3px;
    opacity: 0.45;
    user-select: none;
}

.product-description {
    font-size: 12px;
    line-height: 1.7;
    color: var(--text);
    word-break: break-word;
}

.product-tags {
    margin-top: 8px;
}

.product-tag-hashtag {
    display: inline-block;
    margin-left: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 1.4;
    text-decoration: none;
    color: var(--accent, #667eea);
}

.product-tag-hashtag:hover {
    text-decoration: underline;
    color: var(--accent, #667eea);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.detail-row__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.detail-row__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    line-height: 0;
}

.detail-row__icon .detail-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.detail-row__value {
    text-align: left;
    min-width: 0;
}

.more-toggle {
    margin-top: 8px;
    cursor: pointer;
    color: var(--accent);
    font-weight: 600;
    text-align: left;
    position: relative;
    z-index: 45;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.product-card .more-content {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 10px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    transform: translateY(8px);
    transition: max-height 0.28s ease, opacity 0.22s ease, transform 0.22s ease, padding 0.22s ease, visibility 0.22s ease;
    z-index: 30;
}

.product-card .more-content.active {
    max-height: calc(100% - 28px);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    padding: 12px;
    padding-bottom: 14px;
    bottom: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transform: translateY(0);
}

[data-theme="dark"] .product-card .more-content {
    background: rgba(23, 26, 32, 0.98);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.product-more-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.35);
    touch-action: manipulation;
}

[data-theme="dark"] .product-more-backdrop {
    background: rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .qty-box {
    background: #1c2230;
    border-color: #374151;
}

[data-theme="dark"] .qty-box input,
[data-theme="dark"] .qty-box input.qty-unit,
[data-theme="dark"] .qty-box input.qty-carton,
[data-theme="dark"] .qty-box input.qty-preorder {
    color: #f3f4f6 !important;
    -webkit-text-fill-color: #f3f4f6;
}

[data-theme="dark"] .qty-box input:focus {
    background: #2a3142;
}

/* حالت لیست: پس‌زمینه روشن — متن ورودی باید تیره باشد تا در دارک مود خوانا بماند */
[data-theme="dark"] .products--list .product-card .qty-box input,
[data-theme="dark"] .products--list .product-card .qty-box input.qty-unit,
[data-theme="dark"] .products--list .product-card .qty-box input.qty-carton,
[data-theme="dark"] .products--list .product-card .qty-box input.qty-preorder {
    color: #111827 !important;
    -webkit-text-fill-color: #111827;
}

.product-card.oos {
    opacity: 0.7;
}

.product-card.oos .btn {
    background: var(--muted);
    cursor: not-allowed;
}

.product-card.oos .qty-btn {
    background: var(--muted);
    cursor: not-allowed;
}

.qty-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    opacity: 0.7;
}

.qty-box input:disabled {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

.icon.liked {
    fill: #ff0000 !important;
    stroke: #ff0000 !important;
}

.icon.saved {
    fill: #000 !important;
    stroke: #000 !important;
    color: #000 !important;
}

[data-theme="dark"] .icon.saved {
    fill: #fff !important;
    stroke: #fff !important;
    color: #fff !important;
}

.like-count {
    font-size: 12px;
    color: var(--muted);
    margin-left: 4px;
    margin-right: 8px;
}

/* ========== حالت گرید معمولی ========== */
.products--grid .product-card {
    margin-bottom: 25px;
}

body[data-snap-feed] #products:not(.products--list) .product-card {
    margin-bottom: 0;
}

@media (max-width: 991px) {
    body[data-snap-feed] #products:not(.products--list) .product-card {
        margin-bottom: 0 !important;
    }
}

/* ========== حالت گرید بزرگ ========== */
.products.view-large .product-card {
    max-width: 100%;
}

#products.view-large:not(.products--list) .product-card > .product-image.product__media > img.product__media-img {
    content-visibility: visible !important;
    contain: none !important;
}

/* ========== حالت لیستی ========== */
.products--list {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

/* باکس تصویر list — ابعاد ثابت برای img.product__media-img (lazy-load پایدار) */
#products.products--list .product-card > .product-image.product__media {
    flex-shrink: 0;
    overflow: hidden;
}

#products.products--list .product-card > .product-image.product__media > img.product__media-img {
    display: block !important;
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: contain !important;
    object-position: center;
    margin: 0 !important;
    content-visibility: visible !important;
    contain: none !important;
}

/* ========== دسکتاپ ========== */
@media (min-width: 769px) {
    .products--list .product-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 15px !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 12px 15px !important;
        border-radius: var(--radius) !important;
        background: var(--card) !important;
        box-shadow: var(--shadow) !important;
    }
    
    .products--list .product-card .product-image {
        width: 120px !important;
        min-width: 120px !important;
        border-radius: 10px !important;
        overflow: hidden !important;
    }
    
    .products--list .product-card .product-image img,
    #products.products--list .product-card > .product-image.product__media > img.product__media-img {
        width: 120px !important;
        height: 120px !important;
        max-width: 120px !important;
        max-height: 120px !important;
        object-fit: contain !important;
    }
    
    .products--list .product-card .title-row {
        flex: 2 !important;
        padding: 0 !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
    }
    
    .products--list .product-card .title-row .code {
        font-size: 11px !important;
        color: var(--muted) !important;
        opacity: 0.7 !important;
        display: block !important;
    }
    
    .products--list .product-card .title-row .name {
        font-size: 14px !important;
        font-weight: 700 !important;
        color: var(--text) !important;
        margin: 0 !important;
    }
    
    .products--list .product-card .buy-row:first-of-type,
    .products--list .product-card .buy-row:last-of-type {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 10px !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .products--list .product-card .price {
        font-size: 14px !important;
        font-weight: 700 !important;
        color: var(--primary) !important;
        white-space: nowrap !important;
    }
    
    .products--list .product-card .qty-box {
        padding: 3px !important;
        gap: 4px !important;
        background: #f8fafc !important;
        border-radius: 8px !important;
        border: 1px solid var(--border) !important;
    }
    
    .products--list .product-card .qty-box input {
        width: 65px !important;
        height: 30px !important;
        font-size: 13px !important;
        text-align: center !important;
    }
    
    .products--list .product-card .qty-btn {
        width: 26px !important;
        height: 26px !important;
        font-size: 13px !important;
        border-radius: 5px !important;
    }
    
    .products--list .product-card .add-to-cart,
    .products--list .product-card .add-carton {
        padding: 6px 12px !important;
        font-size: 11px !important;
        min-width: 65px !important;
        height: 32px !important;
        border-radius: 8px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .products--list .product-card .add-to-cart,
    .products--list .product-card .add-carton,
    .products--list .product-card .add-preorder {
        background: var(--accent) !important;
    }
    
    .products--list .product-card .actions,
    .products--list .product-card .meta,
    .products--list .product-card .details,
    .products--list .product-card .divider {
        display: none !important;
    }
}

/* ========== موبایل ========== */
@media (max-width: 768px) {
    .products--list .product-card {
        display: block !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 12px !important;
        border-radius: var(--radius) !important;
        background: var(--card) !important;
        box-shadow: var(--shadow) !important;
    }
    
    /* ردیف اول: تصویر + عنوان در کنار هم با استفاده از display: flex */
    .products--list .product-card .product-image {
        width: 130px !important;
        min-width: 130px !important;
        max-width: 130px !important;
        border-radius: 10px !important;
        overflow: hidden !important;
        display: inline-block !important;
        vertical-align: middle !important;
    }
    
    .products--list .product-card .product-image img,
    #products.products--list .product-card > .product-image.product__media > img.product__media-img {
        width: 130px !important;
        height: 130px !important;
        max-width: 130px !important;
        max-height: 130px !important;
        object-fit: contain !important;
    }
    
    .products--list .product-card .title-row {
        display: inline-flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 4px !important;
        width: calc(100% - 140px) !important;
        padding: 0 !important;
        margin: 0 !important;
        vertical-align: middle !important;
    }
    
    .products--list .product-card .title-row .code {
        font-size: 11px !important;
        color: var(--muted) !important;
        opacity: 0.7 !important;
        display: block !important;
    }
    
    .products--list .product-card .title-row .name {
        font-size: 13px !important;
        font-weight: 700 !important;
        color: var(--text) !important;
        margin: 0 !important;
        line-height: 1.4 !important;
        white-space: normal !important;
    }
    
    /* ردیف دوم: دکمه جینی */
    .products--list .product-card .buy-row:first-of-type {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        width: 100% !important;
        margin: 12px 0 0 0 !important;
        padding: 10px 0 8px 0 !important;
        border-top: 1px solid var(--border) !important;
        clear: both !important;
    }
    
    /* ردیف سوم: دکمه کارتن */
    .products--list .product-card .buy-row:last-of-type {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .products--list .product-card .price {
        font-size: 13px !important;
        font-weight: 700 !important;
        color: var(--primary) !important;
        white-space: nowrap !important;
    }
    
    .products--list .product-card .buy-left {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 8px !important;
    }
    
    .products--list .product-card .qty-box {
        padding: 2px !important;
        gap: 3px !important;
        background: #f8fafc !important;
        border-radius: 6px !important;
        border: 1px solid var(--border) !important;
    }
    
    .products--list .product-card .qty-box input {
        width: 70px !important;
        height: 28px !important;
        font-size: 12px !important;
        text-align: center !important;
    }
    
    .products--list .product-card .qty-btn {
        width: 24px !important;
        height: 24px !important;
        font-size: 12px !important;
        border-radius: 5px !important;
    }
    
    .products--list .product-card .add-to-cart,
    .products--list .product-card .add-carton {
        padding: 5px 10px !important;
        font-size: 10px !important;
        white-space: nowrap !important;
        min-width: 55px !important;
        height: 30px !important;
        border-radius: 8px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .products--list .product-card .add-to-cart,
    .products--list .product-card .add-carton,
    .products--list .product-card .add-preorder {
        background: var(--accent) !important;
    }
    
    /* مخفی کردن المان‌های اضافی */
    .products--list .product-card .actions,
    .products--list .product-card .meta,
    .products--list .product-card .details,
    .products--list .product-card .divider,
    .products--list .product-card .views,
    .products--list .product-card .icon-group {
        display: none !important;
    }
}

/* ========== موبایل خیلی کوچک ========== */
@media (max-width: 480px) {
    .products--list .product-card {
        padding: 10px !important;
    }
    
    .products--list .product-card .product-image {
        width: 100px !important;
        min-width: 100px !important;
        max-width: 100px !important;
    }
    
    .products--list .product-card .product-image img,
    #products.products--list .product-card > .product-image.product__media > img.product__media-img {
        width: 100px !important;
        height: 100px !important;
        max-width: 100px !important;
        max-height: 100px !important;
    }
    
    .products--list .product-card .title-row {
        width: calc(100% - 110px) !important;
    }
    
    .products--list .product-card .title-row .code {
        font-size: 10px !important;
    }
    
    .products--list .product-card .title-row .name {
        font-size: 12px !important;
    }
    
    .products--list .product-card .price {
        font-size: 12px !important;
    }
    
    .products--list .product-card .buy-row:first-of-type,
    .products--list .product-card .buy-row:last-of-type {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .products--list .product-card .buy-left {
        flex: 1 !important;
        justify-content: space-between !important;
    }
    
    .products--list .product-card .add-to-cart,
    .products--list .product-card .add-carton {
        width: 100% !important;
        margin-top: 5px !important;
    }
    
    .products--list .product-card .qty-box input {
        width: 70px !important;
        height: 26px !important;
        font-size: 11px !important;
    }
    
    .products--list .product-card .qty-btn {
        width: 22px !important;
        height: 22px !important;
        font-size: 11px !important;
    }
}

/* Responsive adjustments for normal mode */
@media (max-width: 480px) {
    .product-card {
        border-radius: 18px;
    }
    
    .actions {
        padding: 0px 16px;
    }
    
    .title-row {
        padding: 0 16px;
    }
    
    .buy-row {
        padding: 3px 1px;
    }
    
    .details {
        padding: 0 16px 14px;
    }
}

/* =====================================================================
   📐 کارت محصول: مقیاس‌دهی بر اساس عرض کارت (Container Queries / cqi)
   ارتفاع کارت طبیعی است (محتوا + تصویر) — بدون قفل viewport تا روی موبایل پرپر نکند
   ===================================================================== */

/* پایه: همه‌ی کارت‌های گرید container-query-aware می‌شوند */
.products:not(.products--list) .product-card {
    container-type: inline-size;
    container-name: pcard;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* تصویر محصول: کاملاً دست‌نخورده، فقط در flex-flow اندازه‌ی طبیعی خودش را می‌گیرد */
.products:not(.products--list) .product-card > .product-image,
.products:not(.products--list) .product-card > .product__media {
    flex: 0 0 auto;
}

/* گرید: باکس تصویر ۹۰٪ عرض، مربعی یکسان — در جریان layout (بدون absolute) */
#products:not(.products--list) .product-card > .product-image.product__media {
    width: 100%;
    overflow: hidden;
    display: block;
}

#products:not(.products--list) .product-card > .product-image.product__media > img.product__media-img {
    display: block;
    width: 91%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-width: 91%;
    max-height: none;
    margin: 0 auto;
    object-fit: contain;
    object-position: center;
    content-visibility: visible;
    contain: none;
}

/* اولین بلوک بعد از تصویر: 10px فاصله از تصویر (سقف کارت) */
.products:not(.products--list) .product-card > .actions {
    flex: 0 0 auto;
    padding: 2px clamp(10px, 4cqi, 18px) clamp(2px, 1cqb, 2px) !important;
    gap: clamp(6px, 2cqi, 12px) !important;
    min-width: 0 !important;
    flex-wrap: nowrap !important;
}

/* ردیف‌های میانی: padding افقی همسان، عمودی متناسب با ارتفاع کارت */
.products:not(.products--list) .product-card > .title-row,
.products:not(.products--list) .product-card > .buy-row {
    flex: 0 0 auto;
    padding-left: clamp(10px, 4cqi, 18px) !important;
    padding-right: clamp(10px, 4cqi, 18px) !important;
    min-width: 0 !important;
}

/* لنگر برای پنل «بیشتر»: لبهٔ بالا دقیقاً زیر ردیف نام */
.products:not(.products--list) .product-card > .title-row {
    anchor-name: --order-pcard-title;
}

.products:not(.products--list) .product-card > .buy-row {
    padding-top: clamp(2px, 0.8cqb, 6px) !important;
    gap: clamp(6px, 2cqi, 10px) !important;
    flex-wrap: nowrap !important;
}

.products:not(.products--list) .product-card > .divider {
    flex: 0 0 auto;
    margin: clamp(2px, 0.6cqb, 6px) clamp(10px, 4cqi, 18px) !important;
}

/* جزئیات: فضای باقی‌مانده‌ی عمودی را پر می‌کند، 10px فاصله از کف کارت */
.products:not(.products--list) .product-card > .details {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: clamp(4px, 1.5cqb, 2px) clamp(10px, 4cqi, 18px) 2px !important;
}

/* پنل مطلق نسبت به کارت است؛ وقتی باز است نباید جزئیات آن را ببُرد */
.products:not(.products--list) .product-card.is-more-open > .details {
    overflow: visible;
}

body[data-snap-feed] .products:not(.products--list) .product-card.is-more-open {
    overflow: visible;
}

.products:not(.products--list) .product-card .more-content {
    left: clamp(10px, 4cqi, 18px);
    right: clamp(10px, 4cqi, 18px);
    bottom: clamp(8px, 1.5cqb, 12px);
}

/* از زیر نام تا نزدیک کف کارت؛ اسکرول داخل پنل — fallback وقتی anchor پشتیبانی نشود */
.products:not(.products--list) .product-card .more-content.active {
    top: clamp(110px, 30cqb, 58%);
    bottom: clamp(6px, 1.5cqb, 14px);
    left: clamp(10px, 4cqi, 18px);
    right: clamp(10px, 4cqi, 18px);
    max-height: none;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@supports (top: anchor(bottom)) {
    .products:not(.products--list) .product-card .more-content.active {
        position-anchor: --order-pcard-title;
        top: anchor(bottom);
        margin-top: 6px;
    }
}

.product-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #111827 !important;
    text-decoration: none;
    cursor: pointer;
}

[data-theme="dark"] .product-brand-link,
[data-theme="dark"] .product-brand-link .product-brand-link__label {
    color: #ffffff !important;
}

.product-brand-link img {
    width: 18px;
    height: 18px;
}

.product-brand-link:hover {
    color: var(--primary) !important;
    text-decoration: none;
}

.product-brand-link:hover .product-brand-link__label {
    color: var(--primary) !important;
}

/* ===== سطر اول: بازدید + آیکن‌ها (لایک/شیر/سیو/...) ===== */
.products:not(.products--list) .product-card .views {
    font-size: clamp(10px, 3.2cqi, 13px) !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.products:not(.products--list) .product-card .icon-group {
    gap: clamp(6px, 2.4cqi, 14px) !important;
    flex-wrap: nowrap !important;
    min-width: 0;
}

.products:not(.products--list) .product-card .icon-group .action-pair {
    gap: clamp(2px, 0.8cqi, 4px) !important;
    align-items: center;
}

.products:not(.products--list) .product-card .icon-group .icon {
    width: clamp(16px, 5.5cqi, 22px) !important;
    height: clamp(16px, 5.5cqi, 22px) !important;
    flex-shrink: 0;
}

.products:not(.products--list) .product-card .icon-group--ig .ig-icon {
    font-size: clamp(16px, 5.5cqi, 22px) !important;
    flex-shrink: 0;
}

[data-theme="dark"] .icon-group--ig .ig-icon.saved,
[data-theme="dark"] .icon-group--ig .ig-icon.is-user-saved,
[data-theme="dark"] .icon-group--ig .action-pair--user-saved .fa-bookmark {
    color: #a78bfa !important;
}

.products:not(.products--list) .product-card .count-num {
    font-size: 11px !important;
    margin: 0 !important;
    white-space: nowrap;
    padding-top: 4px;
    font-weight: 600;
}

/* ===== کد و نام محصول ===== */
.products:not(.products--list) .product-card .title-row .code {
    font-size: clamp(10px, 3.5cqi, 13px) !important;
    flex-shrink: 0;
}

.products:not(.products--list) .product-card .title-row .name:not(.name-autofit) {
    font-size: clamp(12px, 4cqi, 16px) !important;
    flex: 1 1 auto !important;
    min-width: 0;
}

.products:not(.products--list) .product-card .title-row .name.name-autofit {
    flex: 1 1 auto !important;
    min-width: 0;
    text-overflow: clip !important;
}

/* ===== ردیف خرید: قیمت + qty-box + دکمه ===== */
.products:not(.products--list) .product-card .price {
    font-size: clamp(11px, 3.6cqi, 14px) !important;
    white-space: nowrap !important;
    flex-shrink: 0;
    color: var(--text);
}

[data-theme="dark"] .products:not(.products--list) .product-card .price {
    color: #fff;
}

.products:not(.products--list) .product-card .buy-left {
    gap: clamp(4px, 1.5cqi, 10px) !important;
    flex-wrap: nowrap !important;
    min-width: 0;
}

.products:not(.products--list) .product-card .qty-box {
    padding: clamp(2px, 0.8cqi, 4px) !important;
    gap: clamp(2px, 1cqi, 6px) !important;
    flex-shrink: 0;
}

.products:not(.products--list) .product-card .qty-box input {
    width: clamp(36px, 16cqi, 60px) !important;
    height: clamp(26px, 9cqi, 36px) !important;
    font-size: clamp(11px, 3.5cqi, 14px) !important;
    padding: 0 !important;
    min-width: 0 !important;
}

.products:not(.products--list) .product-card .qty-btn {
    width: clamp(22px, 8cqi, 32px) !important;
    height: clamp(22px, 8cqi, 32px) !important;
    font-size: clamp(11px, 4cqi, 16px) !important;
    flex-shrink: 0;
}

.products:not(.products--list) .product-card .btn.add-to-cart {
    padding: clamp(4px, 1.5cqi, 8px) clamp(8px, 3cqi, 14px) !important;
    font-size: clamp(9px, 3cqi, 12px) !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 1 1 0 !important;
    white-space: nowrap !important;
    min-height: clamp(26px, 9cqi, 36px) !important;
}

/* ===== جزئیات (برند، ابعاد، ...) ===== */
.products:not(.products--list) .product-card .detail-row {
    font-size: clamp(10px, 3cqi, 12px) !important;
    line-height: 1.55 !important;
}

.products:not(.products--list) .product-card .more-toggle {
    font-size: clamp(10px, 3cqi, 12px) !important;
    margin-top: clamp(0px, 0cqb, 2px) !important;
}

/* fallback برای مرورگرهای قدیمی بدون پشتیبانی از container queries */
@supports not (container-type: inline-size) {
    .products:not(.products--list) .product-card > .actions {
        padding: 10px 14px 6px !important;
    }
    .products:not(.products--list) .product-card > .details {
        padding: 6px 14px 10px !important;
    }
    .products:not(.products--list) .product-card > .title-row,
    .products:not(.products--list) .product-card > .buy-row {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
}

/* تبلیغ فروشگاه (AD) — فقط نمایش بصری */
.product-card.is-shop-ad {
    outline: 2px solid #f59e0b;
    outline-offset: -2px;
}

.product-card .shop-ad-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 24px;
    padding: 0 8px;
    border-radius: 6px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #1f2937;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}