/* Dashboard Specific CSS */
:root {
    --primary-color: #006233;
    --primary-light: #e6efea;
    --secondary-color: #FFC000;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --sidebar-width: 280px;
    
    --c-current: #3b82f6;
    --c-intermediate: #f59e0b;
    --c-historical: #10b981;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Cairo', sans-serif; background-color: var(--bg-main); color: var(--text-dark); }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

.dashboard-container { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: var(--sidebar-width); background: white; border-left: 1px solid var(--border-color); display: flex; flex-direction: column; position: fixed; top: 0; right: 0; height: 100vh; z-index: 100; transition: 0.3s; }
.sidebar-header { padding: 2rem 1.5rem; display: flex; align-items: center; gap: 15px; border-bottom: 1px solid var(--border-color); }
.sidebar-logo { height: 45px; border-radius: 8px; }
.sidebar-header h2 { font-size: 1.1rem; color: var(--primary-color); font-weight: 800; font-family: 'Tajawal', sans-serif; }

.sidebar-menu { padding: 1.5rem 1rem; flex: 1; overflow-y: auto; }
.sidebar-menu li { margin-bottom: 0.5rem; }
.sidebar-menu a { display: flex; align-items: center; gap: 15px; padding: 0.8rem 1rem; border-radius: 8px; color: var(--text-gray); font-weight: 600; transition: 0.3s; }
.sidebar-menu a i { font-size: 1.2rem; width: 24px; text-align: center; }
.sidebar-menu li.active a, .sidebar-menu a:hover { background-color: var(--primary-light); color: var(--primary-color); }

.sidebar-footer { padding: 1.5rem; border-top: 1px solid var(--border-color); }
.logout-btn { display: flex; align-items: center; gap: 10px; color: #ef4444; font-weight: 600; padding: 0.8rem 1rem; border-radius: 8px; transition: 0.3s; }
.logout-btn:hover { background-color: #fef2f2; }

/* Main Content */
.main-content { flex: 1; margin-right: var(--sidebar-width); display: flex; flex-direction: column; }

/* Topbar */
.topbar { background: white; height: 80px; padding: 0 2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 90; }
.search-bar { display: flex; align-items: center; background: var(--bg-main); padding: 0.8rem 1.5rem; border-radius: 30px; width: 400px; gap: 10px; }
.search-bar i { color: var(--text-gray); }
.search-bar input { border: none; background: transparent; width: 100%; outline: none; font-family: 'Cairo', sans-serif; }

.topbar-actions { display: flex; align-items: center; gap: 2rem; }
.notification-icon { position: relative; font-size: 1.4rem; color: var(--text-gray); cursor: pointer; }
.badge { position: absolute; top: -5px; right: -5px; background: #ef4444; color: white; font-size: 0.7rem; font-weight: bold; width: 18px; height: 18px; display: flex; justify-content: center; align-items: center; border-radius: 50%; border: 2px solid white; }
.user-profile { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.user-profile img { width: 40px; height: 40px; border-radius: 50%; }
.user-profile i { font-size: 0.8rem; color: var(--text-gray); }

/* Dashboard Content */
.dashboard-wrapper { padding: 2rem; }

.welcome-banner { background: linear-gradient(135deg, var(--primary-color) 0%, #004523 100%); border-radius: var(--radius); padding: 2rem; color: white; display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; box-shadow: var(--shadow-md); }
.welcome-text h1 { font-size: 1.8rem; margin-bottom: 0.5rem; font-family: 'Tajawal', sans-serif; }
.welcome-text p { opacity: 0.9; font-size: 1.1rem; }
.btn-primary { background: var(--secondary-color); color: var(--text-dark); border: none; padding: 0.8rem 1.5rem; border-radius: 8px; font-weight: 700; font-family: 'Cairo', sans-serif; cursor: pointer; display: flex; gap: 10px; align-items: center; transition: 0.3s; font-size: 1rem; }
.btn-primary:hover { background: #e6ad00; transform: translateY(-2px); }

/* Cards */
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); }
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { padding: 1.5rem; display: flex; align-items: center; gap: 1.5rem; }
.stat-icon { width: 60px; height: 60px; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 1.8rem; }
.stat-icon.current { background: #eff6ff; color: var(--c-current); }
.stat-icon.intermediate { background: #fffbeb; color: var(--c-intermediate); }
.stat-icon.historical { background: #ecfdf5; color: var(--c-historical); }
.stat-icon.requests { background: #fef2f2; color: #ef4444; }
.stat-info p { color: var(--text-gray); font-size: 0.95rem; font-weight: 600; margin-bottom: 0.3rem; }
.stat-info h3 { font-size: 1.8rem; color: var(--text-dark); }

/* Table */
.table-card { padding: 0; overflow: hidden; }
.card-header { padding: 1.5rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.card-header h3 { font-size: 1.2rem; margin: 0; }
.view-all { color: var(--primary-color); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: right; }
th, td { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); }
th { background: #f8fafc; color: var(--text-gray); font-weight: 600; font-size: 0.9rem; }
td { font-size: 0.95rem; font-weight: 500; }
tbody tr:hover { background: #f8fafc; }

/* Tags & Status */
.tag { padding: 0.3rem 0.8rem; border-radius: 20px; font-size: 0.8rem; font-weight: 700; }
.tag-current { background: #eff6ff; color: var(--c-current); }
.tag-intermediate { background: #fffbeb; color: var(--c-intermediate); }
.tag-historical { background: #ecfdf5; color: var(--c-historical); }

.status { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 600; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; }
.status-processing::before { background: var(--c-current); }
.status-pending::before { background: var(--c-intermediate); }
.status-archived::before { background: var(--c-historical); }

.action-btn { width: 32px; height: 32px; border-radius: 6px; border: none; cursor: pointer; display: inline-flex; justify-content: center; align-items: center; margin-left: 5px; transition: 0.2s; }
.action-btn.view { background: #eff6ff; color: var(--c-current); }
.action-btn.view:hover { background: var(--c-current); color: white; }
.action-btn.edit { background: #f1f5f9; color: var(--text-gray); }
.action-btn.edit:hover { background: var(--text-dark); color: white; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(100%); }
    .main-content { margin-right: 0; }
    .welcome-banner { flex-direction: column; align-items: flex-start; gap: 1.5rem; }
}


/* Floating Back Button */
.floating-back-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--c-gold, #FFC000);
    color: var(--c-green-dark, #004523);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 9999;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    cursor: pointer;
}
.floating-back-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
    color: white;
    background-color: var(--c-green-main, #006233);
}
html[dir="ltr"] .floating-back-btn {
    right: auto;
    left: 30px;
}
html[dir="ltr"] .rtl-arrow {
    transform: scaleX(-1);
}
@media (max-width: 768px) {
    .floating-back-btn { bottom: 20px; right: 20px; width: 45px; height: 45px; font-size: 1.2rem; }
    html[dir="ltr"] .floating-back-btn { left: 20px; right: auto; }
}


/* Comprehensive Mobile Adjustments for Dashboard */
@media (max-width: 768px) {
    .dashboard-container { flex-direction: column; height: auto; min-height: 100vh; }
    .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--c-border); display: flex; flex-direction: column; }
    .sidebar-menu { display: flex; overflow-x: auto; padding-bottom: 10px; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .sidebar-menu li { display: inline-block; }
    .sidebar-menu a { padding: 10px; }
    .sidebar-menu a span { display: none; } /* Hide text, show icons only on very small screens, or keep text if there's space */
    .sidebar-footer { position: static; border-top: none; padding: 10px 20px; }
    
    .topbar { flex-direction: column; gap: 15px; text-align: center; }
    .topbar-actions { width: 100%; justify-content: center; }
    .search-bar { width: 100%; }
    
    .dashboard-wrapper { padding: 15px; }
    .stat-cards, .archive-grid { grid-template-columns: 1fr; }
    
    .table-responsive { overflow-x: auto; }
}
