/* WP Posts Cards for Elementor - Styles */

.wpc-posts-container {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 30px !important;
    padding: 20px 0;
    direction: rtl;
    width: 100% !important;
}

/* عمود واحد */
.wpc-posts-container.wpc-columns-1 {
    grid-template-columns: 1fr !important;
}

/* عمودين */
.wpc-posts-container.wpc-columns-2 {
    grid-template-columns: repeat(2, 1fr) !important;
}

/* 3 أعمدة */
.wpc-posts-container.wpc-columns-3 {
    grid-template-columns: repeat(3, 1fr) !important;
}

.wpc-post-card {
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wpc-post-card:nth-child(1) { animation-delay: 0.1s; }
.wpc-post-card:nth-child(2) { animation-delay: 0.2s; }
.wpc-post-card:nth-child(3) { animation-delay: 0.3s; }
.wpc-post-card:nth-child(4) { animation-delay: 0.4s; }
.wpc-post-card:nth-child(5) { animation-delay: 0.5s; }

.wpc-card-inner {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    padding: 30px 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(134, 197, 65, 0.1);
    height: 100%;
    display: flex !important;
    flex-direction: column !important;
    float: none !important;
    clear: both !important;
}

.wpc-card-inner:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border-color: rgba(134, 197, 65, 0.3);
}

.wpc-thumbnail-bg {
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background-size: cover;
    background-position: center;
    opacity: 0.05;
    border-radius: 50%;
    filter: blur(2px);
    transition: all 0.5s ease;
}

.wpc-card-inner:hover .wpc-thumbnail-bg {
    opacity: 0.08;
    transform: scale(1.1);
}

.wpc-card-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
}

.wpc-title-row {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: nowrap;
}

.wpc-number-badge {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(134, 197, 65, 0.4);
    transition: all 0.3s ease;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    z-index: 10;
}

.wpc-card-inner:hover .wpc-number-badge {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(134, 197, 65, 0.5);
}

.wpc-post-title {
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 0;
    line-height: 1.4;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.wpc-post-title a {
    display: block;
}

.wpc-post-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-block;
    position: relative;
}

.wpc-post-title a:after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.4s ease;
}

.wpc-post-title a:hover:after {
    width: 100%;
}

.wpc-post-excerpt {
    margin: 0 0 20px 0;
    line-height: 1.8;
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

.wpc-post-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.wpc-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666666;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    transition: color 0.3s ease;
}

.wpc-meta-item svg {
    width: 16px;
    height: 16px;
    stroke: #86c541;
    transition: all 0.3s ease;
}

.wpc-meta-item:hover {
    color: #86c541;
}

.wpc-meta-item:hover svg {
    transform: scale(1.15);
    stroke: #2c9fda;
}

.wpc-featured-badge {
    display: none;
}

/* تأثيرات الخلفية الديناميكية */
.wpc-card-inner:before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(134, 197, 65, 0.03) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.wpc-card-inner:hover:before {
    opacity: 1;
}

/* إضافة نقاط زخرفية */
.wpc-card-inner:after {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(44, 159, 218, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    transition: all 0.5s ease;
}

.wpc-card-inner:hover:after {
    transform: scale(1.3);
    opacity: 0.8;
}

/* استجابة للأجهزة المحمولة */
@media (max-width: 1024px) {
    .wpc-posts-container.wpc-columns-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .wpc-posts-container,
    .wpc-posts-container.wpc-columns-1,
    .wpc-posts-container.wpc-columns-2,
    .wpc-posts-container.wpc-columns-3 {
        grid-template-columns: 1fr !important;
        gap: 25px !important;
    }
    
    .wpc-card-inner {
        padding: 25px 30px;
    }
    
    .wpc-title-row {
        gap: 10px;
    }
    
    .wpc-number-badge {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .wpc-post-meta {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .wpc-thumbnail-bg {
        width: 150px;
        height: 150px;
    }
}

@media (max-width: 480px) {
    .wpc-posts-container {
        gap: 20px;
        grid-template-columns: 1fr;
    }
    
    .wpc-card-inner {
        padding: 20px 25px;
    }
    
    .wpc-title-row {
        gap: 8px;
    }
    
    .wpc-number-badge {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .wpc-featured-badge {
        width: 40px;
        height: 40px;
        top: 15px;
        left: 15px;
    }
    
    .wpc-featured-badge svg {
        width: 16px;
        height: 16px;
    }
}

/* تحسين العرض على الشاشات الكبيرة جداً */
@media (min-width: 1200px) {
    .wpc-posts-container {
        gap: 35px;
    }
}

/* تحسينات إضافية للتأثيرات البصرية */
.wpc-post-card {
    will-change: transform, opacity;
}

.wpc-card-inner {
    will-change: transform, box-shadow;
}

/* دعم RTL كامل */
[dir="rtl"] .wpc-posts-container,
.rtl .wpc-posts-container {
    direction: rtl;
}

[dir="ltr"] .wpc-posts-container,
.ltr .wpc-posts-container {
    direction: ltr;
    grid-template-columns: repeat(2, 1fr);
}

[dir="ltr"] .wpc-number-badge,
.ltr .wpc-number-badge {
    right: auto;
    left: -20px;
}

[dir="ltr"] .wpc-post-title,
.ltr .wpc-post-title {
    padding-right: 0;
    padding-left: 70px;
}

[dir="ltr"] .wpc-featured-badge,
.ltr .wpc-featured-badge {
    left: auto;
    right: 20px;
}

[dir="ltr"] .wpc-thumbnail-bg,
.ltr .wpc-thumbnail-bg {
    right: auto;
    left: 0;
}

/* تحسين التباين للألوان */
.wpc-card-inner {
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
}

/* إضافة ظل ناعم للنصوص */
.wpc-post-title,
.wpc-post-excerpt {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.01);
}

/* تحسين تجربة النقر على الموبايل */
@media (hover: none) {
    .wpc-card-inner:active {
        transform: scale(0.98);
    }
}

/* طباعة نظيفة */
@media print {
    .wpc-card-inner {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .wpc-thumbnail-bg,
    .wpc-featured-badge {
        display: none;
    }
}

/* تحسين الأداء */
.wpc-posts-container * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* إضافة تأثير التدرج على الحواف */
.wpc-card-inner {
    background-clip: padding-box;
}

/* تحسين القراءة */
.wpc-post-excerpt {
    text-align: justify;
    hyphens: auto;
}

/* ========================================
   النمط 2 - بأرقام كبيرة
   ======================================== */

.wpc-style-2-card .wpc-card-inner-s2 {
    position: relative;
    background: #ffffff;
    border-radius: 0;
    padding: 30px 40px 30px 120px;
    border-bottom: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.wpc-style-2-card:hover .wpc-card-inner-s2 {
    background: #fafafa;
    padding-right: 50px;
}

.wpc-style-2-card .wpc-number-big {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 80px;
    font-weight: 900;
    line-height: 1;
    opacity: 0.15;
    font-family: 'Cairo', 'Tajawal', sans-serif;
    transition: all 0.3s ease;
}

.wpc-style-2-card:hover .wpc-number-big {
    opacity: 0.25;
    transform: translateY(-50%) scale(1.1);
}

.wpc-style-2-card .wpc-content-s2 {
    position: relative;
    z-index: 2;
}

.wpc-style-2-card .wpc-title-s2 {
    margin: 0 0 15px 0;
    line-height: 1.4;
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

.wpc-style-2-card .wpc-title-s2 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.wpc-style-2-card .wpc-excerpt-s2 {
    margin: 0;
    line-height: 1.7;
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

.wpc-style-2-card .wpc-divider-s2 {
    display: none;
}

/* النمط 2 - استجابة الموبايل */
@media (max-width: 768px) {
    .wpc-style-2-card .wpc-card-inner-s2 {
        padding: 25px 30px 25px 90px;
    }
    
    .wpc-style-2-card .wpc-number-big {
        font-size: 60px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .wpc-style-2-card .wpc-card-inner-s2 {
        padding: 20px 25px 20px 70px;
    }
    
    .wpc-style-2-card .wpc-number-big {
        font-size: 50px;
        right: 10px;
    }
}

/* ========================================
   النمط 3 - بطاقات بصور كبيرة
   ======================================== */

.wpc-style-3-card .wpc-card-inner-s3 {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(134, 197, 65, 0.1);
}

.wpc-style-3-card:hover .wpc-card-inner-s3 {
    transform: translateY(-10px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border-color: rgba(134, 197, 65, 0.3);
}

.wpc-style-3-card .wpc-featured-image-s3 {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
}

.wpc-style-3-card .wpc-featured-image-s3 img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.wpc-style-3-card:hover .wpc-featured-image-s3 img {
    transform: scale(1.1);
}

.wpc-style-3-card .wpc-overlay-s3 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.wpc-style-3-card:hover .wpc-overlay-s3 {
    opacity: 0.6;
}

.wpc-style-3-card .wpc-content-s3 {
    padding: 30px;
}

.wpc-style-3-card .wpc-title-s3 {
    margin: 0 0 15px 0;
    line-height: 1.4;
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

.wpc-style-3-card .wpc-title-s3 a {
    color: inherit;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
}

.wpc-style-3-card .wpc-title-s3 a:after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 0;
    height: 3px;
    background: currentColor;
    transition: width 0.4s ease;
}

.wpc-style-3-card .wpc-title-s3 a:hover:after {
    width: 100%;
}

.wpc-style-3-card .wpc-excerpt-s3 {
    margin: 0 0 20px 0;
    line-height: 1.8;
    font-family: 'Cairo', 'Tajawal', sans-serif;
}

.wpc-style-3-card .wpc-post-meta {
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* النمط 3 - بدون صورة مميزة */
.wpc-style-3-card .wpc-card-inner-s3:not(:has(.wpc-featured-image-s3)) .wpc-content-s3 {
    padding: 40px 30px;
}

/* النمط 3 - استجابة الموبايل */
@media (max-width: 768px) {
    .wpc-style-3-card .wpc-featured-image-s3 {
        height: 220px;
    }
    
    .wpc-style-3-card .wpc-content-s3 {
        padding: 25px;
    }
}

@media (max-width: 480px) {
    .wpc-style-3-card .wpc-featured-image-s3 {
        height: 200px;
    }
    
    .wpc-style-3-card .wpc-content-s3 {
        padding: 20px;
    }
}

/* تحسينات عامة للأنماط الجديدة */
.wpc-style-2-card,
.wpc-style-3-card {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.wpc-style-2-card:nth-child(1),
.wpc-style-3-card:nth-child(1) { animation-delay: 0.1s; }
.wpc-style-2-card:nth-child(2),
.wpc-style-3-card:nth-child(2) { animation-delay: 0.2s; }
.wpc-style-2-card:nth-child(3),
.wpc-style-3-card:nth-child(3) { animation-delay: 0.3s; }
.wpc-style-2-card:nth-child(4),
.wpc-style-3-card:nth-child(4) { animation-delay: 0.4s; }
.wpc-style-2-card:nth-child(5),
.wpc-style-3-card:nth-child(5) { animation-delay: 0.5s; }
.wpc-style-2-card:nth-child(6),
.wpc-style-3-card:nth-child(6) { animation-delay: 0.6s; }

/* تحسينات للطباعة */
@media print {
    .wpc-style-3-card .wpc-card-inner-s3,
    .wpc-style-2-card .wpc-card-inner-s2 {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .wpc-style-3-card .wpc-featured-image-s3 {
        height: auto;
        max-height: 150px;
    }
}

/* دعم الألوان الديناميكية من Elementor */
.wpc-posts-container {
    --wpc-primary-color: #86c541;
    --wpc-secondary-color: #2c9fda;
}

/* تطبيق الألوان الديناميكية على hover */
.wpc-post-title a:hover,
.wpc-style-2-card .wpc-title-s2 a:hover,
.wpc-style-3-card .wpc-title-s3 a:hover {
    color: var(--wpc-primary-color) !important;
}

.wpc-meta-item svg {
    stroke: var(--wpc-primary-color);
}

.wpc-meta-item:hover svg {
    stroke: var(--wpc-secondary-color);
}


/* ========================================
   Fix for Theme CSS Conflicts
   ======================================== */

/* منع أي تأثير من الـ theme على الـ container */
.elementor-widget-wp_posts_cards .wpc-posts-container {
    display: grid !important;
    box-sizing: border-box !important;
}

.elementor-widget-wp_posts_cards .wpc-post-card {
    box-sizing: border-box !important;
    float: none !important;
    clear: none !important;
    display: block !important;
}

/* للتأكد من عدم تأثير أي wrapper */
.elementor-widget-container > .wpc-posts-container {
    margin: 0 !important;
    padding: 20px 0 !important;
}

/* إصلاح مشاكل Elementor columns */
.elementor-column .wpc-posts-container {
    width: 100% !important;
}

