/* --- خط بهيج العربي (Bahij TheSansArabic) --- */
@font-face { font-family: 'Bahij'; src: url('../assets/fonts/Bahij/Bahij_TheSansArabic-ExtraLight.ttf') format('truetype'); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bahij'; src: url('../assets/fonts/Bahij/Bahij_TheSansArabic-Light.ttf') format('truetype'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bahij'; src: url('../assets/fonts/Bahij/Bahij_TheSansArabic-SemiLight.ttf') format('truetype'); font-weight: 350; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bahij'; src: url('../assets/fonts/Bahij/Bahij_TheSansArabic-Plain.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bahij'; src: url('../assets/fonts/Bahij/Bahij_TheSansArabic-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bahij'; src: url('../assets/fonts/Bahij/Bahij_TheSansArabic-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bahij'; src: url('../assets/fonts/Bahij/Bahij_TheSansArabic-ExtraBold.ttf') format('truetype'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Bahij'; src: url('../assets/fonts/Bahij/Bahij_TheSansArabic-Black.ttf') format('truetype'); font-weight: 900; font-style: normal; font-display: swap; }

/* --- المتغيرات اللونية المستخرجة من لوحة Figma (Figma Palette) --- */
:root {
    /* ألوان الإدارة والمستشار (البنفسجي والبيج) */
    --primary-purple: #4C466E; /* مستوحى من التدرج البنفسجي */
    --secondary-beige: #D3BD9F; /* مستوحى من التدرج البيج */
    
    /* ألوان العملاء والموقع الأساسي (الأخضر والأصفر) */
    --primary-green: #1D6254; /* الأخضر الزمردي الأنيق من التدرج الأول */
    --secondary-yellow: #FFAF1D; /* الأصفر الذهبي المشرق */
    
    --bg-light-gray: #F5F7F9; /* رمادي بارد وأنيق للمستطيلات */
}

/* --- تنسيقات عامة --- */
*, *::before, *::after {
    font-family: 'Bahij', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

body {
    font-family: 'Bahij', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    background-color: var(--bg-light-gray) !important;
    font-size: 16px !important; /* مقاس النصوص الأساسية للويب */
    font-weight: 400; /* Regular */
}

/* العناوين الرئيسية والفرعية (مقاسات مضاعفة للتباين) */
h1 { font-size: 36px !important; font-weight: 700 !important; }
h2 { font-size: 32px !important; font-weight: 700 !important; }
h3 { font-size: 24px !important; font-weight: 600 !important; }
h4 { font-size: 20px !important; font-weight: 600 !important; }
h5, h6 { font-size: 18px !important; font-weight: 600 !important; }

/* العناوين البارزة داخل الجداول والبطاقات والموقع التعريفي */
.fw-bold, .fw-bolder, .fw-semibold, b, strong, .badge { font-weight: 600 !important; }
th { font-size: 15px !important; font-weight: 600 !important; }
td { font-size: 15px !important; font-weight: 400 !important; }

/* القائمة الجانبية */
.custom-nav-link {
    font-size: 16px !important;
    font-weight: 500 !important;
}

/* الخطوط الثانوية (Captions) */
.small, small, .text-muted {
    font-size: 12px !important;
    font-weight: 300 !important; /* Light */
}

/* --- فئات مساعدة للهوية البنفسجية (لوحة التحكم) --- */
.text-purple { color: var(--primary-purple) !important; }
.text-beige { color: var(--secondary-beige) !important; }
.bg-purple { background-color: var(--primary-purple) !important; }
.bg-beige { background-color: var(--secondary-beige) !important; }
.bg-purple-soft { background-color: rgba(74, 68, 106, 0.15) !important; }

/* --- فئات مساعدة للهوية الخضراء (الموقع التعريفي) --- */
.text-green { color: var(--primary-green) !important; }
.text-yellow { color: var(--secondary-yellow) !important; }
.bg-green { background-color: var(--primary-green) !important; }
.bg-yellow { background-color: var(--secondary-yellow) !important; }

/* خلفيات شفافة للألوان الخضراء والصفراء */
.bg-green-soft { background-color: rgba(23, 133, 83, 0.08) !important; }
.bg-yellow-soft { background-color: rgba(249, 170, 38, 0.15) !important; }

/* --- تصميم جديد كلياً للأزرار (Premium SaaS Buttons) --- */
.btn {
    border-radius: 8px !important; /* زوايا ناعمة واحترافية بدلاً من الدائرية الكاملة */
    padding: 0.5rem 1.25rem !important; /* حجم متناسق مع النص الأساسي */
    font-size: 15px !important; /* تكبير الخط ليتوافق مع Body Text */
    font-weight: 500 !important;
    border: none !important; /* إزالة الحدود القاسية بالكامل */
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1.5px);
}

.btn:active {
    transform: translateY(0);
}

/* 1. الأزرار الناعمة (Soft Buttons) بديلة للـ Outline */
/* زر الإيقاف / الخطر */
.btn-outline-danger, .btn-soft-danger {
    background-color: rgba(220, 53, 69, 0.08) !important;
    color: #dc3545 !important;
}
.btn-outline-danger:hover, .btn-soft-danger:hover {
    background-color: #dc3545 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.25);
}

/* زر التعديل / التنبيه */
.btn-outline-warning, .btn-soft-warning {
    background-color: rgba(249, 170, 38, 0.12) !important;
    color: #c98511 !important;
}
.btn-outline-warning:hover, .btn-soft-warning:hover {
    background-color: var(--secondary-yellow) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(249, 170, 38, 0.3);
}

/* زر تغيير الدور / الأساسي */
.btn-outline-primary, .btn-soft-primary {
    background-color: rgba(13, 110, 253, 0.08) !important;
    color: #0d6efd !important;
}
.btn-outline-primary:hover, .btn-soft-primary:hover {
    background-color: #0d6efd !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.25);
}

/* 2. الأزرار الأساسية الممتلئة (Solid Buttons) */
/* زر إضافة رصيد / النجاح */
.btn-success {
    background-color: var(--primary-green) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(23, 133, 83, 0.15) !important;
}
.btn-success:hover {
    background-color: #126b42 !important;
    box-shadow: 0 6px 15px rgba(23, 133, 83, 0.3) !important;
}

/* زر الإغلاق / الرمادي */
.btn-secondary {
    background-color: #e9ecef !important;
    color: #495057 !important;
}
.btn-secondary:hover {
    background-color: #dee2e6 !important;
    color: #212529 !important;
}

/* الزر البنفسجي */
.bg-purple, .btn-purple {
    background-color: var(--primary-purple) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(74, 68, 106, 0.15) !important;
}
.bg-purple:hover, .btn-purple:hover {
    background-color: #342f54 !important;
    color: white !important;
    box-shadow: 0 6px 15px rgba(74, 68, 106, 0.3) !important;
}

.btn-green {
    background-color: var(--primary-green) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(23, 133, 83, 0.15) !important;
}
.btn-green:hover {
    background-color: #126b42 !important;
    color: white !important;
    box-shadow: 0 6px 15px rgba(23, 133, 83, 0.3) !important;
}

.hover-green:hover {
    color: var(--secondary-yellow) !important;
    transition: color 0.2s;
}

/* --- تنسيقات القائمة الجانبية (Sidebar) للوحة التحكم --- */
.sidebar-wrapper {
    width: 260px;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.custom-nav-link {
    color: #6c757d;
    font-weight: 500;
    border: none !important;
    transition: all 0.2s ease-in-out;
}

.custom-nav-link:hover:not(.active):not(.text-danger) {
    background-color: rgba(211, 193, 172, 0.15);
    color: var(--primary-purple);
}

.custom-nav-link.active {
    background-color: var(--primary-purple) !important;
    color: #ffffff !important;
    border-right: 4px solid var(--secondary-beige) !important;
}

/* --- تنسيقات البطاقات (لوحة التحكم والموقع) --- */
.stat-card {
    transition: transform 0.2s ease;
    border-right: 4px solid transparent;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-right-color: var(--secondary-beige);
}

.feature-card {
    transition: all 0.3s ease;
    border-bottom: 4px solid transparent !important;
}

.feature-card:hover {
    transform: translateY(-8px);
    border-bottom-color: var(--primary-green) !important;
}

/* --- تنسيقات الجدول وشارات الحالة (Status Badges) --- */
.table > :not(caption) > * > * {
    padding: 1rem 0.75rem;
    border-bottom-color: #f1f1f4;
}

.bg-warning-soft { background-color: rgba(249, 170, 38, 0.15) !important; }
.text-warning { color: var(--secondary-yellow) !important; font-weight: 600; }

.bg-success-soft { background-color: rgba(23, 133, 83, 0.15) !important; }
.text-success { color: var(--primary-green) !important; font-weight: 600; }

/* تأثير طفو الصورة في الواجهة الرئيسية */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

/* --- صفحة تسجيل الدخول (Login Page) --- */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #4a446a 0%, #342f54 50%, #2a2545 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    animation: loginFadeIn 0.6s ease-out;
}

.login-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 40px 35px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card .form-control,
.login-card .input-group-text {
    border-color: #e8e5f0;
    font-size: 14px;
    padding: 10px 14px;
}

.login-card .form-control:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(74, 68, 106, 0.15);
}

.login-card .btn.bg-purple {
    transition: all 0.3s ease;
    font-size: 15px;
    padding: 11px;
}

.login-card .btn.bg-purple:hover:not(:disabled) {
    background-color: #3d3860 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(74, 68, 106, 0.4);
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(25px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- شاشة التحميل أثناء التحقق من المصادقة --- */
#auth-loading-screen {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-light-gray);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}

#auth-loading-screen img {
    max-height: 55px;
    opacity: 0.7;
}

#auth-loading-screen .spinner-border {
    color: var(--primary-purple);
}