:root {
  /* Brand */
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #ecfdf5;
  --primary-mid: #a7f3d0;
  --accent: #6366f1;
  --accent-light: #eef2ff;
  --accent-dark: #4f46e5;
  /* Status */
  --red: #ef4444;
  --red-light: #fff1f2;
  --amber: #f59e0b;
  --amber-light: #fffbeb;
  --blue: #3b82f6;
  --blue-light: #eff6ff;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  /* Gray scale */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  /* Surface */
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: rgba(0, 0, 0, 0.07);
  /* Layout */
  --sidebar-w: 265px;
  --topbar-h: 62px;
  /* Radius */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.05), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05);
  /* Transition */
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--gray-800);
  overflow: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SIDEBAR ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.sidebar {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: -2px 0 20px rgba(0, 0, 0, 0.04);
}

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 11px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.logo-icon svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.logo-text h1 {
  font-size: 17px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.logo-text p {
  font-size: 10.5px;
  color: var(--gray-400);
  margin-top: 3px;
  font-weight: 500;
}

.sidebar-section {
  padding: 14px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-400);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 2px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gray-500);
  transition: all var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--gray-50);
  color: var(--gray-800);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  background: var(--primary);
  border-radius: 3px 0 0 3px;
}

.nav-item .ni {
  width: 17px;
  height: 17px;
  opacity: .65;
  flex-shrink: 0;
  transition: opacity var(--transition);
}

.nav-item:hover .ni {
  opacity: .85;
}

.nav-item.active .ni {
  opacity: 1;
}

.nav-badge {
  margin-right: auto;
  background: var(--primary);
  color: white;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 700;
}

.nav-badge.red {
  background: var(--red);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  border-top: 1px solid var(--gray-100);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.user-card:hover {
  background: var(--gray-50);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-800);
}

.user-role {
  font-size: 11px;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 500;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ MAIN LAYOUT ━━━━━━━━━━━━━━━━━━━━━━━━━ */
.main {
  margin-right: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

.topbar-sub {
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 400;
  margin-right: 6px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BUTTONS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.tb-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.tb-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.tb-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: none;
}

.tb-btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.tb-btn.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #047857);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.tb-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}


.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ VIEW PANELS ━━━━━━━━━━━━━━━━━━━━━━━━━ */
.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeInUp 0.25s ease both;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ DASHBOARD ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.metric-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
}

.metric-card.green::before {
  background: var(--primary);
}

.metric-card.red::before {
  background: var(--red);
}

.metric-card.amber::before {
  background: var(--amber);
}

.metric-card.blue::before {
  background: var(--blue);
}

.metric-card.purple::before {
  background: var(--purple);
}

.metric-label {
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.metric-val {
  font-size: 30px;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.metric-pct {
  font-size: 12px;
  margin-top: 5px;
  font-weight: 600;
}

.metric-card.green .metric-pct {
  color: var(--primary);
}

.metric-card.red .metric-pct {
  color: var(--red);
}

.metric-card.amber .metric-pct {
  color: var(--amber);
}

.metric-card.blue .metric-pct {
  color: var(--blue);
}

.metric-card.purple .metric-pct {
  color: var(--purple);
}

.m-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.m-icon svg {
  width: 18px;
  height: 18px;
}

.mline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.m-val {
  font-size: 30px;
  font-weight: 800;
  color: var(--gray-900);
}

.m-title {
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 600;
}

.metric-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  opacity: .06;
  font-size: 42px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 15px 18px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
  flex: 1;
}

.card-body {
  padding: 16px 18px;
}

/* mini bar chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.bar-fill {
  width: 100%;
  border-radius: 6px 6px 0 0;
  background: var(--primary-mid);
  transition: height .5s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 4px;
}

.bar-fill.today {
  background: var(--primary);
}

.bar-lbl {
  font-size: 10px;
  color: var(--gray-400);
}

.bar-val {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-600);
}

/* donut */
.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.donut-labels {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dl-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}

.dl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dl-name {
  flex: 1;
  color: var(--gray-600);
}

.dl-val {
  font-weight: 700;
  color: var(--gray-800);
}

/* recent activity */
.activity-list {
  display: flex;
  flex-direction: column;
}

.act-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}

.act-item:last-child {
  border-bottom: none;
}

.act-ava {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.act-info {
  flex: 1;
  min-width: 0;
}

.act-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
}

.act-desc {
  font-size: 11px;
  color: var(--gray-400);
}

.act-time {
  font-size: 11px;
  color: var(--gray-400);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge.present {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.badge.absent {
  background: var(--red-light);
  color: var(--red);
}

.badge.late {
  background: var(--amber-light);
  color: #92400e;
}

.badge.excused {
  background: var(--blue-light);
  color: #1d4ed8;
}

.badge.remote {
  background: var(--purple-light);
  color: #6d28d9;
}

.badge.gray {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ATTENDANCE ━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.att-toolbar {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.search-wrap input {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 9px 12px 9px 36px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  background: var(--gray-50);
  transition: all var(--transition);
}

.search-wrap input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .12);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
}

.filter-tabs {
  display: flex;
  gap: 4px;
}

.ftab {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--gray-200);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}

.ftab:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.ftab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.att-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.att-stat {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.att-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.att-stat.active-filter {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .15);
}

.att-stat-num {
  font-size: 18px;
  font-weight: 800;
}

.att-stat-lbl {
  font-size: 10px;
  color: var(--gray-400);
  font-weight: 500;
  margin-top: 1px;
}

.as-present .att-stat-num {
  color: var(--primary);
}

.as-absent .att-stat-num {
  color: var(--red);
}

.as-late .att-stat-num {
  color: var(--amber);
}

.as-excused .att-stat-num {
  color: var(--blue);
}

.as-remote .att-stat-num {
  color: var(--purple);
}

.students-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.student-row {
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.student-row:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.student-row.s-present {
  border-right: 3px solid var(--primary);
}

.student-row.s-absent {
  border-right: 3px solid var(--red);
}

.student-row.s-late {
  border-right: 3px solid var(--amber);
}

.student-row.s-excused {
  border-right: 3px solid var(--blue);
}

.student-row.s-remote {
  border-right: 3px solid var(--purple);
}

.s-num {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 600;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.s-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--gray-100);
  color: var(--gray-500);
}

.s-avatar.p {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.s-avatar.a {
  background: var(--red-light);
  color: var(--red);
}

.s-avatar.l {
  background: var(--amber-light);
  color: #92400e;
}

.s-avatar.e {
  background: var(--blue-light);
  color: #1d4ed8;
}

.s-avatar.r {
  background: var(--purple-light);
  color: #6d28d9;
}

.s-info {
  flex: 1;
  min-width: 0;
}

.s-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-800);
}

.s-meta {
  font-size: 11px;
  color: var(--gray-400);
}

.s-actions {
  display: flex;
  gap: 5px;
}

.s-pill {
  padding: 5px 11px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-200);
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  white-space: nowrap;
}

.s-pill:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

.s-pill.sp {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.s-pill.sa {
  background: var(--red);
  color: white;
  border-color: var(--red);
}

.s-pill.sl {
  background: var(--amber);
  color: white;
  border-color: var(--amber);
}

.s-pill.se {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.s-pill.sr {
  background: var(--purple);
  color: white;
  border-color: var(--purple);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ GRADES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.grades-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.grade-select {
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  outline: none;
  cursor: pointer;
  color: var(--gray-700);
  transition: border-color var(--transition);
  box-shadow: var(--shadow-sm);
}

.grade-select:focus {
  border-color: var(--primary);
}

.grades-table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.grades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.grades-table th {
  background: var(--gray-50);
  padding: 11px 14px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  border-bottom: 1.5px solid var(--gray-200);
}

.grades-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.grades-table tr:last-child td {
  border-bottom: none;
}

.grades-table tr:hover td {
  background: var(--gray-50);
}

.grade-input {
  width: 60px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  padding: 5px 8px;
  text-align: center;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: all var(--transition);
}

.grade-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .12);
}

.grade-total {
  font-weight: 800;
  color: var(--gray-800);
}

.grade-level {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.gl-a {
  background: #dcfce7;
  color: #166534;
}

.gl-b {
  background: #dbeafe;
  color: #1e40af;
}

.gl-c {
  background: #fef9c3;
  color: #854d0e;
}

.gl-d {
  background: #fee2e2;
  color: #991b1b;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ CLASSES GRID ━━━━━━━━━━━━━━━━━━━━━━━━ */
.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.class-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.class-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.class-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.class-grade {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 600;
  margin-bottom: 4px;
}

.class-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 14px;
}

.class-meta {
  display: flex;
  gap: 12px;
}

.cm-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cm-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

.cm-lbl {
  font-size: 10px;
  color: var(--gray-400);
  font-weight: 500;
}

.class-add-btn {
  background: var(--gray-50);
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--gray-400);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition);
  min-height: 140px;
}

.class-add-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.plus-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px dashed currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ REPORTS VIEW ━━━━━━━━━━━━━━━━━━━━━━━━ */
.report-center {
  display: flex;
  gap: 18px;
  align-items: stretch;
  height: calc(100vh - 155px);
}

.report-sidebar {
  width: 260px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.rs-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-600);
  transition: all var(--transition);
  background: var(--gray-50);
}

.rs-item:hover {
  background: var(--surface);
  border-color: var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.rs-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(16, 185, 129, .15);
}

.rs-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.ri-green {
  background: #dcfce7;
  color: #166534;
}

.ri-blue {
  background: #dbeafe;
  color: #1e40af;
}

.ri-amber {
  background: #fef9c3;
  color: #854d0e;
}

.ri-red {
  background: #fee2e2;
  color: #991b1b;
}

.report-preview-pane {
  flex: 1;
  min-width: 0;
  background: var(--gray-200);
  border-radius: var(--radius);
  border: 1px solid var(--gray-300);
  overflow-x: auto;
  overflow-y: auto;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  box-shadow: inset 0 2px 15px rgba(0, 0, 0, 0.05);
}

/* A4 Print container replicating word/pdf look */
.a4-wrapper {
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: center;
  width: 100%;
}

.a4-container,
.a4-page {
  background: #fff;
  width: 21cm;
  min-height: 29.7cm;
  padding: 1cm 1.5cm;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  font-family: 'Cairo', 'Arial', sans-serif;
  color: #000;
  margin: 0 auto;
  line-height: 1.6;
  position: relative;
}

.a4-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #1e293b;
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.a4-header-center {
  text-align: center;
  flex: 1;
}

.a4-header h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 5px;
  color: #0f172a;
}

.a4-header p {
  font-size: 14px;
  color: #475569;
}

.a4-title {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  text-decoration: underline;
  margin-bottom: 25px;
  color: #1e293b;
}

.a4-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
  font-size: 12px;
  table-layout: fixed;
  word-wrap: break-word;
}

.a4-table th,
.a4-table td {
  border: 1px solid #94a3b8;
  padding: 6px 8px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.a4-table th {
  background: #f1f5f9;
  font-weight: 700;
  color: #1e293b;
}

.a4-table tr:nth-child(even) {
  background: #f8fafc;
}

.a4-signatures {
  display: flex;
  justify-content: space-around;
  margin-top: 60px;
  font-size: 16px;
  font-weight: 600;
  color: #334155;
}

.a4-signatures div {
  text-align: center;
}

.a4-signatures .sig-line {
  width: 150px;
  border-bottom: 1px dashed #64748b;
  margin-top: 40px;
}

@media(max-width:900px) {
  .report-center {
    flex-direction: column;
    height: auto;
  }

  .report-sidebar {
    width: 100%;
    max-height: 250px;
  }

  .report-preview-pane {
    padding: 10px;
  }

  .a4-container {
    width: 100%;
    padding: 15px;
    min-height: auto;
    font-size: 12px;
  }
}

/* ── Print Overrides ── */
@media print {
  @page {
    margin: 0;
    size: A4;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  body * {
    visibility: hidden;
  }

  #a4-print-area,
  #a4-print-area * {
    visibility: visible;
  }

  #a4-print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 210mm !important;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    transform: none !important;
  }

  .a4-wrapper {
    gap: 0 !important;
    width: 210mm !important;
  }

  .a4-page, .a4-container {
    direction: rtl;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    page-break-after: always;
    width: 210mm !important;
    min-height: 297mm !important;
    border-radius: 0 !important;
    padding: 15mm 20mm !important;
    box-sizing: border-box !important;
  }

  .a4-page:last-child, .a4-container:last-child {
    page-break-after: auto;
  }

  /* Hide UI Elements completely to avoid breaking layout */
  .sidebar,
  .topbar,
  .mobile-overlay,
  .login-screen,
  #view-dashboard,
  #view-settings,
  #view-accounts,
  .report-sidebar,
  .toast-container,
  .modal-overlay,
  .report-filters {
    display: none !important;
  }

  body {
    background: #fff !important;
  }

  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
  }

  @page {
    margin: 0;
    size: A4 portrait;
  }
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SETTINGS ━━━━━━━━━━━━━━━━━━━━━━━━━ */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.setting-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.setting-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-800);
}

.setting-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.setting-label {
  flex: 1;
  font-size: 13px;
  color: var(--gray-700);
  font-weight: 500;
}

.setting-sub {
  font-size: 11px;
  color: var(--gray-400);
  display: block;
  margin-top: 2px;
}

.toggle {
  position: relative;
  width: 42px;
  height: 23px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: var(--gray-200);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
}

.slider:before {
  content: '';
  position: absolute;
  width: 17px;
  height: 17px;
  right: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: all var(--transition);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}

.toggle input:checked+.slider {
  background: var(--primary);
}

.toggle input:checked+.slider:before {
  transform: translateX(-19px);
}

.setting-input {
  flex: 1;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}

.setting-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .1);
}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ MODAL ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 480px;
  max-width: 95vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--border);
  margin: auto;
}

.modal-overlay.open .modal {
  transform: none;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--gray-900);
  flex: 1;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--gray-100);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--gray-500);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-700);
}

.form-input {
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
  background: var(--surface);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .12);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ TOAST ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.toast-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--gray-900);
  color: white;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.toast.success {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.toast.error {
  background: linear-gradient(135deg, var(--red), #b91c1c);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Progress bar */
.progress-bar-wrap {
  height: 6px;
  background: var(--gray-100);
  border-radius: 20px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 20px;
  transition: width 0.5s ease;
}

/* Scrollbar */
.content::-webkit-scrollbar,
.students-grid-wrap::-webkit-scrollbar {
  width: 5px;
}

.content::-webkit-scrollbar-thumb,
.students-grid-wrap::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 10px;
}

.content::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

.students-grid-wrap {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 320px);
}

/* Bulk actions bar */
.bulk-bar {
  background: var(--gray-900);
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  animation: slideIn 0.2s ease;
  box-shadow: var(--shadow);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.bulk-bar span {
  font-size: 13px;
  flex: 1;
  font-weight: 500;
}

.bulk-pill {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: transparent;
  color: white;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  font-weight: 600;
}

.bulk-pill:hover {
  background: rgba(255, 255, 255, .15);
}

.bulk-pill.bp {
  background: var(--primary);
  border-color: var(--primary);
}

.bulk-pill.ba {
  background: var(--red);
  border-color: var(--red);
}

.donut-svg {
  width: 110px;
  height: 110px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ RESPONSIVE ━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media(max-width: 900px) {
  .sidebar {
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.open {
    transform: none;
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.12);
  }

  .main {
    margin-right: 0;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .att-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .report-center {
    flex-direction: column;
    height: auto;
  }

  .report-sidebar {
    width: 100%;
    max-height: 250px;
  }

  .report-preview-pane {
    padding: 10px;
  }
}

/* Login overlay */
body.app-locked {
  overflow: hidden;
}

body.app-locked .sidebar,
body.app-locked .main-content {
  filter: blur(12px) grayscale(50%);
  opacity: 0.2;
  pointer-events: none;
  transition: all 0.3s ease;
}

body .sidebar,
body .main-content {
  transition: all 0.3s ease;
  filter: blur(0);
  opacity: 1;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0f172a;
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  transition: opacity 0.6s ease, visibility 0.6s;
  overflow: hidden;
}

body.app-locked .login-screen {
  display: flex;
}

.login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml;utf8,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><circle cx="30" cy="30" r="1" fill="%23ffffff" opacity="0.05"/></svg>') repeat;
  z-index: 1;
}

.login-screen::after {
  content: '';
  position: absolute;
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 60%);
  bottom: -400px;
  left: -200px;
  z-index: 1;
  animation: pulseLogin 8s ease-in-out infinite alternate;
}

@keyframes pulseLogin {
  0% { transform: scale(1) translate(0, 0); opacity: 0.8; }
  100% { transform: scale(1.1) translate(20px, -20px); opacity: 1; }
}

.login-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 920px;
  animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(32px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.login-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  padding: 14px 22px;
  border-radius: 16px;
  margin-bottom: 18px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

/* اسم المنصة في شاشة الدخول */
.login-platform-name {
  display: flex;
  align-items: center;
  gap: 12px;
  direction: rtl;
}

.login-platform-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* ثيم swatches */
.login-theme-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  position: relative;
  flex-shrink: 0;
}

.login-theme-swatch:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

.login-theme-swatch.active-swatch {
  border-color: var(--gray-900);
  transform: scale(1.12);
}

.login-theme-swatch.active-swatch::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* بطاقة البنر في قائمة الإعلانات */
.banner-list-item {
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}

.banner-list-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.1);
}

.banner-list-item .b-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}

.banner-list-item .b-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-list-item .b-info {
  flex: 1;
  min-width: 0;
}

.banner-list-item .b-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner-list-item .b-desc {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner-list-item .b-type {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary-dark);
  flex-shrink: 0;
}

.banner-list-item .b-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.banner-list-item .b-actions button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.15s;
}

.banner-list-item .b-actions button:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}

.banner-list-item .b-actions button.del-btn:hover {
  background: #fef2f2;
  border-color: #fecaca;
}

.login-body {
  display: flex;
  gap: 24px;
  height: 520px;
  flex-direction: row-reverse;
  /* Reverses DOM order. Since DOM is L-pane(Banner) then R-pane(Form), row-reverse makes Banner go to the Right and Form go to the Left! */
}

.login-left-pane {
  flex: 1.3;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 24px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.login-carousel-wrapper {
  width: 100%;
  position: relative;
  z-index: 2;
  display: flex;
  gap: 20px;
  transition: transform 0.5s ease;
}

.l-slide {
  min-width: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* شريحة صورة في البنر تملأ المساحة بالكامل */
.l-slide-image {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.l-slide-image img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: block;
}

.l-slide-image p {
  font-size: 13px;
  color: var(--gray-500);
  text-align: center;
  margin: 0;
}

.l-slide h3 {
  font-size: 24px;
  color: var(--primary-dark);
  font-weight: 800;
  margin: 20px 0 10px;
}

.l-slide p {
  color: var(--gray-500);
  font-size: 14px;
  line-height: 1.6;
}

.svg-graphic {
  height: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.svg-graphic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  /* إيقاف الاهتزاز على الصور */
  animation: none !important;
}

/* SVG \u0627\u0644\u062e\u0627\u0635\u0629 \u0628\u0627\u0644\u0628\u0646\u0631\u0627\u062a \u0627\u0644\u0646\u0635\u064a\u0629 \u062a\u062d\u0627\u0641\u0638 \u0639\u0644\u0649 \u0627\u0644\u062d\u0631\u0643\u0629 \u0648\u0627\u0644\u062a\u0641\u064a\u0626 */
.svg-graphic svg {
  height: 100%;
  animation: floatY 6s ease-in-out infinite;
  filter: drop-shadow(0 15px 15px rgba(22, 101, 52, 0.15));
}

@keyframes floatY {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-15px);
  }
}

.ornament-dots {
  position: absolute;
  bottom: -30px;
  left: -30px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, #dcfce7 2px, transparent 2px);
  background-size: 20px 20px;
  opacity: 0.5;
  border-radius: 50%;
}

.login-right-pane {
  flex: 1;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  padding: 50px 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 320px;
}

.floating-input-group {
  position: relative;
  width: 100%;
}

.floating-input {
  width: 100%;
  background: var(--header-bg);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 22px 16px 10px 16px;
  font-size: 15px;
  color: var(--gray-800);
  outline: none;
  transition: all 0.3s ease;
  font-family: inherit;
  font-weight: 600;
}

.floating-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px var(--primary-light);
}

.floating-label {
  position: absolute;
  right: 16px;
  top: 18px;
  font-size: 14px;
  color: var(--gray-500);
  pointer-events: none;
  transition: all 0.2s ease;
}

.floating-input:focus~.floating-label,
.floating-input:not(:placeholder-shown)~.floating-label {
  top: 6px;
  font-size: 11px;
  color: var(--primary);
  font-weight: 700;
}

.login-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 56px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.login-btn:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.spin-svg {
  width: 24px;
  height: 24px;
  animation: rotate 2s linear infinite;
}

.spin-svg .path {
  stroke: #fff;
  stroke-linecap: round;
  animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes dash {
  0% {
    stroke-dasharray: 1, 150;
    stroke-dashoffset: 0;
  }

  50% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -35;
  }

  100% {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -124;
  }
}

@keyframes loginShake {

  0%,
  100% {
    transform: translateX(0);
  }

  15% {
    transform: translateX(-8px);
  }

  30% {
    transform: translateX(8px);
  }

  45% {
    transform: translateX(-6px);
  }

  60% {
    transform: translateX(6px);
  }

  75% {
    transform: translateX(-3px);
  }

  90% {
    transform: translateX(3px);
  }
}

/* Mobile Overlay */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.mobile-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Fully Responsive Breakpoints */
@media(max-width: 1024px) {

  /* Tablet Adjustments */
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .login-container {
    width: 90%;
    max-width: 800px;
  }

  .a4-container {
    transform: scale(0.9);
    transform-origin: top center;
    margin-bottom: -10%;
  }
}

@media(max-width: 768px) {
  .login-body {
    flex-direction: column-reverse;
    height: auto;
    gap: 15px;
  }

  .login-left-pane {
    padding: 30px;
  }

  .login-right-pane {
    padding: 38px 24px;
    box-shadow: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    transform: translateX(100%);
    z-index: 100;
    width: 260px;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.15);
  }

  .a4-container,
  .a4-page {
    transform: scale(0.75);
    transform-origin: top center;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 10px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media(max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 8px 15px;
    justify-content: space-between;
  }

  .students-grid {
    min-width: 500px;
  }

  .students-grid-wrap {
    overflow-x: auto;
  }

  .tb-btn {
    min-height: 44px;
  }

  .a4-container,
  .a4-page {
    transform: scale(0.55);
    transform-origin: top center;
  }

  .att-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Topbar hamburger */
.topbar .menu-toggle {
  display: none;
  margin-left: 8px;
  background: transparent;
  border: none;
  font-size: 18px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--gray-600);
  transition: all var(--transition);
}

.topbar .menu-toggle:hover {
  background: var(--gray-100);
}

@media(max-width: 900px) {
  .topbar .menu-toggle {
    display: inline-flex;
  }
}

/* ━━━━━━━━━━━━ NEW STUDENT CARD UI ━━━━━━━━━━━━ */
.students-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
  padding: 10px 0;
}
.student-card-modern {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  position: relative;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.student-card-modern:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
  border-color: var(--primary-light);
}
.class-action-btn {
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--gray-400);
  width: 32px;
  height: 32px;
}
.class-action-btn:hover {
  transform: scale(1.15);
}
.class-action-btn.archive:hover {
  color: #3b82f6;
  background: #eff6ff;
}
.class-action-btn.delete:hover {
  color: #ef4444;
  background: #fef2f2;
}
.s-card-num {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--bg-color);
  color: var(--gray-500);
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.s-card-avatar {
  width: 65px; height: 65px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff;
  position: relative;
  box-shadow: inset 0 0 0 5px rgba(255,255,255,0.5);
}
/* Avatar Patterns */
.av-yellow { background: repeating-linear-gradient(45deg, #fcd34d, #fcd34d 6px, #fef08a 6px, #fef08a 12px); color: #b45309; }
.av-orange { background: repeating-linear-gradient(-45deg, #fb923c, #fb923c 6px, #fdba74 6px, #fdba74 12px); color: #7c2d12; }
.av-red    { background: radial-gradient(circle, #fca5a5 15%, #fee2e2 16%); background-size: 12px 12px; color: #991b1b; }
.av-green  { background: radial-gradient(circle, #86efac 15%, #dcfce7 16%); background-size: 14px 14px; color: #166534; }

.s-card-badge {
  position: absolute; bottom: 0; right: -5px;
  width: 24px; height: 24px;
  border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  font-size: 11px;
}
.s-badge-orange { color: #f59e0b; }
.s-badge-blue { color: #3b82f6; }

.s-card-name { font-size: 14px; font-weight: 700; color: var(--gray-800); margin-top: 4px; }
.s-card-score {
  background: var(--bg-color);
  padding: 4px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 800; color: #eab308;
  display: flex; align-items: center; gap: 6px;
}

/* ━━━━━━━━━━━━ NEW STUDENT MODAL UI ━━━━━━━━━━━━ */
.m-top-bg { background: #dcfce7; padding: 25px; border-radius: 20px 20px 0 0; background-image: radial-gradient(circle, rgba(255,255,255,0.7) 15%, transparent 16%); background-size: 15px 15px; margin: -25px -25px 30px -25px; position: relative; }
.m-avatar-container {
  display: flex; justify-content: center; position: absolute; bottom: -45px; left: 50%; transform: translateX(-50%);
}
.m-avatar-wrap { position: relative; }
.m-avatar {
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, #86efac 20%, #dcfce7 21%); background-size: 12px 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1); border: 4px solid #fff;
}
.m-avatar-btn {
  position: absolute; bottom: 0; right: 0;
  background: #3b82f6; color: #fff;
  border: none; border-radius: 8px; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 2px 8px rgba(59,130,246,0.4);
}
.m-name-row {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 22px; font-weight: 800; color: var(--gray-900); margin: 50px 0 24px;
}
.m-name-row svg { cursor: pointer; color: var(--gray-500); }
.m-stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px;
}
.m-stat-card {
  border-radius: 16px; padding: 16px 10px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; position: relative; overflow: hidden;
}
.m-stat-red { background: #ef4444; box-shadow: 0 4px 15px rgba(239,68,68,0.3); }
.m-stat-orange { background: #f59e0b; box-shadow: 0 4px 15px rgba(245,158,11,0.3); }
.m-stat-blue { background: #3b82f6; box-shadow: 0 4px 15px rgba(59,130,246,0.3); }
.m-stat-val { font-size: 26px; font-weight: 800; line-height: 1; }
.m-stat-lbl { font-size: 12px; font-weight: 700; opacity: 0.95; }
.m-stat-icon { position: absolute; right: -5px; bottom: 10px; opacity: 0.2; font-size: 40px; }

.m-edit-list {
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 10px 16px; margin-bottom: 24px;
}
.m-edit-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.m-edit-row:last-child { border-bottom: none; }
.m-edit-lbl { font-size: 15px; font-weight: 700; color: var(--gray-800); }
.m-edit-ctrls { display: flex; align-items: center; gap: 14px; }
.m-btn-min { background: #fee2e2; color: #ef4444; border: none; border-radius: 6px; width: 30px; height: 30px; font-weight: bold; cursor: pointer; transition: all 0.2s; }
.m-val { font-size: 18px; font-weight: 800; min-width: 24px; text-align: center; }
.m-btn-pls { background: #dcfce7; color: #22c55e; border: none; border-radius: 6px; width: 30px; height: 30px; font-weight: bold; cursor: pointer; transition: all 0.2s; }
.m-btn-pls:active, .m-btn-min:active { transform: scale(0.9); }

.m-att-summary { margin-bottom: 24px; }
.m-att-head {
  display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--gray-700); margin-bottom: 12px;
}
.m-att-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.m-att-box {
  border-radius: 12px; padding: 14px 10px; text-align: center; font-size: 13px; font-weight: 700; display: flex; flex-direction: column; gap: 6px;
}
.m-att-box-v { font-size: 20px; font-weight: 800; line-height: 1; }
.m-att-box.p { background: #f0fdf4; color: #16a34a; }
.m-att-box.l { background: #fefce8; color: #ca8a04; }
.m-att-box.a { background: #fef2f2; color: #dc2626; }

/* =========================================
   Ultra Responsive & Animations Updates
   ========================================= */

@keyframes toastSlideIn {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toastSlideOut {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(100px); opacity: 0; }
}

@keyframes loginShake {
  0% { transform: translateX(0); }
  25% { transform: translateX(8px); }
  50% { transform: translateX(-8px); }
  75% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

/* Base UI Sizing for Mobile Touch Targets */
button, .s-pill, .tb-btn {
  min-height: 48px;
}

/* Fluid Grids overrides */
@media (max-width: 768px) {
  .students-grid-cards {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }
  .modern-toast {
    width: 90%;
    margin-left: auto;
    margin-right: auto;
    bottom: 20px;
  }
  .sidebar {
    transform: translateX(100%);
    position: fixed;
    z-index: 1000;
  }
  .main-content {
    margin-right: 0 !important;
  }
  .top-bar {
    padding: 10px 16px;
  }
}

/* =========================================
   STUDENT PORTAL SPECIFIC CSS
========================================= */
.student-portal-header {
   display:flex; justify-content:space-between; align-items:center; background:#fff; padding:30px; border-radius:24px; box-shadow:0 4px 20px rgba(0,0,0,0.03); border:1.5px solid var(--gray-200); position:relative; overflow:hidden; margin-bottom: 24px;
}
.student-portal-header::after {
   content:''; position:absolute; top:0; left:0; width:150px; height:200px; background:radial-gradient(circle, var(--blue) 0%, transparent 70%); opacity:0.1; transform:translate(-50%, -50%); border-radius:50%;
}
.sp-layout {
   display:grid; grid-template-columns: 2fr 1fr; gap: 24px;
}
.sp-chart-bar-wrap {
   display:flex; flex-direction:column; align-items:center; gap:8px;
}
.sp-chart-bar-bg {
   width:40px; height:150px; background:var(--gray-100); border-radius:10px; position:relative; overflow:hidden;
}
.sp-chart-bar-fill {
   width:100%; position:absolute; bottom:0; left:0; border-radius:10px; transition:height 1s cubic-bezier(0.4, 0, 0.2, 1);
}
@media(max-width: 900px) {
  .sp-layout { grid-template-columns: 1fr; }
  .student-portal-header { flex-direction:column; gap: 20px; text-align:center; padding: 20px; }
  .student-portal-header > div:first-child { flex-direction:column; }
}

/* ══ زر المكافأة الجماعية ══ */
.reward-all-btn {
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s !important;
}
.reward-all-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5) !important;
}
.reward-all-btn:active {
  transform: translateY(0);
}
/* نبضة طفيفة لجذب الانتباه */
@keyframes rewardPulse {
  0%, 100% { box-shadow: 0 3px 10px rgba(245,158,11,.35); }
  50%       { box-shadow: 0 3px 18px rgba(245,158,11,.6); }
}
.reward-all-btn {
  animation: rewardPulse 2.5s ease-in-out infinite;
}

/* ══════════════════════════════════════════
   تأثيرات المكافأة والتحذير البصرية
══════════════════════════════════════════ */

/* جسيمات تتطاير من نقطة الضغط */
@keyframes fxParticle {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.4); opacity: 0; }
}

/* اهتزاز أحمر للتحذير */
@keyframes fxShakeRed {
  0%,100% { transform: translateX(0);     filter: none; }
  15%      { transform: translateX(-9px);  filter: brightness(1) drop-shadow(0 0 8px #ef4444); }
  30%      { transform: translateX( 8px);  filter: brightness(1.05) drop-shadow(0 0 8px #ef4444); }
  45%      { transform: translateX(-7px);  filter: brightness(1) drop-shadow(0 0 6px #ef4444); }
  60%      { transform: translateX( 6px);  filter: brightness(1.05); }
  75%      { transform: translateX(-4px);  }
  90%      { transform: translateX( 3px);  }
}

/* نبضة خضراء لزر + عند المكافأة */
@keyframes fxPulseGreen {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(16,185,129,0); background: #10b981; }
  40%  { transform: scale(1.35); box-shadow: 0 0 0 10px rgba(16,185,129,0.3); background: #059669; }
  100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* وميض اللون الكامل على الـ modal body للمكافأة */
@keyframes fxFlashGreen {
  0%   { box-shadow: inset 0 0 0 80px rgba(16,185,129,0); }
  30%  { box-shadow: inset 0 0 0 80px rgba(16,185,129,0.12); }
  100% { box-shadow: inset 0 0 0 80px rgba(16,185,129,0); }
}

/* بطاقة الطالب في القائمة تومض عند المكافأة */
.student-row-reward-fx {
  animation: rowRewardFx 0.7s ease forwards;
}
@keyframes rowRewardFx {
  0%   { background: transparent; }
  25%  { background: rgba(16,185,129,0.15); transform: scale(1.01); }
  100% { background: transparent; transform: scale(1); }
}

/* بطاقة الطالب في القائمة تومض عند التحذير */
.student-row-warn-fx {
  animation: rowWarnFx 0.6s ease forwards;
}
@keyframes rowWarnFx {
  0%,100% { background: transparent; }
  25%      { background: rgba(239,68,68,0.12); transform: translateX(-4px); }
  50%      { background: rgba(239,68,68,0.18); transform: translateX(4px); }
  75%      { background: rgba(239,68,68,0.08); transform: translateX(-2px); }
}

/* ══════════════════════════════════════════
   تأثيرات المكافأة الجماعية الاحتفالية
══════════════════════════════════════════ */

/* وميض الشاشة الذهبي */
@keyframes grFlash {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}

/* كونفيتي يتساقط من أعلى مع دوران ومسار مائل */
@keyframes grConfetti {
  0%   { transform: translateY(0) translateX(0) rotate(0deg);   opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(110vh) translateX(var(--drift)) rotate(var(--rot)); opacity: 0; }
}

/* البانر الاحتفالي يظهر ويختفي */
@keyframes grBanner {
  0%   { transform: translate(-50%,-50%) scale(0);   opacity: 0; }
  15%  { transform: translate(-50%,-50%) scale(1.1); opacity: 1; }
  25%  { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
  75%  { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
  100% { transform: translate(-50%,-60%) scale(0.9); opacity: 0; }
}

/* نبضة الزر عند الضغط */
@keyframes grBtnPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25); box-shadow: 0 0 0 12px rgba(245,158,11,0.3); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}



/* ==========================================================================
   MOBILE-FIRST ARCHITECTURE & RESPONSIVE REFACTORING
   ========================================================================== */

/* 1. Fluid Typography System (clamp) */
:root {
  --font-xs: clamp(0.7rem, 2vw, 0.75rem);
  --font-sm: clamp(0.75rem, 2.5vw, 0.875rem);
  --font-base: clamp(0.875rem, 3vw, 1rem);
  --font-md: clamp(1rem, 3.5vw, 1.125rem);
  --font-lg: clamp(1.125rem, 4vw, 1.25rem);
  --font-xl: clamp(1.25rem, 4.5vw, 1.5rem);
  --font-2xl: clamp(1.5rem, 5vw, 2rem);
  --spacing-sm: clamp(8px, 2vw, 12px);
  --spacing-md: clamp(12px, 3vw, 20px);
  --spacing-lg: clamp(16px, 4vw, 32px);
}

body { font-size: var(--font-base); line-height: 1.6; }
h1 { font-size: var(--font-2xl); line-height: 1.2; }
h2 { font-size: var(--font-xl); line-height: 1.3; }
h3 { font-size: var(--font-lg); line-height: 1.4; }
h4 { font-size: var(--font-md); line-height: 1.5; }

/* 2. Responsive Media */
img, video, canvas, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 3. Touch-Friendly UI */
button, .btn, .nav-item, input, select, .action-btn {
  min-height: 48px; /* High accessibility touch target */
  padding-top: 8px;
  padding-bottom: 8px;
}

.sch-prem-cell {
  min-height: 80px; 
}

/* 4. Mobile-First Layout System */

/* Sidebar hidden by default on mobile */
.sidebar {
  transform: translateX(100%);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  width: 280px;
  max-width: 100vw;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
}

.sidebar.open {
  transform: translateX(0);
}

/* Main Container full width on mobile */
.main {
  margin-right: 0 !important;
  width: 100%;
  transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s;
}

/* 5. Responsive Breakpoints (Desktop scaling up) */

/* TABLETS (768px+) */
@media (min-width: 768px) {
  /* Fluid grids taking shape */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ KEYFRAMES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

@keyframes crownBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-6px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes monitorGlow {
  0%, 100% { box-shadow: 0 0 5px rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 0 15px rgba(245, 158, 11, 0.7); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Ensure tables are correctly responsive */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

/* LAPTOPS/DESKTOPS (1024px+) */
@media (min-width: 1024px) {
  /* Restore Desktop Layout Side-by-Side */
  .sidebar {
    transform: translateX(0);
    width: var(--sidebar-w);
    box-shadow: none;
    border-left: 1px solid var(--border);
  }
  
  .main {
    margin-right: var(--sidebar-w) !important;
    width: calc(100% - var(--sidebar-w));
  }
  
  .menu-toggle {
    display: none !important;
  }

  .metrics-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  
  /* Advanced Charts Grid */
  .dash-grid {
    grid-template-columns: 2fr 1fr;
  }
}

/* 6. Dynamic Grid & Fluid Containers Override */
.metrics-grid, .students-grid, .grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-md);
}

/* Mobile Topbar Fixes */
.topbar {
  padding: 0 var(--spacing-md);
  height: clamp(56px, 8vh, 70px);
  gap: 10px;
  overflow-x: auto;
}

.topbar-title {
  font-size: var(--font-lg);
  white-space: nowrap;
}

/* Mobile Login Screen Fixes */
.login-body {
  flex-direction: column !important;
}

@media (min-width: 768px) {
  .login-body {
    flex-direction: row !important;
  }
}

/* Mobile Tables (Scrollable) */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  padding-bottom: 5px;
}

table {
  min-width: max-content;
}

/* Scrollbar optimizations */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 10px;
}


/* ==========================================================================
   STUDENT PORTAL MOBILE-FIRST OVERRIDES
   ========================================================================== */

/* By default (Mobile < 768px), flatten all grids to 1 column */
#sptab-dashboard > div:nth-child(2),
#sptab-dashboard > div:nth-child(3),
#sptab-dashboard > div:nth-child(4) {
  display: grid;
  grid-template-columns: 1fr !important;
}

#sp-student-timeline-wrapper > div {
  margin-right: 0 !important;
  margin-bottom: 20px;
}

#sp-student-timeline-wrapper .timeline-bar {
  display: none; /* hide vertical timeline bar on mobile */
}

/* Medium Devices (Tablets 768px+) */
@media (min-width: 768px) {
  #sptab-dashboard > div:nth-child(2) {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  #sptab-dashboard > div:nth-child(4) {
    grid-template-columns: 1fr !important;
  }
}

/* Large Devices (Laptops/Desktops 1024px+) */
@media (min-width: 1024px) {
  #sptab-dashboard > div:nth-child(2) {
    grid-template-columns: repeat(4, 1fr) !important;
  }
  #sptab-dashboard > div:nth-child(3) {
    grid-template-columns: 2fr 1fr !important;
  }
  #sptab-dashboard > div:nth-child(4) {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* Make tables implicitly responsive */
table {
  width: 100%;
  border-collapse: collapse;
}

.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Optimize the Schedule Grid for Mobile */
.sch-prem-grid {
  grid-template-columns: 60px repeat(9, max-content) !important;
  min-width: unset !important;
  width: max-content; 
}
