/* استيراد خط Cairo من Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');

/* متغيرات CSS - تم تحسين الألوان لتكون أكثر حيوية (Vibrant) مثل التطبيقات */
:root {
    --primary-color: #C7CBF2; /* Indigo حديث */
    --primary-dark: #A39EFF;
    --primary-light: #6366f1;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #10b981;
    --info-color: #0ea5e9;
    --light-bg: #A39EFF; /* خلفية ناعمة جداً */
    --dark-bg: #0f172a;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border-color: #f1f5f9;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --app-radius: 20px; /* زوايا دائرية كبيرة مثل التطبيقات */
}

/* إعادة تعيين عام */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* منع الوميض عند اللمس في الموبايل */
}

body {
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    text-align: right;
    background-color: var(--light-bg);
    color: var(--text-dark);
    line-height: 1.6;
    padding-bottom: 90px; /* مساحة أكبر قليلاً للشريط السفلي */
    font-size: 15px;
}

/* الحاويات */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* التخطيط الرئيسي */
.main-layout {
    display: flex;
    min-height: 100vh;
}

.content {
    flex: 1;
    padding: 1.5rem;
    width: 100%;
    transition: all 0.3s ease;
}

/* الشريط الجانبي (تحويله لنمط احترافي للشاشات الكبيرة) */
.sidebar {
    background-color: var(--dark-bg);
    color: white;
    width: 280px;
    flex-shrink: 0;
    z-index: 1001;
    border-left: 1px solid rgba(255,255,255,0.05);
}

.sidebar-menu {
    list-style: none;
    position: sticky;
    top: 0;
    padding: 20px 10px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 5px;
    transition: all 0.2s;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background-color: var(--primary-color);
    color: white;
}

/* الأزرار بنمط الكبسولة (Capsule Buttons) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.8rem;
    border-radius: 14px; /* زوايا أكثر نعومة */
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s active;
    text-decoration: none;
    border: none;
    font-family: inherit;
    gap: 8px;
}

.btn:active {
    transform: scale(0.96); /* تأثير الضغط مثل أزرار الآيفون */
}

.btn-primary { 
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: white;
    box-shadow: 0 4px 14px rgba(67, 56, 202, 0.3);
}

.btn-block { width: 100%; display: flex; }

/* الكروت (نمط الطبقات العائمة) */
.card {
    background: white;
    border-radius: var(--app-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-color);
}

/* الشبكة المتجاوبة */
.row { display: flex; flex-wrap: wrap; margin: -8px; }
[class*="col-"] { padding: 8px; }
.col-6 { flex: 0 0 50%; }
.col-12 { flex: 0 0 100%; }

/* الشريط السفلي - تحويله لنمط تطبيق (Floating Navbar Effect) */
.bottom-navbar {
    position: fixed;
    bottom: 15px; /* رفع الشريط قليلاً ليعطي شكل عائم */
    left: 15px;
    right: 15px;
    height: 65px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px); /* تأثير الزجاج الضبابي */
    display: none;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 2000;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.3);
}

.nav-item {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.nav-item i { font-size: 1.4rem; margin-bottom: 4px; transition: 0.3s; }
.nav-item.active { color: var(--primary-color); }
.nav-item.active i { transform: translateY(-5px); color: var(--primary-color); }

/* =========================================
   تعديلات الموبايل الجوهرية (App-Style)
   ========================================= */

@media (max-width: 760px) {
    .sidebar { display: none !important; }
    
    .content {
        margin-right: 0 !important;
        padding: 1rem !important;
        width: 100% !important;
        background-color: var(--light-bg);
    }

    .bottom-navbar { display: flex; }

    [class*="col-"]:not(.col-6) { flex: 0 0 100% !important; }

    /* تحسين العناوين لتناسب الموبايل */
    h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 1rem; }
    
    /* جعل الكروت بدون حدود جانبية أحياناً لتوفير مساحة */
    .card { padding: 1.2rem; border-radius: 18px; }
}

@media (min-width: 3000px) {
    .bottom-navbar { display: none !important; }
}

/* =========================================
   تنسيق حقول الإدخال (Modern Input)
   ========================================= */

.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.9rem;
    margin-right: 4px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    color: var(--text-dark);
    background-color: #fcfcfd;
    border: 2px solid #f1f5f9;
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-control:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 56, 202, 0.08);
    transform: scale(1.01); /* تمدد بسيط عند الكتابة */
}

/* تنسيق حقول الأرقام */
input[type="number"].form-control {
    font-weight: 800;
    color: var(--primary-color);
}

textarea.form-control { min-height: 100px; }

/* =========================================
   تنسيق كروت التواصل (Contact Cards)
   ========================================= */

.contact-card {
    background: #ffffff;
    border-radius: 18px;
    border-right: 6px solid var(--primary-color);
    overflow: hidden;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 0;
    border-bottom: 1px solid #f8fafc;
}

.contact-icon {
    background: #eef2ff;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: var(--primary-color);
    margin-left: 15px;
}

.contact-label { font-size: 0.7rem; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.contact-text { font-weight: 700; font-size: 1rem; }

.notes-highlight {
    background: #fffbeb;
    padding: 12px;
    border-radius: 12px;
    border: 1px dashed #fbbf24;
    color: #92400e;
    font-weight: 600;
}

/* =========================================
   تنسيق سجل الدفعات (List-Style Table)
   ========================================= */

.table-responsive {
    background: transparent; /* جعل الخلفية شفافة لأن الكروت ستكون بيضاء */
}

.table { width: 100%; border-collapse: separate; border-spacing: 0 10px; } /* تباعد بين الأسطر */

.table thead th {
    padding: 10px 15px;
    color: var(--text-light);
    font-size: 0.8rem;
    border: none;
}

.table tbody td {
    background: white;
    padding: 15px;
    border: none;
}

/* تدوير زوايا أول وأخر خلية في السطر لتبدو كأنها كرت */
.table tbody tr td:first-child { border-radius: 0 15px 15px 0; }
.table tbody tr td:last-child { border-radius: 15px 0 0 15px; }

/* تحسين شكل الجدول في الموبايل */
@media (max-width: 768px) {
    .mobile-card-table tbody tr {
        border: none;
        border-radius: 20px;
        padding: 15px;
        margin-bottom: 12px;
        border-right: 6px solid var(--secondary-color);
        box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    }
    
    .mobile-card-table td {
        padding: 8px 0 !important;
        border-bottom: 1px solid #f8fafc !important;
    }

    .mobile-card-table td::before {
        color: var(--text-dark);
        opacity: 0.6;
    }
}

/* القوائم المنسدلة (Selects) */
.form-select, select.form-control {
    background-position: left 1rem center;
    border-radius: 14px;
    padding-left: 40px;
    font-weight: 600;
}

/* الأيقونات والحالات الفارغة */
.empty-state {
    background: white;
    border-radius: 25px;
    padding: 60px 20px;
}

.empty-state i {
    background: #f1f5f9;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    color: #cbd5e1;
}