/**
 * TNTBook - Related Products Styles
 * Version: 2.0
 * Updated: 2026-07-08 (1405-04-17)
 *
 * Grid 4 ستونه با Responsive کامل
 * سازگار با tntkala_render_amazon_card
 */

/* ═══════════════════════════════════════════
   Container کلی
   ═══════════════════════════════════════════ */
.tnt-dual-related {
    margin: 40px 0 30px;
    direction: rtl;
    text-align: right;
    clear: both;
}

/* ═══════════════════════════════════════════
   هر بخش (همان ناشر / سایر ناشران)
   ═══════════════════════════════════════════ */
.tnt-related-section {
    margin-bottom: 40px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e7e7e7;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tnt-related-section:last-child {
    margin-bottom: 0;
}

/* رنگ‌بندی متفاوت برای هر بخش */
.tnt-related-same-publisher {
    border-top: 3px solid #FEBD69;
}

.tnt-related-other-publishers {
    border-top: 3px solid #232F3E;
}

/* ═══════════════════════════════════════════
   عنوان بخش
   ═══════════════════════════════════════════ */
.tnt-related-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #232F3E;
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    padding-right: 15px;
}

.tnt-related-title::before {
    content: "";
    position: absolute;
    right: 0;
    top: 4px;
    bottom: 16px;
    width: 4px;
    background: #FEBD69;
    border-radius: 2px;
}

.tnt-related-other-publishers .tnt-related-title::before {
    background: #232F3E;
}

/* ═══════════════════════════════════════════
   Grid محصولات (4 ستون در دسکتاپ)
   ═══════════════════════════════════════════ */
.tnt-related-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.tnt-related-item {
    min-width: 0; /* جلوگیری از overflow */
}

/* حذف استایل‌های اضافی از کارت داخل Grid */
.tnt-related-item .tntb-card {
    height: 100%;
    margin: 0;
}

/* ═══════════════════════════════════════════
   Fallback (در صورت نبود tntkala_render_amazon_card)
   ═══════════════════════════════════════════ */
.tnt-related-fallback {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 12px;
    border: 1px solid #e7e7e7;
    border-radius: 6px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    background: #fff;
    height: 100%;
}

.tnt-related-fallback:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    text-decoration: none;
}

.tnt-related-fallback img {
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: contain;
    display: block;
    margin: 0 auto 10px;
}

.tnt-related-fallback h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #232F3E;
    margin: 0;
    line-height: 1.4;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ═══════════════════════════════════════════
   Responsive - تبلت (992px و کمتر)
   ═══════════════════════════════════════════ */
@media (max-width: 1199px) {
    .tnt-related-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }

    .tnt-related-section {
        padding: 15px;
    }

    .tnt-related-title {
        font-size: 1.2rem;
    }
}

/* ═══════════════════════════════════════════
   Responsive - موبایل (768px و کمتر)
   ═══════════════════════════════════════════ */
@media (max-width: 991px) {
    .tnt-related-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .tnt-dual-related {
        margin: 25px 0 15px;
    }

    .tnt-related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .tnt-related-section {
        padding: 12px;
        margin-bottom: 25px;
        border-radius: 6px;
    }

    .tnt-related-title {
        font-size: 1.05rem;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .tnt-related-title::before {
        width: 3px;
    }
}

/* ═══════════════════════════════════════════
   Responsive - موبایل کوچک (480px و کمتر)
   ═══════════════════════════════════════════ */
@media (max-width: 480px) {
    .tnt-related-grid {
        gap: 10px;
    }

    .tnt-related-section {
        padding: 10px;
    }

    .tnt-related-title {
        font-size: 1rem;
    }
}

/* ═══════════════════════════════════════════
   حالت Print (چاپ)
   ═══════════════════════════════════════════ */
@media print {
    .tnt-dual-related {
        display: none;
    }
}

/* ═══════════════════════════════════════════
   🎨 هدر زیبای بخش‌های محصولات مرتبط (v3.0)
   ═══════════════════════════════════════════ */

.tnt-related-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #f0f0f0;
    position: relative;
}

/* خط گرادیانت زیر هدر */
.tnt-related-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 120px;
    height: 3px;
    border-radius: 3px;
}

.tnt-related-title {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    line-height: 1.3 !important;
}

.tnt-related-title::before {
    display: none !important;
}

.tnt-related-title .tnt-title-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.tnt-related-title span {
    display: inline-block;
}

/* دکمه مشاهده همه */
.tnt-related-viewall {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 16px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tnt-related-viewall svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.tnt-related-viewall:hover svg {
    transform: translateX(-3px);
}

/* ═══════════════════════════════════════════
   🟠 بخش 1: همان ناشر (نارنجی)
   ═══════════════════════════════════════════ */

.tnt-related-same-publisher .tnt-related-header::after {
    background: linear-gradient(90deg, #FF9900 0%, #FF6B00 100%);
}

.tnt-related-same-publisher .tnt-related-title {
    color: #E65100 !important;
}

.tnt-related-same-publisher .tnt-related-title .tnt-title-icon {
    color: #FF9900;
}

.tnt-related-same-publisher .tnt-related-viewall {
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
    color: #E65100;
    border: 1px solid #FFB74D;
}

.tnt-related-same-publisher .tnt-related-viewall:hover {
    background: linear-gradient(135deg, #FF9900 0%, #FF6B00 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 153, 0, 0.3);
}

/* ═══════════════════════════════════════════
   🔵 بخش 2: سایر ناشران (آبی)
   ═══════════════════════════════════════════ */

.tnt-related-other-publishers .tnt-related-header::after {
    background: linear-gradient(90deg, #1976D2 0%, #0D47A1 100%);
}

.tnt-related-other-publishers .tnt-related-title {
    color: #0D47A1 !important;
}

.tnt-related-other-publishers .tnt-related-title .tnt-title-icon {
    color: #1976D2;
}

.tnt-related-other-publishers .tnt-related-viewall {
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    color: #0D47A1;
    border: 1px solid #64B5F6;
}

.tnt-related-other-publishers .tnt-related-viewall:hover {
    background: linear-gradient(135deg, #1976D2 0%, #0D47A1 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

/* ═══════════════════════════════════════════
   📱 Responsive
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
    .tnt-related-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }
    
    .tnt-related-title {
        font-size: 1rem !important;
    }
    
    .tnt-related-title .tnt-title-icon {
        width: 22px;
        height: 22px;
    }
    
    .tnt-related-viewall {
        padding: 5px 12px;
        font-size: 0.78rem;
    }
    
    .tnt-related-viewall svg {
        width: 12px;
        height: 12px;
    }
    
    .tnt-related-header::after {
        width: 80px;
    }
}

@media (max-width: 480px) {
    .tnt-related-header {
        gap: 8px;
    }
    
    .tnt-related-title {
        font-size: 0.95rem !important;
        gap: 6px;
    }
    
    .tnt-related-title .tnt-title-icon {
        width: 20px;
        height: 20px;
    }
    
    .tnt-related-viewall span {
        display: none;
    }
    
    .tnt-related-viewall {
        padding: 6px 10px;
    }
    
    .tnt-related-viewall svg {
        width: 14px;
        height: 14px;
    }
}
