/**
 * Client Name Cell Styles v2.0
 * تنسيقات خانة اسم العميل في جدول العملاء
 * 
 * @version 2.0.0
 * @date 2025-10-09
 */

/* ==================== Container الرئيسي ==================== */
.client-name-wrapper-v2 {
    display: flex !important;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 0;
    direction: rtl;
    text-align: right;
}

/* ==================== صورة العميل (Avatar) ==================== */
.client-avatar-container {
    flex-shrink: 0;
}

.client-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-transform: uppercase;
}

.client-avatar:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.client-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.client-avatar.default.initials {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-size: 16px;
    font-weight: 700;
}

/* ==================== معلومات العميل ==================== */
.client-info-container {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ==================== سطر الاسم ==================== */
.client-name-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.client-name-main {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    color: #1f2937;
}

.client-name-link {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 600;
}

.client-name-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.client-name-text {
    color: #1f2937;
    font-weight: 600;
}

.legal-entity-inline {
    color: #6b7280;
    font-size: 0.9em;
    font-weight: 500;
    white-space: nowrap;
}

/* ==================== نسبة الاكتمال ==================== */
.completion-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.completion-badge.high {
    background: #d1fae5;
    color: #059669;
}

.completion-badge.medium {
    background: #fef3c7;
    color: #f59e0b;
}

.completion-badge.low {
    background: #fee2e2;
    color: #dc2626;
}

/* ==================== العمر والجنس ==================== */
.age-gender-line {
    font-size: 0.85em;
    color: #6b7280;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.age-gender-line i {
    font-size: 12px;
}

/* ==================== مجموعات الشارات ==================== */
.badge-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.badge-group-label {
    font-size: 10px;
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 4px;
}

/* ==================== الشارات العامة ==================== */
.client-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
    cursor: default;
}

.client-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.client-badge i {
    font-size: 10px;
    margin-left: 3px;
}

/* ==================== شارات الالتزام الضريبي ==================== */
.vat-badge {
    background: #d1fae5;
    color: #059669;
}

.invoice-badge {
    background: #ede9fe;
    color: #7c3aed;
}

.law6-badge {
    background: #fee2e2;
    color: #dc2626;
}

.insurance-badge {
    background: #cffafe;
    color: #0891b2;
}

/* ==================== شارات المستندات ==================== */
.docs-total-badge {
    background: #e0e7ff;
    color: #4f46e5;
}

.docs-active-badge {
    background: #d1fae5;
    color: #059669;
}

.docs-expired-badge {
    background: #fee2e2;
    color: #dc2626;
}

.docs-expiring-badge {
    background: #fef3c7;
    color: #f59e0b;
}

/* ==================== شارات المهام والطعون ==================== */
.tasks-badge {
    background: #dbeafe;
    color: #2563eb;
}

.appeals-badge {
    background: #f3e8ff;
    color: #9333ea;
}

/* ==================== شارات الملفات ==================== */
.other-files-badge {
    background: #f1f5f9;
    color: #64748b;
}

.parent-file-badge {
    background: #cffafe;
    color: #0891b2;
}

.child-files-badge {
    background: #cffafe;
    color: #06b6d4;
}

/* ==================== تأثيرات تحويمية خاصة ==================== */
.vat-badge:hover {
    background: #a7f3d0;
}

.invoice-badge:hover {
    background: #ddd6fe;
}

.law6-badge:hover {
    background: #fecaca;
}

.insurance-badge:hover {
    background: #a5f3fc;
}

.docs-total-badge:hover {
    background: #c7d2fe;
}

.tasks-badge:hover {
    background: #bfdbfe;
}

.appeals-badge:hover {
    background: #e9d5ff;
}

/* ==================== Responsive - الشاشات الصغيرة ==================== */
@media (max-width: 1024px) {
    .client-name-wrapper-v2 {
        gap: 8px;
    }
    
    .client-avatar {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .client-name-main {
        font-size: 13px;
    }
    
    .client-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .badge-group-label {
        font-size: 9px;
    }
}

@media (max-width: 768px) {
    .client-name-wrapper-v2 {
        gap: 6px;
        padding: 6px 0;
    }
    
    .client-avatar {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
    
    .client-name-main {
        font-size: 12px;
    }
    
    .legal-entity-inline {
        font-size: 0.85em;
    }
    
    .age-gender-line {
        font-size: 0.8em;
    }
    
    .client-badge {
        font-size: 9px;
        padding: 2px 5px;
    }
    
    .badge-group {
        gap: 3px;
    }
}

/* ==================== تحسينات الطباعة ==================== */
@media print {
    .client-avatar {
        border: 1px solid #000;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .client-badge {
        border: 1px solid #ccc;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .client-name-link {
        color: #000 !important;
        text-decoration: none !important;
    }
}

/* ==================== تحسينات الوصولية ==================== */
.client-badge:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.client-name-link:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 2px;
}

/* ==================== Animation للشارات عند التحميل ==================== */
@keyframes badgeFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.client-badge {
    animation: badgeFadeIn 0.3s ease-out;
}

.badge-group:nth-child(1) .client-badge {
    animation-delay: 0.05s;
}

.badge-group:nth-child(2) .client-badge {
    animation-delay: 0.1s;
}

.badge-group:nth-child(3) .client-badge {
    animation-delay: 0.15s;
}

.badge-group:nth-child(4) .client-badge {
    animation-delay: 0.2s;
}

/* ==================== تحسينات DataTables ==================== */
table.dataTable tbody td .client-name-wrapper-v2 {
    max-width: 100%;
}

table.dataTable tbody tr:hover .client-avatar {
    border-color: #3b82f6;
}

table.dataTable tbody tr:hover .client-name-link {
    color: #1d4ed8;
}
