/* ================================================================
   style.css — EduTrack Student Management System
   Design: Clean editorial light theme, amber accent
   Font: Outfit (display) + JetBrains Mono (code/data)
   ================================================================ */

/* ── RESET & TOKENS ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f4f3ef;
  --surface:     #ffffff;
  --surface2:    #f9f8f5;
  --border:      #e5e2d9;
  --border2:     #d4d0c4;

  --text:        #1a1814;
  --text2:       #5a5650;
  --muted:       #9a9590;

  --accent:      #e8820c;
  --accent-dk:   #c46a00;
  --accent-lt:   #fef3e2;
  --accent-glow: rgba(232,130,12,.18);

  --blue:        #2563eb;
  --blue-lt:     #eff6ff;
  --green:       #16a34a;
  --green-lt:    #f0fdf4;
  --red:         #dc2626;
  --red-lt:      #fef2f2;
  --yellow:      #d97706;
  --yellow-lt:   #fffbeb;

  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-sm:   0 1px 2px rgba(0,0,0,.07);
  --topbar-h:    62px;

  --font:        'Outfit', system-ui, sans-serif;
  --mono:        'JetBrains Mono', 'Courier New', monospace;
}

html { font-size: 15px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ──────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 28px;
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0,0,0,.05);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 36px;
  flex-shrink: 0;
}
.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.brand-name {
  font-size: 17px;
  font-weight: 400;
  color: var(--text2);
  letter-spacing: -.01em;
}
.brand-name strong {
  font-weight: 700;
  color: var(--text);
}

/* ── NAV LINKS ────────────────────────────────────────────────── */
.topbar-nav {
  display: flex;
  align-items: stretch;
  height: 100%;
  gap: 2px;
  flex: 1;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  height: 100%;
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  text-decoration: none;
  border-radius: 0;
  transition: color .18s, background .18s;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface2);
}

/* ── ACTIVE TAB HIGHLIGHT ─────────────────────────────────────── */
.nav-link--active {
  color: var(--accent) !important;
  background: var(--accent-lt) !important;
  font-weight: 700;
}

.nav-link--active .nav-icon {
  stroke: var(--accent);
}

/* The sliding underline bar */
.active-bar {
  position: absolute;
  bottom: -1px;        /* sits on the border line */
  left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  animation: barSlide .25s cubic-bezier(.34,1.56,.64,1);
}

@keyframes barSlide {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}

.nav-icon {
  width: 16px; height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
  transition: stroke .18s;
}

.topbar-right {
  margin-left: auto;
  flex-shrink: 0;
}
.sys-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  letter-spacing: .04em;
}

/* ── PAGE WRAP ───────────────────────────────────────────────── */
.page-wrap {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 32px 60px;
}

/* ── PAGE HEADER ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.2;
}
.page-subtitle {
  color: var(--text2);
  font-size: 14px;
  margin-top: 4px;
}
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all .15s;
  line-height: 1;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; stroke: currentColor; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-dk);
  border-color: var(--accent-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border2);
}
.btn-secondary:hover { background: var(--surface2); border-color: var(--border2); }

.btn-danger {
  background: var(--red-lt);
  color: var(--red);
  border-color: #fca5a5;
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-xs { padding: 4px 10px; font-size: 11.5px; border-radius: 4px; }

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
}
.card-body { padding: 22px; }

/* ── STAT CARDS ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.c-orange::before { background: var(--accent); }
.stat-card.c-blue::before   { background: var(--blue); }
.stat-card.c-green::before  { background: var(--green); }
.stat-card.c-amber::before  { background: var(--yellow); }

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 10px;
}
.stat-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--text);
}
.stat-card.c-orange .stat-value { color: var(--accent); }
.stat-card.c-blue   .stat-value { color: var(--blue); }
.stat-card.c-green  .stat-value { color: var(--green); }
.stat-card.c-amber  .stat-value { color: var(--yellow); }
.stat-meta { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ── TABLES ──────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 13.5px;
}
.data-table thead th {
  background: var(--surface2);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text2);
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}
.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface2); }

.td-mono { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 600; }
.td-name { font-weight: 600; color: var(--text); }
.td-dim  { color: var(--text2); font-size: 13px; }
.td-actions { display: flex; gap: 6px; align-items: center; }

/* ── BADGES / PILLS ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-active    { background: var(--green-lt);  color: var(--green);  }
.badge-inactive  { background: #f3f4f6;           color: #6b7280;       }
.badge-graduated { background: var(--blue-lt);   color: var(--blue);   }
.badge-passed    { background: var(--green-lt);  color: var(--green);  }
.badge-failed    { background: var(--red-lt);    color: var(--red);    }
.badge-incomplete{ background: var(--yellow-lt); color: var(--yellow); }
.badge-dropped   { background: #f3f4f6;           color: #6b7280;       }

/* ── FORMS ───────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.form-label span { color: var(--red); margin-left: 2px; }

.form-control {
  font-family: var(--font);
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: 12px; color: var(--muted); }
.form-error { font-size: 12px; color: var(--red); font-weight: 600; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

/* ── ALERTS ──────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  animation: alertIn .3s ease;
}
@keyframes alertIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.alert svg { flex-shrink: 0; }
.alert-success { background: var(--green-lt); color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: var(--red-lt);   color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: var(--blue-lt);  color: #1e40af; border: 1px solid #bfdbfe; }

/* ── SEARCH BAR ──────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.search-input-wrap { position: relative; flex: 1; min-width: 220px; }
.search-input-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; stroke: var(--muted); pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state svg { width: 48px; height: 48px; stroke: var(--border2); margin-bottom: 14px; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--text2); margin-bottom: 6px; }
.empty-state p  { font-size: 14px; }

/* ── DASHBOARD GRID ──────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 24px;
}

/* ── GRADE DISPLAY ───────────────────────────────────────────── */
.grade-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 5px;
  min-width: 52px;
  text-align: center;
}
.grade-a { background: var(--green-lt);  color: var(--green); }
.grade-b { background: var(--blue-lt);   color: var(--blue);  }
.grade-c { background: var(--yellow-lt); color: var(--yellow);}
.grade-d { background: var(--red-lt);    color: var(--red);   }
.grade-f { background: #fee2e2;          color: #7f1d1d;      }

/* ── PAGINATION ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 20px 0 0;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text2);
  background: var(--surface);
  transition: all .15s;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── FOOTER ──────────────────────────────────────────────────── */
.site-footer {
  padding: 18px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  background: var(--surface);
}

/* ── MODAL BACKDROP ──────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 400;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .22s cubic-bezier(.34,1.4,.64,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(12px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 800; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px;
  border-radius: 5px; transition: color .15s, background .15s;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-body { padding: 22px 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 960px) {
  .topbar { padding: 0 16px; }
  .nav-link { padding: 0 11px; font-size: 13px; }
  .page-wrap { padding: 24px 16px 50px; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .topbar-brand .brand-name { display: none; }
  .sys-badge { display: none; }
}
