/* =========================================
   📊 تصميم الجداول الاحترافي (Professional Tables)
   - جميل ومريح للقراءة
   - ممتاز للـ SEO
   - Responsive للجميع الأجهزة
   - RTL Support
   - تصميم عصري وواضح
   ========================================= */

/* =========================================
   1. التصميم الأساسي للجداول
   ========================================= */
.entry-content table,
.service-description table,
.offer-content table,
.page-content table,
.post-content table,
.coverage-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    font-size: 15px;
    font-family: var(--main-font);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 86, 145, 0.12);
    border: 2px solid rgba(0, 86, 145, 0.1);
    direction: rtl;
    text-align: right;
    position: relative;
}

/* إضافة تأثير لطيف للخلفية */
.entry-content table::before,
.service-description table::before,
.offer-content table::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--primary-color));
    background-size: 200% 100%;
    animation: gradientMove 3s ease infinite;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* =========================================
   2. ترويسة الجدول (Header)
   ========================================= */
.entry-content thead,
.service-description thead,
.offer-content thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.entry-content th,
.service-description th,
.offer-content th {
    padding: 18px 25px;
    text-align: right;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 3px solid var(--secondary-color);
    position: relative;
    color: #fff;
}

/* تأثير الزجاج على الترويسة */
.entry-content thead::after,
.service-description thead::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* =========================================
   3. جسم الجدول (Body)
   ========================================= */
.entry-content tbody tr,
.service-description tbody tr,
.offer-content tbody tr {
    border-bottom: 1px solid #e8eef4;
    transition: all 0.3s ease;
    cursor: pointer;
}

.entry-content tbody tr:nth-child(even),
.service-description tbody tr:nth-child(even),
.offer-content tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

.entry-content tbody tr:hover,
.service-description tbody tr:hover,
.offer-content tbody tr:hover {
    background-color: #e8f4fd;
    transform: scale(1.01);
    box-shadow: 0 3px 10px rgba(0, 86, 145, 0.1);
}

.entry-content tbody tr.selected,
.service-description tbody tr.selected,
.offer-content tbody tr.selected {
    background-color: var(--primary-color);
    color: #fff;
    transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 86, 145, 0.3);
}

.entry-content tbody tr.selected td,
.service-description tbody tr.selected td,
.offer-content tbody tr.selected td {
    color: #fff;
    border-right-color: rgba(255, 255, 255, 0.2);
}

/* =========================================
   4. خلايا الجدول (Cells)
   ========================================= */
.entry-content td,
.service-description td,
.offer-content td {
    padding: 18px 25px;
    text-align: right;
    color: var(--text-main);
    line-height: 1.8;
    border-right: 1px solid #e8eef4;
    font-size: 15px;
    font-weight: 500;
}

.entry-content td:first-child,
.service-description td:first-child,
.offer-content td:first-child {
    border-right: none;
    background: linear-gradient(90deg, rgba(0, 86, 145, 0.02) 0%, transparent 100%);
    font-weight: 700;
    color: var(--primary-dark);
}

.entry-content td:last-child,
.service-description td:last-child,
.offer-content td:last-child {
    border-right: none;
}

/* تحسين الروابط داخل الجدول */
.entry-content td a,
.service-description td a,
.offer-content td a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.entry-content td a:hover,
.service-description td a:hover,
.offer-content td a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* =========================================
   5. الجدول البديل (Zebra Stripes)
   ========================================= */
.entry-content table.zebra tbody tr:nth-child(odd),
.service-description table.zebra tbody tr:nth-child(odd),
.offer-content table.zebra tbody tr:nth-child(odd) {
    background-color: #f8fafc;
}

.entry-content table.zebra tbody tr:nth-child(even),
.service-description table.zebra tbody tr:nth-child(even),
.offer-content table.zebra tbody tr:nth-child(even) {
    background-color: #fff;
}

/* =========================================
   6. الجدول المدمج (Compact)
   ========================================= */
.entry-content table.compact td,
.service-description table.compact td,
.offer-content table.compact td {
    padding: 10px 15px;
    font-size: 14px;
}

.entry-content table.compact th,
.service-description table.compact th,
.offer-content table.compact th {
    padding: 12px 15px;
    font-size: 14px;
}

/* =========================================
   7. الجدول البارز (Highlighted)
   ========================================= */
.entry-content table.highlight tbody tr:first-child td,
.service-description table.highlight tbody tr:first-child td,
.offer-content table.highlight tbody tr:first-child td {
    background-color: rgba(0, 174, 239, 0.1);
    font-weight: 600;
    color: var(--primary-dark);
}

/* =========================================
   8. الجدول مع حدود (Bordered)
   ========================================= */
.entry-content table.bordered td,
.service-description table.bordered td,
.offer-content table.bordered td {
    border: 1px solid #e8eef4;
}

/* =========================================
   9. Responsive Design للموبايل
   ========================================= */
@media (max-width: 768px) {
    .entry-content table,
    .service-description table,
    .offer-content table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }
    
    .entry-content thead,
    .service-description thead,
    .offer-content thead {
        display: none; /* إخفاء الترويسة في الموبايل */
    }
    
    .entry-content tbody,
    .service-description tbody,
    .offer-content tbody {
        display: block;
        width: 100%;
    }
    
    .entry-content tr,
    .service-description tr,
    .offer-content tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e8eef4;
        border-radius: 8px;
        padding: 15px;
        background: #fff;
    }
    
    .entry-content td,
    .service-description td,
    .offer-content td {
        display: block;
        text-align: right;
        border: none;
        padding: 8px 0;
        position: relative;
        padding-left: 50%;
    }
    
    /* إضافة التسميات قبل الخلايا في الموبايل */
    .entry-content td::before,
    .service-description td::before,
    .offer-content td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: var(--primary-dark);
        text-align: left;
    }
}

/* =========================================
   10. تحسينات SEO (Accessibility)
   ========================================= */
/* تحسين التباين للقراءة */
.entry-content table,
.service-description table,
.offer-content table {
    color: #2c3e50;
    background-color: #ffffff;
}

/* تحسين حجم الخط للقراءة */
.entry-content td,
.service-description td,
.offer-content td {
    font-size: 15px;
    line-height: 1.6;
}

/* تحسين المسافات */
.entry-content td,
.service-description td,
.offer-content td {
    padding: 15px 20px;
}

/* =========================================
   11. تأثيرات تفاعلية (Interactive)
   ========================================= */
/* تأثير التركيز (Focus) */
.entry-content td:focus,
.service-description td:focus,
.offer-content td:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: -2px;
    background-color: #e8f4fd;
}

/* تأثير النشط (Active) */
.entry-content td:active,
.service-description td:active,
.offer-content td:active {
    background-color: var(--primary-color);
    color: #fff;
}

/* =========================================
   12. أنواع خاصة من الجداول
   ========================================= */

/* جدول الأسعار (Pricing Table) */
.entry-content table.pricing,
.service-description table.pricing,
.offer-content table.pricing {
    text-align: center;
}

.entry-content table.pricing td,
.service-description table.pricing td,
.offer-content table.pricing td {
    text-align: center;
    border-right: 1px solid #e8eef4;
}

.entry-content table.pricing tr:last-child td,
.service-description table.pricing tr:last-child td,
.offer-content table.pricing tr:last-child td {
    border-right: none;
}

/* جدول المقارنة (Comparison Table) */
.entry-content table.comparison td:first-child,
.service-description table.comparison td:first-child,
.offer-content table.comparison td:first-child {
    font-weight: 600;
    background-color: #f8fafc;
    color: var(--primary-dark);
}

/* جدول البيانات (Data Table) */
.entry-content table.data td,
.service-description table.data td,
.offer-content table.data td {
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* =========================================
   13. تحسينات للطباعة (Print)
   ========================================= */
@media print {
    .entry-content table,
    .service-description table,
    .offer-content table {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .entry-content th,
    .service-description th,
    .offer-content th {
        background-color: #f0f0f0 !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .entry-content tbody tr:nth-child(even),
    .service-description tbody tr:nth-child(even),
    .offer-content tbody tr:nth-child(even) {
        background-color: #f9f9f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* =========================================
   14. تحسينات للأداء (Performance)
   ========================================= */
/* استخدام GPU acceleration للحركات */
.entry-content tbody tr,
.service-description tbody tr,
.offer-content tbody tr {
    will-change: transform;
    backface-visibility: hidden;
}

/* =========================================
   15. تخصيص للألوان الداكنة (Dark Mode)
   ========================================= */
@media (prefers-color-scheme: dark) {
    .entry-content table,
    .service-description table,
    .offer-content table {
        background-color: #1a1a2e;
        border-color: #16213e;
        color: #eaeaea;
    }
    
    .entry-content thead,
    .service-description thead,
    .offer-content thead {
        background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    }
    
    .entry-content tbody tr:nth-child(even),
    .service-description tbody tr:nth-child(even),
    .offer-content tbody tr:nth-child(even) {
        background-color: #16213e;
    }
    
    .entry-content td,
    .service-description td,
    .offer-content td {
        color: #eaeaea;
        border-right-color: #16213e;
    }
    
    .entry-content tbody tr:hover,
    .service-description tbody tr:hover,
    .offer-content tbody tr:hover {
        background-color: #0f3460;
    }
}
