:root {
  /* Colors */
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --secondary: #0ea5e9;
  --accent: #f43f5e;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  
  --text-main: #111827;
  --text-muted: #6b7280;
  --text-light: #f9fafb;
  
  --border-color: #e5e7eb;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  
  /* Radii */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  margin: 0;
  line-height: 1.5;
  min-height: 100vh;
}

/* Layout Utilities */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  width: 100%;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--spacing-sm); }
.gap-4 { gap: var(--spacing-md); }
.gap-6 { gap: var(--spacing-lg); }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Responsive Grid */
@media (max-width: 768px) {
  .md\:grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
  .md\:flex-col { flex-direction: column; }
  .sidebar { display: none; } /* Simplified mobile handling */
}

/* Components */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-lg);
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 0.95rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.4);
}
.btn-primary:hover {
  box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover {
  background-color: var(--bg-body);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-success {
  background-color: var(--success);
  color: white;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success { background-color: #d1fae5; color: #065f46; }
.badge-warning { background-color: #fef3c7; color: #92400e; }
.badge-danger { background-color: #fee2e2; color: #991b1b; }
.badge-neutral { background-color: #f3f4f6; color: #374151; }

/* Forms */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-main);
}

.form-input, .form-select {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  color: var(--text-main);
}

h1 { font-size: 2.25rem; letter-spacing: -0.025em; margin-bottom: var(--spacing-md); }
h2 { font-size: 1.5rem; margin-bottom: var(--spacing-sm); }
h3 { font-size: 1.25rem; margin-bottom: var(--spacing-xs); }

p { margin-bottom: var(--spacing-md); color: var(--text-muted); }

.text-sm { font-size: 0.875rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.font-bold { font-weight: 700; }

/* Navigation */
.navbar {
  background: white;
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-md) 0;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.9);
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--primary);
  background-color: rgba(79, 70, 229, 0.05);
}

.nav-link.active {
  color: var(--primary);
  background-color: rgba(79, 70, 229, 0.1);
}

/* Tables */
.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  padding: 1rem;
  background-color: var(--bg-body);
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.table tr:last-child td {
  border-bottom: none;
}

/* Specific Layouts */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  color: var(--text-light);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav {
  flex: 1;
  padding: var(--spacing-md);
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: #94a3b8;
  text-decoration: none;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  transition: all 0.2s;
}

.sidebar-link:hover, .sidebar-link.active {
  background-color: rgba(255,255,255,0.1);
  color: white;
}

.main-content {
  flex: 1;
  background-color: var(--bg-body);
  padding: var(--spacing-xl);
  overflow-y: auto;
  max-height: 100vh;
}

/* Brand Logo */
.brand-logo {
  width: 24px; 
  height: 24px; 
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); 
  border-radius: 6px;
  position: relative;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.brand-logo::after {
  content: '';
  position: absolute;
  top: 6px; left: 6px;
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,0.8);
  border-radius: 2px;
}

/* Placeholders */
.placeholder-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e2e8f0;
}

.placeholder-icon {
  width: 20px;
  height: 20px;
  background-color: currentColor;
  opacity: 0.7;
  border-radius: 4px;
  margin-right: 12px;
  display: inline-block;
  position: relative;
}
/* Icon Shapes */
.icon-dashboard::after { content: ''; display: block; width: 10px; height: 10px; background: inherit; position: absolute; top: 2px; left: 2px; box-shadow: 6px 0 0 inherit, 0 6px 0 inherit, 6px 6px 0 inherit; }
.icon-users::after { content: ''; display: block; width: 8px; height: 8px; border-radius: 50%; background: inherit; position: absolute; top: 2px; left: 6px; box-shadow: -4px 6px 0 inherit, 4px 6px 0 inherit; }
.icon-calendar::after { content: ''; display: block; width: 14px; height: 12px; border: 2px solid currentColor; position: absolute; top: 4px; left: 3px; border-radius: 2px; }
.icon-file::after { content: ''; display: block; width: 12px; height: 14px; border: 2px solid currentColor; position: absolute; top: 3px; left: 4px; border-radius: 2px; }
.icon-settings::after { content: ''; display: block; width: 14px; height: 14px; border-radius: 50%; border: 3px solid currentColor; position: absolute; top: 3px; left: 3px; }

/* Attendance Grid */
.attendance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-md);
}

.student-card {
  border: 1px solid var(--border-color);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  text-align: center;
  background: white;
  transition: all 0.2s;
}

.student-card.present {
  border-color: var(--success);
  background-color: #f0fdf4;
}

.student-card.absent {
  border-color: var(--danger);
  background-color: #fef2f2;
}

.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.stat-icon.blue { background: #e0e7ff; color: var(--primary); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
