/* إحصائيات شاملة - تصميم حديث ومتجاوب */

/* الحاوي الرئيسي للإحصائيات */
.statistics-container {
    padding: 20px;
    background: #f8f9fa;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* الإحصائيات الرئيسية */
.main-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.main-stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 25px;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.main-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

.main-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.main-stat-card.total-files {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.main-stat-card.active-files {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.main-stat-card.closed-files {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.main-stat-card.completion-rate {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.main-stat-card .stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    margin-bottom: 15px;
    backdrop-filter: blur(10px);
}

.main-stat-card .stat-icon i {
    font-size: 24px;
    color: white;
}

.main-stat-card .stat-content {
    text-align: center;
}

.main-stat-card .stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.main-stat-card .stat-label {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 500;
}

/* الإحصائيات التفصيلية */
.detailed-stats-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

.section-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 25px;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

.stats-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.stat-category {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.stat-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.category-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-title i {
    color: #667eea;
    font-size: 1.2rem;
}

.category-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    transition: all 0.2s ease;
}

.category-stat-item:hover {
    background: #f1f3f4;
    border-left-color: #764ba2;
}

.stat-key {
    font-weight: 500;
    color: #495057;
}

.stat-value {
    font-weight: bold;
    color: #667eea;
    background: #e8f0fe;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.9rem;
}

/* الإحصائيات الزمنية */
.time-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.time-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.time-stat-item:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.time-stat-label {
    font-weight: 500;
    color: #6c757d;
    font-size: 0.9rem;
}

.time-stat-value {
    font-weight: bold;
    color: #495057;
    background: #e3f2fd;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
}

/* الرسوم البيانية */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.chart-container:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.chart-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #f8f9fa;
}

.chart-container canvas {
    max-height: 300px;
    width: 100% !important;
    height: auto !important;
}

/* مؤشر التحميل */
.statistics-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.preloader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.statistics-preloader p {
    font-size: 1.1rem;
    color: #495057;
    font-weight: 500;
}

/* تصميم متجاوب */
@media (max-width: 768px) {
    .statistics-container {
        padding: 15px;
    }
    
    .main-stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .main-stat-card {
        padding: 20px;
    }
    
    .main-stat-card .stat-number {
        font-size: 2rem;
    }
    
    .detailed-stats-section {
        padding: 20px;
    }
    
    .stats-categories {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .chart-container {
        padding: 20px;
    }
    
    .time-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .main-stat-card .stat-number {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    .chart-title {
        font-size: 1.1rem;
    }
    
    .category-title {
        font-size: 1rem;
    }
}

/* تحسينات إضافية */
.stat-category {
    position: relative;
    overflow: hidden;
}

.stat-category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

/* تأثيرات التحريك */
.main-stat-card,
.stat-category,
.chart-container {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تأخير التحريك للعناصر المختلفة */
.main-stat-card:nth-child(1) { animation-delay: 0.1s; }
.main-stat-card:nth-child(2) { animation-delay: 0.2s; }
.main-stat-card:nth-child(3) { animation-delay: 0.3s; }
.main-stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-category:nth-child(1) { animation-delay: 0.5s; }
.stat-category:nth-child(2) { animation-delay: 0.6s; }
.stat-category:nth-child(3) { animation-delay: 0.7s; }
.stat-category:nth-child(4) { animation-delay: 0.8s; }

.chart-container:nth-child(1) { animation-delay: 0.9s; }
.chart-container:nth-child(2) { animation-delay: 1.0s; }
.chart-container:nth-child(3) { animation-delay: 1.1s; }
.chart-container:nth-child(4) { animation-delay: 1.2s; }