/* ============================================
   نظام إدارة الجداول المدرسية - التنسيقات
   ============================================ */

/* الخطوط الأساسية */
body {
    font-family: 'Cairo', sans-serif;
    background-color: #f4f6f9;
    direction: rtl;
}

/* ============================================
   القائمة الجانبية (Sidebar)
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 100;
    padding: 0;
    background: linear-gradient(180deg, #0d6efd 0%, #0a58ca 100%);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    width: 250px;
}

.sidebar .sidebar-header {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar .sidebar-header h5 {
    color: #fff;
    font-weight: 700;
    margin: 0;
}

.sidebar .sidebar-header small {
    color: rgba(255,255,255,0.7);
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 20px;
    transition: all 0.3s;
    border-radius: 0;
    font-weight: 400;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar .nav-link.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-weight: 600;
    border-right: 4px solid #fff;
}

.sidebar .nav-link i {
    margin-left: 10px;
    width: 20px;
    text-align: center;
}

.sidebar .nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 20px;
}

/* ============================================
   المحتوى الرئيسي
   ============================================ */
main {
    padding-top: 20px;
    margin-right: 250px;
}

/* ============================================
   البطاقات الإحصائية
   ============================================ */
.stat-card {
    padding: 25px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    cursor: default;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.9;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
}

.stat-card .stat-content h3 {
    margin: 0;
    font-weight: 700;
    font-size: 1.8rem;
}

.stat-card .stat-content p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

/* ============================================
   الجداول
   ============================================ */
.table {
    font-size: 0.9rem;
}

.table thead {
    background-color: #f8f9fa;
}

.table thead th {
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding: 12px 8px;
}

.table tbody td {
    padding: 10px 8px;
    vertical-align: middle;
}

/* ============================================
   بطاقات المراحل
   ============================================ */
.stage-card {
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stage-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.stage-card .stage-stats .stat-item {
    padding: 5px;
}

.stage-card .stage-stats .stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0d6efd;
}

.stage-card .stage-stats .stat-label {
    font-size: 0.8rem;
    color: #6c757d;
}

/* ============================================
   جداول الحصص
   ============================================ */
.schedule-cell {
    padding: 8px 5px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.schedule-cell strong {
    display: block;
    color: #0d6efd;
    font-weight: 700;
}

.schedule-cell small {
    font-size: 0.75rem;
    color: #6c757d;
}

/* ============================================
   النماذج
   ============================================ */
.form-label {
    font-weight: 600;
    color: #495057;
}

.form-control:focus, .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* ============================================
   الأزرار
   ============================================ */
.btn {
    font-weight: 500;
    padding: 8px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.btn-primary {
    background: #0d6efd;
    border: none;
}

.btn-primary:hover {
    background: #0a58ca;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
}

/* ============================================
   التنبيهات (Alerts)
   ============================================ */
.alert {
    border: none;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* ============================================
   الشارات (Badges)
   ============================================ */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 500;
}

/* ============================================
   الوسائط المتجاوبة (Responsive)
   ============================================ */
@media (max-width: 767.98px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    main {
        margin-right: 0;
        padding: 15px;
    }
    
    .stat-card {
        padding: 15px;
        gap: 10px;
    }
    
    .stat-card .stat-icon {
        font-size: 1.8rem;
        width: 45px;
        height: 45px;
    }
    
    .stat-card .stat-content h3 {
        font-size: 1.3rem;
    }
}

@media (max-width: 575.98px) {
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 6px 4px;
    }
    
    .schedule-cell {
        font-size: 0.7rem;
        padding: 4px 3px;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* ============================================
   الطباعة
   ============================================ */
@media print {
    .sidebar,
    .btn,
    .navbar,
    .no-print {
        display: none !important;
    }
    
    main {
        margin-right: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
    
    .table {
        font-size: 0.8rem !important;
    }
    
    .table thead th {
        background: #f8f9fa !important;
    }
}

/* ============================================
   تحميل (Loading Spinner)
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   أدوات مساعدة إضافية
   ============================================ */
.text-rtl {
    direction: rtl;
}

.text-ltr {
    direction: ltr;
}

.cursor-pointer {
    cursor: pointer;
}

.shadow-hover:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.1) !important;
}

.transition-all {
    transition: all 0.3s ease;
}