/* =====================================================
   تصميم الجداول البسيط والاحترافي - FilterX
   تصميم نظيف وبسيط مع دعم كامل للغة العربية RTL
   مصمم بواسطة: FilterX Team
   التاريخ: 2025-10-11
   ===================================================== */

/* =====================================================
   1. الحاويات (Containers)
   ===================================================== */

.fx-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
}

@media (min-width: 1600px) {
    .fx-container {
        max-width: 1600px;
        padding: 0 20px;
    }
}

@media (min-width: 1920px) {
    .fx-container {
        max-width: 1800px;
    }
}

/* =====================================================
   2. الجداول - التصميم الأساسي
   ===================================================== */

.table-modern {
    width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table-full-width {
    width: 100%;
    min-width: 100%;
}

/* =====================================================
   3. رأس الجدول (Table Header)
   ===================================================== */

.table-modern thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.table-modern thead th {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 13px;
    color: #495057;
    text-align: right;
    vertical-align: middle;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.table-modern thead th:first-child {
    border-top-right-radius: 8px;
}

.table-modern thead th:last-child {
    border-top-left-radius: 8px;
}

/* محاذاة النص في الرأس */
.table-modern thead th.text-center {
    text-align: center;
}

.table-modern thead th.text-left {
    text-align: left;
}

/* تنسيق العناوين المزدوجة في الرأس */
.table-modern thead th div {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.table-modern thead th small {
    display: block;
    font-size: 11px;
    opacity: 0.85;
    font-weight: 400;
}

/* ألوان خاصة للرأس */
.table-modern thead th.bg-danger {
    background-color: #dc3545 !important;
}

.table-modern thead th.bg-success {
    background-color: #198754 !important;
}

.table-modern thead th.bg-info {
    background-color: #0dcaf0 !important;
}

/* =====================================================
   4. جسم الجدول (Table Body)
   ===================================================== */

.table-modern tbody tr {
    border-bottom: 1px solid #f1f3f5;
    transition: background-color 0.2s ease;
}

.table-modern tbody tr:hover {
    background-color: #f8f9fa;
}

.table-modern tbody tr:last-child {
    border-bottom: none;
}

.table-modern tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    color: #212529;
    font-size: 14px;
    text-align: right;
}

/* محاذاة النص في الخلايا */
.table-modern tbody td.text-center {
    text-align: center;
}

.table-modern tbody td.text-left {
    text-align: left;
}

/* =====================================================
   5. ألوان الصفوف (Row Colors)
   ===================================================== */

/* صف نجاح */
.table-modern tbody tr.table-success {
    background-color: #d1e7dd;
}

.table-modern tbody tr.table-success:hover {
    background-color: #badbcc;
}

/* صف تحذير */
.table-modern tbody tr.table-warning {
    background-color: #fff3cd;
}

.table-modern tbody tr.table-warning:hover {
    background-color: #ffe69c;
}

/* صف خطر */
.table-modern tbody tr.table-danger {
    background-color: #f8d7da;
}

.table-modern tbody tr.table-danger:hover {
    background-color: #f1aeb5;
}

/* صف معلومات */
.table-modern tbody tr.table-info {
    background-color: #cff4fc;
}

.table-modern tbody tr.table-info:hover {
    background-color: #9eeaf9;
}

/* =====================================================
   6. الأعمدة (Columns)
   ===================================================== */

.col-narrow {
    width: 80px;
    min-width: 80px;
}

.col-medium {
    width: 120px;
    min-width: 120px;
}

.col-wide {
    width: 200px;
    min-width: 200px;
}

.col-auto {
    width: auto;
}

/* =====================================================
   7. الخلايا المتخصصة (Specialized Cells)
   ===================================================== */

/* خلايا الأرقام */
.number-cell,
.table-modern .number {
    font-family: 'Segoe UI', 'Roboto', sans-serif;
    font-weight: 600;
    text-align: center;
    direction: ltr;
}

/* خلايا العملات */
.currency-cell,
.table-modern .currency {
    font-family: 'Segoe UI', 'Roboto', sans-serif;
    font-weight: 600;
    text-align: center;
    direction: ltr;
    color: #198754;
}

/* خلايا النسب المئوية */
.percentage-cell,
.table-modern .percentage {
    font-family: 'Segoe UI', 'Roboto', sans-serif;
    font-weight: 700;
    text-align: center;
    direction: ltr;
}

/* ROI إيجابي */
.table-modern .roi-positive {
    color: #198754;
    font-weight: 700;
}

/* ROI سلبي */
.table-modern .roi-negative {
    color: #dc3545;
    font-weight: 700;
}

/* بيانات PropellerAds */
.table-modern .propeller-data {
    color: #dc3545;
    font-weight: 600;
}

/* بيانات Adsterra */
.table-modern .adsterra-data {
    color: #198754;
    font-weight: 600;
}

/* =====================================================
   8. الـ Badges
   ===================================================== */

.table-modern .badge {
    font-size: 11px;
    padding: 4px 8px;
    font-weight: 600;
    border-radius: 4px;
}

/* =====================================================
   9. الأزرار في الجداول
   ===================================================== */

.table-modern .btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.table-modern .btn-group-sm .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* =====================================================
   10. التمرير الأفقي (Horizontal Scroll)
   ===================================================== */

.table-responsive-full {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* شريط التمرير */
.table-responsive-full::-webkit-scrollbar {
    height: 8px;
}

.table-responsive-full::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 4px;
}

.table-responsive-full::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.table-responsive-full::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* =====================================================
   11. البطاقات (Cards)
   ===================================================== */

.modern-card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    overflow: hidden;
}

.modern-card-header {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.modern-card-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #212529;
}

.modern-card-body {
    padding: 20px;
}

.modern-card-body.p-0 {
    padding: 0;
}

/* =====================================================
   12. بطاقات الإحصائيات (Stat Cards)
   ===================================================== */

.stat-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
}

/* =====================================================
   13. Hero Section
   ===================================================== */

.zones-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.zones-hero h1 {
    color: #ffffff;
    margin-bottom: 8px;
}

.zones-hero p {
    margin-bottom: 0;
}

.zones-hero .badge {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* =====================================================
   14. Responsive - الشاشات الكبيرة
   ===================================================== */

@media (min-width: 1400px) {
    .table-modern {
        font-size: 15px;
    }
    
    .table-modern thead th {
        padding: 16px 20px;
        font-size: 14px;
    }
    
    .table-modern tbody td {
        padding: 14px 20px;
        font-size: 15px;
    }
}

@media (min-width: 1920px) {
    .table-modern {
        font-size: 16px;
    }
    
    .table-modern thead th {
        padding: 18px 24px;
    }
    
    .table-modern tbody td {
        padding: 16px 24px;
    }
}

/* =====================================================
   15. Responsive - الشاشات المتوسطة
   ===================================================== */

@media (max-width: 1200px) {
    .table-modern {
        font-size: 13px;
    }
    
    .table-modern thead th,
    .table-modern tbody td {
        padding: 10px 12px;
    }
}

@media (max-width: 992px) {
    .table-modern {
        font-size: 12px;
    }
    
    .table-modern thead th,
    .table-modern tbody td {
        padding: 8px 10px;
    }
    
    .col-wide {
        width: 150px;
        min-width: 150px;
    }
}

/* =====================================================
   16. Responsive - الشاشات الصغيرة
   ===================================================== */

@media (max-width: 768px) {
    .fx-container {
        padding: 0 10px;
    }
    
    .table-modern {
        font-size: 11px;
    }
    
    .table-modern thead th,
    .table-modern tbody td {
        padding: 6px 8px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-card .stat-value {
        font-size: 20px;
    }
    
    .stat-card .stat-label {
        font-size: 11px;
    }
    
    .zones-hero {
        padding: 16px;
    }
}

@media (max-width: 576px) {
    .table-modern {
        font-size: 10px;
    }
    
    .table-modern thead th,
    .table-modern tbody td {
        padding: 4px 6px;
    }
    
    .modern-card-header,
    .modern-card-body {
        padding: 12px;
    }
}

/* =====================================================
   17. Print Styles
   ===================================================== */

@media print {
    .table-modern {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .table-modern tbody tr:hover {
        background-color: transparent !important;
    }
    
    .stat-card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .zones-hero {
        background: #f8f9fa !important;
        color: #212529 !important;
        box-shadow: none;
    }
}

/* =====================================================
   18. Utilities
   ===================================================== */

.text-nowrap {
    white-space: nowrap;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fw-semibold {
    font-weight: 600;
}

.fw-medium {
    font-weight: 500;
}

/* =====================================================
   19. DataTables Integration (RTL Support)
   ===================================================== */

.dataTables_wrapper {
    direction: rtl;
    padding: 15px;
}

/* البحث والفلترة */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    text-align: right;
}

.dataTables_wrapper .dataTables_filter input {
    margin-right: 8px;
    margin-left: 0;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    padding: 6px 12px;
}

.dataTables_wrapper .dataTables_length select {
    margin-right: 8px;
    margin-left: 8px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    padding: 4px 8px;
}

/* المعلومات والترقيم */
.dataTables_wrapper .dataTables_info {
    text-align: right;
    padding-top: 15px;
    color: #6c757d;
    font-size: 13px;
}

.dataTables_wrapper .dataTables_paginate {
    text-align: left;
    padding-top: 15px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    margin-left: 4px;
    margin-right: 0;
    border-radius: 6px;
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    background: #ffffff;
    color: #495057 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #667eea !important;
    border-color: #667eea !important;
    color: #ffffff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* أزرار التصدير */
.dt-buttons {
    margin-bottom: 15px;
    display: flex;
    gap: 8px;
    flex-direction: row-reverse;
}

.dt-buttons .btn {
    border-radius: 6px;
    font-size: 13px;
}

/* أيقونات الفرز */
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
    cursor: pointer;
    position: relative;
}

table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before {
    left: 8px;
    right: auto;
}

table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    left: 8px;
    right: auto;
}

/* تحسين مظهر الجدول مع DataTables */
table.dataTable {
    border-collapse: separate !important;
    border-spacing: 0;
}

table.dataTable thead th {
    border-bottom: 2px solid #dee2e6;
}

table.dataTable tbody tr {
    border-bottom: 1px solid #f1f3f5;
}

table.dataTable tbody tr:hover {
    background-color: #f8f9fa;
}

/* Loading */
.dataTables_processing {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* =====================================================
   20. Animations
   ===================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.table-modern tbody tr {
    animation: fadeIn 0.3s ease;
}

.stat-card {
    animation: fadeIn 0.4s ease;
}

/* =====================================================
   النهاية - End of Styles
   ===================================================== */
