.joz-widget-container {
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 5px;
    background: #f9f9f9;
}

.joz-widget-container h2 {
    margin-top: 0;
}






/* ساختار اصلی */
.advanced-post-display {
    font-family: 'Tahoma', sans-serif;
    margin: 0 auto;
    max-width: 1200px;
}

.apd-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

/* استایل کارت پست */
.apd-post-item {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: #fff;
}

.apd-post-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* استایل تصویر */
.apd-post-thumbnail {
    overflow: hidden;
    height: 200px;
}

.apd-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.apd-post-item:hover .apd-post-thumbnail img {
    transform: scale(1.05);
}

/* استایل محتوا */
.apd-post-content {
    padding: 20px;
}

.apd-post-title {
    margin: 0 0 15px;
    font-size: 1.3em;
    line-height: 1.4;
}

.apd-post-title a {
    color: inherit;
    text-decoration: none;
}

.apd-post-excerpt {
    margin-bottom: 15px;
    color: #666;
    line-height: 1.6;
}

.apd-read-more {
    display: inline-block;
    padding: 8px 15px;
    background: #3498db;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.apd-read-more:hover {
    background: #2980b9;
}

/* پیام عدم وجود پست */
.apd-no-posts {
    text-align: center;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
}




/* نشان فرمت پست */
.upd-format-badge {
    position: absolute;
    left: 10px;
    bottom: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 2;
}

/* استایل‌های مختلف برای فرمت‌های مختلف */
.upd-format-standard .upd-format-badge { background: #95a5a6; }
.upd-format-video .upd-format-badge { background: #e74c3c; }
.upd-format-gallery .upd-format-badge { background: #9b59b6; }
.upd-format-image .upd-format-badge { background: #1abc9c; }
.upd-format-quote .upd-format-badge { background: #f39c12; }
.upd-format-link .upd-format-badge { background: #34495e; }
.upd-format-audio .upd-format-badge { background: #e67e22; }

/* موقعیت نسبی برای والد تصویر */
.upd-post-thumbnail {
    position: relative;
    overflow: hidden;
}












/* ساختار اصلی */
.upd-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    width:100%;
}

/* موقعیت‌های مختلف تصویر */
.upd-image-top .upd-post-item {
    display: flex;
    flex-direction: column;
}

.upd-image-bottom .upd-post-item {
    display: flex;
    flex-direction: column-reverse;
}

.upd-image-left .upd-post-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

.upd-image-right .upd-post-item {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
}

/* استایل آیکون فرمت */
.upd-format-icon {
    position: absolute;
    left: 10px;
    top: 10px;
    background: rgba(255, 255, 255, 0.9);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* تنظیمات تصویر برای موقعیت‌های چپ و راست */
.upd-image-left .upd-post-thumbnail,
.upd-image-right .upd-post-thumbnail {
    flex: 0 0 auto;
    margin-right: 20px;
}

.upd-image-right .upd-post-thumbnail {
    margin-right: 0;
    margin-left: 20px;
}

.upd-post-content {
    flex: 1;
}

/* تنظیمات پاسخگویی */
@media (max-width: 768px) {
    .upd-image-left .upd-post-item,
    .upd-image-right .upd-post-item {
        flex-direction: column;
    }
    
    .upd-image-left .upd-post-thumbnail,
    .upd-image-right .upd-post-thumbnail {
        margin-right: 0;
        margin-left: 0;
        margin-bottom: 15px;
        width: 100% !important;
    }
}

/* تضمین کارکرد object-fit در تمام مرورگرها */
.upd-post-thumbnail {
    position: relative;
    overflow: hidden;
}

.upd-post-thumbnail img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover; /* مقدار پیش‌فرض */
    object-position: center center; /* مقدار پیش‌فرض */
    transition: all 0.3s ease;
}

/* حالت‌های مختلف موقعیت تصویر */
.upd-post-thumbnail img[style*="object-position: top center"] {
    object-position: top center;
}

.upd-post-thumbnail img[style*="object-position: bottom center"] {
    object-position: bottom center;
}

/* ... سایر موقعیت‌ها به همین صورت */

/* چیدمان‌های مختلف تصویر */
.upd-flex-container {
    display: flex;
    width: 100%;
}

.upd-position-left .upd-flex-container {
    flex-direction: row;
}

.upd-position-right .upd-flex-container {
    flex-direction: row-reverse;
}

.upd-post-thumbnail {
    flex: 0 0 <?php echo $settings['image_width']['size'] ?? 300 ?>px;
    max-width: 100%;
    position: relative;
    overflow: hidden;
}

.upd-position-left .upd-post-thumbnail,
.upd-position-right .upd-post-thumbnail {
    margin-bottom: 0;
    margin-right: 20px;
}

.upd-position-right .upd-post-thumbnail {
    margin-right: 0;
    margin-left: 20px;
}

.upd-post-content-wrapper {
    flex: 1;
}

.upd-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* استایل فیلد ACF */
.upd-acf-field {
    margin-top: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 4px;
    font-size: 0.9em;
}

/* پاسخگویی */
@media (max-width: 768px) {
    .upd-flex-container {
        flex-direction: column !important;
    }
    
    .upd-position-left .upd-post-thumbnail,
    .upd-position-right .upd-post-thumbnail {
        margin-right: 0;
        margin-left: 0;
        margin-bottom: 15px;
        flex: 0 0 auto;
        width: 100% !important;
    }
}


/* تنظیمات پاسخگویی */
@media (max-width: 1024px) {
    .elementor-grid-tablet-3 .upd-posts-grid,
    .elementor-grid-tablet-4 .upd-posts-grid,
    .elementor-grid-tablet-5 .upd-posts-grid,
    .elementor-grid-tablet-6 .upd-posts-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .elementor-grid-mobile-2 .upd-posts-grid,
    .elementor-grid-mobile-3 .upd-posts-grid,
    .elementor-grid-mobile-4 .upd-posts-grid,
    .elementor-grid-mobile-5 .upd-posts-grid,
    .elementor-grid-mobile-6 .upd-posts-grid {
        grid-template-columns: repeat(1, 1fr) !important;
    }
}

/* استایل پایه آیتم پست */
.upd-post-item {
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* محتوای پست */
.upd-post-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* حالت‌های مختلف موقعیت تصویر */
.upd-position-top .upd-post-item {
    flex-direction: column;
}

.upd-position-bottom .upd-post-item {
    flex-direction: column-reverse;
}

.upd-position-left .upd-post-item,
.upd-position-right .upd-post-item {
    flex-direction: row;
}

.upd-position-right .upd-post-item {
    flex-direction: row-reverse;
}

/* انیمیشن‌های هاور */
.elementor-animation-grow .upd-post-item:hover {
    transform: scale(1.05);
}

.elementor-animation-shrink .upd-post-item:hover {
    transform: scale(0.95);
}

.elementor-animation-float .upd-post-item:hover {
    transform: translateY(-5px);
}

/* پاسخگویی */
@media (max-width: 768px) {
    .upd-post-item {
        flex-direction: column !important;
    }
}

/* استایل متادیتاها */
.upd-post-meta {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
    font-size: 0.85em;
    color: #777;
}

.upd-post-meta > span {
    display: inline-flex;
    align-items: center;
}

.upd-post-meta > span:not(:last-child):after {
    content: "|";
    margin-left: 8px;
    opacity: 0.5;
}

/* بهبود نمایش متن در کنار تصاویر */
.upd-position-left .upd-post-thumbnail,
.upd-position-right .upd-post-thumbnail {
    flex: 0 0 40%;
    max-width: 40%;
}

.upd-position-left .upd-post-content,
.upd-position-right .upd-post-content {
    flex: 0 0 60%;
    max-width: 60%;
    padding: 15px;
}

@media (max-width: 768px) {
    .upd-position-left .upd-post-thumbnail,
    .upd-position-right .upd-post-thumbnail {
        flex: 0 0 100%;
        max-width: 100%;
        margin-right: 0;
        margin-left: 0;
        margin-bottom: 15px;
    }
    
    .upd-position-left .upd-post-content,
    .upd-position-right .upd-post-content {
        flex: 0 0 100%;
        max-width: 100%;
        padding: 15px;
    }
}

/* استایل‌های پیشرفته متادیتا */
.upd-post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 0.9em;
}

.upd-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.upd-meta-item a {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
}

.upd-meta-item:hover a {
    opacity: 0.8;
}

.upd-meta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.upd-meta-icon i {
    font-size: 0.9em;
}

/* جداکننده بین آیتم‌ها */
.upd-meta-item:not(:last-child) {
    position: relative;
    padding-left: 10px;
}

.upd-meta-item:not(:last-child):after {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 14px;
    background-color: currentColor;
    opacity: 0.3;
}

/* حالت‌های پاسخگو */
@media (max-width: 768px) {
    .upd-post-meta {
        gap: 10px;
    }
    
    .upd-meta-item {
        font-size: 0.85em;
    }
    
    .upd-meta-item:not(:last-child):after {
        height: 12px;
    }
}
