:root {
  --primary: #1a237e;
  --primary-light: #3949ab;
  --accent: #ff6f00;
  --accent-light: #ffa040;
  --bg: #f0f4ff;
  --card: #ffffff;
  --text: #1a1a2e;
  --muted: #6b7280;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --border: #e0e7ff;
  --shadow: 0 8px 32px rgba(26,35,126,0.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== LOGIN PAGE ===== */
.bg-shapes {
  position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none;
}
.shape {
  position: absolute; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  opacity: 0.08;
  animation: float 8s ease-in-out infinite;
}
.s1 { width: 500px; height: 500px; top: -150px; left: -100px; }
.s2 { width: 350px; height: 350px; bottom: -100px; right: -80px; animation-delay: -3s; opacity: 0.06; }
.s3 { width: 200px; height: 200px; top: 40%; left: 60%; animation-delay: -5s; }
@keyframes float {
  0%,100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.03); }
}

.login-wrapper {
  position: relative; z-index: 1;
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 2rem;
}

.brand { text-align: center; margin-bottom: 2rem; }
.logo-icon { font-size: 3.5rem; display: block; margin-bottom: 0.5rem; }
.brand h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2.8rem; font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.brand p { color: var(--muted); font-size: 1rem; margin-top: 0.25rem; }

.role-selector {
  display: flex; gap: 1rem; margin-bottom: 2rem;
}
.role-btn {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 1.5rem; border-radius: 50px; border: 2px solid var(--border);
  background: white; font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
  font-weight: 500; cursor: pointer; transition: all 0.25s;
  color: var(--muted);
}
.role-btn:hover { border-color: var(--primary-light); color: var(--primary); }
.role-btn.active {
  background: var(--primary); color: white; border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(26,35,126,0.25);
}
.role-icon { font-size: 1.2rem; }

.login-card {
  background: white; border-radius: 20px; padding: 2.5rem;
  width: 100%; max-width: 420px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
  animation: slideUp 0.35s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-card h2 {
  font-family: 'Playfair Display', serif; font-size: 1.7rem;
  color: var(--primary); margin-bottom: 1.5rem;
}
.hidden { display: none !important; }

.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--muted); margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.form-group input, .form-group select {
  width: 100%; padding: 0.75rem 1rem; border: 2px solid var(--border);
  border-radius: 10px; font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
  transition: border 0.2s; outline: none; background: #fafbff;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--primary-light); background: white;
}

.login-btn {
  width: 100%; padding: 0.9rem; border-radius: 10px; border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white; font-family: 'DM Sans', sans-serif; font-size: 1rem;
  font-weight: 600; cursor: pointer; transition: all 0.25s;
  margin-top: 0.5rem;
}
.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26,35,126,0.3);
}
.login-btn:active { transform: translateY(0); }

.error-msg { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.5rem; min-height: 1rem; }
.hint { text-align: center; font-size: 0.8rem; color: var(--muted); margin-top: 1rem; }
.hint b { color: var(--primary); }

/* ===== DASHBOARD LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px; background: var(--primary); color: white;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 100;
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}
.sidebar-brand {
  padding: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 0.8rem;
}
.sidebar-brand .logo-icon { font-size: 1.8rem; }
.sidebar-brand h1 { font-family: 'Playfair Display', serif; font-size: 1.3rem; font-weight: 700; }
.sidebar-brand p { font-size: 0.7rem; opacity: 0.7; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-section { padding: 0.5rem 1rem; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.1em; opacity: 0.5; margin-top: 0.5rem; }
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1.5rem; cursor: pointer; transition: all 0.2s;
  font-size: 0.9rem; font-weight: 500; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.08); }
.nav-item.active { background: rgba(255,255,255,0.12); border-left-color: var(--accent-light); color: white; }
.nav-icon { font-size: 1.1rem; width: 1.5rem; }

.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,0.1); }
.logout-btn {
  width: 100%; padding: 0.6rem; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2);
  background: transparent; color: white; font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem; cursor: pointer; transition: all 0.2s;
}
.logout-btn:hover { background: rgba(255,255,255,0.1); }

.main-content { margin-left: 260px; flex: 1; padding: 2rem; }

/* ===== TOPBAR ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2rem;
}
.topbar h2 {
  font-family: 'Playfair Display', serif; font-size: 1.8rem; color: var(--primary);
}
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.user-badge {
  background: white; border: 1px solid var(--border); border-radius: 50px;
  padding: 0.4rem 1rem; font-size: 0.85rem; font-weight: 500;
  display: flex; align-items: center; gap: 0.5rem; color: var(--primary);
  box-shadow: var(--shadow);
}

/* ===== STAT CARDS ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.stat-card {
  background: white; border-radius: 16px; padding: 1.5rem;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 1rem;
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-icon { font-size: 2rem; width: 3rem; height: 3rem; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; }
.stat-icon.blue { background: #e0e7ff; }
.stat-icon.green { background: #d1fae5; }
.stat-icon.orange { background: #fef3c7; }
.stat-icon.red { background: #fee2e2; }
.stat-info label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.stat-info h3 { font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-info span { font-size: 0.8rem; color: var(--muted); }

/* ===== CARDS ===== */
.card {
  background: white; border-radius: 16px; padding: 1.5rem;
  border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 1.5rem;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.card-header h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); }

/* ===== BUTTONS ===== */
.btn {
  padding: 0.55rem 1.2rem; border-radius: 8px; border: none;
  font-family: 'DM Sans', sans-serif; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); box-shadow: 0 4px 12px rgba(26,35,126,0.3); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.78rem; }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-light); }

/* ===== TABS ===== */
.tab-bar { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab {
  padding: 0.5rem 1.2rem; border-radius: 50px; border: 1.5px solid var(--border);
  font-size: 0.85rem; font-weight: 500; cursor: pointer; background: white; transition: all 0.2s;
}
.tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.tab:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th {
  background: #f5f7ff; padding: 0.75rem 1rem; text-align: left;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--border);
}
td { padding: 0.75rem 1rem; border-bottom: 1px solid #f0f4ff; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbff; }

/* ===== ATTENDANCE BADGES ===== */
.badge {
  display: inline-block; padding: 0.2rem 0.65rem; border-radius: 50px;
  font-size: 0.75rem; font-weight: 600;
}
.badge-present { background: #d1fae5; color: #065f46; }
.badge-absent { background: #fee2e2; color: #991b1b; }
.badge-late { background: #fef3c7; color: #92400e; }

/* ===== ATTENDANCE BUTTONS ===== */
.att-group { display: flex; gap: 0.4rem; }
.att-btn {
  padding: 0.3rem 0.7rem; border-radius: 6px; border: 1.5px solid transparent;
  font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.att-btn.p { border-color: #16a34a; color: #16a34a; background: transparent; }
.att-btn.p.selected, .att-btn.p:hover { background: #16a34a; color: white; }
.att-btn.a { border-color: #dc2626; color: #dc2626; background: transparent; }
.att-btn.a.selected, .att-btn.a:hover { background: #dc2626; color: white; }
.att-btn.l { border-color: #d97706; color: #d97706; background: transparent; }
.att-btn.l.selected, .att-btn.l:hover { background: #d97706; color: white; }

/* ===== FORM CONTROLS ===== */
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.form-field { display: flex; flex-direction: column; gap: 0.35rem; flex: 1; min-width: 150px; }
.form-field label { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.form-field input, .form-field select {
  padding: 0.6rem 0.9rem; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: 'DM Sans', sans-serif; font-size: 0.9rem; outline: none;
  transition: border 0.2s; background: #fafbff;
}
.form-field input:focus, .form-field select:focus { border-color: var(--primary-light); background: white; }

/* ===== PROGRESS BAR ===== */
.progress-bar { background: #e0e7ff; border-radius: 50px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 50px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.5s; }

/* ===== STUDENT ATTENDANCE PIE ===== */
.circle-stats { display: flex; gap: 2rem; flex-wrap: wrap; }
.circle-stat { text-align: center; }
.circle-stat svg { display: block; margin: 0 auto 0.5rem; }
.circle-stat label { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.circle-stat h4 { font-size: 1.2rem; font-weight: 700; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 999;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: white; border-radius: 20px; padding: 2rem; max-width: 480px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15); animation: slideUp 0.25s;
}
.modal h3 { font-family: 'Playfair Display', serif; font-size: 1.4rem; color: var(--primary); margin-bottom: 1.2rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ===== ALERT ===== */
.alert {
  padding: 0.75rem 1rem; border-radius: 10px; font-size: 0.88rem; margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-info    { background: #e0e7ff; color: #1e40af; border: 1px solid #c7d2fe; }

/* ===== CLASS CARDS ===== */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.class-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white; border-radius: 14px; padding: 1.25rem;
  cursor: pointer; transition: all 0.25s; text-align: center;
  box-shadow: 0 4px 12px rgba(26,35,126,0.2);
}
.class-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(26,35,126,0.3); }
.class-card.selected { background: linear-gradient(135deg, var(--accent), var(--accent-light)); }
.class-card h3 { font-size: 1.3rem; font-weight: 700; }
.class-card p { font-size: 0.75rem; opacity: 0.85; margin-top: 0.25rem; }
.class-card .count { font-size: 2rem; font-weight: 900; display: block; }

/* ===== CALENDAR ===== */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.4rem; }
.cal-day-header { text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; padding: 0.4rem; }
.cal-day {
  aspect-ratio: 1; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 500; cursor: pointer; border: 1.5px solid transparent; transition: all 0.15s;
}
.cal-day:hover { border-color: var(--primary-light); }
.cal-day.present { background: #d1fae5; color: #065f46; }
.cal-day.absent { background: #fee2e2; color: #991b1b; }
.cal-day.late { background: #fef3c7; color: #92400e; }
.cal-day.empty { background: transparent; cursor: default; }
.cal-day.today { border-color: var(--accent); font-weight: 700; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { width: 60px; overflow: hidden; }
  .sidebar-brand h1, .sidebar-brand p, .nav-item span, .nav-section { display: none; }
  .sidebar-brand { justify-content: center; padding: 1rem; }
  .nav-item { justify-content: center; padding: 0.75rem; }
  .main-content { margin-left: 60px; padding: 1rem; }
}

/* ===== PAGE SECTIONS ===== */
.page-section { display: none; }
.page-section.active { display: block; }

.empty-state { text-align: center; padding: 3rem; color: var(--muted); }
.empty-state .icon { font-size: 3rem; display: block; margin-bottom: 1rem; }

/* ===== NOTIFICATION DOT ===== */
.notif { position: relative; }
.notif::after {
  content: ''; position: absolute; top: -3px; right: -3px;
  width: 8px; height: 8px; background: var(--accent); border-radius: 50%;
}

/* ===== INPUT SEARCH ===== */
.search-input {
  padding: 0.55rem 1rem; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: 'DM Sans', sans-serif; font-size: 0.85rem; outline: none;
  transition: border 0.2s; min-width: 200px;
}
.search-input:focus { border-color: var(--primary-light); }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
