/**
 * ============================================
 * Modern DataTable Design - Team Portal Plugin
 * ============================================
 * 
 * @version 1.0.0
 * @description تصميم عصري للجدول الرئيسي مع تأثيرات حديثة
 * @features
 * - Gradient headers
 * - Avatar images
 * - Status badges
 * - Smooth transitions
 * - Responsive design
 * - Glass morphism effects
 */

/* ============================================
   1. Modern Table Container
   ============================================ */
.dataTables_wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2px;
    border-radius: 16px;
    box-shadow: 
        0 20px 60px rgba(102, 126, 234, 0.3),
        0 8px 16px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.dataTables_wrapper > div {
    background: #ffffff;
    border-radius: 14px;
}

/* ============================================
   2. Modern Table Header with Gradient
   ============================================ */
#posts-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

#posts-table thead::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 100%
    );
    pointer-events: none;
}

#posts-table thead th {
    color: #ffffff !important;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 18px 16px !important;
    border: none !important;
    position: relative;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#posts-table thead th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    transition: width 0.3s ease;
}

#posts-table thead th:hover::after {
    width: 80%;
}

/* Header Icons */
#posts-table thead th i {
    margin-left: 8px;
    opacity: 0.9;
    font-size: 13px;
}

/* ============================================
   3. Modern Table Body with Enhanced Rows
   ============================================ */
#posts-table tbody tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
}

#posts-table tbody tr:hover {
    background: linear-gradient(
        90deg,
        rgba(102, 126, 234, 0.08) 0%,
        rgba(118, 75, 162, 0.05) 100%
    );
    transform: translateX(4px);
    box-shadow: 
        -4px 0 0 0 #667eea inset,
        0 4px 12px rgba(102, 126, 234, 0.15);
}

#posts-table tbody td {
    padding: 16px !important;
    vertical-align: middle;
    border: none !important;
    font-size: 14px;
    color: #2d3748;
}

/* ============================================
   4. Client Avatar & Name Cell
   ============================================ */
.client-name-cell {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
}

.client-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #667eea, #764ba2) border-box;
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.25),
        0 0 0 4px rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.client-avatar:hover {
    transform: scale(1.1);
    box-shadow: 
        0 6px 20px rgba(102, 126, 234, 0.4),
        0 0 0 6px rgba(102, 126, 234, 0.15);
}

.client-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.client-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
}

.client-name-info {
    flex: 1;
    min-width: 0;
}

.client-name-text {
    font-weight: 600;
    font-size: 15px;
    color: #1a202c;
    margin-bottom: 4px;
    line-height: 1.3;
}

.client-name-text:hover {
    color: #667eea;
    text-decoration: none;
}

.client-sub-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #718096;
}

.client-sub-info i {
    font-size: 11px;
    color: #a0aec0;
}

/* ============================================
   5. Modern Status Badges
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.status-badge i {
    font-size: 10px;
}

/* Badge Variants */
.status-badge.badge-active {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

.status-badge.badge-pending {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(237, 137, 54, 0.3);
}

.status-badge.badge-inactive {
    background: linear-gradient(135deg, #cbd5e0 0%, #a0aec0 100%);
    color: #4a5568;
    box-shadow: 0 2px 8px rgba(160, 174, 192, 0.3);
}

.status-badge.badge-warning {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(245, 101, 101, 0.3);
}

.status-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ============================================
   6. Info Cards in Cells
   ============================================ */
.cell-info-card {
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    padding: 10px 14px;
    border-radius: 10px;
    border-left: 3px solid #667eea;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.cell-info-card:hover {
    background: linear-gradient(135deg, #edf2f7 0%, #e2e8f0 100%);
    border-left-color: #764ba2;
    transform: translateX(4px);
}

.cell-info-label {
    font-size: 11px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
}

.cell-info-value {
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
}

/* ============================================
   7. Action Buttons in Cells
   ============================================ */
.cell-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.cell-action-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.cell-action-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.cell-action-btn:active {
    transform: translateY(-1px);
}

.cell-action-btn.btn-edit {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
}

.cell-action-btn.btn-delete {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
}

.cell-action-btn.btn-view {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

/* ============================================
   8. Table Footer & Pagination
   ============================================ */
.dataTables_info {
    padding: 16px !important;
    color: #4a5568;
    font-size: 13px;
    font-weight: 500;
}

.dataTables_paginate {
    padding: 16px !important;
}

.dataTables_paginate .paginate_button {
    padding: 8px 14px !important;
    margin: 0 4px !important;
    border-radius: 8px !important;
    border: none !important;
    background: #f7fafc !important;
    color: #4a5568 !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.dataTables_paginate .paginate_button:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}

.dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}

.dataTables_paginate .paginate_button.disabled {
    opacity: 0.4;
    cursor: not-allowed !important;
}

/* ============================================
   9. Search & Length Controls
   ============================================ */
.dataTables_filter input {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #f7fafc;
}

.dataTables_filter input:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.dataTables_length select {
    padding: 8px 32px 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    background: #f7fafc;
    transition: all 0.3s ease;
}

.dataTables_length select:focus {
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* ============================================
   10. Loading & Empty States
   ============================================ */
.dataTables_processing {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white !important;
    padding: 30px 50px !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2) !important;
    border: none !important;
    z-index: 10000;
}

.dataTables_processing::before {
    content: '';
    display: block;
    width: 50px;
    height: 50px;
    margin: 0 auto 15px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.dataTables_empty {
    padding: 60px 20px !important;
    text-align: center;
    font-size: 16px;
    color: #718096;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

.dataTables_empty::before {
    content: '📋';
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
}

/* ============================================
   11. Responsive Design
   ============================================ */
@media (max-width: 768px) {
    #posts-table thead {
        display: none;
    }
    
    #posts-table tbody tr {
        display: block;
        margin-bottom: 16px;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        padding: 16px;
        background: white;
    }
    
    #posts-table tbody tr:hover {
        transform: translateY(-4px);
    }
    
    #posts-table tbody td {
        display: block;
        padding: 12px 0 !important;
        border: none !important;
    }
    
    #posts-table tbody td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        color: #4a5568;
        margin-bottom: 6px;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
}

/* ============================================
   12. Dark Mode Support (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    .dataTables_wrapper > div {
        background: #1a202c;
    }
    
    #posts-table tbody tr {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    #posts-table tbody td {
        color: #e2e8f0;
    }
    
    .cell-info-card {
        background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
        border-left-color: #667eea;
    }
    
    .dataTables_info {
        color: #cbd5e0;
    }
}

/* ============================================
   13. Animations & Transitions
   ============================================ */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#posts-table tbody tr {
    animation: slideInUp 0.3s ease forwards;
}

#posts-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
#posts-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
#posts-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
#posts-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
#posts-table tbody tr:nth-child(5) { animation-delay: 0.25s; }

/* ============================================
   14. Glassmorphism Effects
   ============================================ */
.glass-effect {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ============================================
   15. Custom Scrollbar
   ============================================ */
.dataTables_scrollBody::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.dataTables_scrollBody::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.dataTables_scrollBody::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.dataTables_scrollBody::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}
