/* jnew/assets/css/main.css */

/* 1. استدعاء Tailwind CSS الأساسي. هذا يجب أن يكون ناتج عملية بناء Tailwind لديك */
/* تأكد أن ملف output.css موجود في نفس المجلد (jnew/assets/css/) */
@import url('output.css'); 

/* ====== بداية المتغيرات والأنماط المخصصة (مجمعة من كل مكان) ====== */

/* Custom CSS Variables - Define your custom color palette */
:root {
    --color-primary: #0c7ff2;
    --color-primary-rgb: 12, 127, 242;
    --color-primary-dark: #0b73db;
    --color-accent: #8a2be2; /* بنفسجي بمبي */
    --color-accent-rgb: 138, 43, 226;
    --color-accent-light: #e0b0ff;
    --color-success: #10b981;
    --color-success-rgb: 16, 185, 129;
    --color-warning: #f59e0b;
    --color-error: #ef4444;

    --color-background-body: #f8f9fa;
    --color-background-card: #ffffff;
    --color-text-primary: #111418;
    --color-text-secondary: #60758a;
    --color-border: #e2e8f0;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
}

/* Base Styles */
html, body {
    overflow-x: hidden; /* لمنع التمرير الأفقي غير المرغوب فيه */
    scroll-behavior: smooth;
}

body {
    font-family: "Plus Jakarta Sans", "Noto Sans Arabic", sans-serif;
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-background-body);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
    /* تعويض ارتفاع الهيدر الثابت. سيتم تطبيق هذا على جميع الصفحات */
    padding-top: 64px; /* ارتفاع الهيدر الثابت */
}

/* Overriding Tailwind's default colors with custom variables */
.bg-white { background-color: var(--color-background-card) !important; }
.bg-gray-100 { background-color: var(--color-background-body) !important; }
.bg-gray-50 { background-color: var(--color-background-body) !important; }
.bg-blue-50 { background-color: rgba(var(--color-primary-rgb), 0.05) !important; }

.text-gray-800 { color: var(--color-text-primary) !important; }
.text-gray-900 { color: var(--color-text-primary) !important; }
.text-gray-700 { color: var(--color-text-primary) !important; }
.text-gray-600 { color: var(--color-text-secondary) !important; }
.text-gray-500 { color: var(--color-text-secondary) !important; }
.text-blue-600 { color: var(--color-primary) !important; }
.hover\:bg-blue-700:hover { background-color: var(--color-primary-dark) !important; }

.border-gray-200 { border-color: var(--color-border) !important; }
.border-gray-100 { border-color: var(--color-border) !important; }

/* Global Link Styles */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* Enhanced Glass Effect */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* Header Specific Styles — scoped to smart-header only */
#smartHeader {
    position: fixed;
    top: 0;
    z-index: 50;
    box-shadow: none;
    background-color: transparent;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    height: 64px;
}
#smartHeader .container {
    height: 100%;
}

/* Sidebar (القائمة الجانبية) - حل مشكلة التداخل */
.dashboard-sidebar {
    background-color: var(--color-background-card);
    border-left: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    position: fixed;
    top: 0; 
    right: -100%; /* مخفي خارج الشاشة افتراضياً */
    height: 100vh;
    width: 100%; /* عرض كامل على الموبايل */
    z-index: 40; /* أقل من الهيدر (z-50) */
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: right 0.3s ease;
    padding-top: 64px; /* تعويض ارتفاع الهيدر على الموبايل */
}

.dashboard-sidebar.open {
    right: 0; /* يظهر من اليمين عند الفتح */
    box-shadow: var(--shadow-xl); /* إضافة ظل عند الفتح */
}

/* القائمة الجانبية على الديسكتوب (فوق 1024px) */
@media (min-width: 1024px) { 
    .dashboard-sidebar {
        width: 18rem; /* عرض ثابت (w-72) */
        right: 0; /* دائماً مرئي على الديسكتوب */
        left: auto;
        top: 64px; /* يبدأ بعد الهيدر مباشرة */
        height: calc(100vh - 64px); /* ارتفاع كامل الشاشة ناقص ارتفاع الهيدر */
        padding: 1.5rem;
        /* لا يوجد md:hidden هنا لأنها مصممة لتكون مرئية على الديسكتوب */
    }
}


/* Main content area when sidebar is open/visible (on desktop) */
/* هذا الـ margin يدفع المحتوى الرئيسي ليحل مشكلة التداخل على الديسكتوب */
/* يجب تطبيق هذا الكلاس على العنصر الذي يحتوي على محتوى الصفحة الرئيسي بعد الهيدر */
.main-content-offset {
    margin-right: 0; /* لا يوجد margin افتراضياً (للموبايل) */
    transition: margin-right 0.3s ease; /* انتقال سلس */
}

@media (min-width: 1024px) { /* على الديسكتوب (lg breakpoint) */
    .main-content-offset {
        margin-right: 18rem; /* يدفع المحتوى ليترك مساحة للقائمة الجانبية بعرض 18rem */
    }
}

/* Navigation Links (used in sidebar and desktop nav) */
.nav-item { 
    display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: 0.5rem; color: #4a5568; transition: all 0.15s; 
}
.nav-item.active { 
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    color: white; 
    box-shadow: var(--shadow-sm);
} 
.nav-item.active p, .nav-item.active .material-icons-outlined { 
    color: white; 
}
.nav-item:hover {
    background-color: var(--color-background-body); 
    color: var(--color-text-primary); 
}
.nav-item:hover p, .nav-item:hover .material-icons-outlined { 
    color: var(--color-text-primary); 
}
.nav-item.active:hover { 
    background-color: var(--color-primary-dark); 
}
/* Mega Menu / Dropdown styles */
.has-submenu {
    position: relative;
}
.submenu {
    display: none;
    position: absolute;
    background-color: var(--color-background-card);
    min-width: 200px;
    box-shadow: var(--shadow-md);
    z-index: 60;
    border-radius: var(--radius-md);
    top: 100%; 
    left: 0; 
    padding: 0.5rem 0;
    transition: all 0.3s ease-out;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none; 
}
.has-submenu:hover .submenu {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.submenu a {
    color: var(--color-text-primary);
    padding: 0.75rem 1rem;
    text-decoration: none;
    display: block;
    font-weight: normal;
    transition: background-color 0.2s ease;
}
.submenu a:hover {
    background-color: var(--color-background-body);
    text-decoration: none;
}

/* Enhanced Buttons (btn-primary) */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    z-index: 1;
}
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
    z-index: -1;
}
.btn-primary:hover::before {
    left: 100%;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(var(--color-accent-rgb), 0.4);
}
.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; border-radius: 0.5rem; background-color: #e2e8f0; padding: 0.75rem 1.5rem; font-size: 1rem; font-weight: 500; color: #1f2937; transition: all 0.2s; 
}
.btn-secondary:hover {
    background-color: #cbd5e0;
}

/* Profile Dropdown Menu */
.profile-dropdown-menu {
    position: absolute; left: 0; margin-top: 0.5rem; width: 12rem; background-color: white; border-radius: 0.375rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05); padding-top: 0.25rem; padding-bottom: 0.25rem; z-index: 50; 
    min-width: 180px; 
    max-width: 90%; 
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
}
.group:hover > .profile-dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.profile-dropdown-menu a {
    display: block; padding-left: 1rem; padding-right: 1rem; padding-top: 0.5rem; padding-bottom: 0.5rem; font-size: 0.875rem; color: #4a5568; 
    transition: background-color 0.2s; 
}
.profile-dropdown-menu a:hover {
    background-color: #f7fafc; 
}

/* Notification Badge */
.notification-badge {
    animation: pulse-glow 2s infinite;
    box-shadow: 0 0 10px currentColor;
    background-color: var(--color-error);
}

/* Animations */
@keyframes pulse-glow { 0%, 100% { opacity: 1; box-shadow: 0 0 10px currentColor; } 50% { opacity: 0.7; box-shadow: 0 0 20px currentColor; } }
        
/* Mobile Specific Styles */
@media (max-width: 767px) { 
    .mobile-nav-hidden { display: none !important; }
    .mobile-nav-visible { display: flex !important; }
    .dashboard-sidebar {
        width: 100%;
        top: 0;
        right: -100%; 
        padding-top: 5rem; 
        height: 100vh;
        border-left: none; 
        box-shadow: none;
    }
    .dashboard-sidebar.open {
        right: 0;
        box-shadow: var(--shadow-xl); 
    }
    .profile-dropdown-menu {
        left: auto;
        right: 0;
    }
}
/* Mobile overlay for sidebar */
#mobile-sidebar-overlay {
    background-color: rgba(0, 0, 0, 0.5); 
    transition: opacity 0.3s ease;
}
#mobile-sidebar-overlay.opacity-0 {
    opacity: 0;
    pointer-events: none; 
}
#mobile-sidebar-overlay.opacity-50 {
    opacity: 0.5;
    pointer-events: auto; 
}
/* Style for active navigation link */
.nav-link.active {
    color: var(--color-primary) !important; 
    font-weight: bold;
    border-bottom: 2px solid var(--color-primary); 
}
/* Apply active class to submenu links too */
.submenu a.active {
    background-color: var(--color-background-body); 
    color: var(--color-primary);
    font-weight: bold;
}

/* Other general styles from previous header/dashboard */
.hero-section {
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('<?php echo BASE_URL; ?>assets/images/hero-bg.jpg') center center / cover no-repeat;
    color: white;
    padding: 8rem 0;
    text-align: center;
}
.section-card {
    background-color: var(--color-background-card); 
    border-radius: var(--radius-lg); 
    box-shadow: var(--shadow-md); 
    padding: 1.5rem; 
    text-align: center; 
    transition: transform 0.2s ease, box-shadow 0.2s ease; 
}
.section-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}
.section-card .icon {
    font-size: 3.125rem; 
    margin-bottom: 1rem; 
    color: var(--color-primary);
}
.section-card .title {
    font-size: 1.25rem; 
    font-weight: 700; 
    color: var(--color-text-primary); 
    margin-bottom: 0.5rem;
}
.section-card .description {
    color: var(--color-text-secondary); 
    font-size: 0.875rem; 
}
.btn-primary-lg {
    display: inline-block;
    padding: 1rem 2.5rem;
    font-size: 1.25rem; 
    font-weight: 700; 
    border-radius: 0.75rem; 
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-md);
    text-decoration: none; 
}
.btn-primary-lg:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.btn-ghost-lg {
    display: inline-block;
    padding: 1rem 2.5rem;
    font-size: 1.25rem; 
    font-weight: 700; 
    border-radius: 0.75rem; 
    background-color: transparent;
    border: 2px solid white;
    color: white;
    transition: background-color 0.2s ease, color 0.2s ease;
    text-decoration: none; 
}
.btn-ghost-lg:hover {
    background-color: white;
    color: var(--color-primary);
}
.feature-card {
    padding: 1.5rem; border-radius: 0.5rem; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06); /* Shadow-md */
    background-color: var(--color-background-card);
}
.feature-card .title { /* Specific title for feature-card */
    font-size: 1.25rem; font-weight: 600; color: var(--color-text-primary); margin-bottom: 0.5rem;
}
.feature-card .description { /* Specific description for feature-card */
    font-size: 0.875rem; color: var(--color-text-secondary);
}

/* Styles for dashboard modules */
.welcome-section {
    background-color: var(--color-background-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.welcome-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.05) 0%, rgba(var(--color-accent-rgb), 0.05) 100%);
    z-index: 0;
}
.welcome-section h1, .welcome-section p {
    position: relative;
    z-index: 1;
}

.tabs-navigation {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overflow-x: auto; 
}
.tabs-navigation::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex-shrink: 0;
    transition: all 0.2s ease;
    border: 1px solid var(--color-border);
}
.tab-btn.bg-blue-600 {
    border-color: var(--color-primary-dark);
    box-shadow: var(--shadow-sm);
}

.dashboard-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .dashboard-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .dashboard-content {
        grid-template-columns: repeat(3, 1fr);
    }
}

.role-dashboard {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transition: all 0.5s ease-out;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInSlideUp 0.8s ease-out forwards;
}
.role-dashboard:nth-child(1) { animation-delay: 0.1s; }
.role-dashboard:nth-child(2) { animation-delay: 0.2s; }
.role-dashboard:nth-child(3) { animation-delay: 0.3s; }
.role-dashboard:nth-child(4) { animation-delay: 0.4s; }


.stat-card-elegant {
    background-color: var(--color-background-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 90px;
}
.stat-card-elegant:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.stat-card-elegant .icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}
.stat-card-elegant .stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text-primary);
}
.stat-card-elegant .stat-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.admin-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0.9;
    transition: all 0.2s ease;
    text-decoration: none;
    background-color: rgba(255, 255, 255, 0.2);
}
.admin-action-button:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.admin-action-button-small {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--color-primary);
    transition: color 0.2s ease;
    text-decoration: none;
}
.admin-action-button-small:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}
.admin-action-button-small .material-icons-outlined {
    font-size: 0.75rem;
}

.admin-mini-card {
    padding: 1rem;
    background-color: var(--color-background-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
}
.admin-mini-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.admin-summary-card.bg-gradient-to-br.from-blue-500 { background: linear-gradient(to bottom right, #3B82F6, #1D4ED8); }
.admin-summary-card.bg-gradient-to-br.from-purple-500 { background: linear-gradient(to bottom right, #8B5CF6, #6D28D9); }
.admin-summary-card.bg-gradient-to-br.from-teal-500 { background: linear-gradient(to bottom right, #2DD4BF, #0D9488); }
.admin-summary-card.bg-gradient-to-br.from-indigo-500 { background: linear-gradient(to bottom right, #6366F1, #4F46E5); }
.admin-summary-card.bg-gradient-to-br.from-orange-500 { background: linear-gradient(to bottom right, #F97316, #EA580C); }
.admin-summary-card.bg-gradient-to-br.from-cyan-500 { background: linear-gradient(to bottom right, #06B6D4, #0891B2); }
.admin-summary-card.bg-gradient-to-br.from-emerald-500 { background: linear-gradient(to bottom right, #10B981, #059669); }
.admin-summary-card.bg-gradient-to-br.from-red-500 { background: linear-gradient(to bottom right, #EF4444, #DC2626); }
.admin-summary-card.bg-gradient-to-br.from-pink-500 { background: linear-gradient(to bottom right, #EC4899, #BE185D); }
.admin-summary-card.bg-gradient-to-br.from-gray-600 { background: linear-gradient(to bottom right, #4B5563, #1F2937); }
.admin-summary-card.bg-gradient-to-br.from-yellow-500 { background: linear-gradient(to bottom right, #F59E0B, #D97706); }


@keyframes fadeInSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInSlideUp 0.8s ease-out forwards;
}
/* Mobile overlay for sidebar */
body.mobile-menu-open {
    overflow: hidden; /* Prevent scrolling when sidebar is open */
}