/* ═══════════════════════════════════════════════════════════════
   Modern UI/UX للنظام بالكامل
   النسخة: 2.0.0
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   المتغيرات العامة
   ═══════════════════════════════════════════════════════════════ */
:root {
    /* التدرجات اللونية */
    --gradient-blue: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-green: linear-gradient(135deg, #0cebeb 0%, #20e3b2 100%);
    --gradient-orange: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-purple: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-gold: linear-gradient(135deg, #fad961 0%, #f76b1c 100%);
    
    /* الظلال المتقدمة */
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.4);
    --shadow-float: 0 5px 15px rgba(0, 0, 0, 0.2);
    
    /* الانتقالات */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* الحواف المنحنية */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات عامة
   ═══════════════════════════════════════════════════════════════ */

/* تحسين التمرير */
* {
    scrollbar-width: thin;
    scrollbar-color: #4b5563 #1f2937;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: #1f2937;
    border-radius: 10px;
}

*::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 10px;
    transition: background var(--transition-fast);
}

*::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* تحسين الأزرار */
button, .btn {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

button:hover, .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-float);
}

button:active, .btn:active {
    transform: translateY(0);
}

/* تأثير الموجة عند الضغط */
button::after, .btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::after, .btn:active::after {
    width: 300px;
    height: 300px;
}

/* تحسين البطاقات */
.card, .bg-gray-800 {
    transition: all var(--transition-normal);
    border-radius: var(--radius-lg);
}

.card:hover, .bg-gray-800:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات الجداول
   ═══════════════════════════════════════════════════════════════ */

table {
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

thead {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}

thead th {
    padding: 16px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

tbody tr {
    transition: all var(--transition-fast);
    border-bottom: 1px solid #374151;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(59, 130, 246, 0.1);
    transform: scale(1.01);
}

tbody td {
    padding: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات النماذج
   ═══════════════════════════════════════════════════════════════ */

input, select, textarea {
    transition: all var(--transition-normal);
    border-radius: var(--radius-md);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

/* تأثير Label العائم */
.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: #374151;
    border: 2px solid #4b5563;
    color: white;
}

.input-group label {
    position: absolute;
    right: 16px;
    top: 12px;
    color: #9ca3af;
    transition: all var(--transition-fast);
    pointer-events: none;
    background: #374151;
    padding: 0 4px;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label,
.input-group select:focus + label,
.input-group select:not([value=""]) + label,
.input-group textarea:focus + label,
.input-group textarea:not(:placeholder-shown) + label {
    top: -10px;
    font-size: 0.75rem;
    color: #3b82f6;
    right: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات البطاقات الإحصائية
   ═══════════════════════════════════════════════════════════════ */

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.05) 100%);
    transition: opacity var(--transition-normal);
    opacity: 0;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: all var(--transition-normal);
}

.stat-card:hover .stat-card-icon {
    transform: rotate(10deg) scale(1.1);
}

/* ═══════════════════════════════════════════════════════════════
   شارات الحالة (Badges)
   ═══════════════════════════════════════════════════════════════ */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all var(--transition-fast);
}

.status-badge:hover {
    transform: scale(1.05);
}

.status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.status-paid, .status-completed {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-paid::before, .status-completed::before {
    background: #10b981;
}

.status-pending, .status-in-progress {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.status-pending::before, .status-in-progress::before {
    background: #f59e0b;
}

.status-overdue, .status-cancelled {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-overdue::before, .status-cancelled::before {
    background: #ef4444;
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات النوافذ المنبثقة (Modals)
   ═══════════════════════════════════════════════════════════════ */

.modal-backdrop {
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    animation: slideUp 0.4s ease;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات القائمة الجانبية
   ═══════════════════════════════════════════════════════════════ */

#sidebar-nav a {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    border-right: 3px solid transparent;
}

#sidebar-nav a::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--gradient-blue);
    transform: scaleY(0);
    transition: transform var(--transition-normal);
}

#sidebar-nav a:hover::before {
    transform: scaleY(1);
}

#sidebar-nav a.active {
    background: rgba(59, 130, 246, 0.2);
    border-right-color: #3b82f6;
}

/* ═══════════════════════════════════════════════════════════════
   تأثيرات الحركة (Animations)
   ═══════════════════════════════════════════════════════════════ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* تأثير التحميل */
.loading-shimmer {
    background: linear-gradient(90deg, #1f2937 0%, #374151 50%, #1f2937 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* تأثير الظهور التدريجي */
.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-in-right {
    animation: slideInRight 0.5s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات بطاقات العملاء
   ═══════════════════════════════════════════════════════════════ */

.client-card {
    position: relative;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border: 1px solid #374151;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--transition-normal);
}

.client-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.client-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    margin-bottom: 1rem;
    transition: all var(--transition-normal);
}

.client-card:hover .client-avatar {
    transform: scale(1.1) rotate(5deg);
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات بطاقات المشاريع
   ═══════════════════════════════════════════════════════════════ */

.project-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: #1f2937;
    transition: all var(--transition-normal);
}

.project-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-blue);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transition-normal);
}

.project-card:hover::after {
    transform: scaleX(1);
}

.project-progress {
    position: relative;
    height: 8px;
    background: #374151;
    border-radius: 10px;
    overflow: hidden;
}

.project-progress-bar {
    height: 100%;
    background: var(--gradient-green);
    border-radius: 10px;
    transition: width 1s ease;
    position: relative;
    overflow: hidden;
}

.project-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات الفواتير
   ═══════════════════════════════════════════════════════════════ */

.invoice-card {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-radius: var(--radius-lg);
    border: 1px solid #374151;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.invoice-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-gold);
    transform: scaleY(0);
    transition: transform var(--transition-normal);
}

.invoice-card:hover::before {
    transform: scaleY(1);
}

.invoice-amount {
    font-size: 2rem;
    font-weight: bold;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات الأزرار المخصصة
   ═══════════════════════════════════════════════════════════════ */

.btn-gradient {
    background: var(--gradient-blue);
    border: none;
    color: white;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.btn-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    transition: left 0.5s ease;
}

.btn-gradient:hover::before {
    left: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات الإشعارات
   ═══════════════════════════════════════════════════════════════ */

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    background: #ef4444;
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    animation: bounce 2s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════
   Responsive Design
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .stat-card, .client-card, .project-card, .invoice-card {
        margin-bottom: 1rem;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    thead th, tbody td {
        padding: 12px 8px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Dark Mode Specific Enhancements
   ═══════════════════════════════════════════════════════════════ */

[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="dark"] .card,
[data-theme="dark"] .bg-gray-800 {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* ═══════════════════════════════════════════════════════════════
   Light Mode Specific Enhancements
   ═══════════════════════════════════════════════════════════════ */

[data-theme="light"] {
    color-scheme: light;
}

[data-theme="light"] .card,
[data-theme="light"] .bg-gray-800 {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

/* ═══════════════════════════════════════════════════════════════
   تحسينات الطباعة
   ═══════════════════════════════════════════════════════════════ */

@media print {
    .no-print,
    button,
    .btn {
        display: none !important;
    }
    
    .card, .bg-gray-800 {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    * {
        color: #000 !important;
        background: #fff !important;
    }
}

