/* * استایل‌های ویجت لیست نوشته سفارشی (نسخه ۶)
 */

/* --- Wrapper --- */
.cpl-widget-wrapper {
    direction: rtl; 
    background-color: #70c945; 
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    overflow: hidden; 
}

.cpl-section-title {
    text-align: center;
    color: #ffffff;
    font-size: 24px;
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 20px;
}

/* --- Tabs Nav --- */
.cpl-tabs-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap; 
}

.cpl-tab-trigger {
    border: none;
    background-color: rgba(0,0,0,0.1); 
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cpl-tab-trigger:hover,
.cpl-tab-trigger.active {
    background-color: #333; 
    color: #fff;
}

/* --- Tabs Content --- */
.cpl-tabs-content {}
.cpl-tab-pane { display: none; }
.cpl-tab-pane.active { display: block; }

/* --- Post Item --- */
.cpl-post-item {
    display: flex; 
    position: relative; 
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

/* لایه پس‌زمینه */
.cpl-post-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.5); 
    z-index: 0; 
    border-radius: inherit; 
    transition: background-color 0.3s ease; 
}

.cpl-post-item a {
    text-decoration: none;
    color: inherit;
}

/* تنظیم لایه محتوا */
.cpl-post-thumbnail,
.cpl-post-content {
    position: relative;
    z-index: 1; 
}


/* --- افکت‌های هاور --- */
.elementor-widget.cpl-hover-effect-lift-up .cpl-post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.elementor-widget.cpl-hover-effect-scale .cpl-post-item:hover {
    transform: scale(1.03);
}

/* --- استایل‌های تصویر شاخص (بر اساس کلاس prefix) --- */

/* ۱. استایل پیش‌فرض: گرد در چپ (round-left) */
.cpl-thumb-style-round-left .cpl-post-item {
    align-items: center;
    padding: 10px;
    border-radius: 50px; 
    /* flex-direction: row-reverse;  <-- حذف شد */
}
.cpl-thumb-style-round-left .cpl-post-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%; 
    margin-left: 15px; /* *** اصلاح شده *** */
    border: 3px solid #fff;
    overflow: hidden;
}

/* ۲. استایل مربع در چپ (square-left) */
.cpl-thumb-style-square-left .cpl-post-item {
    align-items: center;
    padding: 10px;
    border-radius: 20px; 
    /* flex-direction: row-reverse;  <-- حذف شد */
}
.cpl-thumb-style-square-left .cpl-post-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 10px; 
    margin-left: 15px; /* *** اصلاح شده *** */
    overflow: hidden;
}

/* ۳. استایل تصویر در بالا (top) */
.cpl-thumb-style-top .cpl-post-item {
    flex-direction: column;
    align-items: stretch; 
    padding: 0; 
    border-radius: 20px; 
}
.cpl-thumb-style-top .cpl-post-thumbnail {
    width: 100%;
    height: 180px; 
    border-radius: 20px 20px 0 0; 
    margin-left: 0; /* *** اصلاح شده *** */
    margin-bottom: 15px;
    overflow: hidden;
}
.cpl-thumb-style-top .cpl-post-content {
    padding: 0 15px 15px; 
}


/* --- استایل عمومی تصویر شاخص (برای همه حالت‌ها) --- */
.cpl-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cpl-post-thumbnail.cpl-no-thumb span {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    height: 100%;
    background: #e0e0e0;
    color: #555;
    font-size: 12px;
    line-height: 1.3;
}
.cpl-post-thumbnail:not(.cpl-no-thumb) span { display: none; }


/* --- Post Content --- */
.cpl-post-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    text-align: right; /* *** جدید: همه چیز را راست‌چین می‌کند *** */
}

.cpl-post-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; 
}

.cpl-post-date {
    background-color: #6c757d; 
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 15px;
    white-space: nowrap;
}

.cpl-post-title {
    margin: 0;
    /* text-align: right; <-- دیگر لازم نیست */
}
.cpl-post-title a {
    color: #333;
    transition: color 0.3s ease;
}
.cpl-post-item:hover .cpl-post-title a {
    color: #70c945; 
}

.cpl-post-excerpt {
    font-size: 13px;
    color: #555;
    margin-top: 5px;
    line-height: 1.5;
    /* text-align: right; <-- دیگر لازم نیست */
}

/* استایل دکمه ادامه مطلب */
.cpl-read-more {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: bold;
    color: #70c945;
    text-decoration: none;
    transition: color 0.3s ease;
}
.cpl-read-more:hover {
    color: #333;
}

/* --- More Button (پایین) --- */
.cpl-more-button {
    display: block;
    max-width: 90%; 
    margin: 20px auto 0; 
    text-align: center;
    padding: 12px 20px;
    border-radius: 30px;
    transition: all 0.3s ease;
}
.cpl-button-style-filled .cpl-more-button {
    background-color: #fff;
    color: #333;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.cpl-button-style-filled .cpl-more-button:hover {
    background-color: #333;
    color: #fff;
}
.cpl-button-style-underline .cpl-more-button {
    background-color: transparent;
    color: #fff; 
    box-shadow: none;
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.5); 
    text-underline-offset: 5px; 
}
.cpl-button-style-underline .cpl-more-button:hover {
    color: #fff;
    text-decoration-color: #fff; 
}


/* ********** جدید: بازنویسی کامل موبایل ********** */
@media (max-width: 767px) {
    .cpl-section-title { font-size: 20px; }
    .cpl-tabs-nav { gap: 5px; }
    .cpl-tab-trigger { padding: 6px 12px; }

    /* اجرای استایل "تصویر در بالا" برای همه آیتم‌ها در موبایل */
    
    .cpl-post-item {
        flex-direction: column !important; /* !important برای اولویت */
        align-items: stretch !important;
        padding: 0 !important; 
        border-radius: 20px !important; 
    }
    
    .cpl-post-thumbnail {
        width: 100% !important;
        height: 180px !important; 
        border-radius: 20px 20px 0 0 !important; 
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 15px !important;
    }
    
    .cpl-post-content {
        padding: 0 15px 15px !important; 
    }

    /* راست‌چین کردن متا در موبایل */
    .cpl-post-meta {
        justify-content: flex-start; /* در RTL به معنای راست است */
    }
}
/* ********** پایان بخش موبایل ********** */


/* --- انیمیشن نورانی دور کادر --- */
@keyframes cpl-rotate-glow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.cpl-glow-effect-yes .cpl-post-item::before {
    content: '';
    position: absolute;
    z-index: -1; 
    left: -2px; 
    top: -2px;
    right: -2px;
    bottom: -2px;
    background: conic-gradient(
        from 0deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0) 70%,
        #ffffff 90%, 
        #ffffff 100%
    );
    animation: cpl-rotate-glow 4s linear infinite; 
    border-radius: inherit; 
}