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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f7fa;
  color: #1a1a2e;
  line-height: 1.6;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Login View */
#login-view {
  max-width: 400px;
  margin: 4rem auto;
  background: #fff;
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

#login-view h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: #666;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #4a6cf7;
  box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.15);
}

button[type="submit"] {
  width: 100%;
  padding: 0.7rem;
  background: #4a6cf7;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.2s;
}

button[type="submit"]:hover {
  background: #3a5ce5;
}

button[type="submit"]:disabled {
  background: #a0b0e0;
  cursor: not-allowed;
}

.error {
  background: #fef2f2;
  color: #b91c1c;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

/* Results View */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.header-row h1 {
  font-size: 1.5rem;
}

.btn-link {
  background: none;
  border: none;
  color: #4a6cf7;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.btn-link:hover {
  text-decoration: underline;
}

.student-name {
  color: #666;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: #333;
}

/* CLO Score Bars */
.clo-bars {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.clo-bar-item {
  background: #fff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.clo-bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.clo-bar-track {
  background: #e5e7eb;
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
}

.clo-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Color palette for CLO bars */
.clo-bar-fill.clo1 { background: #4a6cf7; }
.clo-bar-fill.clo2 { background: #10b981; }
.clo-bar-fill.clo3 { background: #f59e0b; }
.clo-bar-fill.clo4 { background: #ef4444; }
.clo-bar-fill.clo5 { background: #8b5cf6; }

/* Breakdown Table */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  font-size: 0.9rem;
}

th, td {
  padding: 0.6rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
}

th {
  background: #f8f9fb;
  font-weight: 600;
  color: #555;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

td:first-child,
th:first-child {
  text-align: left;
}

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

tr.final-row {
  background: #f0f4ff;
  font-weight: 700;
}

tr.final-row td {
  border-top: 2px solid #4a6cf7;
}

tr.adj-row {
  background: #f5f0ff;
  font-weight: 600;
}

tr.adj-row td {
  border-top: 1px solid #c4b5fd;
}

tr.level-row {
  background: #faf8ff;
}

tr.level-row td {
  font-size: 0.8rem;
}

/* Grade Summary */
.grade-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: #fff;
  padding: 1.25rem 1.5rem;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  margin-bottom: 1.5rem;
}

.grade-letter {
  font-size: 2.5rem;
  font-weight: 800;
  color: #4a6cf7;
  min-width: 4rem;
  text-align: center;
}

.grade-detail {
  display: flex;
  flex-direction: column;
}

.grade-pct {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1a1a2e;
}

.grade-label {
  font-size: 0.85rem;
  color: #888;
}

/* Outcome Level Tags */
.outcome-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.outcome-0  { background: #fee2e2; color: #991b1b; }
.outcome-2  { background: #ffedd5; color: #9a3412; }
.outcome-25 { background: #fef9c3; color: #854d0e; }
.outcome-3  { background: #dcfce7; color: #166534; }
.outcome-4  { background: #dbeafe; color: #1e40af; }

/* CLO Bar Score */
.clo-bar-score {
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.2rem;
  text-align: right;
}

/* Reference Tables */
.ref-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ref-table-wrap h3 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: #555;
}

.ref-table {
  font-size: 0.8rem;
}

@media (max-width: 600px) {
  .ref-tables {
    grid-template-columns: 1fr;
  }
}

/* Download Button */
.btn-download {
  display: block;
  width: 100%;
  padding: 0.7rem;
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  transition: background 0.2s;
}

.btn-download:hover {
  background: #059669;
}

.footer {
  color: #999;
  font-size: 0.8rem;
  text-align: center;
  margin-top: 1rem;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 1rem 0.75rem;
  }

  #login-view {
    margin: 2rem auto;
    padding: 1.5rem;
  }

  table {
    font-size: 0.8rem;
  }

  th, td {
    padding: 0.4rem 0.5rem;
  }
}
