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

:root {
  --navy:       #0d1b2a;
  --navy-mid:   #1b2d45;
  --navy-light: #243852;
  --accent:     #3b82f6;
  --accent-hover: #2563eb;
  --green:      #22c55e;
  --yellow:     #f59e0b;
  --red:        #ef4444;
  --purple:     #8b5cf6;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --border:     #1e3a5f;
  --card-bg:    #162032;
  --radius:     10px;
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--navy);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { padding-left: 1.4rem; }
li { margin-bottom: .35rem; }
pre { white-space: pre-wrap; word-break: break-word; }

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
  background: var(--navy-mid);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}
.brand-icon { font-size: 1.3rem; }
.brand-sub {
  font-size: .75rem;
  font-weight: 400;
  color: var(--text-muted);
  background: var(--navy-light);
  padding: .15rem .5rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.nav-admin {
  font-size: .85rem;
  color: var(--text-muted);
}
.nav-admin:hover { color: var(--accent); text-decoration: none; }

/* ── Layout ───────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
}
.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .5rem;
}
.hero-sub { color: var(--text-muted); font-size: 1.05rem; }

/* ── Page Header ──────────────────────────────────────── */
.page-header { margin-bottom: 2rem; }
.page-header.center { text-align: center; }
.page-header h1 { font-size: 1.8rem; font-weight: 700; margin: .5rem 0; }
.page-meta { display: flex; gap: .6rem; align-items: center; margin-bottom: .4rem; }
.session-label { font-size: .8rem; color: var(--text-muted); }
.back-link { font-size: .85rem; color: var(--text-muted); display: inline-block; margin-bottom: .5rem; }
.back-link:hover { color: var(--accent); }

/* ── Session Section ──────────────────────────────────── */
.session-section { margin-bottom: 3rem; }
.session-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.session-header h2 { font-size: 1.2rem; font-weight: 600; }
.session-badge {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; flex-shrink: 0;
}

/* ── Cards ────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.card-grid.compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.assignment-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: border-color .2s, transform .2s;
}
.assignment-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.card-top { display: flex; flex-direction: column; gap: .5rem; }
.assignment-card h3 { font-size: 1rem; font-weight: 600; }
.card-desc { font-size: .85rem; color: var(--text-muted); line-height: 1.5; }

.mini-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}
.mini-title { font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.mini-row { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; color: var(--text-muted); }
.avg-badge {
  background: var(--navy-light);
  padding: .15rem .5rem;
  border-radius: 20px;
  font-size: .75rem;
  color: var(--accent);
}

/* ── Type Badges ──────────────────────────────────────── */
.type-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .05em;
}
.type-python  { background: #1e3a5f; color: #60a5fa; }
.type-sql     { background: #1e3d2f; color: #4ade80; }
.type-design  { background: #2d1e5f; color: #c4b5fd; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .6rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  border: none;
  transition: background .2s, transform .15s;
  text-decoration: none;
  text-align: center;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-outline:hover { background: var(--navy-light); }
.btn-large { padding: .85rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; display: block; }

/* ── Two Column Layout ────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 768px) { .two-col { grid-template-columns: 1fr; } }

.detail-panel, .form-panel { display: flex; flex-direction: column; gap: 1rem; }

.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.panel-card h3 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .75rem;
}
.problem-text { line-height: 1.7; white-space: pre-wrap; }
.code-block {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .9rem 1rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .82rem;
  color: #93c5fd;
  line-height: 1.6;
}

/* ── Form ─────────────────────────────────────────────── */
.submit-form { display: flex; flex-direction: column; gap: 1rem; }
.form-row.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 500px) { .form-row.two { grid-template-columns: 1fr; } }

.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group label { font-size: .85rem; font-weight: 500; color: var(--text-muted); }
.required { color: var(--red); }

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .65rem .9rem;
  color: var(--text);
  font-size: .9rem;
  font-family: var(--font);
  transition: border-color .2s;
  width: 100%;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; font-family: 'JetBrains Mono', monospace; font-size: .82rem; }

.grader-info-box {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  background: #0f2a4a;
  border: 1px solid #1e4976;
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .85rem;
  color: #93c5fd;
  line-height: 1.5;
}
.info-icon { flex-shrink: 0; font-size: 1rem; margin-top: .05rem; }

.divider-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
}
.or-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--text-muted);
  font-size: .8rem;
}
.or-divider::before, .or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* File Upload */
.file-upload-area { position: relative; }
.file-upload-area input[type="file"] {
  position: absolute; opacity: 0; width: 0; height: 0;
}
.file-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  cursor: pointer;
  transition: border-color .2s;
  text-align: center;
}
.file-label:hover { border-color: var(--accent); }
.file-icon { font-size: 1.8rem; }
.file-text { font-size: .9rem; font-weight: 500; }
.file-hint { font-size: .75rem; color: var(--text-muted); }

/* ── Alerts ───────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: 6px;
  font-size: .9rem;
}
.alert-error { background: #3b0f0f; border: 1px solid var(--red); color: #fca5a5; }

/* ── Score Hero ───────────────────────────────────────── */
.score-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem 1rem 2rem;
}
.score-ring {
  width: 130px; height: 130px;
  border-radius: 50%;
  border: 8px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-green { border-color: var(--green); }
.ring-yellow { border-color: var(--yellow); }
.ring-red { border-color: var(--red); }

.score-number { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.score-max { font-size: .8rem; color: var(--text-muted); }
.score-label { font-size: 1.1rem; font-weight: 600; }

.score-bar-wrap { display: flex; align-items: center; gap: .75rem; width: 100%; max-width: 380px; }
.score-bar { flex: 1; height: 8px; background: var(--navy-light); border-radius: 4px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 4px; transition: width .8s ease; }
.fill-green { background: var(--green); }
.fill-yellow { background: var(--yellow); }
.fill-red { background: var(--red); }
.score-pct { font-size: .85rem; font-weight: 600; min-width: 38px; }

/* ── Result Grid ──────────────────────────────────────── */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 640px) { .result-grid { grid-template-columns: 1fr; } }

.result-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.result-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: .75rem; }
.result-card p { line-height: 1.7; }
.full-width { grid-column: 1 / -1; }
.card-green { border-left: 4px solid var(--green); }
.card-red    { border-left: 4px solid var(--red); }
.card-blue   { border-left: 4px solid var(--accent); }
.card-purple { border-left: 4px solid var(--purple); }

/* ── Meta Bar ─────────────────────────────────────────── */
.meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: .8rem;
  color: var(--text-muted);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem 1.2rem;
  margin-bottom: 1.5rem;
}

/* ── CTA Row ──────────────────────────────────────────── */
.cta-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }

/* ── Stats Row ────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (max-width: 640px) { .stats-row { grid-template-columns: 1fr 1fr; } }

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}
.stat-card.stat-green { border-top: 3px solid var(--green); }
.stat-card.stat-red   { border-top: 3px solid var(--red); }
.stat-card.stat-blue  { border-top: 3px solid var(--accent); }
.stat-number { font-size: 2rem; font-weight: 800; }
.stat-label  { font-size: .8rem; color: var(--text-muted); }

/* ── Table ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
}
.data-table th {
  background: var(--navy-light);
  padding: .75rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  white-space: nowrap;
}
.data-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--navy-light); }

/* ── Pills & Badges ───────────────────────────────────── */
.score-pill {
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 700;
}
.pill-green  { background: #14532d; color: #4ade80; }
.pill-yellow { background: #451a03; color: #fcd34d; }
.pill-red    { background: #3b0f0f; color: #f87171; }

.status-badge {
  padding: .2rem .6rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.status-graded    { background: #14532d; color: #4ade80; }
.status-submitted { background: #1e3a5f; color: #60a5fa; }
.status-failed    { background: #3b0f0f; color: #f87171; }

/* ── Section ──────────────────────────────────────────── */
.section { margin-bottom: 2.5rem; }
.section-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }

/* ── Auth ─────────────────────────────────────────────── */
.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4rem 1rem;
}
.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}
.auth-card h2 { font-size: 1.4rem; margin-bottom: .4rem; }

/* ── Misc ─────────────────────────────────────────────── */
.muted  { color: var(--text-muted); }
.small  { font-size: .8rem; }
.link-btn { font-size: .82rem; color: var(--accent); }
.link-btn:hover { text-decoration: underline; }

.empty-state {
  background: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
}

/* ── Footer ───────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: .8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
