@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
    --bg-body: #F3F4F6; --bg-surface: #FFFFFF; --primary: #4F46E5; --primary-hover: #4338CA;
    --text-main: #111827; --text-muted: #6B7280; --border-color: #E5E7EB;
    --danger: #EF4444; --success: #10B981;
}

[data-theme="dark"] {
    --bg-body: #111827; --bg-surface: #1F2937; --text-main: #F9FAFB; --text-muted: #9CA3AF;
    --border-color: #374151;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Cairo', sans-serif; }
body { display: flex; height: 100vh; background-color: var(--bg-body); color: var(--text-main); font-size: 14px; overflow: hidden; transition: background 0.3s, color 0.3s; }

/* Sidebar */
.sidebar { width: 260px; background: var(--bg-surface); display: flex; flex-direction: column; border-left: 1px solid var(--border-color); z-index: 10; transition: 0.3s; }
.sidebar-header { height: 64px; display: flex; align-items: center; padding: 0 20px; font-weight: 800; font-size: 18px; border-bottom: 1px solid var(--border-color); color: var(--primary); }
.sidebar-header img { height: 30px; max-width: 40px; margin-left: 10px; border-radius: 6px; object-fit: contain; }
.nav-menu { flex: 1; padding: 16px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.nav-btn { display: flex; align-items: center; padding: 12px 16px; border-radius: 8px; background: none; border: none; color: var(--text-main); font-weight: 600; cursor: pointer; text-align: right; width: 100%; transition: 0.2s; }
.nav-btn:hover { background: rgba(79, 70, 229, 0.1); }
.nav-btn.active { background: rgba(79, 70, 229, 0.1); color: var(--primary); }
.nav-btn i { margin-left: 12px; font-size: 18px; width: 20px; text-align: center; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border-color); }
.logout-btn { width: 100%; padding: 10px; border-radius: 8px; border: none; background: #FEF2F2; color: var(--danger); font-weight: 700; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px; }
.logout-btn:hover { background: var(--danger); color: white; }

/* Main Content */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.top-header { height: 64px; background: var(--bg-surface); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; padding: 0 24px; }
.user-profile { font-weight: 700; display: flex; align-items: center; gap: 12px; }
.content-body { flex: 1; padding: 24px; overflow-y: auto; }
.page-title { font-size: 22px; font-weight: 800; margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center; }

/* Tables */
.table-container { background: var(--bg-surface); border-radius: 12px; border: 1px solid var(--border-color); overflow: hidden; margin-bottom: 24px; }
.table-header { padding: 16px 24px; background: var(--bg-body); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
table { width: 100%; border-collapse: collapse; text-align: right; }
th { padding: 12px 24px; background: var(--bg-body); font-size: 13px; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border-color); }
td { padding: 16px 24px; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
tbody tr:hover td { background: rgba(0,0,0,0.02); }

/* Forms & Buttons */
.btn { padding: 8px 16px; border-radius: 8px; border: none; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; text-decoration: none; transition: 0.2s; }
.btn-primary { background: var(--primary); color: white; } .btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-info { background: #E5E7EB; color: #374151; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 700; font-size: 13px; color: var(--text-main); }
.form-control { width: 100%; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-main); outline: none; transition: 0.2s; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }

/* Modals */
.modal { display: none; position: fixed; inset: 0; background: rgba(17, 24, 39, 0.6); z-index: 10000; justify-content: center; align-items: center; }
.modal-content { background: var(--bg-surface); width: 95%; max-width: 500px; border-radius: 12px; overflow: hidden; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); display: flex; flex-direction: column; }
.modal-header { padding: 16px 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 18px; font-weight: 800; color: var(--text-main); }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 12px; background: var(--bg-body); }

/* Badges */
.badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; display: inline-block; }
.bg-green { background: #D1FAE5; color: #065F46; } .bg-red { background: #FEE2E2; color: #991B1B; }
.bg-orange { background: #FEF3C7; color: #92400E; } .bg-purple { background: #EDE9FE; color: #5B21B6; } .bg-blue { background: #DBEAFE; color: #1E40AF; }

.tab { display: none; } .tab.active { display: block; }

/* Switch Toggle */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #CBD5E1; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }

/* Mobile */
.menu-toggle { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-main); }
@media (max-width: 768px) {
    .sidebar { position: fixed; right: -260px; height: 100%; z-index: 1000; box-shadow: -5px 0 15px rgba(0,0,0,0.1); }
    .sidebar.active { right: 0; }
    .menu-toggle { display: block; }
    .content-body { padding: 16px; }
}