/* ============================================
   Student Performance Analytics Dashboard
   style.css — External Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ---------- CSS Variables ---------- */
:root {
 --bg:        #0a0c12;    /* Deep Oxford Blue (Foundation) */
  --surface:   #121620;    /* Slate Navy (Cards/Sections) */
  --surface2:  #1b2130;    /* Lighter Slate (Interactions) */
  --border:    #2a3142;    /* Subtle Metallic Border */
  
  /* Accent Colors */
  --accent:    #c5a059;    /* Muted Gold (High-end Branding) */
  --accent2:   #5c7cfa;    /* Academic Blue (Focus/Links) */
  
  /* Status Colors (Muted for Sophistication) */
  --danger:    #e55039;    /* Deep Crimson */
  --warning:   #f39c12;    /* Ochre */
  
  /* Typography */
  --text:      #f8f9fa;    /* High-contrast Off-White */
  --muted:     #8a94ad;    /* Steel Gray */
  
  /* Aesthetics */
  --radius:    6px;        /* Sharper corners feel more formal */
  --font:      'Inter', 'Playfair Display', serif; /* Mix of Sans and Serif */
  --mono:      'JetBrains Mono', monospace;
  --shadow:    0 10px 30px rgba(0,0,0,0.5);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 15px;
}

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

/* ---------- Layout ---------- */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Navbar ---------- */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .brand {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar .brand span {
  color: var(--accent);
}

.navbar nav {
  display: flex;
  gap: 4px;
}

.navbar nav a {
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.navbar nav a:hover,
.navbar nav a.active {
  color: var(--text);
  background: var(--surface2);
  text-decoration: none;
}

/* ---------- Hero / Page Header ---------- */
.page-header {
  padding: 56px 0 40px;
  text-align: center;
}

.page-header h1 {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.8px;
  line-height: 1.2;
  margin-bottom: 12px;
}

.page-header h1 em {
  font-style: normal;
  color: var(--accent);
}

.page-header p {
  color: var(--muted);
  font-size: 16px;
  max-width: 480px;
  margin: 0 auto;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  
}

.card h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.card h2 .icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
 
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

/* ---------- Upload Form ---------- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  background: var(--surface2);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(108, 143, 255, 0.06);
}

.upload-zone .upload-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.6;
}

.upload-zone p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
}

.upload-zone strong {
  color: var(--accent);
}

/* ---------- File Input ---------- */
input[type="file"] {
  display: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: var(--font);
  justify-content: center;
}

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

.btn-primary:hover {
  background: #849eff;
}

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

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

/* ---------- Alerts & Messages ---------- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-danger {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: #ff9999;
}

.alert-success {
  background: rgba(78, 204, 163, 0.1);
  border: 1px solid rgba(78, 204, 163, 0.3);
  color: var(--accent2);
}

.alert-warning {
  background: rgba(255, 201, 77, 0.1);
  border: 1px solid rgba(255, 201, 77, 0.3);
  color: var(--warning);
}

/* ---------- Summary Stat Cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card .label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: -1px;
}

.stat-card.accent  .value { color: var(--accent); }
.stat-card.success .value { color: var(--accent2); }
.stat-card.danger  .value { color: var(--danger); }
.stat-card.warning .value { color: var(--warning); }

/* ---------- Students Table ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: var(--surface2);
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

tbody tr {
  border-top: 1px solid var(--border);
  transition: background 0.15s;
}

tbody tr:hover {
  background: var(--surface2);
}

tbody td {
  padding: 12px 16px;
  color: var(--text);
}

/* ---------- Grade & Risk Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
}

.badge-A { background: rgba(78,204,163,0.15); color: var(--accent2); }
.badge-B { background: rgba(108,143,255,0.15); color: var(--accent); }
.badge-C { background: rgba(255,201,77,0.15);  color: var(--warning); }
.badge-D { background: rgba(255,140,0,0.15);    color: #ff9a3c; }
.badge-E { background: rgba(255,107,107,0.15);  color: var(--danger); }

.risk-yes {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 500;
}

.risk-no {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent2);
  font-size: 12px;
  font-weight: 500;
}

/* ---------- Chart Container ---------- */
.chart-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.chart-box h3 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 20px;
  color: var(--muted);
}

canvas {
  max-height: 300px;
}

/* ---------- CSV Format Hint ---------- */
.format-hint {
  background: var(--surface2);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.8;
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 32px 0;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ---------- Utility ---------- */
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); font-size: 13px; }
