/**
 * ============================================
 * Modern Client Modal Design - Team Portal Plugin
 * ============================================
 * 
 * @version 1.0.0
 * @description تصميم عصري للنافذة المنبثقة مع تأثيرات حديثة
 * @features
 * - Modern header with avatar
 * - Enhanced tabs
 * - Card-based layout
 * - Smooth animations
 * - Progress indicators
 * - Quick actions
 * - Glass morphism
 * - Dark mode support
 */

/* ============================================
   1. Modal Container & Backdrop
   ============================================ */
.client-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.client-modal.show {
    opacity: 1;
    visibility: visible;
}

.client-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.client-modal-container {
    position: relative;
    width: 90%;
    max-width: 1400px;
    height: 90vh;
    max-height: 900px;
    background: white;
    border-radius: 24px;
    box-shadow: 
        0 30px 90px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.client-modal.show .client-modal-container {
    transform: scale(1);
}

/* ============================================
   2. Modern Modal Header
   ============================================ */
.client-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0;
    border-bottom: none;
    position: relative;
    overflow: hidden;
}

.client-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.modal-header-content {
    display: flex;
    align-items: center;
    padding: 24px 32px;
    gap: 24px;
    position: relative;
    z-index: 1;
}

/* Client Avatar in Header */
.modal-header-avatar {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.2),
        0 0 0 8px rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.modal-header-avatar:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5);
}

.modal-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-header-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Client Info in Header */
.modal-header-info {
    flex: 1;
    min-width: 0;
}

.modal-header-title {
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin: 0 0 8px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-header-subtitle {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.modal-header-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 13px;
    color: white;
    font-weight: 500;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-header-meta i {
    font-size: 12px;
    opacity: 0.9;
}

/* Header Actions */
.modal-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.modal-header-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-header-btn i {
    font-size: 16px;
}

.modal-header-btn.btn-close {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

.modal-header-btn.btn-close:hover {
    background: rgba(239, 68, 68, 0.5);
}

/* ============================================
   3. Progress Indicator
   ============================================ */
.modal-progress-indicator {
    padding: 20px 32px;
    background: linear-gradient(90deg, #f7fafc 0%, #edf2f7 100%);
    border-bottom: 1px solid #e2e8f0;
}

.progress-stats {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 12px;
}

.progress-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.progress-stat-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.progress-stat-label {
    font-size: 11px;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #2d3748;
}

.progress-bar-container {
    position: relative;
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============================================
   4. Enhanced Tabs Navigation
   ============================================ */
.client-tabs-nav {
    display: flex;
    gap: 4px;
    padding: 16px 32px;
    background: #f7fafc;
    border-bottom: 2px solid #e2e8f0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.client-tabs-nav::-webkit-scrollbar {
    height: 4px;
}

.client-tabs-nav::-webkit-scrollbar-track {
    background: #e2e8f0;
}

.client-tabs-nav::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.client-tab-btn {
    position: relative;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
}

.client-tab-btn i {
    font-size: 16px;
    transition: transform 0.3s ease;
}

.client-tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.client-tab-btn:hover i {
    transform: scale(1.1);
}

.client-tab-btn.active {
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.client-tab-btn.active::before {
    content: '';
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #667eea;
}

/* Tab Badge */
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
}

.client-tab-btn.active .tab-badge {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   5. Modal Body with Cards
   ============================================ */
.client-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: #f8fafc;
}

.client-modal-body::-webkit-scrollbar {
    width: 10px;
}

.client-modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.client-modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   6. Data Cards
   ============================================ */
.data-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.data-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.data-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.3s ease;
}

.data-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.data-card:hover::before {
    transform: scaleY(1);
}

.data-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.data-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 700;
    color: #2d3748;
}

.data-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.data-card-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.data-card-action:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.data-card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.data-field:last-child {
    border-bottom: none;
}

.data-field-label {
    font-size: 13px;
    color: #718096;
    font-weight: 500;
}

.data-field-value {
    font-size: 14px;
    color: #2d3748;
    font-weight: 600;
    text-align: left;
}

/* ============================================
   7. Quick Actions Bar
   ============================================ */
.quick-actions-bar {
    position: sticky;
    top: 0;
    background: white;
    padding: 16px 32px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    z-index: 10;
}

.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-action-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.quick-action-btn i {
    font-size: 14px;
}

/* ============================================
   8. Loading & Empty States
   ============================================ */
.modal-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 20px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 16px;
    color: #718096;
    font-weight: 500;
}

.modal-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.empty-state-icon {
    font-size: 64px;
    opacity: 0.3;
}

.empty-state-text {
    font-size: 18px;
    color: #718096;
    font-weight: 500;
}

.empty-state-subtext {
    font-size: 14px;
    color: #a0aec0;
}

/* ============================================
   9. Modal Footer
   ============================================ */
.client-modal-footer {
    padding: 20px 32px;
    background: #f7fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.modal-footer-info {
    font-size: 13px;
    color: #718096;
}

.modal-footer-actions {
    display: flex;
    gap: 12px;
}

.modal-footer-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-footer-btn.btn-secondary {
    background: white;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.modal-footer-btn.btn-secondary:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.modal-footer-btn.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.modal-footer-btn.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

/* ============================================
   10. Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .client-modal-container {
        width: 95%;
        height: 95vh;
    }
    
    .data-cards-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .modal-header-content {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }
    
    .modal-header-avatar {
        width: 60px;
        height: 60px;
    }
    
    .modal-header-title {
        font-size: 22px;
    }
    
    .client-tabs-nav {
        padding: 12px 20px;
    }
    
    .client-modal-body {
        padding: 20px;
    }
    
    .quick-actions-bar {
        padding: 12px 20px;
    }
    
    .client-modal-footer {
        padding: 16px 20px;
        flex-direction: column;
    }
    
    .modal-footer-actions {
        width: 100%;
    }
    
    .modal-footer-btn {
        flex: 1;
    }
}

/* ============================================
   11. Dark Mode Support
   ============================================ */
@media (prefers-color-scheme: dark) {
    .client-modal-container {
        background: #1a202c;
    }
    
    .client-modal-body {
        background: #0f1419;
    }
    
    .data-card {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .data-card-title,
    .data-field-value {
        color: #e2e8f0;
    }
    
    .data-field-label {
        color: #a0aec0;
    }
    
    .client-modal-footer {
        background: #2d3748;
        border-top-color: #4a5568;
    }
}

/* ============================================
   12. Accessibility Enhancements
   ============================================ */
.client-modal-container:focus {
    outline: 3px solid #667eea;
    outline-offset: 4px;
}

.client-tab-btn:focus,
.modal-header-btn:focus,
.quick-action-btn:focus,
.modal-footer-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ============================================
   13. Print Styles
   ============================================ */
@media print {
    .client-modal-backdrop,
    .modal-header-actions,
    .client-tabs-nav,
    .quick-actions-bar,
    .client-modal-footer {
        display: none !important;
    }
    
    .client-modal-container {
        width: 100%;
        height: auto;
        max-height: none;
        box-shadow: none;
        border-radius: 0;
    }
    
    .client-modal-body {
        overflow: visible;
    }
    
    .tab-content {
        display: block !important;
        page-break-after: always;
    }
}
