/* ====================================
   کانتینر اصلی ماسونری
==================================== */
.ft-masonry-wrapper {
    width: 100%;
    position: relative;
    display: block;
}

/* ====================================
   چیدمان METRO/BENTO GRID (جدید)
==================================== */
.ft-metro-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 250px;
    gap: 20px;
    grid-auto-flow: dense;
    width: 100%;
}
.ft-metro-wrapper::before, .ft-metro-wrapper::after { display: none; }

.ft-metro-wrapper .ft-masonry-item {
    width: 100% !important;
    height: 100%;
    padding: 0;
    margin-bottom: 0;
    float: none;
    display: block;
}

/* سایزهای هوشمند تولید شده توسط PHP */
.ft-metro-wrapper .ft-span-col-1 { grid-column: span 1; }
.ft-metro-wrapper .ft-span-col-2 { grid-column: span 2; }
.ft-metro-wrapper .ft-span-row-1 { grid-row: span 1; }
.ft-metro-wrapper .ft-span-row-2 { grid-row: span 2; }

/* ==================================== */

.ft-masonry-sizer { }

.ft-masonry-item {
    width: 33.333%;
    padding: 0 10px;
    margin-bottom: 20px;
    box-sizing: border-box;
    float: right;
}

body:not(.rtl) .ft-masonry-item {
    float: left;
}

.ft-masonry-item-inner {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: #ffffff;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* پوششی مشترک (استفاده شده در Overlay و Metro) */
.style-metro {
    display: flex;
    flex-direction: column;
}

.ft-masonry-thumbnail {
    position: relative;
    width: 100%;
    display: block;
    overflow: hidden;
    height: 100%;
}

.ft-masonry-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
    transition: transform 0.5s ease;
}

.ft-masonry-item-inner:hover .ft-masonry-thumbnail img {
    transform: scale(1.08);
}

/* ====================================
   استایل ۱: پوششی (Overlay) + مترو - نمایش با هاور
==================================== */
.ft-masonry-item-inner.style-overlay .ft-masonry-overlay,
.ft-masonry-item-inner.style-metro .ft-masonry-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 25px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 70%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.3s ease-in-out;
}

.ft-masonry-item-inner.style-overlay:hover .ft-masonry-overlay,
.ft-masonry-item-inner.style-metro:hover .ft-masonry-overlay {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ft-masonry-item-inner.style-overlay .ft-masonry-title a,
.ft-masonry-item-inner.style-metro .ft-masonry-title a {
    color: #ffffff;
    text-decoration: none;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    display: block;
}

/* ====================================
   استایل ۲: کارتی (Card)
==================================== */
.ft-masonry-item-inner.style-card .ft-masonry-content {
    padding: 20px;
}

.ft-masonry-item-inner.style-card .ft-masonry-title {
    margin: 0 0 10px 0;
}

.ft-masonry-item-inner.style-card .ft-masonry-title a {
    color: #333333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.ft-masonry-item-inner.style-card .ft-masonry-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* ====================================
   استایل‌های ووکامرس (قیمت)
==================================== */
.ft-masonry-price {
    font-weight: bold;
    font-size: 16px;
    margin-top: 8px;
    display: block;
}

.ft-masonry-item-inner.style-overlay .ft-masonry-price,
.ft-masonry-item-inner.style-overlay .ft-masonry-price ins,
.ft-masonry-item-inner.style-overlay .ft-masonry-price .amount,
.ft-masonry-item-inner.style-metro .ft-masonry-price,
.ft-masonry-item-inner.style-metro .ft-masonry-price ins,
.ft-masonry-item-inner.style-metro .ft-masonry-price .amount {
    color: #ffc107;
    text-decoration: none;
}

.ft-masonry-item-inner.style-card .ft-masonry-price,
.ft-masonry-item-inner.style-card .ft-masonry-price ins,
.ft-masonry-item-inner.style-card .ft-masonry-price .amount {
    color: #0073aa;
    text-decoration: none;
}

.ft-masonry-price del {
    opacity: 0.6;
    font-size: 13px;
    font-weight: normal;
    margin-inline-end: 8px;
}

/* ====================================
   استایل‌های صفحه‌بندی (Pagination)
==================================== */
.ft-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 30px;
    width: 100%;
}

.ft-pagination .page-numbers {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    background-color: #f5f5f5;
    color: #444;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.ft-pagination .page-numbers:hover {
    background-color: #e0e0e0;
    color: #111;
}

.ft-pagination .page-numbers.current {
    background-color: #0073aa;
    color: #ffffff;
    border-color: #0073aa;
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.2);
}

.ft-pagination .prev, .ft-pagination .next {
    font-size: 18px;
}

/* ====================================
   استایل‌های بارگذاری ایجکس (AJAX Loading)
==================================== */
.ft-masonry-container {
    position: relative;
    transition: opacity 0.3s ease;
    min-height: 200px;
}

.ft-masonry-container.ft-is-loading {
    pointer-events: none;
}

.ft-masonry-container.ft-is-loading::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    z-index: 9;
}

.ft-masonry-container.ft-is-loading::after {
    content: "";
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: ft-spin 1s linear infinite;
    z-index: 10;
}

@keyframes ft-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ====================================
   استایل دکمه نمایش بیشتر (Load More)
==================================== */
.ft-load-more-container {
    text-align: center;
    margin-top: 40px;
    clear: both;
    width: 100%;
    display: block;
}

.ft-btn-load-more {
    display: inline-block;
    padding: 12px 35px;
    background-color: #333;
    color: #fff;
    border-radius: 30px;
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.ft-btn-load-more:hover {
    background-color: #0073aa;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 115, 170, 0.3);
}

.ft-btn-load-more.loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

/* ====================================
   ریسپانسیو مترو (جدید)
==================================== */
@media (max-width: 1024px) {
    .ft-metro-wrapper { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 220px; }
    .ft-metro-wrapper .ft-span-col-2 { grid-column: span 2; }
}

@media (max-width: 767px) {
    .ft-metro-wrapper { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 200px; gap: 15px; }
    .ft-metro-wrapper .ft-masonry-item { grid-column: span 1 !important; grid-row: span 1 !important; }
}

@media (max-width: 480px) {
    .ft-metro-wrapper { grid-template-columns: 1fr; grid-auto-rows: auto; min-height: 250px; }
}








@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.ft-masonry-grid { display: grid; grid-auto-flow: dense; width: 100%; box-sizing: border-box; }
.ft-masonry-grid * { box-sizing: border-box; }
.ft-masonry-item { position: relative; overflow: hidden; grid-column: span 1; grid-row: span 1; min-width: 0; }
.ft-masonry-item.ft-ajax-item { animation: fadeInUp 0.5s ease forwards; }

/* Square Mode */
.ft-masonry-grid.ft-force-square .ft-masonry-item-inner { aspect-ratio: 1 / 1; }
.ft-masonry-grid.ft-force-square .ft-masonry-item.ft-span-col-2 .ft-masonry-item-inner { aspect-ratio: 2 / 1; }
.ft-masonry-grid.ft-force-square .ft-masonry-item.ft-span-row-2 .ft-masonry-item-inner { aspect-ratio: 1 / 2; }

/* Smart Sizing */
.ft-masonry-item.ft-span-col-2 { grid-column: span 2; }
.ft-masonry-item.ft-span-row-2 { grid-row: span 2; }

@media screen and (max-width: 767px) {
    .ft-masonry-grid {
        grid-template-columns: 1fr !important;
        grid-auto-rows: auto !important; 
        gap: 20px !important;
    }
    .ft-masonry-item {
        grid-column: span 1 !important;
        grid-row: span 1 !important;
        height: auto !important;
        min-height: 300px; 
    }
    .ft-masonry-item-inner { aspect-ratio: 1 / 1; }
    .ft-masonry-grid:not(.ft-force-square) .ft-masonry-item-inner { aspect-ratio: auto; height: auto; }
    .ft-masonry-grid:not(.ft-force-square) .ft-masonry-item-inner img { height: auto; position: relative; }
}

.ft-masonry-item-inner { position: relative; width: 100%; height: 100%; overflow: hidden; display: flex; }
.ft-masonry-img-link { display: block; width: 100%; height: 100%; position: absolute; }
.ft-masonry-img-wrapper { width: 100%; height: 100%; }
.ft-masonry-item-inner img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; display: block; }
.ft-masonry-item:hover .ft-masonry-item-inner img { transform: scale(1.1); }
.ft-masonry-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.6); opacity: 0; transition: all 0.3s ease; display: flex; flex-direction: column; padding: 20px; z-index: 2; pointer-events: none; }
.ft-masonry-content { pointer-events: auto; transform: translateY(20px); transition: transform 0.3s ease; width: 100%; }
.ft-masonry-item:hover .ft-masonry-overlay { opacity: 1; }
.ft-masonry-item:hover .ft-masonry-content { transform: translateY(0); }
.ft-masonry-title a { color: #fff; text-decoration: none; font-size: 18px; font-weight: bold; display: block; }
.ft-masonry-price { color: #f1f1f1; margin: 5px 0; font-size: 16px; }
.ft-masonry-rating { margin-bottom: 5px; }
.ft-masonry-desc { color: #ddd; font-size: 13px; margin-bottom: 10px; line-height: 1.4; }
.ft-masonry-btn-wrap { display: flex; width: 100%; margin-top: 10px; }
.ft-add-to-cart-btn, .button.add_to_cart_button { display: inline-flex; align-items: center; justify-content: center; padding: 8px 15px; background: #fff; color: #333; text-decoration: none; border-radius: 4px; font-size: 14px; transition: 0.3s; border: none; cursor: pointer; line-height: 1.2; }
.ft-add-to-cart-btn:hover, .button.add_to_cart_button:hover { background: #eee; color: #000; }
.ft-sale-badge { position: absolute; top: 10px; right: 10px; background: #e1306c; color: #fff; padding: 3px 8px; font-size: 12px; border-radius: 3px; z-index: 5; }
.ft-masonry-pagination { margin-top: 40px; width: 100%; display: flex; justify-content: center; }
.ft-masonry-pagination ul.page-numbers { display: flex !important; flex-wrap: wrap; justify-content: center; align-items: center; gap: 5px; list-style: none !important; margin: 0 !important; padding: 0 !important; }
.ft-masonry-pagination ul.page-numbers li { margin: 0 !important; padding: 0 !important; border: none !important; display: block; }
.ft-masonry-pagination ul.page-numbers li .page-numbers { display: flex; justify-content: center; align-items: center; min-width: 35px; height: 35px; padding: 0 5px; border: 1px solid #ddd; text-decoration: none; color: #333; border-radius: 4px; font-size: 14px; line-height: 1; transition: all 0.3s ease; }
.ft-masonry-pagination ul.page-numbers li .page-numbers:hover, .ft-masonry-pagination ul.page-numbers li .page-numbers.current { background: #333; color: #fff; border-color: #333; }
.ft-load-more-wrapper { margin-top: 30px; text-align: center; }
.ft-load-more-btn { cursor: pointer; padding: 10px 25px; font-size: 16px; border-radius: 5px; border: 1px solid #333; background: #333; color: #fff; transition: 0.3s; }
.ft-load-more-btn:hover { background: #555; }
.ft-load-more-btn.loading { opacity: 0.5; cursor: wait; }

/* استایل‌های اضافی برای حالت justified (مترو) */
.ft-metro-wrapper[data-justified="true"] {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.ft-metro-wrapper[data-justified="true"] .ft-masonry-item {
    flex: none;
    margin: 0;
}
