/* ─── ML Attendance Dashboard — Original Theme ─── */
/* Dark cyber palette with cyan accents               */

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

:root {
  --bg-primary: #0f1422;
  --bg-secondary: #1a2035;
  --bg-card: #1e2740;
  --border: #2a3650;
  --text-primary: #e8edf5;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;
  --accent-red: #ef4444;
  --accent-purple: #8b5cf6;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ��── App Header ─── */

#header {
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.app-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  flex: 1;
}

.app-header .nav-link {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.app-header .nav-link:hover {
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  text-decoration: none;
}

.app-header .nav-link.active {
  color: var(--accent-cyan);
}

/* ─── Container ─── */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ─── Cards ─── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ─── Stats Grid ─── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  transition: border-color 0.15s;
}

.stat-card:hover {
  border-color: var(--accent-cyan);
}

.stat-card .num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-card .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ─── Class Card ─── */

.class-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  transition: border-color 0.15s;
}

.class-card:hover {
  border-color: var(--accent-cyan);
}

.class-card .info { flex: 1; min-width: 200px; }
.class-card .name { font-weight: 600; font-size: 1rem; }
.class-card .meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; }
.class-card .actions { display: flex; gap: 0.5rem; align-items: center; }

/* ─── Day Label ─── */

.day-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

/* ─── Buttons ─── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent-cyan);
  color: #0a0e1a;
}

.btn-primary:hover {
  background: #22d3ee;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-cyan);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
}

.btn-danger {
  background: transparent;
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn-success {
  background: var(--accent-green);
  color: #0a0e1a;
}

.btn-success:hover {
  background: #34d399;
}

/* ─── Tabs ─── */

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-muted);
  transition: all 0.15s;
}

.tab:hover {
  border-color: var(--accent-cyan);
  color: var(--text-secondary);
}

.tab.active {
  background: var(--accent-cyan);
  color: #0a0e1a;
  border-color: var(--accent-cyan);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Tables ─── */

.table-scroll {
  overflow-x: auto;
  max-height: 400px;
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.table-scroll th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
}

.table-scroll td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid rgba(42, 54, 80, 0.3);
}

.table-scroll tr:hover td {
  background: rgba(6, 182, 212, 0.03);
}

/* ─── Forms ─── */

.controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.controls label {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.controls input,
.controls select {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font);
}

.controls input:focus,
.controls select:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.form-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.form-row input,
.form-row select {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: var(--font);
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.form-row input::placeholder {
  color: var(--text-muted);
}

/* ─── Drop Zone ─── */

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone:hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.03);
}

.drop-zone input[type="file"] {
  display: none;
}

/* ─── Result Box ─── */

.result-box {
  padding: 0.75rem;
  border-radius: 6px;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  line-height: 1.6;
}

.result-box.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.result-box.fail {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* ─── Loading / Spinner ─── */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem;
}

.spinner {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Empty State ─── */

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ─── Hint ─── */

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.hint a { color: var(--accent-cyan); }

/* ─── Class Header (Attendance page) ─── */

.class-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.class-header .title {
  font-size: 1.1rem;
  font-weight: 600;
}

.class-header .meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ─── Summary Bar ─── */

.summary-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.summary-item {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.summary-item strong {
  color: var(--text-primary);
}

/* ─── Saved Indicator ─── */

.saved-indicator {
  font-size: 0.78rem;
  color: var(--accent-green);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ─── All Present Button ─── */

.all-present-btn {
  margin-bottom: 0.5rem;
}

/* ─── Roll Grid (Attendance page) ─── */

.roll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem;
}

.roll-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.15s;
}

.roll-card:hover {
  border-color: var(--accent-cyan);
}

.roll-card .name {
  font-weight: 600;
  font-size: 0.9rem;
}

.type-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  display: inline-block;
  margin-left: 0.3rem;
  vertical-align: middle;
}

.type-student {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.type-staff {
  background: rgba(56, 159, 168, 0.15);
  color: #5eead4;
}

/* ─── Status Buttons ─── */

.status-btns {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.status-btn {
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  transition: all 0.12s;
}

.status-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-secondary);
}

.status-btn.active-present {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: var(--accent-green);
}

.status-btn.active-absent {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: var(--accent-red);
}

.status-btn.active-late {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: var(--accent-yellow);
}

.status-btn.active-excused {
  background: rgba(139, 92, 246, 0.2);
  color: #a78bfa;
  border-color: var(--accent-purple);
}

/* ─── Percentage Bar ─── */

.pct-bar {
  display: inline-block;
  height: 6px;
  border-radius: 3px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.pct-good { background: var(--accent-green); }
.pct-warn { background: var(--accent-yellow); }
.pct-bad { background: var(--accent-red); }

/* ─── Notification Toast ─── */

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 1000;
  animation: toast-in 0.3s ease-out;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.toast.success {
  background: rgba(16, 185, 129, 0.95);
  color: #0a0e1a;
}

.toast.error {
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Enrollment Manager ─── */

.enrollment-class-name {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.enrollment-tag {
  display: inline-block;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  margin: 0.15rem;
}

.enrollment-tag.student {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.enrollment-tag.staff {
  background: rgba(56, 159, 168, 0.1);
  border: 1px solid rgba(56, 159, 168, 0.3);
}

.enrollment-tag .remove {
  cursor: pointer;
  color: var(--accent-red);
  margin-left: 0.15rem;
}

/* ─── Media Queries ─── */

@media (max-width: 600px) {
  .container { padding: 1rem; }
  .app-header { flex-direction: column; align-items: flex-start; }
  .roll-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
