/* Student Statistics Block Main Styles */
/* Fully responsive for mobile and desktop */

/* Base styling */
.block_student_statistics {
    font-family: 'Tajawal', 'Cairo', Arial, sans-serif;
    color: #333;
}

/* Main container */
.student-stat-container {
    background-color: #f8f9fc;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    padding: 15px;
    margin: 0;
}

/* Header with user info */
.stat-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.stat-avatar {
    margin-left: 15px;
}

.stat-avatar img {
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.stat-user-info {
    flex: 1;
    min-width: 150px;
}

.stat-user-info h3 {
    margin: 0 0 5px;
    font-size: 18px;
    font-weight: 600;
    color: #4e73df;
}

.stat-role {
    color: #4e73df;
    margin: 5px 0;
    font-size: 14px;
    font-weight: 500;
}

.stat-last-active {
    color: #858796;
    font-size: 12px;
    margin: 5px 0 0;
}

/* Summary cards section */
.stat-summary-cards {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
    gap: 10px;
}

.stat-card {
    flex: 1 1 calc(33.33% - 20px);
    min-width: 100px;
    margin: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    padding: 15px;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover, .stat-card:focus {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    cursor: pointer;
}

.stat-card-icon {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: 15px;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.course-icon {
    background: linear-gradient(135deg, #4e73df 0%, #3a58c7 100%);
}

.activity-icon {
    background: linear-gradient(135deg, #1cc88a 0%, #13a673 100%);
}

.quiz-icon {
    background: linear-gradient(135deg, #f6c23e 0%, #e5a11d 100%);
}

.stat-card-info {
    flex-grow: 1;
}

.stat-card-value {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #5a5c69;
    line-height: 1.2;
}

.stat-card-label {
    font-size: 13px;
    color: #858796;
}

/* Progress section */
.stat-progress-section {
    margin: 25px 0;
}

.stat-progress-section h4 {
    margin: 0 0 10px;
    font-size: 16px;
    color: #5a5c69;
    font-weight: 600;
}

.stat-progress-container {
    height: 8px;
    background-color: #eaecf4;
    border-radius: 5px;
    overflow: hidden;
}

.stat-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1cc88a, #36b9cc);
    border-radius: 5px;
}

.stat-progress-details {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: #858796;
}

.stat-completed {
    color: #1cc88a;
}

.stat-total {
    color: #858796;
}

/* Course section */
.stat-course-section {
    margin: 25px 0;
}

.stat-course-section h4 {
    margin: 0 0 15px;
    font-size: 16px;
    color: #5a5c69;
    font-weight: 600;
}

.stat-course-item {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.stat-course-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.stat-course-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.stat-course-title {
    font-weight: 600;
    color: #4e73df;
    text-decoration: none;
    font-size: 14px;
}

.stat-course-title:hover {
    text-decoration: underline;
}

.stat-course-percent {
    font-weight: 600;
    color: #5a5c69;
}

.stat-course-progress-container {
    height: 6px;
    background-color: #eaecf4;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.stat-course-progress {
    height: 100%;
    background: linear-gradient(90deg, #1cc88a, #36b9cc);
    border-radius: 3px;
}

.stat-course-details {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #858796;
    flex-wrap: wrap;
    gap: 5px;
}

.stat-course-details span {
    flex: 1;
    min-width: 120px;
}

/* View Report Button */
.stat-view-report {
    text-align: center;
    margin: 20px 0 10px;
}

.stat-btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.5;
    border-radius: 6px;
    transition: all 0.2s;
    color: #fff;
    background-color: #4e73df;
    text-decoration: none;
}

.stat-btn:hover, .stat-btn:focus {
    background-color: #2e59d9;
    text-decoration: none;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 3px 8px rgba(46, 89, 217, 0.2);
}

/* Footer */
.stat-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eaecf4;
    text-align: center;
    font-size: 12px;
    color: #858796;
}

/* RTL Support */
[dir="rtl"] .stat-avatar {
    margin-right: 15px;
    margin-left: 0;
}

[dir="rtl"] .stat-card-icon {
    margin-right: 15px;
    margin-left: 0;
}

/* Responsive design for mobile devices */
@media (max-width: 768px) {
    .stat-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .stat-avatar {
        margin: 0 0 10px 0;
    }
    
    .stat-user-info {
        text-align: center;
    }
    
    .stat-summary-cards {
        flex-direction: column;
        margin: 0;
    }
    
    .stat-card {
        flex: 1 1 100%;
        margin: 5px 0;
        min-width: 0;
    }
    
    .stat-course-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stat-course-percent {
        margin-top: 5px;
    }
    
    .stat-course-details {
        flex-direction: column;
    }
    
    .stat-course-details span {
        margin-bottom: 5px;
    }
    
    .stat-btn {
        width: 100%;
        padding: 10px;
        font-size: 16px;
    }
}

@media (max-width: 576px) {
    .student-stat-container {
        padding: 10px;
        border-radius: 5px;
    }
    
    .stat-user-info h3 {
        font-size: 16px;
    }
    
    .stat-role {
        font-size: 12px;
    }
    
    .stat-card {
        padding: 10px;
    }
    
    .stat-card-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .stat-card-value {
        font-size: 18px;
    }
    
    .stat-card-label {
        font-size: 12px;
    }
    
    .stat-progress-section h4,
    .stat-course-section h4 {
        font-size: 14px;
    }
    
    .stat-course-item {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .stat-course-title {
        font-size: 13px;
    }
    
    .stat-progress-details,
    .stat-course-details {
        font-size: 11px;
    }
    
    /* Touch-optimized spacing */
    .stat-view-report {
        margin: 15px 0;
    }
    
    .stat-btn {
        padding: 12px 10px;
    }
    
    /* Ensure proper spacing when items stack */
    [dir="rtl"] .stat-avatar,
    [dir="rtl"] .stat-card-icon {
        margin: 0 0 10px 0;
    }
}

/* Special handling for very small screens */
@media (max-width: 350px) {
    .stat-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 12px 5px;
    }
    
    .stat-card-icon {
        margin: 0 0 10px 0;
    }
    
    .stat-card-info {
        text-align: center;
    }
    
    .stat-progress-details {
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }
    
    .stat-completed {
        margin-bottom: 3px;
    }
    
    /* Fix RTL spacing */
    [dir="rtl"] .stat-card-icon {
        margin: 0 0 10px 0;
    }
}

/* Loading Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.student-stat-container {
    animation: fadeInUp 0.4s ease-out forwards;
}

.stat-card:nth-child(1) { animation: fadeInUp 0.4s 0.1s both; }
.stat-card:nth-child(2) { animation: fadeInUp 0.4s 0.2s both; }
.stat-card:nth-child(3) { animation: fadeInUp 0.4s 0.3s both; }

/* Improve touch targets on mobile */
@media (max-width: 768px) {
    .stat-card,
    .stat-btn,
    .stat-course-title {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    .stat-card:active,
    .stat-btn:active,
    .stat-course-title:active {
        opacity: 0.8;
    }
}

/* Print optimization */
@media print {
    .student-stat-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .stat-card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .stat-btn {
        display: none;
    }
}