/* =========================================
   LOOPS STYLES — Products & Posts  v2
   ========================================= */

/* ════════════════════════════════════════════
   Swiper — تنظیمات پایه
   ════════════════════════════════════════════ */

.swiper-wrapper {
    align-items: stretch;      /* ★ همه slides یک ارتفاع — از tallest slide */
}

.swiper-slide {
    height: auto;
    max-height: 351px;
}

/* فضای امن برای سایه و overflow کارت‌ها */
.dm-products-slider,
.dm-posts-slider,
.dm-sp-products-slider,
.dm-posts-related-slider,
.dm-sp-products-slider {
    padding-top: 00px;
    padding-bottom: 35px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    /*margin-top: -20px;*/
    /*margin-bottom: -25px;*/
}

@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: 12px;
    padding: 15px;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    border: 1px solid #f1f2f4;
    display: flex;
    flex-direction: column;
    height: 100%;              /* ★ کارت کل ارتفاع slide رو پر می‌کنه */
    direction: rtl;
    position: relative;
    overflow: hidden;
}
.dm-product-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.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%;
    padding-top: 100%;
    position: relative;
    margin-bottom: 0;
}
.dm-product-card .dm-product-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
}
.dm-product-card:hover .dm-product-thumb img { transform: scale(1.04); }

/* badge تخفیف روی عکس */
.dm-product-card .dm-product-thumb .dm-discount-badge { display: none; }

/* اطلاعات محصول */
.dm-product-card .dm-product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
    padding-top: 10px;
    justify-content: space-between;
}

.dm-product-card .dm-product-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.8;
    margin: 0;
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    overflow: hidden !important;
    /* ★ flex-grow: 1 — جایگزین margin-top: auto روی قیمت */
    /*flex-grow: 1;*/
}

/* قیمت */
.dm-product-card .dm-product-price-wrapper {
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    direction: rtl;
    align-items: flex-end;
    /* ★ margin-top: auto حذف شد */
}

.dm-product-card .dm-current-price {
    font-size: 16px;
    font-weight: 800;
    color: #222;
}

.dm-product-card .dm-old-price-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
}

.dm-product-card .dm-discount-badge {
    background: #ef4056;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    line-height: 1.4;
}

.dm-product-card .dm-old-price {
    font-size: 13px;
    color: #bbb;
    text-decoration: line-through;
}
.dm-product-card .dm-old-price .woocommerce-Price-currencySymbol { display: none; }

.dm-product-card .dm-unavailable {
    color: #bbb;
    font-size: 13px;
    font-weight: 600;
}

/* دکمه افزودن به سبد */
.dm-add-to-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    margin-top: 12px;
    border: none;
    border-radius: 10px;
    background: var(--dm-primary, #ff6600);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    text-decoration: none;
    font-family: inherit;
    line-height: 1;
}
.dm-add-to-cart-btn:hover { opacity: 0.88; transform: scale(1.02); color: #fff; }
.dm-add-to-cart-btn.loading { opacity: 0.6; pointer-events: none; }
.dm-add-to-cart-btn.added  { background: #27ae60; }

.dm-select-options {
    background: transparent;
    color: var(--dm-primary, #ff6600);
    border: 1.5px solid var(--dm-primary, #ff6600);
}
.dm-select-options:hover { background: var(--dm-primary, #ff6600); color: #fff; }

.dm-unavailable-btn {
    background: #f5f5f5;
    color: #bbb;
    cursor: not-allowed;
}
.dm-unavailable-btn:hover { opacity: 1; transform: none; color: #bbb; }


/* ════════════════════════════════════════════
   کارت مقاله
   ════════════════════════════════════════════ */
.dm-post-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #f1f2f4;
    display: flex;
    flex-direction: column;
    direction: rtl;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.dm-post-card:hover {
    box-shadow: 0 8px 24px rgba(0,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 / 11;
    overflow: hidden;
    background: #f5f5f5;
    flex-shrink: 0;
}
.dm-post-card .dm-post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    display: block;
}
.dm-post-card:hover .dm-post-thumb img { transform: scale(1.05); }
.dm-post-thumb-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg, #f0f0f0, #e0e0e0); }

.dm-post-card .dm-post-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dm-post-card .dm-post-category {
    background: #eaf3ff;
    color: #5b9bd5;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    align-self: flex-end;
}
.dm-post-card .dm-post-title {
    font-size: 14px;
    font-weight: 800;
    color: #333;
    line-height: 1.8;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -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 #f5f5f5;
    padding-top: 12px;
    margin-top: 8px;
    font-size: 12px;
    color: #999;
    font-weight: 500;
}


/* ════════════════════════════════════════════
   ARCHIVE — صفحه دسته‌بندی محصولات
   ════════════════════════════════════════════ */
.dm-archive-wrap { direction: rtl; background: #f7f8fa; min-height: 60vh; padding-bottom: 60px; }
.dm-container { max-width: 1500px; margin: 0 auto; padding: 0 24px; }

.dm-archive-breadcrumb { background: #fff; border-bottom: 1px solid #eee; padding: 10px 0; font-size: 12px; }
.dm-archive-breadcrumb .woocommerce-breadcrumb { margin: 0; color: #888; }
.dm-archive-breadcrumb a { color: #888; text-decoration: none; }
.dm-archive-breadcrumb a:hover { color: var(--dm-primary, #ff6600); }

.dm-archive-header { padding: 24px 0 16px; }
.dm-archive-title { font-size: 22px; font-weight: 900; color: #222; margin: 0 0 12px; }

.dm-archive-desc-wrap { position: relative; }
.dm-archive-desc-text { font-size: 13px; color: #666; line-height: 2; max-height: 60px; overflow: hidden; transition: max-height 0.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, #ff6600); font-size: 12px; font-weight: 700; cursor: pointer; padding: 6px 0; display: block; font-family: inherit; }

.dm-archive-sort-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: #fff; border-radius: 12px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); flex-wrap: wrap; }
.dm-archive-result-count { font-size: 13px; color: #888; }
.dm-archive-result-count .woocommerce-result-count { margin: 0; }
.dm-archive-sort-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dm-sort-label { font-size: 12px; color: #888; font-weight: 600; margin-left: 4px; }
.dm-sort-btn { padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; color: #666; background: #f5f5f5; text-decoration: none; transition: all 0.2s; white-space: nowrap; }
.dm-sort-btn:hover { background: var(--dm-primary, #ff6600); color: #fff; }
.dm-sort-btn.is-active { background: var(--dm-primary, #ff6600); color: #fff; }

.dm-archive-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; 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; } }

.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: 8px; font-size: 13px; font-weight: 700; border: 1.5px solid #eee; background: #fff; color: #555; text-decoration: none; transition: all 0.2s; }
.dm-archive-pagination .page-numbers li a:hover { border-color: var(--dm-primary, #ff6600); color: var(--dm-primary, #ff6600); }
.dm-archive-pagination .page-numbers li span.current { background: var(--dm-primary, #ff6600); color: #fff; border-color: var(--dm-primary, #ff6600); }
.dm-archive-empty { text-align: center; padding: 60px 20px; color: #aaa; }