/**
 * Team Portal - Design System v3.0
 * 
 * نظام تصميم موحد لجميع المكونات
 * يضمن اتساق الألوان، الخطوط، المسافات، والحركات
 * 
 * @package TeamPortal
 * @version 3.0.0
 */

/* ============================================
   CSS VARIABLES - المتغيرات العامة
   ============================================ */

:root {
    /* ===== Colors - الألوان ===== */
    
    /* Primary Colors */
    --tp-primary-50: #eff6ff;
    --tp-primary-100: #dbeafe;
    --tp-primary-200: #bfdbfe;
    --tp-primary-300: #93c5fd;
    --tp-primary-400: #60a5fa;
    --tp-primary-500: #3b82f6;
    --tp-primary-600: #2563eb;
    --tp-primary-700: #1d4ed8;
    --tp-primary-800: #1e40af;
    --tp-primary-900: #1e3a8a;
    
    /* Success Colors */
    --tp-success-50: #f0fdf4;
    --tp-success-100: #dcfce7;
    --tp-success-200: #bbf7d0;
    --tp-success-300: #86efac;
    --tp-success-400: #4ade80;
    --tp-success-500: #10b981;
    --tp-success-600: #059669;
    --tp-success-700: #047857;
    --tp-success-800: #065f46;
    --tp-success-900: #064e3b;
    
    /* Warning Colors */
    --tp-warning-50: #fffbeb;
    --tp-warning-100: #fef3c7;
    --tp-warning-200: #fde68a;
    --tp-warning-300: #fcd34d;
    --tp-warning-400: #fbbf24;
    --tp-warning-500: #f59e0b;
    --tp-warning-600: #d97706;
    --tp-warning-700: #b45309;
    --tp-warning-800: #92400e;
    --tp-warning-900: #78350f;
    
    /* Danger Colors */
    --tp-danger-50: #fef2f2;
    --tp-danger-100: #fee2e2;
    --tp-danger-200: #fecaca;
    --tp-danger-300: #fca5a5;
    --tp-danger-400: #f87171;
    --tp-danger-500: #ef4444;
    --tp-danger-600: #dc2626;
    --tp-danger-700: #b91c1c;
    --tp-danger-800: #991b1b;
    --tp-danger-900: #7f1d1d;
    
    /* Info Colors */
    --tp-info-50: #ecfeff;
    --tp-info-100: #cffafe;
    --tp-info-200: #a5f3fc;
    --tp-info-300: #67e8f9;
    --tp-info-400: #22d3ee;
    --tp-info-500: #06b6d4;
    --tp-info-600: #0891b2;
    --tp-info-700: #0e7490;
    --tp-info-800: #155e75;
    --tp-info-900: #164e63;
    
    /* Gray Colors */
    --tp-gray-50: #f9fafb;
    --tp-gray-100: #f3f4f6;
    --tp-gray-200: #e5e7eb;
    --tp-gray-300: #d1d5db;
    --tp-gray-400: #9ca3af;
    --tp-gray-500: #6b7280;
    --tp-gray-600: #4b5563;
    --tp-gray-700: #374151;
    --tp-gray-800: #1f2937;
    --tp-gray-900: #111827;
    
    /* ===== Semantic Colors - الألوان الدلالية ===== */
    --tp-color-primary: var(--tp-primary-500);
    --tp-color-success: var(--tp-success-500);
    --tp-color-warning: var(--tp-warning-500);
    --tp-color-danger: var(--tp-danger-500);
    --tp-color-info: var(--tp-info-500);
    
    /* Background Colors */
    --tp-bg-primary: #ffffff;
    --tp-bg-secondary: var(--tp-gray-50);
    --tp-bg-tertiary: var(--tp-gray-100);
    --tp-bg-overlay: rgba(0, 0, 0, 0.5);
    
    /* Text Colors */
    --tp-text-primary: var(--tp-gray-900);
    --tp-text-secondary: var(--tp-gray-600);
    --tp-text-tertiary: var(--tp-gray-500);
    --tp-text-disabled: var(--tp-gray-400);
    --tp-text-inverse: #ffffff;
    
    /* Border Colors */
    --tp-border-color: var(--tp-gray-200);
    --tp-border-color-hover: var(--tp-gray-300);
    --tp-border-color-focus: var(--tp-primary-500);
    
    /* ===== Typography - الطباعة ===== */
    
    /* Font Families */
    --tp-font-arabic: 'Cairo', 'Tajawal', 'Almarai', sans-serif;
    --tp-font-english: 'Inter', 'Roboto', sans-serif;
    --tp-font-mono: 'Fira Code', 'Courier New', monospace;
    
    /* Font Sizes */
    --tp-text-xs: 0.75rem;      /* 12px */
    --tp-text-sm: 0.875rem;     /* 14px */
    --tp-text-base: 1rem;       /* 16px */
    --tp-text-lg: 1.125rem;     /* 18px */
    --tp-text-xl: 1.25rem;      /* 20px */
    --tp-text-2xl: 1.5rem;      /* 24px */
    --tp-text-3xl: 1.875rem;    /* 30px */
    --tp-text-4xl: 2.25rem;     /* 36px */
    --tp-text-5xl: 3rem;        /* 48px */
    
    /* Font Weights */
    --tp-font-light: 300;
    --tp-font-normal: 400;
    --tp-font-medium: 500;
    --tp-font-semibold: 600;
    --tp-font-bold: 700;
    --tp-font-extrabold: 800;
    
    /* Line Heights */
    --tp-leading-none: 1;
    --tp-leading-tight: 1.25;
    --tp-leading-snug: 1.375;
    --tp-leading-normal: 1.5;
    --tp-leading-relaxed: 1.625;
    --tp-leading-loose: 2;
    
    /* ===== Spacing - المسافات ===== */
    --tp-space-0: 0;
    --tp-space-1: 0.25rem;      /* 4px */
    --tp-space-2: 0.5rem;       /* 8px */
    --tp-space-3: 0.75rem;      /* 12px */
    --tp-space-4: 1rem;         /* 16px */
    --tp-space-5: 1.25rem;      /* 20px */
    --tp-space-6: 1.5rem;       /* 24px */
    --tp-space-8: 2rem;         /* 32px */
    --tp-space-10: 2.5rem;      /* 40px */
    --tp-space-12: 3rem;        /* 48px */
    --tp-space-16: 4rem;        /* 64px */
    --tp-space-20: 5rem;        /* 80px */
    --tp-space-24: 6rem;        /* 96px */
    
    /* ===== Border Radius - الحواف المستديرة ===== */
    --tp-radius-none: 0;
    --tp-radius-sm: 0.25rem;    /* 4px */
    --tp-radius-base: 0.5rem;   /* 8px */
    --tp-radius-md: 0.75rem;    /* 12px */
    --tp-radius-lg: 1rem;       /* 16px */
    --tp-radius-xl: 1.5rem;     /* 24px */
    --tp-radius-2xl: 2rem;      /* 32px */
    --tp-radius-full: 9999px;
    
    /* ===== Shadows - الظلال ===== */
    --tp-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --tp-shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --tp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --tp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --tp-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --tp-shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --tp-shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    
    /* ===== Transitions - الانتقالات ===== */
    --tp-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --tp-transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --tp-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --tp-transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Easing Functions */
    --tp-ease-in: cubic-bezier(0.4, 0, 1, 1);
    --tp-ease-out: cubic-bezier(0, 0, 0.2, 1);
    --tp-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    
    /* ===== Z-Index - ترتيب الطبقات ===== */
    --tp-z-base: 1;
    --tp-z-dropdown: 100;
    --tp-z-sticky: 200;
    --tp-z-fixed: 300;
    --tp-z-modal-backdrop: 400;
    --tp-z-modal: 500;
    --tp-z-popover: 600;
    --tp-z-tooltip: 700;
    --tp-z-notification: 800;
    --tp-z-max: 9999;
}

/* ============================================
   DARK MODE - الوضع الداكن
   ============================================ */

[data-theme="dark"] {
    /* Background Colors */
    --tp-bg-primary: #1f2937;
    --tp-bg-secondary: #111827;
    --tp-bg-tertiary: #0f172a;
    --tp-bg-overlay: rgba(0, 0, 0, 0.75);
    
    /* Text Colors */
    --tp-text-primary: var(--tp-gray-50);
    --tp-text-secondary: var(--tp-gray-300);
    --tp-text-tertiary: var(--tp-gray-400);
    --tp-text-disabled: var(--tp-gray-600);
    --tp-text-inverse: var(--tp-gray-900);
    
    /* Border Colors */
    --tp-border-color: var(--tp-gray-700);
    --tp-border-color-hover: var(--tp-gray-600);
    
    /* Adjust shadows for dark mode */
    --tp-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --tp-shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --tp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --tp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

/* ============================================
   UTILITY CLASSES - فئات الأدوات
   ============================================ */

/* Text Colors */
.tp-text-primary { color: var(--tp-text-primary); }
.tp-text-secondary { color: var(--tp-text-secondary); }
.tp-text-tertiary { color: var(--tp-text-tertiary); }
.tp-text-success { color: var(--tp-success-600); }
.tp-text-warning { color: var(--tp-warning-600); }
.tp-text-danger { color: var(--tp-danger-600); }
.tp-text-info { color: var(--tp-info-600); }

/* Background Colors */
.tp-bg-primary { background-color: var(--tp-bg-primary); }
.tp-bg-secondary { background-color: var(--tp-bg-secondary); }
.tp-bg-success { background-color: var(--tp-success-50); }
.tp-bg-warning { background-color: var(--tp-warning-50); }
.tp-bg-danger { background-color: var(--tp-danger-50); }
.tp-bg-info { background-color: var(--tp-info-50); }

/* Borders */
.tp-border { border: 1px solid var(--tp-border-color); }
.tp-border-t { border-top: 1px solid var(--tp-border-color); }
.tp-border-r { border-right: 1px solid var(--tp-border-color); }
.tp-border-b { border-bottom: 1px solid var(--tp-border-color); }
.tp-border-l { border-left: 1px solid var(--tp-border-color); }

/* Border Radius */
.tp-rounded-none { border-radius: var(--tp-radius-none); }
.tp-rounded-sm { border-radius: var(--tp-radius-sm); }
.tp-rounded { border-radius: var(--tp-radius-base); }
.tp-rounded-md { border-radius: var(--tp-radius-md); }
.tp-rounded-lg { border-radius: var(--tp-radius-lg); }
.tp-rounded-xl { border-radius: var(--tp-radius-xl); }
.tp-rounded-full { border-radius: var(--tp-radius-full); }

/* Shadows */
.tp-shadow-none { box-shadow: none; }
.tp-shadow-sm { box-shadow: var(--tp-shadow-sm); }
.tp-shadow { box-shadow: var(--tp-shadow-base); }
.tp-shadow-md { box-shadow: var(--tp-shadow-md); }
.tp-shadow-lg { box-shadow: var(--tp-shadow-lg); }
.tp-shadow-xl { box-shadow: var(--tp-shadow-xl); }

/* Transitions */
.tp-transition { transition: all var(--tp-transition-base); }
.tp-transition-fast { transition: all var(--tp-transition-fast); }
.tp-transition-slow { transition: all var(--tp-transition-slow); }

/* ============================================
   COMPONENT STYLES - أنماط المكونات
   ============================================ */

/* Buttons */
.tp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--tp-space-2);
    padding: var(--tp-space-3) var(--tp-space-6);
    font-size: var(--tp-text-base);
    font-weight: var(--tp-font-medium);
    line-height: var(--tp-leading-tight);
    border-radius: var(--tp-radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--tp-transition-base);
    text-decoration: none;
    white-space: nowrap;
}

.tp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tp-btn-primary {
    background: linear-gradient(135deg, var(--tp-primary-500), var(--tp-primary-600));
    color: white;
    box-shadow: var(--tp-shadow-sm);
}

.tp-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--tp-primary-600), var(--tp-primary-700));
    box-shadow: var(--tp-shadow-md);
    transform: translateY(-1px);
}

.tp-btn-success {
    background: linear-gradient(135deg, var(--tp-success-500), var(--tp-success-600));
    color: white;
}

.tp-btn-danger {
    background: linear-gradient(135deg, var(--tp-danger-500), var(--tp-danger-600));
    color: white;
}

.tp-btn-outline {
    background: transparent;
    border-color: var(--tp-border-color);
    color: var(--tp-text-primary);
}

.tp-btn-outline:hover:not(:disabled) {
    background: var(--tp-bg-secondary);
    border-color: var(--tp-border-color-hover);
}

/* Cards */
.tp-card {
    background: var(--tp-bg-primary);
    border: 1px solid var(--tp-border-color);
    border-radius: var(--tp-radius-lg);
    padding: var(--tp-space-6);
    box-shadow: var(--tp-shadow-sm);
    transition: all var(--tp-transition-base);
}

.tp-card:hover {
    box-shadow: var(--tp-shadow-md);
    transform: translateY(-2px);
}

.tp-card-header {
    margin-bottom: var(--tp-space-4);
    padding-bottom: var(--tp-space-4);
    border-bottom: 1px solid var(--tp-border-color);
}

.tp-card-title {
    font-size: var(--tp-text-xl);
    font-weight: var(--tp-font-semibold);
    color: var(--tp-text-primary);
    margin: 0;
}

.tp-card-body {
    color: var(--tp-text-secondary);
}

/* Badges */
.tp-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--tp-space-1);
    padding: var(--tp-space-1) var(--tp-space-3);
    font-size: var(--tp-text-sm);
    font-weight: var(--tp-font-medium);
    border-radius: var(--tp-radius-full);
    white-space: nowrap;
}

.tp-badge-primary {
    background: var(--tp-primary-100);
    color: var(--tp-primary-700);
}

.tp-badge-success {
    background: var(--tp-success-100);
    color: var(--tp-success-700);
}

.tp-badge-warning {
    background: var(--tp-warning-100);
    color: var(--tp-warning-700);
}

.tp-badge-danger {
    background: var(--tp-danger-100);
    color: var(--tp-danger-700);
}

/* Loading States */
.tp-skeleton {
    background: linear-gradient(
        90deg,
        var(--tp-gray-200) 25%,
        var(--tp-gray-100) 50%,
        var(--tp-gray-200) 75%
    );
    background-size: 200% 100%;
    animation: tp-skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--tp-radius-base);
}

@keyframes tp-skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Animations */
@keyframes tp-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes tp-slide-in-right {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes tp-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.tp-animate-fade-in {
    animation: tp-fade-in var(--tp-transition-base);
}

.tp-animate-slide-in {
    animation: tp-slide-in-right var(--tp-transition-slow);
}

.tp-animate-pulse {
    animation: tp-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
