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

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0284c7;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #1e293b;
  --dim: #64748b;
  --border: #e2e8f0;
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --radius: 8px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); }

/* Layout */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: fixed; height: 100vh; z-index: 10;
}
.sidebar-header {
  padding: 20px; font-size: 20px; font-weight: 700; color: #fff;
  display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #334155;
}
.nav-menu { list-style: none; padding: 12px 0; flex: 1; }
.nav-menu li a {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  color: var(--sidebar-text); text-decoration: none; font-size: 14px; transition: all 0.2s;
}
.nav-menu li a:hover, .nav-menu li a.active {
  color: #fff; background: rgba(255,255,255,0.1);
}
.nav-menu li a.active { border-right: 3px solid var(--primary); }
.nav-menu li a i { width: 20px; text-align: center; }
.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid #334155;
  display: flex; justify-content: space-between; align-items: center; font-size: 13px;
}
.sidebar-footer a { color: var(--sidebar-text); }

/* Content */
.content { flex: 1; margin-left: 240px; padding: 24px; }

/* Cards */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 24px; font-weight: 700; }
.page-header p { color: var(--dim); font-size: 14px; margin-top: 4px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  border: 1px solid var(--border); display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; font-size: 20px;
}
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-info h3 { font-size: 24px; font-weight: 700; }
.stat-info p { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.5px; }

/* Table */
.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden; margin-bottom: 24px;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.card-header h2 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

table { width: 100%; border-collapse: collapse; }
th { padding: 10px 16px; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--dim); background: #f8fafc; border-bottom: 1px solid var(--border); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* Badges */
.badge {
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; display: inline-block;
}
.badge-present { background: #dcfce7; color: #16a34a; }
.badge-absent { background: #fee2e2; color: #dc2626; }
.badge-late { background: #ffedd5; color: #ea580c; }
.badge-excused { background: #dbeafe; color: #2563eb; }
.badge-active { background: #dcfce7; color: #16a34a; }
.badge-inactive { background: #fee2e2; color: #dc2626; }

/* Buttons */
.btn {
  padding: 8px 16px; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; text-decoration: none; display: inline-flex;
  align-items: center; gap: 6px; transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f8fafc; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; color: var(--text); outline: none; transition: border 0.2s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }

/* Alert */
.alert {
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Attendance Grid */
.attendance-grid { display: grid; gap: 8px; }
.attendance-row {
  display: flex; align-items: center; padding: 12px 16px; background: #f8fafc;
  border-radius: var(--radius); gap: 16px;
}
.attendance-row .student-name { flex: 1; font-size: 14px; font-weight: 500; }
.attendance-row .student-id { font-size: 12px; color: var(--dim); width: 80px; }
.radio-group { display: flex; gap: 4px; }
.radio-label {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--border); transition: all 0.2s; background: #fff;
}
.radio-label:hover { border-color: var(--primary); }
.radio-label input { display: none; }
.radio-label.present input:checked + span { background: none; }
.radio-label:has(input:checked).present { background: #dcfce7; border-color: #16a34a; color: #16a34a; }
.radio-label:has(input:checked).absent { background: #fee2e2; border-color: #dc2626; color: #dc2626; }
.radio-label:has(input:checked).late { background: #ffedd5; border-color: #ea580c; color: #ea580c; }
.radio-label:has(input:checked).excused { background: #dbeafe; border-color: #2563eb; color: #2563eb; }

/* Login Page */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px; width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-card h1 { text-align: center; font-size: 24px; margin-bottom: 8px; }
.login-card p { text-align: center; color: var(--dim); font-size: 14px; margin-bottom: 28px; }
.login-card .icon { text-align: center; font-size: 48px; margin-bottom: 16px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; }

/* Report filters */
.filters {
  display: flex; gap: 12px; margin-bottom: 20px; align-items: flex-end; flex-wrap: wrap;
}
.filters .form-group { margin-bottom: 0; min-width: 160px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header span, .nav-menu li a span, .sidebar-footer span { display: none; }
  .sidebar-header { justify-content: center; }
  .nav-menu li a { justify-content: center; padding: 14px; }
  .content { margin-left: 60px; padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .filters { flex-direction: column; }
}
