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

/* =========================
   1. GLOBAL SETTINGS
========================= */
:root {
  --ink: #20213a;
  --muted: #85869e;
  --purple: #6b59db;
  --purple-dark: #5745c5;
  --pale: #f5f5fc;
  --line: #ececf5;
  --white: #ffffff;
  --success: #268866;
  --radius: 14px;
  --shadow: 0 5px 22px #29204a08;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #f7f7fc;
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #c9c1ff;
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

img,
canvas {
  max-width: 100%;
}

.app {
  min-height: 100vh;
}

/* =========================
   2. SIDEBAR
========================= */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 238px;
  background: var(--white);
  border-right: 1px solid var(--line);
  padding: 28px 17px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 10px;
  margin-bottom: 32px;
  font: 800 21px 'Manrope', sans-serif;
  letter-spacing: -0.7px;
}

.brand-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 43px;
  height: 43px;
  border-radius: 14px;
  color: white;
  background: linear-gradient(145deg, #8c7cf2, #5745c5);
  box-shadow: 0 8px 20px #6b59db30;
}

.brand small {
  display: block;
  color: var(--muted);
  font: 500 10px 'DM Sans', sans-serif;
  letter-spacing: 0;
  margin-top: 2px;
}

.nav {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 11px;
  padding: 13px 14px;
  text-align: left;
  display: flex;
  gap: 13px;
  align-items: center;
  color: #777891;
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}

.nav.active,
.nav:hover {
  color: var(--purple);
  background: #f0edff;
  font-weight: 700;
}

.side-note {
  margin: auto 8px 20px;
  padding: 18px 14px;
  background: #f6f4ff;
  border-radius: 13px;
  color: #6c5ad6;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 2;
}

.side-note small {
  font-weight: 400;
  letter-spacing: 0;
  font-size: 11px;
  color: #85819d;
}

/* =========================
   3. MAIN AREA AND TOP BAR
========================= */
.main {
  margin-left: 238px;
  padding: 0 38px 30px;
  max-width: 1700px;
  min-width: 0;
}

.topbar {
  min-height: 91px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.eyebrow {
  color: #8b82d5;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.8px;
  margin-bottom: 7px;
}

.top-title {
  font: 700 17px 'Manrope', sans-serif;
}

.profile {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eae5ff;
  color: var(--purple);
  font-weight: 800;
}

.profile b,
.profile small {
  display: block;
}

.profile b {
  font-size: 12px;
}

.profile small {
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}

.menu-toggle {
  display: none;
}

/* =========================
   4. PAGES AND HEADINGS
========================= */
.page {
  padding-bottom: 12px;
  min-width: 0;
}

.hidden {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: 'Manrope', sans-serif;
}

h1 {
  font-size: clamp(25px, 3vw, 34px);
  letter-spacing: -1.2px;
  line-height: 1.25;
  margin-bottom: 8px;
}

h2 {
  font-size: 21px;
  letter-spacing: -0.5px;
}

h3 {
  font-size: 15px;
  margin-bottom: 7px;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.welcome-row,
.section-heading,
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.welcome-row {
  margin-bottom: 25px;
}

.welcome-row h1 span {
  color: #f2b65c;
}

.welcome-row p,
.section-heading p,
.panel-head p {
  margin-bottom: 0;
  font-size: 12px;
}

/* =========================
   5. BUTTONS AND LABELS
========================= */
.primary,
.outline,
.light-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: filter 0.2s, background 0.2s;
}

.primary {
  border: 0;
  border-radius: 9px;
  padding: 13px 17px;
  background: linear-gradient(110deg, #6754d3, #8574e8);
  color: white;
  font-weight: 800;
  box-shadow: 0 6px 15px #6b59db22;
}

.primary:hover {
  filter: brightness(1.05);
}

.primary.full {
  width: 100%;
  margin-top: 22px;
  justify-content: space-between;
}

.outline {
  padding: 11px 16px;
  border: 1px solid #e5e1fa;
  border-radius: 9px;
  background: white;
  color: var(--purple);
  font-weight: 700;
}

.outline:hover {
  background: #f7f5ff;
}

.tag,
.chart-label {
  display: inline-block;
  background: #f1eeff;
  color: #7767ce;
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

/* =========================
   6. DASHBOARD HERO
========================= */
.hero-card {
  background: linear-gradient(112deg, #6150cf, #8372e9 75%, #a39af3);
  color: white;
  border-radius: 19px;
  min-height: 220px;
  padding: 31px 34px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
  position: relative;
  margin-bottom: 32px;
}

.hero-label {
  font-size: 10px;
  letter-spacing: 2px;
  opacity: 0.8;
  font-weight: 700;
}

.hero-card h2 {
  font-size: clamp(25px, 3vw, 33px);
  line-height: 1.3;
  margin: 13px 0 8px;
}

.hero-card h2 span {
  color: #e8ddff;
}

.hero-card p {
  color: #e4e0ff;
  font-size: 12px;
}

.light-button {
  background: white;
  color: #5e4cc4;
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 800;
  margin-top: 7px;
}

.light-button:hover {
  background: #f4f1ff;
}

.hero-art {
  width: 210px;
  position: relative;
  flex-shrink: 0;
}

.hero-ring {
  position: absolute;
  width: 180px;
  height: 180px;
  right: 0;
  top: 5px;
  border: 1px solid #ffffff55;
  border-radius: 50%;
  box-shadow: 0 0 0 23px #ffffff0b, 0 0 0 47px #ffffff0b;
}

.hero-star {
  position: absolute;
  right: 65px;
  top: 35px;
  font-size: 72px;
  color: #ffe5a6;
  text-shadow: 0 8px 24px #382a8b55;
}

.hero-number {
  position: absolute;
  right: 30px;
  bottom: 10px;
  font: 800 42px 'Manrope', sans-serif;
  color: #ffffff4d;
}

/* =========================
   7. SECTION HEADINGS
========================= */
.section-heading {
  margin: 0 0 17px;
}

.section-heading h2 {
  margin-bottom: 5px;
}

/* =========================
   8. STAT CARDS
========================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
  margin-bottom: 30px;
}

.stat-card,
.panel,
.subject-card {
  background: white;
  border: 1px solid #efeff6;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 19px;
  min-width: 0;
}

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.stat-icon {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 10px;
  font-size: 16px;
}

.lilac {
  background: #f0ecff;
  color: #7864db;
}

.blue {
  background: #e9f3ff;
  color: #4389d7;
}

.peach {
  background: #fff1e7;
  color: #e69a56;
}

.stat-value {
  font: 800 29px 'Manrope', sans-serif;
  margin: 15px 0 4px;
  overflow-wrap: anywhere;
}

.small-value {
  font-size: 21px;
}

.stat-foot {
  color: #9b9bb0;
  font-size: 11px;
}

/* =========================
   9. CHARTS
========================= */
.charts-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 17px;
  margin-bottom: 32px;
}

.panel {
  padding: 23px;
  margin-bottom: 20px;
  min-width: 0;
}

.panel-head {
  margin-bottom: 17px;
  align-items: flex-start;
}

.panel-head h3 {
  margin-bottom: 5px;
}

.chart-box {
  height: 230px;
  position: relative;
  width: 100%;
}

.donut-box {
  max-width: 250px;
  margin: 0 auto;
  height: 205px;
}

.legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 13px;
  font-size: 10px;
  color: var(--muted);
  margin-top: 10px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 50%;
  background: #8b78e9;
}

.blue-dot {
  background: #63a7e9;
}

.orange-dot {
  background: #f3b46f;
}

/* =========================
   10. SUBJECT CARDS
========================= */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}

.subject-card {
  padding: 18px;
  min-width: 0;
}

.subject-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 17px;
}

.subject-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 12px;
  font-size: 17px;
  background: #f0ecff;
  color: #7663d9;
}

.subject-card:nth-child(2) .subject-icon {
  background: #eaf4ff;
  color: #438cd9;
}

.subject-card:nth-child(3) .subject-icon {
  background: #fff1e5;
  color: #dd9353;
}

.subject-card:nth-child(4) .subject-icon {
  background: #e8f8f2;
  color: #329d7b;
}

.subject-card:nth-child(5) .subject-icon {
  background: #fff0f4;
  color: #d77c9a;
}

.subject-head h3 {
  margin: 0;
}

.subject-score {
  font: 800 24px 'Manrope', sans-serif;
}

.subject-score small {
  font: 500 11px 'DM Sans', sans-serif;
  color: var(--muted);
}

.progress-track {
  height: 5px;
  background: #eeeef7;
  border-radius: 8px;
  margin: 10px 0 17px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 8px;
  background: #8574e8;
  transition: width 0.3s ease;
}

.subject-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.subject-actions button {
  flex: 1;
  min-width: 65px;
  padding: 9px 4px;
  border: 1px solid #eae8f6;
  border-radius: 7px;
  background: white;
  color: #6e60c7;
  font-size: 10px;
  font-weight: 700;
}

.subject-actions button:hover {
  background: #f2efff;
}

/* =========================
   11. FOOTER
========================= */
.footer-note {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
  color: #a0a0b4;
  font-size: 10px;
}

/* =========================
   12. LOGIN AND REGISTER
========================= */
.auth-page {
  min-height: calc(100vh - 125px);
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}

.auth-art {
  position: relative;
  padding: 48px 36px;
  background: linear-gradient(145deg, #5b4ac8, #8070e5 70%, #a39af2);
  color: white;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 560px;
}

.art-orbit {
  position: absolute;
  top: 40px;
  right: 40px;
  font-size: 50px;
  color: #ffe6a7;
}

.art-symbol {
  width: 65px;
  height: 65px;
  border: 1px solid #ffffff80;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font: 800 30px 'Manrope', sans-serif;
  margin-bottom: 30px;
  background: #ffffff16;
}

.auth-art h1 {
  font-size: clamp(31px, 4vw, 46px);
  line-height: 1.2;
}

.auth-art h1 span {
  color: #ffe2a0;
}

.auth-art p {
  color: #e4dfff;
  max-width: 270px;
  line-height: 1.8;
}

.art-bottom {
  position: absolute;
  bottom: 27px;
  left: 36px;
  font-size: 9px;
  letter-spacing: 2px;
  opacity: 0.75;
}

.auth-form {
  padding: 42px clamp(22px, 4vw, 55px);
  align-self: center;
  min-width: 0;
}

.auth-form h2 {
  font-size: 27px;
  margin: 12px 0 7px;
}

.auth-form > p {
  font-size: 12px;
}

.role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f4f3fa;
  padding: 4px;
  border-radius: 9px;
  margin: 24px 0;
}

.role {
  padding: 11px 5px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  color: #85849d;
  font-size: 12px;
  font-weight: 700;
}

.role.active {
  background: white;
  color: #6857d2;
  box-shadow: 0 2px 7px #30245a0c;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  margin: 15px 0 8px;
  color: #494960;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid #e6e5ef;
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: #b2b1c3;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #8b7ae8;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
}

.auth-links button {
  border: 0;
  background: transparent;
  color: #6b59db;
  font-size: 11px;
  font-weight: 700;
  padding: 0;
}

.tiny {
  font-size: 10px;
  color: #9999ae;
  line-height: 1.7;
  margin-top: 17px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.full-field {
  grid-column: 1 / -1;
}

.auth-form:has(#registerForm:not(.hidden)) {
  padding-top: 25px;
  padding-bottom: 25px;
}

#registerForm .full {
  margin-top: 15px;
}

/* =========================
   13. RESULTS AND MARKS
========================= */
.results-panel {
  margin-top: 25px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-row label {
  margin: 0;
}

.filter-row select {
  width: auto;
  min-width: 160px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 570px;
}

th {
  background: #f8f7fd;
  color: #85849b;
  font-size: 10px;
  letter-spacing: 0.4px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid #f0eff6;
}

td {
  font-size: 12px;
}

.score-pill {
  display: inline-block;
  background: #eaf8f1;
  color: #268866;
  padding: 6px 9px;
  border-radius: 6px;
  font-weight: 800;
}

.add-panel {
  margin-top: 20px;
}

.result-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.result-form label {
  margin-top: 8px;
}

.result-form .primary {
  margin-top: 0;
  min-height: 43px;
}

/* =========================
   14. STUDENTS AND ANALYSIS
========================= */
#students .panel,
#analysis .panel {
  margin-top: 25px;
}

#analysis .panel {
  text-align: center;
  padding: 55px 22px;
}

#analysis .panel p {
  max-width: 430px;
  margin: 0 auto 18px;
}

.empty-icon {
  font-size: 34px;
  color: #7765d8;
  background: #f1edff;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
}

/* Student cards created by JavaScript */
#studentList {
  display: grid;
  gap: 12px;
}

#studentList > *,
#dashboardStudentGrid > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* =========================
   15. UPCOMING ASSESSMENTS
========================= */
#upcoming .panel {
  margin-top: 25px;
}

#upcoming .empty-icon {
  margin-top: 15px;
}

/* =========================
   16. TOAST NOTIFICATION
========================= */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: #292642;
  color: white;
  padding: 12px 19px;
  border-radius: 10px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =========================
   17. LARGE SCREENS
========================= */
@media (min-width: 1500px) {
  .main {
    margin-right: auto;
    padding-left: 48px;
    padding-right: 48px;
  }
}

/* =========================
   18. TABLETS
========================= */
@media (max-width: 1050px) {
  .sidebar {
    width: 205px;
  }

  .main {
    margin-left: 205px;
    padding: 0 23px 25px;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .subject-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-page {
    grid-template-columns: 0.8fr 1.2fr;
  }

  .auth-art {
    padding: 35px 25px;
  }

  .art-bottom {
    left: 25px;
  }

  .result-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================
   19. MOBILE PHONES
========================= */
@media (max-width: 700px) {
  .sidebar {
    width: 238px;
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 15px 0 35px #17112d20;
  }

  .main {
    margin-left: 0;
    padding: 0 16px 24px;
  }

  .topbar {
    min-height: 76px;
    margin-bottom: 24px;
  }

  .menu-toggle {
    display: block;
    flex-shrink: 0;
    border: 0;
    background: #efedff;
    color: #6b59db;
    padding: 10px 12px;
    border-radius: 8px;
  }

  .top-title {
    font-size: 14px;
  }

  .profile {
    gap: 7px;
  }

  .profile small {
    display: none;
  }

  .avatar {
    width: 35px;
    height: 35px;
  }

  .welcome-row {
    align-items: flex-start;
  }

  .welcome-row h1 {
    font-size: 25px;
  }

  .welcome-row .outline {
    font-size: 10px;
    padding: 10px;
    white-space: nowrap;
  }

  .hero-card {
    padding: 25px 20px;
    min-height: 215px;
  }

  .hero-card h2 {
    font-size: 26px;
  }

  .hero-art {
    width: 90px;
    opacity: 0.8;
  }

  .hero-ring {
    width: 110px;
    height: 110px;
    right: -30px;
    top: 25px;
  }

  .hero-star {
    right: -1px;
    top: 50px;
    font-size: 46px;
  }

  .hero-number {
    right: -8px;
    bottom: 4px;
    font-size: 29px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-value {
    font-size: 25px;
    margin-top: 9px;
  }

  .stat-top {
    font-size: 11px;
  }

  .charts-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .panel {
    padding: 17px;
  }

  .chart-box {
    height: 210px;
  }

  .subject-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .section-heading h2 {
    font-size: 18px;
  }

  .footer-note {
    flex-wrap: wrap;
  }

  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-art {
    min-height: 210px;
    padding: 26px 24px;
  }

  .art-symbol {
    width: 42px;
    height: 42px;
    font-size: 21px;
    border-radius: 12px;
    margin-bottom: 15px;
  }

  .auth-art h1 {
    font-size: 28px;
    margin-bottom: 8px;
  }

  .auth-art p {
    font-size: 11px;
    margin-bottom: 0;
  }

  .art-orbit {
    top: 20px;
    right: 25px;
    font-size: 32px;
  }

  .art-bottom {
    display: none;
  }

  .auth-form {
    padding: 27px 22px;
  }

  .auth-form h2 {
    font-size: 24px;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0 9px;
  }

  .result-form {
    grid-template-columns: 1fr;
  }

  .panel-head {
    gap: 8px;
  }

  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-row select {
    width: 100%;
  }
}

/* =========================
   20. VERY SMALL PHONES
========================= */
@media (max-width: 360px) {
  .main {
    padding-left: 11px;
    padding-right: 11px;
  }

  .profile b {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .welcome-row {
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .full-field {
    grid-column: auto;
  }

  .hero-art {
    display: none;
  }

  .auth-form {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* =========================
   21. REDUCED MOTION
========================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
