/* Modern Product Cards - Only for Home Page Products Section */

/* Products Grid - 4 products per row */
.mlm-recent-products-wrapper .modern-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 35px 25px; /* gap عمودی بیشتر برای فضای دکمه‌ها */
    padding: 0 40px 80px; /* padding پایین برای ردیف آخر */
}

/* Modern Product Card - Home page AND Related Products */
.mlm-recent-products-wrapper .modern-product-card,
.mlm-related-products-modern .modern-product-card {
    background: white;
    border-radius: 15px;
    overflow: visible; /* تغییر به visible تا دکمه‌ها بیرون بیان */
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 420px; /* حداقل ارتفاع برای جلوگیری از تغییر اندازه */
}

.mlm-recent-products-wrapper .modern-product-card:hover,
.mlm-related-products-modern .modern-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

/* Card Image Area - Rectangular با نسبت ثابت */
.mlm-recent-products-wrapper .modern-product-card .item-header {
    width: 100%;
    padding-top: 66.67%; /* نسبت 3:2 برای مستطیل */
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.mlm-recent-products-wrapper .modern-product-card .item-header a {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mlm-recent-products-wrapper .modern-product-card .item-header img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* تصویر کل فضا رو پر می‌کنه */
    object-position: center;
    transition: transform 0.3s ease;
}

.mlm-recent-products-wrapper .modern-product-card:hover .item-header img {
    transform: scale(1.05);
}

/* VIP and OFF badges - با position absolute */
.mlm-recent-products-wrapper .modern-product-card .item-header .vip,
.mlm-recent-products-wrapper .modern-product-card .item-header .off {
    position: absolute;
    z-index: 2;
}

.mlm-recent-products-wrapper .modern-product-card .item-header .vip {
    top: 10px;
    right: 10px;
    background: #FFD700;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.mlm-recent-products-wrapper .modern-product-card .item-header .off {
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

/* Product Title Area */
.mlm-recent-products-wrapper .modern-product-card .item-title {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #f0f0f0;
}

.mlm-recent-products-wrapper .modern-product-card .item-title h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
}

.mlm-recent-products-wrapper .modern-product-card .item-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.mlm-recent-products-wrapper .modern-product-card .item-title a:hover {
    color: #667eea;
}

/* Product Footer - Price and Meta */
.mlm-recent-products-wrapper .modern-product-card .item-footer {
    padding: 20px;
    background: white;
    position: relative;
    flex: 1; /* فضای باقی‌مانده رو می‌گیره */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 0 0 15px 15px; /* گوشه‌های پایینی گرد */
    overflow: hidden; /* برای border-radius */
}

.mlm-recent-products-wrapper .modern-product-card .item-meta {
    display: inline-block;
    background: #f8f9fa;
    color: #666;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin: 2px;
}

.mlm-recent-products-wrapper .modern-product-card .item-meta.download {
    background: #e3f2fd;
    color: #1976d2;
}

.mlm-recent-products-wrapper .modern-product-card .item-meta.price {
    background: #fff3e0;
    color: #f57c00;
}

/* Hover Effect - Buttons */
.mlm-recent-products-wrapper .modern-product-card .hover-buttons {
    position: absolute;
    bottom: -60px; /* شروع از پایین‌تر برای اینکه کامل بیرون باشه */
    left: 0;
    right: 0;
    background: white;
    padding: 15px 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    gap: 10px;
    border-top: 1px solid #f0f0f0;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 10;
}

.mlm-recent-products-wrapper .modern-product-card:hover .hover-buttons {
    bottom: 0; /* میاد بالا تا bottom کارت */
    opacity: 1;
    visibility: visible;
}

/* Add to Cart Button */
.mlm-recent-products-wrapper .hover-buttons .btn-add-to-cart {
    flex: 1;
    background: #FFA726; /* نارنجی مثل تصویر نمونه */
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px; /* گوشه گرد ملایم */
    font-weight: 600;
    font-size: 13px; /* متن ریزتر */
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap; /* جلوگیری از رفتن به خط بعدی */
}

.mlm-recent-products-wrapper .hover-buttons .btn-add-to-cart:hover {
    background: #FB8C00;
    box-shadow: 0 4px 12px rgba(255, 167, 38, 0.4);
    color: white;
}

/* Preview Button */
.mlm-recent-products-wrapper .hover-buttons .btn-preview {
    flex: 1;
    background: #E0E0E0; /* خاکستری روشن مثل تصویر نمونه */
    color: #424242; /* متن تیره */
    border: none;
    padding: 10px 16px;
    border-radius: 8px; /* گوشه گرد ملایم */
    font-weight: 600;
    font-size: 13px; /* متن ریزتر */
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap; /* جلوگیری از رفتن به خط بعدی */
}

.mlm-recent-products-wrapper .hover-buttons .btn-preview:hover {
    background: #BDBDBD;
    color: #212121;
    box-shadow: 0 4px 12px rgba(189, 189, 189, 0.4);
}

/* Preview button always visible now */

/* Vendor Section */
.mlm-recent-products-wrapper .modern-product-card .item-vendor {
    display: flex;
    align-items: center;
    padding: 10px 0;
    text-decoration: none;
    color: #666;
    transition: color 0.3s ease;
}

.mlm-recent-products-wrapper .modern-product-card .item-vendor:hover {
    color: #667eea;
}

.mlm-recent-products-wrapper .modern-product-card .item-vendor img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-left: 10px;
    border: 2px solid #ddd;
    transition: border-color 0.3s ease;
}

.mlm-recent-products-wrapper .modern-product-card .item-vendor.verified img {
    border-color: #4caf50;
}

/* Badge Styles */
.mlm-recent-products-wrapper .modern-product-card .vip {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    position: absolute;
    top: 15px;
    right: 15px;
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.3);
}

.mlm-recent-products-wrapper .modern-product-card .off {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    position: absolute;
    top: 15px;
    left: 15px;
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
}

/* Responsive Design */

/* تبلت (2 کارت) */
@media (max-width: 1024px) {
    .mlm-recent-products-wrapper .modern-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 0 30px 20px;
    }
    
    .mlm-recent-products-wrapper .modern-product-card {
        min-height: auto;
        overflow: hidden;
    }
    
    .mlm-recent-products-wrapper .modern-product-card .item-header {
        padding-top: 66.67%;
    }
    
    .mlm-recent-products-wrapper .modern-product-card .item-footer {
        padding-bottom: 0;
    }
    
    /* دکمه‌ها در تبلت بدون hover - همیشه نمایش داده می‌شوند */
    .mlm-recent-products-wrapper .modern-product-card .hover-buttons {
        position: relative;
        bottom: auto;
        opacity: 1;
        visibility: visible;
        margin-top: 0;
        border-top: 1px solid #f0f0f0;
        box-shadow: none;
        border-radius: 0;
    }
    
    /* حذف افکت hover در تبلت */
    .mlm-recent-products-wrapper .modern-product-card:hover {
        transform: none;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    
    .mlm-recent-products-wrapper .modern-product-card:hover .hover-buttons {
        bottom: auto;
    }
}

/* موبایل (1 کارت) */
@media (max-width: 768px) {
    .mlm-recent-products-wrapper .modern-products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 20px 20px;
    }
    
    .mlm-recent-products-wrapper .modern-product-card {
        min-height: auto;
        overflow: hidden;
    }
    
    .mlm-recent-products-wrapper .modern-product-card .item-header {
        padding-top: 66.67%;
    }
    
    .mlm-recent-products-wrapper .modern-product-card .item-title,
    .mlm-recent-products-wrapper .modern-product-card .item-footer {
        padding: 15px;
    }
    
    /* دکمه‌ها در موبایل بدون hover - همیشه نمایش داده می‌شوند */
    .mlm-recent-products-wrapper .modern-product-card .hover-buttons {
        position: relative;
        bottom: auto;
        opacity: 1;
        visibility: visible;
        margin-top: 0;
        border-top: 1px solid #f0f0f0;
        flex-direction: row;
        gap: 10px;
        box-shadow: none;
        border-radius: 0;
    }
    
    .mlm-recent-products-wrapper .modern-product-card:hover {
        transform: none;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    
    .mlm-recent-products-wrapper .modern-product-card:hover .hover-buttons {
        bottom: auto;
    }
}

/* موبایل کوچک (دکمه‌های عمودی) */
@media (max-width: 480px) {
    .mlm-recent-products-wrapper .modern-products-grid {
        padding: 0 15px 20px;
    }
    
    /* دکمه‌ها به صورت عمودی */
    .mlm-recent-products-wrapper .modern-product-card .hover-buttons {
        flex-direction: column;
        gap: 8px;
        padding: 12px 15px;
    }
    
    .mlm-recent-products-wrapper .hover-buttons .btn-add-to-cart,
    .mlm-recent-products-wrapper .hover-buttons .btn-preview {
        font-size: 12px;
        padding: 10px 12px;
    }
}