﻿/* ===============================
   الأساسيات
================================= */
:root {
    --primary-color: #4facfe;
    --secondary-color: #00f2fe;
    --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --font-main: 'Cairo', 'Tajawal', sans-serif;
    --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html, .navbar, .dropdown-menu, .btn,
.form-control, .form-select, .nav-link, .dropdown-item {
    font-family: var(--font-main) !important;
}

body {
    background-color: #f8f9fa;
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 16px; /* حجم خط ثابت وواضح */
    line-height: 1.7;
    color: #212529;
}


/* العناوين */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.4;
    color: #2c3e50;
    margin-bottom: 1rem;
}

/* 
   ✅ الخطوة 1: نستهدف العنوان الرئيسي الذي يقع داخل form-container فقط.
   هذا يمنع تطبيق الخط على أي h1 آخر في الصفحة (مثل الموجود في الهيدر أو الـ Layout).
*/
.form-container > h1:not(:empty) {
    font-size: 2.2rem;
    border-right: 4px solid var(--primary-color);
    padding-right: 15px;
}

/* 
   ✅ الخطوة 2: تنسيق خاص ونظيف للعنوان الموجود داخل الهيدر الملون.
   هذا يضمن عدم ظهور أي خط أزرق له على الإطلاق.
*/
.header-section h1 {
    font-size: 2.5rem;
    border: none; /* نضمن عدم وجود أي حدود */
    padding: 0; /* نلغي أي حواشي داخلية */
    margin: 0;
    color: white; /* لونه أبيض ليتناسب مع الخلفية */
}

h2 {
    font-size: 1.9rem;
}

h3 {
    font-size: 1.6rem;
}

/* ===============================
   تنسيق النماذج
================================= */
.main-container {
    max-width: 1300px;
    margin: 20px auto;
    background: white;
    border-radius: 20px;
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.header-section {
    background: var(--gradient-primary);
    color: white;
    padding: 30px;
    text-align: center;
}

    .header-section h1 {
        margin: 0;
        font-weight: 700;
        font-size: 2.5rem;
    }

.form-container {
    padding: 40px;
}

.form-group-horizontal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

    .form-group-horizontal .form-group {
        flex: 1 1 calc(25% - 15px);
        min-width: 200px;
    }

/* إدخالات */
.form-control, .form-select {
    font-size: 1rem;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #ced4da;
}

label {
    font-weight: 600;
    margin-bottom: 5px;
}

/* ===============================
   شريط التنقل
================================= */
.navbar {
    background: var(--gradient-primary) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1rem;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: white !important;
}

.navbar-nav .nav-link {
    color: white !important;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    border-radius: 5px;
}

    .navbar-nav .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.2);
    }

/* ===============================
   القوائم المنسدلة
================================= */
.dropdown-menu {
    background-color: white;
    border: none;
    box-shadow: var(--box-shadow);
    border-radius: 10px;
    padding: 0.5rem 0;
    right: 0 !important;
    left: auto !important;
}

.dropdown-item {
    color: #333 !important;
    font-weight: 500;
    font-size: 1rem;
    padding: 0.5rem 1.5rem;
    transition: all 0.3s ease;
}

    .dropdown-item:hover {
        background: var(--gradient-primary) !important;
        color: white !important;
    }

/* ===============================
   الأزرار
================================= */
.btn {
    border-radius: 10px;
    padding: 10px 25px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: none;
    box-shadow: var(--box-shadow);
}

/* الأساسي */
.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
    }

/* نجاح */
.btn-success {
    background: var(--success-color);
    color: #fff;
}

    .btn-success:hover {
        opacity: 0.9;
    }

/* معلومات */
.btn-info {
    background: var(--info-color);
    color: #fff;
}

    .btn-info:hover {
        opacity: 0.9;
    }

/* تحذير */
.btn-warning {
    background: var(--warning-color);
    color: #212529;
}

    .btn-warning:hover {
        opacity: 0.9;
    }

/* خطير */
.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

    .btn-danger:hover {
        opacity: 0.9;
    }

/* ===============================
   الجدول
================================= */
.af-table-responsive {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.af-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

    .af-table th {
        background-color: #4facfe;
        color: white;
        padding: 12px 15px;
        text-align: right;
        font-weight: 600;
    }

    .af-table td {
        padding: 10px 15px;
        border-bottom: 1px solid #e9ecef;
        vertical-align: middle;
    }

    .af-table tr:hover {
        background-color: #f8f9fa;
    }

/* ===============================
   صور و أيقونات
================================= */
.af-profile-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e9ecef;
}

.af-no-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #f1f1f1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 24px;
}

/* ===============================
   التجاوب
================================= */
/* ========== الأزرار والإجراءات داخل الجدول ========== */
.af-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

    .af-actions .af-btn {
        background: #f1f1f1;
        color: #333;
        border: none;
        padding: 8px 10px;
        border-radius: 6px;
        cursor: pointer;
        font-size: 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        transition: background 0.3s, transform 0.2s;
    }

        .af-actions .af-btn:hover {
            transform: scale(1.05);
        }

        /* ✅ جعل أيقونات الأزرار باللون الأبيض */
        .af-actions .af-btn i {
            color: #fff !important;
        }

    /* زر التعديل */
    .af-actions .af-btn-edit {
        background: #4facfe;
    }

        .af-actions .af-btn-edit:hover {
            background: #2196f3;
        }

    /* زر الحذف */
    .af-actions .af-btn-delete {
        background: #e74c3c;
    }

        .af-actions .af-btn-delete:hover {
            background: #c0392b;
        }

    /* زر التحميل */
    .af-actions .af-btn-download {
        background: #2ecc71;
    }

        .af-actions .af-btn-download:hover {
            background: #27ae60;
        }
    /* زر التفاصيل (جديد) */
    .af-actions .af-btn-info {
        background: #17a2b8; /* لون المعلومات */
    }

        .af-actions .af-btn-info:hover {
            background: #138496;
        }


@media (max-width: 768px) {
    .main-container {
        margin: 10px;
        border-radius: 15px;
    }

    .form-container {
        padding: 20px;
    }

    .header-section {
        padding: 20px;
    }

    .form-group-horizontal {
        flex-direction: column;
    }

        .form-group-horizontal .form-group {
            flex: 1 1 100%;
        }

    .navbar-nav {
        padding: 10px 0;
    }

        .navbar-nav .nav-link {
            padding: 0.5rem;
        }

    .af-table td:nth-child(3),
    .af-table th:nth-child(3) {
        display: none;
    }

    .af-description {
        max-width: 150px;
    }

    /* الخط الأساسي لكل الموقع */
    body {
        font-family: 'Cairo', sans-serif;
        font-size: 16px;
    }

    /* لضبط شريط القوائم */
    .navbar, .navbar a, .navbar-nav .nav-link {
        font-family: 'Cairo', sans-serif;
        font-size: 18px;
        font-weight: 600;
    }
    /* ===============================
   إضافات جديدة: تنبيهات وشارات
================================= */

    /* تنسيق رسائل التنبيه (Success Message) */
    .alert {
        padding: 15px 20px;
        border-radius: 10px;
        margin-bottom: 20px;
        display: flex;
        align-items: center;
        border: 1px solid transparent;
        font-size: 1rem;
    }

    .alert-success {
        color: #0f5132;
        background-color: #d1e7dd;
        border-color: #badbcc;
    }

    .alert-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        margin-right: auto; /* لنقل الزر إلى أقصى اليمين */
        padding: 0 10px;
        line-height: 1;
    }

    /* تنسيق الشارات (Badges) للمراحل الدراسية */
    .badge {
        display: inline-block;
        padding: 0.4em 0.7em;
        font-size: 0.85em;
        font-weight: 600;
        line-height: 1;
        color: #fff;
        text-align: center;
        white-space: nowrap;
        vertical-align: baseline;
        border-radius: 8px;
    }

    .bg-info {
        background-color: var(--info-color);
    }

    .bg-secondary {
        background-color: #6c757d;
    }

    /* تنسيق كود المادة لتمييزه */
    code {
        font-family: 'Courier New', Courier, monospace;
        background-color: #e9ecef;
        padding: 0.2em 0.4em;
        border-radius: 4px;
        color: #dc3545;
    }
    /* =========================================
   تنسيقات صفحة التفاصيل (Details Page)
========================================= */

    /* تنسيق الصورة الشخصية الكبيرة */
    .details-profile-img {
        width: 180px;
        height: 180px;
        border-radius: 50%;
        object-fit: cover;
        border: 5px solid #fff;
        box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    }

    .details-no-image {
        width: 180px;
        height: 180px;
        border-radius: 50%;
        background: #f1f1f1;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #6c757d;
        border: 5px solid #fff;
        box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    }

    /* شبكة عرض التفاصيل */
    .details-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
        background-color: #f8f9fa;
        padding: 25px;
        border-radius: 15px;
    }

    .details-item {
        background-color: #fff;
        padding: 15px;
        border-radius: 10px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        display: flex;
        flex-direction: column;
    }

        .details-item.full-width {
            grid-column: 1 / -1; /* لجعل الحقل يمتد على عرض الشبكة بالكامل */
        }

        .details-item label {
            font-size: 0.9rem;
            color: #6c757d;
            margin-bottom: 5px;
        }

        .details-item span {
            font-size: 1.1rem;
            font-weight: 600;
            color: #2c3e50;
        }

    .code-font {
        direction: ltr;
        text-align: right;
        font-family: 'Courier New', Courier, monospace !important;
    }

    /* أزرار الإجراءات في الأسفل */
    .details-actions {
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid #e9ecef;
        display: flex;
        gap: 15px;
        justify-content: flex-start; /* محاذاة لليمين */
    }
    /* =========================================
   إضافات لتنسيقات صفحة التفاصيل
========================================= */

    /* تنسيق العناوين الفرعية داخل صفحة التفاصيل */
    .details-section-header {
        font-size: 1.2rem;
        font-weight: 700;
        color: var(--primary-color);
        margin-top: 25px; /* لإضافة مسافة قبل كل قسم */
        margin-bottom: 10px;
        padding-bottom: 5px;
        border-bottom: 2px solid #e9ecef;
    }

        /* لجعل أول عنوان بدون مسافة علوية */
        .details-section-header:first-of-type {
            margin-top: 0;
        }
    /* =========================================
   تنسيقات صفحة الفواتير / أذونات الصرف
========================================= */

    /* تنسيق العناوين الفرعية للأقسام */
    .form-section-header {
        font-size: 1.4rem;
        font-weight: 700;
        color: var(--primary-color);
        margin-top: 30px;
        margin-bottom: 15px;
        padding-bottom: 10px;
        border-bottom: 2px solid #e9ecef;
    }

        .form-section-header:first-of-type {
            margin-top: 0;
        }

    /* حاوية أزرار تصفية الأصناف */
    .item-filter-container {
        background-color: #f8f9fa;
        border-radius: 8px;
        padding: 1rem;
        border: 1px solid #dee2e6;
    }

    /* تنسيق كارت الإجمالي النهائي */
    .total-card {
        background-color: #e8f5e9;
        border-radius: 10px;
        padding: 20px;
        border: 1px solid var(--success-color);
        text-align: center;
    }

        .total-card label {
            font-size: 1.1rem;
            font-weight: 600;
            color: #0f5132;
            display: block;
            margin-bottom: 10px;
        }

        .total-card input {
            font-size: 2rem !important;
            font-weight: 700;
            color: var(--success-color);
            text-align: center;
            background: transparent !important;
            border: none !important;
            padding: 0 !important;
            box-shadow: none !important;
        }

    /* تنسيق رسائل الخطأ تحت حقل الكمية */
    .error-message {
        font-size: 0.85rem;
        display: block;
        margin-top: 4px;
    }
}
