/* کانتینر اصلی نوشته */
.saitima-single-universe {
    max-width: 1300px;
    margin: 120px auto 50px;
    padding: 0 5%;
}
.single-hero-3d {
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 40px;
    margin-bottom: 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.05);
    position: relative;
    z-index: 100;
    perspective: 1200px;
    transform-style: preserve-3d;
}
.hero-content-right {
    flex: 1;
    transform: translateZ(30px);
    transform-style: preserve-3d;
    position: relative;
    z-index: 99999 !important;
}

.breadcrumbs {
    font-size: 0.85rem;
    color: #ff007a;
    margin-bottom: 15px;
}

.single-title {
    font-size: 2.2rem;
    line-height: 1.4;
    color: #1a1a2e;
    margin-bottom: 15px;
}

.single-meta {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
}

.toc-box-3d {
    background: rgba(255, 255, 255, 0.6);
    padding: 20px;
    border-right: 4px solid #7a00ff;
    position: relative;
    z-index: 999;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.toc-box-3d:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(122,0,255,0.15);
}
.toc-box-3d h3 { margin-top: 0; font-size: 1.2rem; color: #ff007a; }
.toc-box-3d ul { list-style: none; padding: 0; margin: 0; }
.toc-box-3d li { margin-bottom: 8px; }
.toc-box-3d a { color: #444; text-decoration: none; transition: color 0.2s; }
.toc-box-3d a:hover { color: #7a00ff; }
.toc-item-h3 { padding-right: 15px; font-size: 0.9em; }

/* تصویر شاخص سمت چپ */
.hero-image-left {
    flex: 1;
    perspective: 1000px;
}
.image-wrapper-3d {
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}
.hero-image-left:hover .image-wrapper-3d {
    transform: rotateY(-10deg) rotateX(10deg);
}
.floating-thumbnail {
    width: 100%;
    height: auto;
    border-radius: 20px;
    box-shadow: -20px 20px 40px rgba(0,0,0,0.2);
}

/* ================== بدنه (محتوا + سایدبار) ================== */
.single-body-grid {
    display: flex;
    gap: 30px;
    margin-bottom: 60px;
    margin-top: 68px;
    position: relative;
    z-index: 1 !important;
}

.single-content {
    flex: 3;
    padding: 40px;
    line-height: 1.8;
    font-size: 1.1rem;
    color: #333;
}
.single-content h2, .single-content h3 { color: #1a1a2e; margin-top: 30px; }

.single-sidebar {
    flex: 1;
    perspective: 1000px;
}

.sidebar-widget-3d {
    position: sticky;
    top: 100px;
    padding: 25px;
    transform: translateZ(20px);
    transition: transform 0.3s;
}
.sidebar-widget-3d:hover { transform: translateZ(40px); }

.sidebar-post-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    text-decoration: none;
    color: #444;
    transition: transform 0.2s;
    overflow: hidden; /* این خط را حتماً اضافه کنید */
}
.sidebar-post-item:hover { transform: translateX(-5px); color: #ff007a; }
.sidebar-post-item img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
}
.sidebar-post-item h4 {
    font-size: 0.9rem; /* فونت کمی جمع‌وجورتر */
    margin: 0;
    line-height: 1.6;

    /* کدهای محدود کردن متن به ۲ خط و اضافه کردن سه نقطه */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* اگر اصرار دارید فقط ۱ خط باشد، این عدد را ۱ کنید */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* ================== سیستم اسلایدر مقالات مرتبط ================== */
.related-posts-3d-section {
    margin-top: 50px;
}
.related-slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}
.related-grid-3d {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    padding: 15px 5px;
}
/* مخفی کردن نوار اسکرول پیش‌فرض برای تمیزی اسلایدر */
.related-grid-3d::-webkit-scrollbar {
    display: none;
}
.related-card-3d {
    position: relative;
    z-index: 1;
    transition: all 0.4s ease;
    padding: 15px;
    flex: 0 0 calc(33.333% - 16px); /* نمایش ۳ کارت در دسکتاپ */
    scroll-snap-align: start;
    box-sizing: border-box;
}
.related-card-3d:hover {
    z-index: 10;
    transform: translateY(-10px) scale(1.02);
}
.card-img-3d img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 15px;
    transform: translateZ(30px);
}
.card-content-3d { transform: translateZ(40px); margin-top: 15px; }

/* تک خطی کردن تیترهای بخش مقالات پیشنهاد شده و ریزتر کردن فونت */
.card-content-3d h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1rem; /* فونت کمی ریزتر برای زیبایی */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* ایجاد افکت سه نقطه در پایان متن طولانی */
}
.card-content-3d h4 a { color: #1a1a2e; text-decoration: none; }

/* استایل دکمه‌های ناوبری اسلایدر */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
}
.slider-arrow:hover {
    background: #7a00ff;
    color: #fff;
    border-color: #7a00ff;
}
.prev-arrow { right: -20px; } /* دکمه قبلی در راست */
.next-arrow { left: -20px; transform: translateY(-50%) rotate(180deg); } /* دکمه بعدی در چپ */


/* =========================================
   اصلاحیه کامل رسپانسیو موبایل (کلاس‌های تصحیح شده)
========================================= */
@media (max-width: 992px) {
    .related-card-3d {
        flex: 0 0 calc(50% - 12px); /* نمایش ۲ کارت در تبلت */
    }
}

@media (max-width: 768px) {
    .saitima-single-universe {
        margin: 80px auto 30px;
        padding: 0 4%;
    }

    /* هیرو بخش بالای صفحه */
    .single-hero-3d {
        flex-direction: column-reverse; /* جابجایی تصویر به بالای متن در موبایل */
        padding: 20px;
        gap: 25px;
    }
    .hero-content-right, .hero-image-left {
        width: 100%;
        flex: none;
    }
    .single-title {
        font-size: 1.6rem;
        line-height: 1.5;
    }
    .single-meta {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 20px;
    }

    /* ساختار محتوا و سایدبار */
    .single-body-grid {
        flex-direction: column; /* چیدمان زیر هم ستون‌ها */
        gap: 30px;
        margin-top: 30px;
    }
    .single-content {
        width: 100% !important;
        padding: 20px;
        font-size: 1.05rem;
    }
    .single-sidebar {
        width: 100% !important;
        flex: none;
    }
    .sidebar-widget-3d {
        position: static !important; /* غیرفعال کردن حالت چسبان در موبایل */
        padding: 20px;
    }

    /* تنظیمات تصاویر داخل متن */
    .single-content img {
        max-width: 100% !important;
        height: auto !important;
        border-radius: 12px;
    }

    /* تنظیمات اسلایدر در موبایل */
    .related-card-3d {
        flex: 0 0 100%; /* هر کارت تمام عرض صفحه را می‌گیرد */
    }
    .slider-arrow {
        display: none; /* مخفی کردن دکمه‌ها در موبایل؛ کاربران با دست سایپ می‌کنند */
    }
    .card-img-3d img {
        height: 180px;
    }
}

/* مخفی‌سازی جعبه فهرست مطالب وقتی مقاله تیتر ندارد */
#saitima-toc-container.is-hidden { display: none; }
