:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --accent: #0f766e;
  --accent-soft: #dff7f3;
  --text: #172033;
  --muted: #667085;
  --border: #d9e2ef;
  --ring: rgba(37, 99, 235, 0.18);
  --shadow: 0 16px 36px rgba(31, 41, 55, 0.08);
  --header-bg: rgba(255, 255, 255, 0.86);
  --card-bg: rgba(255, 255, 255, 0.94);
  --input-bg: #ffffff;
  --hero-line: #e0f2fe;
}

html[data-theme="dark"] {
  --bg: #101418;
  --surface: #18202a;
  --surface-soft: #202a36;
  --primary: #60a5fa;
  --primary-dark: #93c5fd;
  --accent: #2dd4bf;
  --accent-soft: #143a38;
  --text: #edf2f7;
  --muted: #a7b2c1;
  --border: #334155;
  --ring: rgba(96, 165, 250, 0.22);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.26);
  --header-bg: rgba(24, 32, 42, 0.88);
  --card-bg: rgba(24, 32, 42, 0.94);
  --input-bg: #111827;
  --hero-line: #c7d2fe;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 28rem),
    linear-gradient(315deg, rgba(15, 118, 110, 0.08), transparent 26rem),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  padding: 1.4rem 0;
  margin-bottom: 1rem;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.site-header .container,
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.site-header p {
  margin: 0.45rem 0 0;
  max-width: 42rem;
  color: var(--muted);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-soft);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#user-welcome {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

nav,
.nav-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

nav a,
.nav-pills a,
.nav-button {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  margin-top: 0;
}

nav a:hover,
.nav-pills a:hover,
.nav-button:hover {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--primary-dark);
  transform: none;
}

.lock-menu::before {
  content: "🔒";
  margin-right: 0.35rem;
  font-size: 0.95rem;
}

main.container {
  padding-bottom: 3rem;
}

.teacher-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  padding-bottom: 3rem;
}

.student-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 1rem;
  align-items: start;
  padding-bottom: 3rem;
}

.teacher-shell main.container {
  width: 100%;
  padding-bottom: 0;
}

.student-shell main.container {
  width: 100%;
  padding-bottom: 0;
}

.teacher-sidebar {
  position: sticky;
  top: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.student-sidebar {
  position: sticky;
  top: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.side-nav {
  display: grid;
  gap: 0.35rem;
  align-items: stretch;
  justify-content: stretch;
}

.side-nav a {
  display: flex;
  align-items: center;
  min-height: 2.65rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 850;
}

.side-nav a:hover,
.side-nav a[aria-current="page"] {
  border-color: var(--border);
  background: var(--surface-soft);
  color: var(--primary-dark);
}

.card {
  margin-bottom: 1rem;
  padding: clamp(1.1rem, 2vw, 1.6rem);
  border: 1px solid rgba(217, 226, 239, 0.95);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.card h2,
.card h3 {
  margin: 0 0 0.75rem;
  line-height: 1.2;
}

.card p {
  color: var(--muted);
}

.split-hero,
.login-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(280px, 1fr);
  gap: clamp(1rem, 4vw, 3rem);
  align-items: center;
}

.hero-copy h2,
.login-card h2 {
  margin-bottom: 0.5rem;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.hero-copy p,
.login-card p {
  max-width: 34rem;
}

.hero-actions,
.top-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}

.action-row {
  margin-top: 1rem;
}

.visual-panel,
.logo-box {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.92), rgba(15, 118, 110, 0.88)),
    #1d4ed8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.logo-box {
  background: var(--surface-soft);
}

.logo-box img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
}

.visual-panel::before,
.visual-panel::before {
  content: "";
  position: absolute;
  inset: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
}

.visual-panel::after,
.visual-panel::after {
  content: "";
  position: absolute;
  right: 2rem;
  bottom: 2rem;
  width: 58%;
  height: 52%;
  border-radius: 8px;
  background:
    linear-gradient(#fff, #fff) 18% 24% / 56% 6px no-repeat,
    linear-gradient(var(--hero-line), var(--hero-line)) 18% 40% / 68% 5px no-repeat,
    linear-gradient(var(--hero-line), var(--hero-line)) 18% 54% / 45% 5px no-repeat,
    rgba(255, 255, 255, 0.18);
  box-shadow:
    -58px -48px 0 -16px rgba(255, 255, 255, 0.24),
    -98px 20px 0 -22px rgba(255, 255, 255, 0.22),
    0 22px 50px rgba(15, 23, 42, 0.18);
}

.visual-panel span,
.visual-panel span {
  position: absolute;
  left: 2rem;
  top: 2rem;
  max-width: 14rem;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.12;
}

.login-card {
  width: 100%;
  max-width: 430px;
  justify-self: center;
}

label {
  display: block;
  margin-top: 1rem;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.8rem;
  margin-top: 0.45rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input[type="file"] {
  padding: 0.7rem;
  background: var(--surface-soft);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
}

textarea {
  resize: vertical;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

button:hover,
.button:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
}

button.secondary,
.button.secondary,
.hero-actions .button:first-child {
  border-color: var(--border);
  background: var(--input-bg);
  color: var(--text);
}

button.secondary:hover,
.button.secondary:hover,
.hero-actions .button:first-child:hover {
  background: var(--surface-soft);
  color: var(--primary-dark);
}

.section-header,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.filter-row > * {
  flex: 1 1 220px;
}

.materials-list,
#materials-list,
#activities-list,
#classes-list,
#subjects-list,
#students-list-page,
#class-students,
#my-subjects-list,
#due-summary {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.material-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.material-item h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.material-item p {
  margin: 0.25rem 0;
  color: var(--muted);
}

.material-item small {
  color: var(--muted);
}

.material-item a {
  display: inline-flex;
  margin-top: 0.75rem;
  margin-right: 0.75rem;
}

.material-item button {
  margin-top: 0.75rem;
  margin-right: 0.45rem;
}

.activity-card {
  position: relative;
}

.activity-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.compact-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.compact-form button {
  margin-top: 0.45rem;
}

.submissions-panel,
.submission-summary {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.subject-card h3 {
  margin-bottom: 0.85rem;
}

.subject-activity-group {
  display: grid;
  gap: 0.8rem;
  padding-top: 0.4rem;
}

.subject-activity-group + .subject-activity-group {
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.subject-activity-group > h3 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 1.05rem;
}

.subject-materials {
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.subject-materials ul {
  display: grid;
  gap: 0.75rem;
  padding-left: 1.2rem;
  margin: 0;
}

.subject-materials li p {
  margin: 0.2rem 0 0;
}

.submissions-panel h4 {
  margin: 0 0 0.8rem;
}

.submission-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.4fr);
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.submission-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.grade-fields {
  display: grid;
  grid-template-columns: minmax(100px, 0.35fr) minmax(180px, 1fr) auto;
  gap: 0.7rem;
  align-items: end;
}

.grade-fields button {
  margin-top: 0.45rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 1.8rem;
  margin: 0 0 0.6rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 900;
}

.status-badge.done {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-badge.pending {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.lock-icon {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  margin-right: 0.45rem;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1rem;
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

hr {
  height: 1px;
  margin: 1.5rem 0;
  border: 0;
  background: var(--border);
}

.form-card {
  max-width: 680px;
  margin: 1rem auto;
}

#subjects-area {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

#subjects-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.65rem;
  font-weight: 700;
}

#subjects-checkboxes input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.site-footer {
  padding: 1.5rem 0 2.5rem;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 760px) {
  .site-header .container,
  .header-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .teacher-shell {
    grid-template-columns: 1fr;
  }

  .student-shell {
    grid-template-columns: 1fr;
  }

  .teacher-sidebar {
    position: static;
  }

  .student-sidebar {
    position: static;
    order: -1;
  }

  nav,
  .nav-pills {
    justify-content: flex-start;
  }

  .split-hero,
  .login-grid {
    grid-template-columns: 1fr;
  }

  .visual-panel,
  .logo-box {
    min-height: 220px;
  }

  .top-actions .button,
  .hero-actions .button,
  button {
    width: 100%;
  }

  .compact-form,
  .submission-row,
  .grade-fields {
    grid-template-columns: 1fr;
  }
}
