:root {
  --primary-color: #0d47a1;
  --secondary-color: #1976d2;
  --bg-main: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --accent-color: #f59e0b;
  --danger-color: #ef4444;
  --success-color: #10b981;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --border-radius: 8px;
  --transition: all 0.2s ease;
}

[data-theme="dark"] {
  --primary-color: #90caf9;
  --secondary-color: #42a5f5;
  --bg-main: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Outfit', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(--bg-main); color: var(--text-main); line-height: 1.6; }

/* RTL Support */
[dir="rtl"] { font-family: 'Heebo', 'Segoe UI', Tahoma, sans-serif; }
[dir="rtl"] .sidebar { right: 0; left: auto; border-right: none; border-left: 1px solid var(--border-color); }
[dir="rtl"] .main-content { margin-right: 250px; margin-left: 0; }
[dir="rtl"] .sidebar-link i { margin-left: 12px; margin-right: 0; }

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

.sidebar { width: 250px; background-color: var(--bg-sidebar); border-right: 1px solid var(--border-color); position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; transition: var(--transition); z-index: 100; }
.brand { padding: 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-color); }
.brand img { width: 40px; height: 40px; border-radius: 8px; }
.brand-text { font-weight: 700; font-size: 1.1rem; }
.nav-menu { padding: 20px 0; flex: 1; overflow-y: auto; }
.nav-link { display: flex; align-items: center; padding: 12px 20px; color: var(--text-main); text-decoration: none; transition: var(--transition); gap: 12px; font-weight: 500; }
.nav-link:hover { background-color: rgba(13, 71, 161, 0.05); color: var(--primary-color); }
[data-theme="dark"] .nav-link:hover { background-color: rgba(255, 255, 255, 0.05); }
.nav-link.active { background-color: rgba(13, 71, 161, 0.1); color: var(--primary-color); border-right: 3px solid var(--primary-color); }
[dir="rtl"] .nav-link.active { border-right: none; border-left: 3px solid var(--primary-color); }

.main-content { flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-height: 100vh; transition: var(--transition); }
.header { background-color: var(--bg-sidebar); padding: 16px 30px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 90; }
.header-actions { display: flex; align-items: center; gap: 16px; }

.btn { padding: 8px 16px; border-radius: var(--border-radius); border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main); cursor: pointer; font-family: inherit; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; transition: var(--transition); text-decoration: none; }
.btn:hover { background: var(--border-color); }
.btn-primary { background: var(--primary-color); color: #fff; border: none; }
.btn-primary:hover { background: var(--secondary-color); color: #fff; }

.content-area { padding: 30px; flex: 1; overflow-x: auto; }
.page-title { font-size: 1.8rem; margin-bottom: 24px; font-weight: 700; color: var(--text-main); }

.card { background: var(--bg-card); border-radius: var(--border-radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 24px; border: 1px solid var(--border-color); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); padding: 24px; border-radius: var(--border-radius); box-shadow: var(--shadow); border: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 8px; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary-color); }
.stat-label { color: var(--text-muted); font-weight: 500; }

table { width: 100%; border-collapse: collapse; text-align: left; }
[dir="rtl"] table { text-align: right; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); }
th { color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: none; }
tr:hover { background-color: rgba(0,0,0,0.02); }
[data-theme="dark"] tr:hover { background-color: rgba(255,255,255,0.02); }

.badge { padding: 4px 8px; border-radius: 12px; font-size: 0.8rem; font-weight: 600; }
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success-color); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--accent-color); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger-color); }
.badge-default { background: rgba(100, 116, 139, 0.1); color: var(--text-muted); }

.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user-info { display: flex; align-items: center; gap: 12px; }

.select-lang { padding: 8px; border-radius: var(--border-radius); border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main); font-family: inherit; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; margin-right: 0 !important; }
  .menu-toggle { display: block; }
}
@media (min-width: 769px) { .menu-toggle { display: none; } }
