﻿/* ✅ الخط العام */
body, * {
    font-family: 'Cairo', sans-serif;
}

/* ✅ تحميل FontAwesome */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css');

/* ✅ الوضع العادي والليلي للخلفية */
body {
    background-color: #f1f5f9;
}

html.dark body {
    background-color: #0f172a;
    color: white;
}

/* ✅ الإدخالات والتواريخ في الوضع الليلي */
.dark .form-control,
.dark input[type="date"] {
    background-color: #1f2937;
    color: white;
    border-color: #374151;
}

/* ✅ الحقول الموحدة */
.form-control {
    border: 1px solid #d1d5db;
    padding: 0.4rem;
    border-radius: 0.375rem;
    background-color: white;
}

/* إزالة أي مسافات بين العناصر */
.form > div:not(:last-child) {
    margin-bottom: 0;
}

/* التأكد من أن الجدول ملتصق بالتول بار */
.table-wrapper .table-auto {
    margin-top: 0;
}

html.dark .form-control {
    background-color: #1f2937;
    color: white;
    border-color: #374151;
}

/* ✅ توحيد ارتفاع الحقول وتقليل الحجم */
select.form-control,
input.form-control,
textarea.form-control {
    height: 36px;
    font-size: 0.875rem;
}

/* ✅ صف الحقل: label + input بجانب بعض */
.field-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

    .field-row > label {
        white-space: nowrap;
        min-width: 80px;
    }

    .field-row > .form-control {
        flex: 1;
        min-width: 0;
    }


/* ✅ توسيط المحتوى أفقياً ورأسياً في كل الخلايا */
.centered-cells td,
.centered-cells th {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100%;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
}

/* ✅ أزرار عامة */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

/* تأكيد أن كل الأزرار تظهر بشكل اليد عند المرور عليها */
button, input[type="submit"], input[type="button"], .cursor-pointer {
    cursor: pointer !important;
}

#toast {
    position: fixed;
    top: 1.5rem; /* ✅ يظهر في أعلى الشاشة */
    left: 50%;
    transform: translateX(-50%); /* ✅ يضمن التوسيط أفقيًا */
    background-color: #22c55e;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9rem;
    z-index: 9999;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    display: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    word-wrap: break-word;
    max-width: 80%; /* ✅ يمنع التمدد */
    text-align: center; /* ✅ يضمن التوسيط */
    min-width: 200px;
    padding: 16px 24px; /* 🔹 مسافة أكثر راحة */
}
    #toast.show {
        display: block;
        opacity: 1;
        transform: scale(0.9);
        animation: fadeIn 0.4s ease-out; /* ✅ تأثير أكثر سلاسة */
    }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8); /* يبدأ بحجم أصغر */
    }

    to {
        opacity: 1;
        transform: scale(0.9); /* يكبر تدريجياً */
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(0.9);
    }

    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

#toast.hide {
    animation: fadeOut 0.4s ease-out;
}

    /* ✅ لون الخطأ محسّن */
    #toast.error {
        background-color: #ef4444; /* 🔴 أحمر */
        color: #ffe5e5; /* 🔹 لون فاتح مريح للعين */
    }

    #toast.warning {
        background-color: #f59e0b; /* 🔶 برتقالي */
        color: #4a2700; /* 🔹 بني داكن لوضوح أفضل */
    }

#toast i {
    font-size: 1.2rem; /* ✅ يجعل الأيقونة أكثر وضوحًا */
    margin-right: 8px;
}

/* ✅ إشعار العد التنازلي */
#logoutNotice {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.notice-box {
    background-color: #f87171;
    color: white;
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
    width: 300px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: fadeInScale 0.4s ease;
    position: relative;
}

    .notice-box .close-btn {
        position: absolute;
        top: 10px;
        left: 12px;
        background: transparent;
        color: white;
        font-size: 20px;
        border: none;
        cursor: pointer;
        font-weight: bold;
    }

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

html.dark .notice-box {
    background-color: #dc2626;
}

/* ✅ السايد بار */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 250px;
    height: 100%;
    background-color: #fff;
    transition: transform 0.4s ease, opacity 0.4s ease;
    transform: translateX(0);
    opacity: 1;
    z-index: 1000;
}

    .sidebar.closed {
        transform: translateX(100%);
        opacity: 0;
    }

html.dark .sidebar {
    background-color: #1e293b;
}

/* ✅ المحتوى الرئيسي */
.main-content {
    transition: margin-right 0.3s ease;
    margin-right: 250px;
}

    .main-content.expanded {
        margin-right: 0;
    }

/* ✅ التول بار */
.toolbar {
    height: 4rem;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255,255,255,0.9);
    backdrop-filter: blur(5px);
    z-index: 900;
}

html.dark .toolbar {
    background-color: rgba(30,41,59,0.9);
}

    html.dark .toolbar h2,
    html.dark .toolbar div,
    html.dark .toolbar span {
        color: #f1f5f9 !important;
    }

    html.dark .toolbar .fa {
        color: #facc15 !important;
    }

/* ✅ الشعار */
.brand-logo {
    font-size: 1.4rem;
    font-weight: bold;
    color: #0c4a6e;
}

html.dark .brand-logo {
    color: #60a5fa;
}

/* ✅ أزرار السايد بار */
.btn-section {
    width: 100%;
    text-align: right;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

    .btn-section i {
        color: inherit;
        transition: transform 0.3s ease;
    }

    .btn-section:hover i {
        transform: scale(1.2);
    }

.dark .btn-section.bg-blue-900 {
    background-color: #1e3a8a;
}

.dark .btn-section.bg-green-900 {
    background-color: #064e3b;
}

.dark .btn-section.bg-yellow-900 {
    background-color: #78350f;
}

.dark .btn-section.bg-purple-900 {
    background-color: #4c1d95;
}

.dark .btn-section.bg-pink-900 {
    background-color: #831843;
}

/* ✅ النصوص */
h1, h2, h3, h4 {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

/* ✅ الجداول */
.table-auto {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
}

.dark .table-auto {
    background-color: #1f2937;
    color: #f1f5f9;
}

.table-auto th {
    background-color: #e5e7eb;
    color: #1f2937;
    padding: 0.75rem;
    font-weight: bold;
}

.dark .table-auto th {
    background-color: #374151;
    color: #f1f5f9;
}

.table-auto td {
    padding: 0.5rem;
    border-bottom: 1px solid #ccc;
}

.dark .table-auto td {
    border-bottom: 1px solid #4b5563;
}


/* ✅ الباجينج داخل الجريد */
table tr td table td {
    padding: 6px 10px;
    border-radius: 6px;
    background-color: #f1f5f9;
    color: #1e293b;
    font-weight: bold;
}

html.dark table tr td table td {
    background-color: #1f2937;
    color: white;
}

table tr td table td span {
    background-color: #3b82f6;
    color: white;
    border-radius: 6px;
    padding: 6px 12px;
}


html.dark table tr td table td span {
    background-color: #2563eb;
    color: white;
}

.table-auto {
    flex-grow: 1;
    overflow-y: auto;
}

.table-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 0 !important; /* إزالة الحشوات */
    margin-top: 0 !important; /* إزالة الهوامش العلوية */
    background-color: transparent;
}



/* ✅ حدود داخلية واضحة لكل الأعمدة والصفوف */
.table-auto td,
.table-auto th {
    border: 1px solid #d1d5db;
}

.dark .table-auto td,
.dark .table-auto th {
    border: 1px solid #4b5563;
}


/* ✅ تمييز فوتر الجريد */
.table-auto tfoot td {
    background-color: #e2e8f0; /* Tailwind: gray-200 */
    font-weight: bold;
    color: #1e293b;
    border-top: 2px solid #94a3b8;
}

.dark .table-auto tfoot td {
    background-color: #1e293b;
    color: #f8fafc;
    border-top: 2px solid #475569;
}

/* ✅ تثبيت الهيدر للجدول */
.fixed-header th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f3f4f6;
}

.dark .fixed-header th {
    background-color: #374151;
}

/* ✅ التحكم في ارتفاع الصفوف */
.fixed-header td, .fixed-header th {
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}

/* ✅ صف بلون وصف بلون */
.fixed-header .row-alt {
    background-color: #f9fafb;
}

.dark .fixed-header .row-alt {
    background-color: #1f2937;
}

.fixed-header tfoot tr:last-child td {
    background-color: #e5e7eb;
    font-weight: bold;
    color: #000;
}

.dark .fixed-header tfoot tr:last-child td {
    background-color: #1f2937;
    color: #fff;
}


/* ✅ Responsive */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* ✅ شاشة التحميل بخلفية شفافة */
#loadingOverlay {
    background-color: rgba(0, 0, 0, 0.1) !important;
    backdrop-filter: none;
    pointer-events: all;
    z-index: 9999;
}

/* ✅ دعم Select2 */
.select2-container--default .select2-selection--single {
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    height: 40px;
    border-radius: 0.375rem;
    padding: 0.5rem;
    direction: rtl;
}

html.dark .select2-container--default .select2-selection--single {
    background-color: #1f2937;
    border-color: #4b5563;
    color: white;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #111827;
    font-size: 14px;
    text-align: right;
}

html.dark .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: white;
}

.select2-dropdown {
    z-index: 2000 !important;
}

/* ✅ Toast التصدير */
#exportToast {
    transition: opacity 0.3s ease;
}

    #exportToast .btn-export:hover {
        opacity: 0.8;
    }

html, body, form {
    height: 100%;
    margin: 0;
    padding: 0;
}

.overflow-x-auto {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}


input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

