/* ============================================================
   Narmpa — Loops: Product Card + Archive  v3  (#B43F3F)
   ============================================================ */

/* ════════════════════════════════════════════
   Swiper base
   ════════════════════════════════════════════ */
.swiper-wrapper { align-items: stretch; }
.swiper-slide   { height: auto; }

.dm-products-slider,
.dm-posts-slider,
.dm-sp-products-slider,
.dm-posts-related-slider {
    padding: 4px 1.5rem 36px;
}
@media (min-width: 992px) {
    .dm-products-slider,
    .dm-posts-slider,
    .dm-sp-products-slider,
    .dm-posts-related-slider { padding-left: 0; padding-right: 0; }
}


/* ════════════════════════════════════════════
   کارت محصول
   ════════════════════════════════════════════ */
.dm-product-card {
    background: #fff;
    border-radius: 14px;
    padding: 10px;
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    height: 100%;
    direction: rtl;
    position: relative;
    overflow: hidden;
    transition: box-shadow .25s ease, transform .25s ease, border-color .25s;
}
.dm-product-card:hover {
    box-shadow: 0 6px 22px rgba(0,0,0,.07);
    transform: translateY(-3px);
    border-color: #e8e8e8;
}

.dm-product-card .dm-product-card-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    flex: 1;
    color: inherit;
}

/* تصویر — پرتره، پر */
.dm-product-card .dm-product-thumb {
    width: 100%;
    aspect-ratio: 3 / 4;
    position: relative;
    background: #f5f5f5;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0;
}
.dm-product-card .dm-product-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}
.dm-product-card:hover .dm-product-thumb img { transform: scale(1.05); }

/* هاور → تصویر شاخص محو و اولین تصویر گالری نمایان می‌شود (کراس‌فید، نه پرش ناگهانی).
   سلکتور عمداً img.dm-product-hover-img است (نه فقط .dm-product-hover-img): چون همین المان
   قانونِ پایه‌ی .dm-product-thumb img (که فقط transition:transform دارد) را هم می‌گیرد و آن
   قانون specificity بالاتری داشت، پس ترنزیشنِ opacity نادیده گرفته می‌شد و به‌جای محوِ نرم،
   ناگهانی سوییچ می‌کرد. position/inset/size/object-fit از همان قانون پایه ارث می‌رسد. */
.dm-product-card .dm-product-thumb img.dm-product-hover-img {
    opacity: 0;
    transition: opacity .4s ease, transform .4s ease;
    pointer-events: none;
}
.dm-product-card:hover .dm-product-thumb img.dm-product-hover-img {
    opacity: 1;
    transform: scale(1.05);
}

/* بج تخفیف روی تصویر */
.dm-product-card .dm-product-badge {
    position: absolute;
    top: 8px; right: 8px;
    background: var(--dm-primary, #B43F3F);
    color: #fff;
    font-size: 11px; font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    z-index: 2;
}

/* اطلاعات — وسط‌چین */
.dm-product-card .dm-product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
    padding: 12px 6px 4px;
    align-items: center;
    text-align: center;
}

.dm-product-card .dm-product-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.7;
    margin: 0;
    width: 100%;
    /* همیشه تک‌خطی؛ خط دوم نمایش داده نشود */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* قیمت — وسط، قرمز برند، همیشه یک خط (حتی با تخفیف) */
.dm-product-card .dm-product-price-wrapper {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 6px;
    direction: rtl;
    width: 100%;
    overflow: hidden;
}
.dm-product-card .dm-current-price { white-space: nowrap; }
.dm-product-card .dm-old-price { white-space: nowrap; flex-shrink: 0; }
.dm-product-card .dm-current-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--dm-primary, #B43F3F);
    display: flex; align-items: baseline; gap: 3px;
}
.dm-product-card .dm-current-price .woocommerce-Price-currencySymbol {
    font-size: 11px; font-weight: 700; opacity: .85; margin-right: 2px;
}
.dm-product-card .dm-current-price .dm-price-suffix-img { height: 14px; }
.dm-product-card .dm-cur-unit { font-size: 11px; font-weight: 700; }
.dm-product-card .dm-old-price {
    font-size: 12px;
    color: #c0c0c0;
    text-decoration: line-through;
}
.dm-product-card .dm-old-price .woocommerce-Price-currencySymbol { display: none; }
.dm-product-card .dm-unavailable { color: #c0c0c0; font-size: 12.5px; font-weight: 600; }

/* دکمه (در صورت فعال بودن) */
.dm-add-to-cart-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 5px; padding: 8px 12px; margin-top: 8px;
    border: none; border-radius: 9px;
    background: var(--dm-primary, #B43F3F); color: #fff;
    font-size: 12px; font-weight: 700;
    cursor: pointer; transition: opacity .2s;
    text-decoration: none; font-family: inherit; line-height: 1;
}
.dm-add-to-cart-btn:hover { opacity: .86; color: #fff; }
.dm-unavailable-btn { background: #f2f2f2; color: #c0c0c0; cursor: not-allowed; }
.dm-unavailable-btn:hover { opacity: 1; color: #c0c0c0; }

/* ════ سواچ‌های افزونه dm-product-variations داخل کارت ════ */
.dm-product-card .dm-pv-archive {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /*margin-top: 10px;*/
    align-items: center;
}
.dm-product-card .dm-pv-archive-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    overflow: hidden;
        padding: 1px;
}
/* سایزها — چیپ */
.dm-product-card .dm-pv-archive-label {
    min-width: 12px;
    padding: 4px 8px;
    border: 1px solid #e2e2e2;
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 700;
    color: #555;
    text-align: center;
    background: #fff;
    transition: border-color .15s, color .15s;
}
.dm-product-card:hover .dm-pv-archive-label { border-color: #d8d8d8; }
/* رنگ‌ها — دایره */
.dm-product-card .dm-pv-archive-color {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1.5px #ddd;
    display: inline-block;
}
.dm-product-card .dm-pv-archive-image {
    width: 22px; height: 22px;
    border-radius: 50%;
    background-size: cover; background-position: center;
    box-shadow: 0 0 0 1.5px #ddd;
}
.dm-product-card .dm-pv-archive-more {
    font-size: 11px; font-weight: 700; color: #aaa;
    align-self: center;
}


/* ════════════════════════════════════════════
   کارت مقاله
   ════════════════════════════════════════════ */
.dm-post-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    direction: rtl;
    overflow: hidden;
    transition: box-shadow .25s, transform .25s;
}
.dm-post-card:hover {
    box-shadow: 0 6px 22px rgba(0,0,0,.07);
    transform: translateY(-2px);
}
.dm-post-card .dm-post-card-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    color: inherit;
}
.dm-post-card .dm-post-thumb {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #f4f4f4;
    flex-shrink: 0;
}
.dm-post-card .dm-post-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
    display: block;
}
.dm-post-card:hover .dm-post-thumb img { transform: scale(1.04); }
.dm-post-thumb-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg, #f0f0f0, #e4e4e4); }

.dm-post-card .dm-post-content {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.dm-post-card .dm-post-category {
    background: rgba(180,63,63,.08);
    color: var(--dm-primary, #B43F3F);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 5px;
    display: inline-block;
    align-self: flex-end;
}
.dm-post-card .dm-post-title {
    font-size: 14px;
    font-weight: 800;
    color: #222;
    line-height: 1.75;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dm-post-card .dm-post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f4f4f4;
    padding-top: 10px;
    margin-top: 4px;
    font-size: 12px;
    color: #bbb;
    font-weight: 500;
}


/* ════════════════════════════════════════════
   ARCHIVE WRAP
   ════════════════════════════════════════════ */
.dm-archive-wrap { direction: rtl; background: #f7f7f7; min-height: 60vh; padding-bottom: 64px; }
.dm-container { max-width: 1500px; margin: 0 auto; padding: 0 24px; }

/* Breadcrumb */
.dm-archive-breadcrumb {
    background: #fff;
    border-bottom: 1px solid #efefef;
    padding: 10px 0;
}
.dm-archive-breadcrumb .woocommerce-breadcrumb { margin: 0; font-size: 12px; color: #bbb; }
.dm-archive-breadcrumb a { color: #bbb; text-decoration: none; transition: color .15s; }
.dm-archive-breadcrumb a:hover { color: var(--dm-primary, #B43F3F); }

/* Header */
.dm-archive-header { padding: 22px 0 14px; }
.dm-archive-title { font-size: 20px; font-weight: 900; color: #1a1a1a; margin: 0 0 10px; }

.dm-archive-desc-wrap { position: relative; }
.dm-archive-desc-text {
    font-size: 13px; color: #777; line-height: 2;
    max-height: 56px; overflow: hidden;
    transition: max-height .4s ease;
}
.dm-archive-desc-wrap.is-expanded .dm-archive-desc-text { max-height: 1000px; }
.dm-show-more-btn {
    background: transparent; border: none;
    color: var(--dm-primary, #B43F3F);
    font-size: 12px; font-weight: 700;
    cursor: pointer; padding: 6px 0;
    display: block; font-family: inherit;
}

/* Sort bar */
.dm-archive-sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 18px;
    border: 1px solid #efefef;
    flex-wrap: wrap;
}
.dm-archive-result-count { font-size: 12.5px; color: #aaa; }
.dm-archive-result-count .woocommerce-result-count { margin: 0; }

.dm-archive-sort-btns { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.dm-sort-label { font-size: 12px; color: #bbb; font-weight: 600; margin-left: 2px; }
.dm-sort-btn {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px; font-weight: 700;
    color: #777; background: #f4f4f4;
    text-decoration: none;
    transition: background .18s, color .18s;
    white-space: nowrap;
}
.dm-sort-btn:hover { background: var(--dm-primary-10, rgba(180,63,63,.08)); color: var(--dm-primary, #B43F3F); }
.dm-sort-btn.is-active { background: var(--dm-primary, #B43F3F); color: #fff; }

/* چیدمانِ آرشیو با سایدبارِ فیلتر (افزونه‌ی DM Search & Filter): سایدبار سمتِ راست (RTL،
   قبل از گرید در DOM)، گرید فضای باقیمانده را می‌گیرد. سایدبار خودش استایل/آکاردئونِ داخلی
   را از dms-sidebar-builder.css (خودِ افزونه) می‌گیرد؛ این‌جا فقط عرض/چیدمانِ ستونی است. */
.dm-archive-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}
.dm-archive-sidebar {
    flex: 0 0 260px;
    min-width: 0;
}
.dm-archive-main {
    flex: 1;
    min-width: 0;
}
/* موبایل: نه سایدبار، نه نوارِ مرتب‌سازیِ خودِ قالب — فقط نوارِ فیلترِ موبایلِ افزونه
   ([dm_search_mobile_bar], بالای همین بخش در آرشیو-پروداکت) دیده می‌شود. */
@media (max-width: 992px) {
    .dm-archive-sidebar { display: none; }
    .dm-archive-sort-bar { display: none; }
}

/* Grid */
.dm-archive-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 32px;
}
@media (max-width: 1200px) { .dm-archive-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px)  { .dm-archive-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .dm-archive-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

/* Pagination */
.dm-archive-pagination { text-align: center; padding: 20px 0; }
.dm-archive-pagination .woocommerce-pagination { margin: 0; }
.dm-archive-pagination ul.page-numbers {
    display: inline-flex; gap: 4px;
    list-style: none; margin: 0; padding: 0;
}
.dm-archive-pagination .page-numbers li a,
.dm-archive-pagination .page-numbers li span {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    border-radius: 9px;
    font-size: 13px; font-weight: 700;
    border: 1px solid #e8e8e8;
    background: #fff; color: #666;
    text-decoration: none;
    transition: border-color .18s, color .18s;
}
.dm-archive-pagination .page-numbers li a:hover {
    border-color: var(--dm-primary, #B43F3F);
    color: var(--dm-primary, #B43F3F);
}
.dm-archive-pagination .page-numbers li span.current {
    background: var(--dm-primary, #B43F3F);
    color: #fff;
    border-color: var(--dm-primary, #B43F3F);
}

.dm-archive-empty { text-align: center; padding: 60px 20px; color: #bbb; }

/* ════ Archive Category Banner ════ */
.dm-archive-cat-banner {
    position: relative;
    background: #f9eded;
    overflow: hidden;
    min-height: 160px;
    display: flex;
    align-items: flex-end;
    margin-bottom: 0;
}
.dm-archive-cat-img {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center left;
    opacity: .18;
}
.dm-archive-cat-content {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 24px 0 20px;
}
.dm-archive-cat-content .woocommerce-breadcrumb {
    font-size: 12px; color: rgba(180,63,63,.6);
    margin: 0 0 8px;
}
.dm-archive-cat-content .woocommerce-breadcrumb a { color: rgba(180,63,63,.6); text-decoration: none; }
.dm-archive-cat-title {
    font-size: 26px; font-weight: 900;
    color: var(--dm-primary, #B43F3F);
    margin: 0;
}
.dm-archive-desc-heading {
    font-size: 18px; font-weight: 800;
    color: #1a1a1a; margin: 0 0 14px;
    padding-top: 40px;
}
@media (max-width: 768px) {
    .dm-archive-cat-banner { min-height: 120px; }
    .dm-archive-cat-title { font-size: 20px; }
}


/* ════════════════════════════════════════════
   Skeleton Loader
   ════════════════════════════════════════════ */
.dm-skeleton-overlay {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 32px;
}
@media (max-width: 1200px) { .dm-skeleton-overlay { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px)  { .dm-skeleton-overlay { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .dm-skeleton-overlay { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

.dm-skel-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #f0f0f0;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dm-skel-img {
    width: 100%; padding-top: 100%;
    background: #f0f0f0;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}
.dm-skel-line {
    height: 12px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.dm-skel-line--title  { width: 85%; }
.dm-skel-line--short  { width: 55%; height: 10px; }
.dm-skel-line--price  { width: 65%; height: 14px; }

.dm-skel-img::after,
.dm-skel-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.55) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: dm-shimmer 1.4s infinite;
}
@keyframes dm-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* ============================================================
   تطبیق کارت‌های محصول و مقاله با تم دارک (Dark Mode)
   ============================================================ */

/* پس‌زمینه کارت‌ها */
body.theme-dark .dm-product-card,
body.theme-dark .dm-post-card {
    background-color: var(--dm-card-bg);
    border-color: var(--dm-border);
}

/* هاور کارت‌ها */
body.theme-dark .dm-product-card:hover,
body.theme-dark .dm-post-card:hover {
    box-shadow: 0 6px 22px rgba(0,0,0,0.3);
    border-color: var(--dm-border);
}

/* تصویر محصولات و مقالات (پس‌زمینه لودینگ) */
body.theme-dark .dm-product-card .dm-product-thumb,
body.theme-dark .dm-post-card .dm-post-thumb {
    background-color: var(--dm-border);
}

/* رنگ عناوین */
body.theme-dark .dm-product-card .dm-product-title,
body.theme-dark .dm-post-card .dm-post-title {
    color: var(--dm-text);
}

/* رنگ قیمت */
body.theme-dark .dm-product-card .dm-current-price {
    color: var(--dm-primary);
}

/* دکمه افزودن به سبد (در کارت محصول) */
body.theme-dark .dm-add-to-cart-btn {
    background: var(--dm-border);
    color: var(--dm-text);
}
body.theme-dark .dm-add-to-cart-btn:hover {
    background: var(--dm-primary);
    color: #fff;
}
body.theme-dark .dm-unavailable-btn {
    background: #15202B;
    color: var(--dm-text-muted);
}

/* متاهای مقاله */
body.theme-dark .dm-post-card .dm-post-meta {
    border-top-color: var(--dm-border);
    color: var(--dm-text-muted);
}

/* سواچ‌های وارییشن (محصولات متغیر) */
body.theme-dark .dm-product-card .dm-pv-archive-label {
    background: var(--dm-border);
    border-color: var(--dm-border);
    color: var(--dm-text-muted);
}

/* اسکلتون لودر (Skeleton) */
body.theme-dark .dm-skel-card {
    background-color: var(--dm-bg-soft);
    border-color: var(--dm-border);
}
body.theme-dark .dm-skel-img,
body.theme-dark .dm-skel-line {
    background-color: var(--dm-border);
}
body.theme-dark .dm-skel-img::after,
body.theme-dark .dm-skel-line::after {
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.05) 50%, transparent 100%);
}