/* =============================================
   أكاديمية الأبطال - Design System
   Mobile-First | RTL/LTR | Dark/Light Mode
   ============================================= */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
  /* Brand Colors */
  --primary: #1B4FD8;
  --primary-dark: #1440B8;
  --primary-light: #3B6FFF;
  --primary-glow: rgba(27,79,216,0.18);

  --secondary: #F59E0B;
  --secondary-dark: #D97706;
  --secondary-light: #FDE68A;

  --accent: #10B981;
  --accent-dark: #059669;

  --danger: #EF4444;
  --warning: #F59E0B;
  --success: #10B981;
  --info: #3B82F6;

  /* Light Mode */
  --bg: #F0F4FF;
  --bg-card: #FFFFFF;
  --bg-sidebar: #0F2057;
  --bg-topbar: #FFFFFF;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-sidebar: rgba(255,255,255,0.85);
  --border: #E2E8F0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 20px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --input-bg: #F8FAFF;
  --input-border: #CBD5E1;

  /* Spacing */
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --bg: #0A0F1E;
  --bg-card: #111827;
  --bg-sidebar: #060B14;
  --bg-topbar: #111827;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #475569;
  --border: #1E293B;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 20px rgba(0,0,0,0.2);
  --input-bg: #1E293B;
  --input-border: #334155;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Cairo', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0;
  right: 0;
  left: auto;
  z-index: 100;
  transition: transform var(--transition), width var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-logo {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
}
.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.sidebar-logo-text h2 {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}
.sidebar-logo-text span {
  color: var(--secondary);
  font-size: 11px;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-section-label {
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.nav-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(27,79,216,0.35);
}
.nav-item .nav-icon { font-size: 18px; width: 26px; flex-shrink: 0; text-align: center; display: inline-block; overflow: visible; }
.nav-badge {
  margin-inline-start: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user:hover { background: rgba(255,255,255,0.08); }
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-info h4 { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user-info span { color: rgba(255,255,255,0.5); font-size: 11px; }

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-w);
  margin-left: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-toggle {
  display: none;
  font-size: 22px;
  color: var(--text-secondary);
  padding: 4px;
}
.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
  background: var(--bg);
  cursor: pointer;
}
.topbar-btn:hover { background: var(--primary-glow); color: var(--primary); }
.notif-dot {
  position: absolute;
  top: 7px;
  inset-inline-end: 7px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-topbar);
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-header p { color: var(--text-secondary); font-size: 14px; margin-top: 2px; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); }

/* ── Stats Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.stat-icon.blue { background: rgba(27,79,216,0.12); }
.stat-icon.green { background: rgba(16,185,129,0.12); }
.stat-icon.amber { background: rgba(245,158,11,0.12); }
.stat-icon.red { background: rgba(239,68,68,0.12); }
.stat-icon.purple { background: rgba(139,92,246,0.12); }
.stat-icon.teal { background: rgba(20,184,166,0.12); }
.stat-info h2 { font-size: 26px; font-weight: 800; line-height: 1; }
.stat-info p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.stat-change { font-size: 12px; margin-top: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(27,79,216,0.35); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: var(--secondary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: var(--accent-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-icon { width: 38px; height: 38px; padding: 0; justify-content: center; font-size: 18px; border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 11px 14px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { appearance: none; cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ── Tables ── */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { border-bottom: 2px solid var(--border); }
th {
  padding: 12px 16px;
  text-align: start;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg); }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: rgba(16,185,129,0.12); color: #059669; }
.badge-danger { background: rgba(239,68,68,0.12); color: #DC2626; }
.badge-warning { background: rgba(245,158,11,0.12); color: #D97706; }
.badge-secondary { background: rgba(71,85,105,0.1); color: #475569; }
.badge-info { background: rgba(59,130,246,0.12); color: #2563EB; }
.badge-primary { background: rgba(27,79,216,0.12); color: var(--primary); }
.badge-beginner { background: rgba(16,185,129,0.12); color: #059669; }
.badge-intermediate { background: rgba(245,158,11,0.12); color: #D97706; }
.badge-advanced { background: rgba(139,92,246,0.12); color: #7C3AED; }

/* ── Avatar ── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.avatar-xl { width: 80px; height: 80px; font-size: 32px; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: rgba(16,185,129,0.1); color: #059669; border-inline-start: 3px solid #059669; }
.alert-danger { background: rgba(239,68,68,0.1); color: #DC2626; border-inline-start: 3px solid #DC2626; }
.alert-warning { background: rgba(245,158,11,0.1); color: #D97706; border-inline-start: 3px solid #D97706; }
.alert-info { background: rgba(59,130,246,0.1); color: #2563EB; border-inline-start: 3px solid #2563EB; }

/* ── Stars ── */
.stars { display: inline-flex; gap: 2px; }
.star { font-size: 18px; color: #CBD5E1; }
.star.filled { color: #F59E0B; }

/* ── Attendance Buttons ── */
.att-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  font-family: inherit;
}
.att-btn.present { background: rgba(16,185,129,0.1); color: #059669; border-color: rgba(16,185,129,0.2); }
.att-btn.present.active, .att-btn.present:hover { background: var(--success); color: #fff; border-color: var(--success); }
.att-btn.absent { background: rgba(239,68,68,0.1); color: #DC2626; border-color: rgba(239,68,68,0.2); }
.att-btn.absent.active, .att-btn.absent:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.att-btn.late { background: rgba(245,158,11,0.1); color: #D97706; border-color: rgba(245,158,11,0.2); }
.att-btn.late.active, .att-btn.late:hover { background: var(--warning); color: #fff; border-color: var(--warning); }

/* ── Child Card ── */
.child-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform var(--transition), box-shadow var(--transition);
}
.child-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.child-card-header { display: flex; align-items: center; gap: 12px; }
.child-card-info h3 { font-size: 16px; font-weight: 700; }
.child-card-info p { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.child-card-stats { display: flex; gap: 16px; }
.child-stat { text-align: center; }
.child-stat h4 { font-size: 18px; font-weight: 800; color: var(--primary); }
.child-stat p { font-size: 11px; color: var(--text-muted); }
.child-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Progress Bar ── */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.6s ease;
}
.progress-bar-fill.green { background: var(--success); }
.progress-bar-fill.amber { background: var(--warning); }
.progress-bar-fill.red { background: var(--danger); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { color: var(--text-muted); font-size: 22px; transition: color var(--transition); }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Notification Dropdown ── */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: 340px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 300;
  overflow: hidden;
  animation: slideDown 0.2s ease;
}
.notif-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-header h4 { font-size: 15px; font-weight: 700; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  transition: background var(--transition);
  cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-glow); }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.notif-content h5 { font-size: 13px; font-weight: 600; }
.notif-content p { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── Dropdown ── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 200;
  overflow: hidden;
  animation: slideDown 0.15s ease;
  display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}
.empty-state-icon { font-size: 56px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 300px; margin: 0 auto 20px; }

/* ── Session Card ── */
.session-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--primary);
  transition: transform var(--transition);
}
.session-card:hover { transform: translateY(-1px); }
.session-card.completed { border-inline-start-color: var(--success); }
.session-card.cancelled { border-inline-start-color: var(--danger); opacity: 0.7; }
.session-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.session-card-title { font-size: 15px; font-weight: 700; }
.session-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.session-meta-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Loader ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Search Box ── */
.search-box { position: relative; }
.search-box .form-control { padding-inline-start: 40px; }
.search-box::before { content: '🔍'; position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); font-size: 16px; pointer-events: none; }

/* ── Gamification ── */
.points-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--secondary-light);
  color: var(--secondary-dark);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
}
.trophy-row { display: flex; gap: 6px; flex-wrap: wrap; }
.trophy { font-size: 20px; cursor: pointer; }

/* ── Invoice Print ── */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin: 0 !important; }
  .page-content { padding: 0; }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(110%);
    width: 270px;
    right: 0;
    left: auto;
    z-index: 9999;
    transition: transform 0.3s ease !important;
  }
  .sidebar.open {
    transform: translateX(0) !important;
    box-shadow: -4px 0 30px rgba(0,0,0,0.3);
  }
  .main-content { margin-right: 0 !important; margin-left: 0 !important; }
  .topbar-toggle { display: flex; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .modal { max-height: 95vh; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .notif-dropdown { width: calc(100vw - 32px); }
}

/* ── RTL Specific ── */


/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Utilities ── */
.text-center { text-align: center; }
.text-start { text-align: start; }
.text-end { text-align: end; }
.text-muted { color: var(--text-secondary); }
.text-small { font-size: 13px; }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
  display: none;
}
.overlay-backdrop.open { display: block; }

/* ── User dropdown ── */
.sidebar-footer { position: relative; }
#userMenu {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.2);
  overflow: hidden;
  z-index: 9999;
}
.lang-switcher {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  margin-bottom: 4px;
}
.lang-btn {
  flex: 1; text-align: center;
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 12px; font-weight: 700;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.06);
  text-decoration: none;
  transition: all 0.2s;
}
.lang-btn:hover  { background: rgba(255,255,255,0.12); color: #fff; }
.lang-btn.active { background: var(--primary); color: #fff; }

/* ── Laptop responsive ── */
@media (max-width: 1280px) {
  :root { --sidebar-w: 240px; }
  .nav-item { font-size: 13px; }
}
@media (max-width: 1024px) {
  :root { --sidebar-w: 210px; }
  .nav-item { font-size: 13px; padding: 9px 10px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-title { font-size: 14px; }
}