/* ملف التنسيقات الرئيسي لنظام الإدارة المالية */

/* إعدادات عامة للنص العربي */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    text-align: right;
    background-color: #f8f9fa;
}

/* الحاوي الرئيسي */
.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* الشريط العلوي */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: bold;
    color: white !important;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 500;
    margin: 0 5px;
    padding: 8px 15px !important;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white !important;
}

.navbar-nav .nav-link.active {
    background-color: rgba(255,255,255,0.2);
    color: white !important;
}

/* الشريط الجانبي */
.sidebar {
    background: white;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    min-height: calc(100vh - 76px);
    padding: 20px 0;
}

.sidebar-link {
    color: #333;
    text-decoration: none;
    padding: 12px 20px;
    display: block;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.sidebar-link:hover {
    background-color: #f8f9fa;
    border-left-color: #667eea;
    color: #667eea;
    text-decoration: none;
}

.sidebar-link.active {
    background-color: #e3f2fd;
    border-left-color: #2196f3;
    color: #2196f3;
}

.sidebar-link i {
    margin-left: 10px;
    width: 20px;
    text-align: center;
}

/* البطاقات */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0 !important;
    font-weight: bold;
}

/* الأزرار */
.btn {
    border-radius: 25px;
    font-weight: 500;
    padding: 10px 20px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border: none;
}

.btn-danger {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    border: none;
}

.btn-warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    border: none;
}

.btn-info {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    border: none;
}

/* الجداول */
.table {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table thead th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* النماذج */
.form-control {
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    padding: 12px 15px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

/* المودال */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-title {
    font-weight: bold;
}

/* إحصائيات لوحة التحكم */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: scale(1.05);
}

.stat-card h3 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 1.1rem;
    margin: 0;
}

/* الرسائل والتنبيهات */
.alert {
    border-radius: 10px;
    border: none;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.alert-danger {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
}

/* صفحة تسجيل الدخول */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 100%;
}

.login-title {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-weight: bold;
}

/* التحميل */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner-border {
    color: #667eea;
}

/* الاستجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 76px;
        right: -100%;
        width: 250px;
        height: calc(100vh - 76px);
        z-index: 1000;
        transition: right 0.3s ease;
    }
    
    .sidebar.show {
        right: 0;
    }
    
    .content {
        margin-right: 0 !important;
    }
    
    .stat-card h3 {
        font-size: 2rem;
    }
}

/* تحسينات إضافية */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.border-gradient {
    border: 2px solid;
    border-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%) 1;
}

/* الأفاتارات */
.avatar-sm {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* تحسينات إضافية للجداول */
.transaction-description {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-description:hover {
    white-space: normal;
    overflow: visible;
}

/* تحسينات للشاشات الصغيرة */
@media (max-width: 576px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-card h3 {
        font-size: 1.5rem;
    }
}

/* تحسين الطباعة */
@media print {
    .sidebar, .navbar, .btn {
        display: none !important;
    }
    
    .content {
        margin: 0 !important;
    }
}

/* تصميم قفل الأشهر */
.month-locks-grid {
    max-height: 400px;
    overflow-y: auto;
}

.year-section {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.months-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.month-lock-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 12px 8px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.month-lock-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.month-lock-btn.locked {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-color: #bd2130;
    color: white;
}

.month-lock-btn.unlocked {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    border-color: #1e7e34;
    color: white;
}

.month-lock-btn .month-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
}

.month-lock-btn .lock-icon {
    font-size: 18px;
    opacity: 0.9;
}

.month-lock-btn.locked:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.month-lock-btn.unlocked:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

/* تحسين الطباعة */
@media print {
    body {
        font-family: 'Arial', sans-serif;
        font-size: 18px;
        line-height: 1.4;
        color: #000;
    }
    
    .sidebar, .navbar, .btn, .modal, .alert {
        display: none !important;
    }
    
    .main-container {
        margin: 0;
        padding: 0;
    }
    
    .content {
        margin: 0 !important;
        padding: 20px !important;
        width: 100% !important;
        max-width: none !important;
    }
    
    .card {
        border: 1px solid #000;
        box-shadow: none;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }
    
    .card-header {
        background-color: #f8f9fa !important;
        border-bottom: 1px solid #000;
        padding: 10px;
        font-weight: bold;
    }
    
    .table {
        border: 1px solid #000;
        font-size: 16px;
    }
    
    .table th, .table td {
        border: 1px solid #000;
        padding: 8px;
        vertical-align: middle;
    }
    
    .table th {
        background-color: #f8f9fa !important;
        font-weight: bold;
    }
    
    .badge {
        border: 1px solid #000;
        color: #000 !important;
        background-color: transparent !important;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        font-weight: bold;
        margin-bottom: 10px;
    }
    
    .page-break {
        page-break-before: always;
    }
    
    .no-print {
        display: none !important;
    }
}
