/**
 * Modern Related Products - iOS-like Design for Demo 1
 * 
 * Clean, minimal design inspired by Apple/iOS
 * Features:
 * - Clean white cards with gray borders
 * - Fully rounded corners (16px)
 * - NO shadows anywhere
 * - NO animations/transitions
 * - Gray typography
 * - Generous white space
 * - Professional design
 * - Exact same style as main page products
 * - Grid Layout (NO Swiper/Slider)
 * - Proper Responsive Design
 * 
 * @package MLM
 * @version 2.0.0
 * @demo Demo 1 (Default)
 */

/* ============================================
   CSS Variables - iOS-like Design System
   ============================================ */
:root {
    --mlm-product-white: #ffffff;
    --mlm-product-gray-50: #f9fafb;
    --mlm-product-gray-100: #f3f4f6;
    --mlm-product-gray-200: #e5e7eb;
    --mlm-product-gray-300: #d1d5db;
    --mlm-product-gray-400: #9ca3af;
    --mlm-product-gray-500: #6b7280;
    --mlm-product-gray-600: #4b5563;
    --mlm-product-gray-700: #374151;
    --mlm-product-gray-800: #1f2937;
    --mlm-product-gray-900: #111827;
    
    --mlm-product-accent: #F97316;
    --mlm-product-accent-light: #fb923c;
    
    --mlm-product-border: 1px solid var(--mlm-product-gray-200);
    --mlm-product-radius: 12px; /* Smaller border radius */
    --mlm-product-radius-sm: 6px; /* Smaller border radius */
    --mlm-product-radius-full: 9999px;
    
    --mlm-product-transition: all 0.2s ease;
}

/* ============================================
   Related Products Container
   ============================================ */
.mlm-related-products-modern {
    margin: 40px 0;
    padding: 0 var(--mlm-ios-space-xl, 32px);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.mlm-related-products-modern .mlm-related-title {
    font-size: var(--mlm-ios-font-size-2xl, 24px);
    font-weight: 700;
    color: var(--mlm-product-gray-900);
    margin-bottom: var(--mlm-ios-space-lg, 24px);
    padding: 0;
    border: none;
    background: transparent;
}

/* ============================================
   Grid Layout - NO Swiper
   ============================================ */
.mlm-related-products-modern .mlm-related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.mlm-related-products-modern .mlm-related-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0; /* جلوگیری از overflow */
    box-sizing: border-box;
}

/* ============================================
   Modern Product Card - Related Products
   ============================================ */
.mlm-related-products-modern .modern-product-card {
    background: var(--mlm-product-white) !important;
    border: var(--mlm-product-border) !important;
    border-radius: var(--mlm-product-radius) !important;
    overflow: visible !important;
    /* NO SHADOW - iOS style */
    box-shadow: none !important;
    /* NO TRANSITION - iOS style */
    transition: none !important;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 320px !important; /* Smaller card height */
    height: 100%;
    width: 100%;
    min-width: 0; /* جلوگیری از فشرده شدن */
    max-width: 100%;
    box-sizing: border-box;
}

.mlm-related-products-modern .modern-product-card:hover {
    /* NO transform or shadow on hover - iOS style */
    transform: none !important;
    box-shadow: none !important;
    border-color: var(--mlm-product-gray-300) !important;
}

/* Card Image Area - Rectangular با نسبت ثابت */
.mlm-related-products-modern .modern-product-card .item-header {
    width: 100%;
    padding-top: 55% !important; /* Smaller image ratio */
    position: relative;
    overflow: hidden;
    background: var(--mlm-product-gray-100);
    border-radius: 12px 12px 0 0 !important; /* Smaller border radius */
    box-sizing: border-box;
}

.mlm-related-products-modern .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-related-products-modern .modern-product-card .item-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center; /* نمایش از بالا - پایین برش می‌خورد */
    /* NO TRANSITION - iOS style */
    transition: none !important;
    display: block;
}

.mlm-related-products-modern .modern-product-card:hover .item-header img {
    /* NO transform on hover - iOS style */
    transform: none !important;
}

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

.mlm-related-products-modern .modern-product-card .item-header .vip {
    top: 8px !important; /* Smaller spacing */
    right: 8px !important; /* Smaller spacing */
    background: var(--mlm-product-accent);
    color: var(--mlm-product-white);
    width: 24px !important; /* Smaller badge */
    height: 24px !important;
    border-radius: var(--mlm-product-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px !important; /* Smaller icon */
    /* NO SHADOW - iOS style */
    box-shadow: none !important;
    border: none;
}

.mlm-related-products-modern .modern-product-card .item-header .off {
    top: 8px !important; /* Smaller spacing */
    left: 8px !important; /* Smaller spacing */
    padding: 4px 10px !important; /* Smaller padding */
    border-radius: var(--mlm-product-radius-full);
    font-size: 10px !important; /* Smaller font */
    font-weight: 600;
    color: var(--mlm-product-white);
    background: var(--mlm-product-accent);
    max-width: 60px !important; /* Smaller max width */
    max-height: 22px !important; /* Smaller max height */
    /* NO SHADOW - iOS style */
    box-shadow: none !important;
    border: none;
}

/* Product Title Area */
.mlm-related-products-modern .modern-product-card .item-title {
    padding: 10px 12px !important; /* Smaller padding */
    background: var(--mlm-product-white);
    border-bottom: var(--mlm-product-border);
    box-sizing: border-box;
}

.mlm-related-products-modern .modern-product-card .item-title h4 {
    margin: 0;
    font-size: 13px !important; /* Smaller font */
    font-weight: 600;
    line-height: 1.4 !important; /* Tighter line height */
    color: var(--mlm-product-gray-900);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.mlm-related-products-modern .modern-product-card .item-title a {
    color: var(--mlm-product-gray-900);
    text-decoration: none;
    /* NO TRANSITION - iOS style */
    transition: none !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.mlm-related-products-modern .modern-product-card .item-title a:hover {
    color: var(--mlm-product-accent);
}

/* Product Footer - Price and Meta */
.mlm-related-products-modern .modern-product-card .item-footer {
    padding: 10px 12px !important; /* Smaller padding */
    background: var(--mlm-product-white);
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 0 0 12px 12px !important; /* Smaller border radius */
    overflow: hidden;
    box-sizing: border-box;
}

.mlm-related-products-modern .modern-product-card .item-meta {
    display: inline-block;
    background: var(--mlm-product-gray-100);
    color: var(--mlm-product-gray-700);
    padding: 3px 8px !important; /* Smaller padding */
    border-radius: 6px !important; /* Smaller radius */
    font-size: 10px !important; /* Smaller font */
    font-weight: 600;
    margin: 1px !important; /* Smaller margin */
    border: var(--mlm-product-border);
    white-space: nowrap;
}

.mlm-related-products-modern .modern-product-card .item-meta.download {
    background: var(--mlm-product-gray-50);
    color: var(--mlm-product-gray-700);
    border-color: var(--mlm-product-gray-200);
}

.mlm-related-products-modern .modern-product-card .item-meta.price {
    background: var(--mlm-product-gray-50);
    color: var(--mlm-product-accent);
    border-color: var(--mlm-product-gray-200);
}

/* Hover Effect - Buttons */
.mlm-related-products-modern .modern-product-card {
    z-index: 1;
}

.mlm-related-products-modern .modern-product-card .hover-buttons {
    position: static;
    background: var(--mlm-product-white);
    padding: 8px 10px !important; /* Smaller padding */
    display: flex;
    gap: 6px !important; /* Smaller gap */
    border-top: var(--mlm-product-border);
    border-radius: 0 0 12px 12px !important; /* Smaller border radius */
    box-shadow: none !important;
    z-index: 101;
    box-sizing: border-box;
    margin-top: 8px !important; /* Smaller margin */
}

/* Add to Cart Button */
.mlm-related-products-modern .hover-buttons .btn-add-to-cart {
    flex: 1;
    background: var(--mlm-product-gray-900);
    color: var(--mlm-product-white);
    border: none !important;
    padding: 8px 10px !important; /* Smaller padding */
    border-radius: 6px !important; /* Smaller radius */
    font-weight: 600;
    font-size: 11px !important; /* Smaller font */
    cursor: pointer;
    /* NO TRANSITION - iOS style */
    transition: none !important;
    text-decoration: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    /* NO SHADOW - iOS style */
    box-shadow: none !important;
    min-width: 0;
    box-sizing: border-box;
}

.mlm-related-products-modern .hover-buttons .btn-add-to-cart:hover {
    background: var(--mlm-product-gray-800);
    border: none !important;
    color: var(--mlm-product-white);
    /* NO transform or shadow - iOS style */
    transform: none !important;
    box-shadow: none !important;
}

/* Preview Button */
.mlm-related-products-modern .hover-buttons .btn-preview {
    flex: 1;
    background: var(--mlm-product-white);
    color: var(--mlm-product-gray-700);
    border: var(--mlm-product-border);
    padding: 8px 10px !important; /* Smaller padding */
    border-radius: 6px !important; /* Smaller radius */
    font-weight: 600;
    font-size: 11px !important; /* Smaller font */
    cursor: pointer;
    /* NO TRANSITION - iOS style */
    transition: none !important;
    text-decoration: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    /* NO SHADOW - iOS style */
    box-shadow: none !important;
    min-width: 0;
    box-sizing: border-box;
}

.mlm-related-products-modern .hover-buttons .btn-preview:hover {
    background: var(--mlm-product-gray-50);
    border-color: var(--mlm-product-gray-300);
    color: var(--mlm-product-gray-900);
    /* NO transform or shadow - iOS style */
    transform: none !important;
    box-shadow: none !important;
}

/* Vendor Section */
.mlm-related-products-modern .modern-product-card .item-vendor {
    display: flex;
    align-items: center;
    padding: 6px 0 !important; /* Smaller padding */
    text-decoration: none;
    color: var(--mlm-product-gray-600);
    /* NO TRANSITION - iOS style */
    transition: none !important;
    font-size: 10px !important; /* Smaller font */
}

.mlm-related-products-modern .modern-product-card .item-vendor:hover {
    color: var(--mlm-product-gray-900);
}

.mlm-related-products-modern .modern-product-card .item-vendor img {
    width: 18px !important; /* Smaller image */
    height: 18px !important;
    border-radius: var(--mlm-product-radius-full);
    margin-left: 6px !important; /* Smaller margin */
    border: var(--mlm-product-border);
    /* NO TRANSITION - iOS style */
    transition: none !important;
}

.mlm-related-products-modern .modern-product-card .item-vendor.verified img {
    border-color: var(--mlm-product-gray-700);
}

/* ============================================
   Product Info Layout (Same as home page)
   ============================================ */
.mlm-related-products-modern .modern-product-card .item-info-shell {
    position: relative;
    background: transparent;
    border-radius: 0 0 12px 12px !important; /* Smaller border radius */
    overflow: visible;
}

.mlm-related-products-modern .modern-product-card .item-info {
    background: var(--mlm-product-white);
    border-top: none;
    border-radius: 0 0 12px 12px !important; /* Smaller border radius */
    padding: 10px 12px !important; /* Smaller padding */
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    overflow: hidden;
    box-shadow: none !important; /* NO SHADOW - iOS style */
    z-index: 2;
    transition: none !important; /* NO TRANSITION - iOS style */
    flex: 1 1 auto;
    justify-content: space-between;
    transform: none !important;
    padding-bottom: 0;
}

.mlm-related-products-modern .modern-product-card .item-info-body {
    display: flex;
    flex-direction: column;
    gap: 8px !important; /* Smaller gap */
    flex: 1 1 auto;
}

.mlm-related-products-modern .modern-product-card .item-title {
    margin: 0;
    padding: 0 !important;
    min-height: auto;
    background: transparent !important;
    border: none !important;
}

.mlm-related-products-modern .modern-product-card .item-title h4 {
    margin: 0;
    font-size: 13px !important; /* Smaller font */
    font-weight: 500;
    line-height: 1.4 !important; /* Tighter line height */
}

.mlm-related-products-modern .modern-product-card .item-title a {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #2F2F2F;
    font-size: 13px !important; /* Smaller font */
    font-weight: 500;
    line-height: 1.4 !important; /* Tighter line height */
    transition: color 0.25s ease !important;
}

.mlm-related-products-modern .modern-product-card:hover .item-title a {
    color: var(--mlm-product-accent);
}

/* ============================================
   Pricing Section (Same as home page)
   ============================================ */
.mlm-related-products-modern .modern-product-card .item-pricing {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px !important; /* Smaller gap */
    flex-wrap: nowrap;
    position: relative;
    min-height: 32px !important; /* Fixed height to prevent card height changes */
}

.mlm-related-products-modern .modern-product-card .item-discount-badge {
    width: 28px !important; /* Smaller badge */
    height: 28px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px !important; /* Smaller radius */
    font-size: 11px !important; /* Smaller font */
    font-weight: 700;
    color: #fff;
    background: var(--mlm-discount-bg, var(--mlm-product-accent));
    flex-shrink: 0;
    position: absolute !important;
    top: 0;
    right: 0;
    z-index: 1;
}

.mlm-related-products-modern .modern-product-card .item-discount-badge.empty {
    background: transparent;
    border: 1px solid transparent;
    color: transparent;
    position: absolute !important;
    top: 0;
    right: 0;
    z-index: 1;
    pointer-events: none;
}

.mlm-related-products-modern .modern-product-card .item-price-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
    min-height: 32px !important; /* Fixed height: 12px (price) + 2px (gap) + 10px (regular price) + 8px (buffer) */
    padding-right: 36px !important; /* Space for discount badge (28px + 8px gap) */
    box-sizing: border-box;
}

.mlm-related-products-modern .modern-product-card .item-price-current {
    font-size: 12px !important; /* Smaller font */
    font-weight: 500;
    color: #2F2F2F;
}

.mlm-related-products-modern .modern-product-card .item-price-current.free {
    color: var(--mlm-product-accent);
}

.mlm-related-products-modern .modern-product-card .item-price-regular {
    font-size: 10px !important; /* Smaller font */
    color: #B7A191;
    text-decoration: line-through;
}

.mlm-related-products-modern .modern-product-card .item-file-meta {
    font-size: 11px !important; /* Smaller font */
    color: var(--mlm-product-gray-600);
    display: inline-flex;
    align-items: center;
    gap: 4px !important; /* Smaller gap */
}

.mlm-related-products-modern .modern-product-card .item-pricing-meta {
    display: flex;
    align-items: center;
    gap: 8px !important; /* Smaller gap */
    flex-shrink: 0;
}

.mlm-related-products-modern .modern-product-card .metric {
    display: inline-flex;
    align-items: center;
    gap: 3px !important; /* Smaller gap */
    font-size: 10px !important; /* Smaller font */
    color: var(--mlm-product-gray-500);
}

.mlm-related-products-modern .modern-product-card .metric-icon svg {
    width: 11px !important; /* Smaller icon */
    height: 11px !important;
}

.mlm-related-products-modern .modern-product-card .metric-icon-star .icon-star-full {
    font-size: 12px !important; /* Smaller icon */
    color: #F5B318;
    display: inline-block;
    line-height: 1;
}

.mlm-related-products-modern .modern-product-card .metric-number {
    font-weight: 600;
    color: var(--mlm-product-gray-600);
}

.mlm-related-products-modern .modern-product-card .item-price-stack .woocommerce-Price-currencySymbol,
.mlm-related-products-modern .modern-product-card .item-price-stack .woocommerce-Price-suffix {
    color: #747474;
    font-weight: 400;
}

/* ============================================
   Responsive Design - Proper Breakpoints
   ============================================ */

/* دسکتاپ (4 کارت) - Default */
@media (min-width: 1024px) {
    .mlm-related-products-modern {
        padding: 0 var(--mlm-ios-space-xl, 32px);
    }
    
    .mlm-related-products-modern .mlm-related-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
}

/* تبلت بزرگ (3 کارت) */
@media (max-width: 1023px) and (min-width: 768px) {
    .mlm-related-products-modern {
        padding: 0 var(--mlm-ios-space-lg, 24px);
    }
    
    .mlm-related-products-modern .mlm-related-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 20px !important;
    }
    
    .mlm-related-products-modern .modern-product-card {
        min-height: auto;
        overflow: hidden;
        width: 100%;
        min-width: 0;
    }
    
    .mlm-related-products-modern .modern-product-card .item-header {
        padding-top: 55% !important; /* Smaller image ratio */
    }
    
    .mlm-related-products-modern .modern-product-card .item-footer {
        padding-bottom: 0;
    }
    
    /* دکمه‌ها در تبلت بدون hover - همیشه نمایش داده می‌شوند */
    .mlm-related-products-modern .modern-product-card .hover-buttons {
        position: static;
        margin-top: 0;
        border-top: var(--mlm-product-border);
        box-shadow: none !important;
        border-radius: 0;
    }
}

/* تبلت معمولی (2 کارت) */
@media (max-width: 767px) and (min-width: 481px) {
    .mlm-related-products-modern {
        padding: 0 var(--mlm-ios-space-md, 16px);
    }
    
    .mlm-related-products-modern .mlm-related-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
    
    .mlm-related-products-modern .modern-product-card {
        min-height: auto;
        overflow: hidden;
        width: 100%;
        min-width: 0;
    }
    
    .mlm-related-products-modern .modern-product-card .item-header {
        padding-top: 55% !important; /* Smaller image ratio */
    }
    
    .mlm-related-products-modern .modern-product-card .item-title,
    .mlm-related-products-modern .modern-product-card .item-footer {
        padding: 12px;
    }
    
    /* دکمه‌ها در تبلت کوچک بدون hover - همیشه نمایش داده می‌شوند */
    .mlm-related-products-modern .modern-product-card .hover-buttons {
        position: static;
        margin-top: 0;
        border-top: var(--mlm-product-border);
        flex-direction: row;
        gap: 8px;
        padding: 12px;
        box-shadow: none !important;
        border-radius: 0;
    }
    
    .mlm-related-products-modern .hover-buttons .btn-add-to-cart,
    .mlm-related-products-modern .hover-buttons .btn-preview {
        font-size: 11px !important; /* Smaller font on mobile */
        padding: 8px 10px !important; /* Smaller padding */
    }
    
}

/* موبایل (1 کارت) */
@media (max-width: 480px) {
    .mlm-related-products-modern {
        padding: 0 var(--mlm-ios-space-sm, 12px);
    }
    
    .mlm-related-products-modern .mlm-related-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .mlm-related-products-modern .mlm-related-title {
        font-size: var(--mlm-ios-font-size-xl, 20px);
    }
    
    .mlm-related-products-modern .modern-product-card {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    
    /* دکمه‌ها به صورت عمودی */
    .mlm-related-products-modern .modern-product-card .hover-buttons {
        position: static;
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        margin-top: 0;
        border-top: var(--mlm-product-border);
        box-shadow: none !important;
        border-radius: 0;
    }
    
    .mlm-related-products-modern .hover-buttons .btn-add-to-cart,
    .mlm-related-products-modern .hover-buttons .btn-preview {
        font-size: 10px !important; /* Smaller font on small mobile */
        padding: 7px 9px !important; /* Smaller padding */
        width: 100%;
    }
}
