/* =====================================================
   KPI Cards Styling
   ===================================================== */

/* تنسيق عام للبطاقات */
.kpi-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.kpi-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* تنسيق الأيقونات */
.kpi-card-icon {
    opacity: 0.9;
    transition: all 0.3s ease;
}

.kpi-card:hover .kpi-card-icon {
    opacity: 1;
    transform: scale(1.1);
}

/* تنسيق نسبة التغيير */
.change-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.change-indicator.positive {
    background-color: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

.change-indicator.negative {
    background-color: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

/* تنسيق الـ Loading Skeleton */
.kpi-skeleton {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* تنسيق الـ Dashboard Container */
.dashboard-container {
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

/* تنسيق الفلاتر */
.filters-panel {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* تنسيق الرسوم البيانية */
.chart-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* تنسيق التنبيهات */
.alerts-widget {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.alert-item {
    padding: 12px;
    border-right: 4px solid #ff9800;
    margin-bottom: 10px;
    background: rgba(255, 152, 0, 0.05);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.alert-item:hover {
    background: rgba(255, 152, 0, 0.1);
    transform: translateX(-5px);
}

/* تنسيق التوصيات */
.recommendations-widget {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.recommendation-item {
    padding: 12px;
    border-right: 4px solid #2196f3;
    margin-bottom: 10px;
    background: rgba(33, 150, 243, 0.05);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.recommendation-item:hover {
    background: rgba(33, 150, 243, 0.1);
    transform: translateX(-5px);
}

/* تنسيق What-If Scenarios */
.scenario-widget {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* RTL Support */
[dir="rtl"] .alert-item {
    border-right: none;
    border-left: 4px solid #ff9800;
}

[dir="rtl"] .recommendation-item {
    border-right: none;
    border-left: 4px solid #2196f3;
}

[dir="rtl"] .alert-item:hover,
[dir="rtl"] .recommendation-item:hover {
    transform: translateX(5px);
}

/* Responsive Design */
@media (max-width: 960px) {
    .kpi-card {
        margin-bottom: 15px;
    }
    
    .dashboard-container {
        padding: 10px;
    }
}

/* Print Styles */
@media print {
    .filters-panel,
    .mud-button,
    .mud-icon-button {
        display: none;
    }
    
    .kpi-card {
        break-inside: avoid;
    }
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
    .dashboard-container {
        background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
    }
    
    .filters-panel,
    .chart-container,
    .alerts-widget,
    .recommendations-widget,
    .scenario-widget {
        background: #2c2c2c;
        color: #e0e0e0;
    }
}

/* 🔹 خلفية المكون */
.modern-section {
    background: linear-gradient(180deg, #f9fafb 0%, #ffffff 100%);
    border-radius: 16px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.05);
}

/* 🔸 الرسم البياني */
.chart-container {
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

    .chart-container:hover {
        transform: scale(1.02);
    }

/* 🔸 بطاقات الإحصائيات */
.stat-card {
    position: relative;
    border-radius: 14px;
    padding: 20px;
    color: #fff;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .stat-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
    }

/* ألوان متدرجة حسب نوع البطاقة */
.blue-card {
    background: linear-gradient(135deg, #1976d2 0%, #64b5f6 100%);
}

.green-card {
    background: linear-gradient(135deg, #2e7d32 0%, #81c784 100%);
}

.orange-card {
    background: linear-gradient(135deg, #f57c00 0%, #ffb74d 100%);
}

/* نصوص البطاقة */
.stat-label {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    font-size: 1.4rem;
}

/* أيقونة البطاقة */
.stat-icon {
    position: absolute;
    bottom: 10px;
    right: 14px;
    opacity: 0.2;
    font-size: 48px;
}


/* ============================================
   🌙 الوضع الداكن (Dark Mode for ERP Dashboard)
   ============================================ */

body.dark-mode {
    background-color: #0f1115 !important;
    color: #e4e7eb !important;
}

    /* 🪄 المكون الرئيسي */
    body.dark-mode .modern-section {
        background: linear-gradient(180deg, #16181d 0%, #1d1f25 100%) !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6) !important;
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    /* 📊 الرسم البياني */
    body.dark-mode .chart-container {
        background: linear-gradient(180deg, #1a1c22 0%, #1e2128 100%);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
        border: 1px solid rgba(255, 255, 255, 0.06);
    }

        body.dark-mode .chart-container:hover {
            transform: scale(1.02);
            box-shadow: 0 3px 20px rgba(255, 255, 255, 0.05);
        }

    /* 💎 بطاقات الإحصائيات */
    body.dark-mode .stat-card {
        border: 1px solid rgba(255, 255, 255, 0.07);
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
        color: #fff;
    }

    /* ألوان البطاقات في الوضع الداكن */
    body.dark-mode .blue-card {
        background: linear-gradient(135deg, #1565c0 0%, #42a5f5 100%) !important;
    }

    body.dark-mode .green-card {
        background: linear-gradient(135deg, #1b5e20 0%, #66bb6a 100%) !important;
    }

    body.dark-mode .orange-card {
        background: linear-gradient(135deg, #e65100 0%, #ffb74d 100%) !important;
    }

    /* النصوص */
    body.dark-mode .stat-label {
        color: rgba(255, 255, 255, 0.8) !important;
    }

    body.dark-mode .stat-value {
        color: #ffffff !important;
    }

    /* أيقونات البطاقات */
    body.dark-mode .stat-icon {
        opacity: 0.15 !important;
    }

    /* العنوان والنصوص العامة */
    body.dark-mode .mud-typography-h6,
    body.dark-mode .mud-text {
        color: #e8eaed !important;
    }

    /* الأيقونات والأزرار */
    body.dark-mode .mud-icon-button {
        color: #90caf9 !important;
    }

        body.dark-mode .mud-icon-button:hover {
            background-color: rgba(144, 202, 249, 0.15) !important;
        }

    /* التنبيهات */
    body.dark-mode .mud-alert {
        background-color: #20222a !important;
        color: #f1f3f5 !important;
        border-left: 4px solid #42a5f5 !important;
    }

    /* ظل أنيق عند المرور */
    body.dark-mode .stat-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 25px rgba(255, 255, 255, 0.1);
    }

