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

:root {
  --sidebar-w: 260px;
  --sidebar-collapsed: 70px;
  --accent: #5b5bd6;
  --accent2: #7c3aed;
  --bg: #f5f4ff;
  --surface: #ffffff;
  --border: rgba(91, 91, 214, 0.12);
  --text: #1a1740;
  --text-muted: #6b7280;
  --shadow: 0 2px 16px rgba(91, 91, 214, 0.08);
}

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

body {
  font-family: "Sora", sans-serif;
  background: var(--bg);
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  display: flex;
  color: var(--text);
}

button {
  font-family: "Sora", sans-serif;
}

.hidden {
  display: none !important;
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 20px rgba(91, 91, 214, 0.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  transition: width 0.3s ease;
  overflow: hidden;
}

#sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-logo {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.logo-wordmark {
  display: flex;
  align-items: baseline;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1;
}

.lw-ed {
  color: #5b5bd6;
}

.lw-b {
  color: #7c3aed;
}

.lw-oo {
  color: #7c3aed;
}

.lw-x {
  color: #d97706;
}

.logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

#sidebar.collapsed .logo-wordmark,
#sidebar.collapsed .logo-sub {
  display: none;
}

.sidebar-section-label {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 18px 20px 8px;
  white-space: nowrap;
}

#sidebar.collapsed .sidebar-section-label {
  opacity: 0;
}

.menu-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  flex: 1;
  overflow-y: auto;
}

.menu-items::-webkit-scrollbar {
  width: 3px;
}

.menu-items::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.18s;
  white-space: nowrap;
  position: relative;
}

.nav-link:hover {
  background: #f0eeff;
  color: var(--accent);
}

.nav-link.active {
  background: #ede9ff;
  color: var(--accent);
  font-weight: 700;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label {
  overflow: hidden;
}

#sidebar.collapsed .nav-label {
  display: none;
}

#sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 12px;
}

#sidebar.collapsed .nav-link.active::before {
  display: none;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
}

#sidebar.collapsed .sidebar-footer {
  opacity: 0;
  pointer-events: none;
}

.usage-widget {
  margin-bottom: 10px;
}

.usage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.usage-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.usage-val {
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
}

.usage-bar-wrap {
  width: 100%;
  height: 4px;
  background: #ede9ff;
  border-radius: 4px;
  overflow: hidden;
}

.usage-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #5b5bd6, #d97706);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.usage-bar.warn {
  background: linear-gradient(90deg, #d97706, #ef4444);
}

.usage-bar.full {
  background: #ef4444;
}

.usage-tokens {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 6px;
  opacity: 0.7;
}

.usage-copy {
  font-size: 11px;
  color: var(--accent);
  margin-top: 8px;
  opacity: 1;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ── MAIN ── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  transition: margin-left 0.3s ease;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  padding: 28px 36px 0;
  flex-shrink: 0;
  margin-bottom: 20px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.module-content {
  padding: 0 36px 40px;
  flex: 1;
  overflow-y: auto;
}

/* ── CARD ── */
.card {
  background: var(--surface);
  padding: 32px;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow-y: auto;
  width: 100%;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #5b5bd6 0%, #7c3aed 55%, #d97706 100%);
  border-radius: 20px 20px 0 0;
}

h2 {
  font-weight: 800;
  color: var(--text);
  font-size: 20px;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 22px;
  font-size: 13px;
}

/* ── FORMS ── */
.input-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 10px;
  margin-bottom: 7px;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 15px;
  border: 1.5px solid #e5e2f8;
  background: #faf9ff;
  border-radius: 10px;
  box-sizing: border-box;
  font-size: 14px;
  transition: 0.2s;
  color: var(--text);
  font-family: "Sora", sans-serif;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.1);
}

select option {
  background: white;
  color: var(--text);
}

.toggle-container {
  display: flex;
  background: #f0eeff;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 20px;
  border: 1px solid #e5e2f8;
}

.toggle-btn {
  flex: 1;
  padding: 10px;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  font-weight: 700;
  background: transparent;
  transition: 0.2s;
  color: var(--text-muted);
  font-size: 13px;
  font-family: "Sora", sans-serif;
}

.toggle-btn.active {
  background: white;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(91, 91, 214, 0.1);
}

.btn-main {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #5b5bd6, #7c3aed);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 4px 16px rgba(91, 91, 214, 0.25);
  transition: 0.2s;
}

.btn-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(91, 91, 214, 0.35);
}

.token-display {
  font-family: monospace;
  font-size: 11px;
  background: #f0eeff;
  color: var(--accent);
  padding: 7px 16px;
  border-radius: 20px;
  display: inline-block;
  margin-top: 16px;
  border: 1px solid #e5e2f8;
}

/* ── HOMEPAGE ── */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 40px 48px;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.5;
}

.hero-glow-1 {
  width: 360px;
  height: 360px;
  background: #c4b5fd;
  top: -100px;
  left: 0%;
}

.hero-glow-2 {
  width: 280px;
  height: 280px;
  background: #bfdbfe;
  top: -60px;
  right: 5%;
}

.hero-glow-3 {
  width: 200px;
  height: 200px;
  background: #fde68a;
  bottom: -40px;
  left: 45%;
  opacity: 0.3;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ede9ff;
  border: 1px solid #c4b5fd;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.hero-title-accent {
  background: linear-gradient(135deg, #5b5bd6 0%, #7c3aed 50%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 500px;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.hero-actions {
  display: flex;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.btn-hero-primary {
  background: linear-gradient(135deg, #5b5bd6, #7c3aed);
  color: white;
  padding: 13px 28px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(91, 91, 214, 0.3);
  transition: 0.2s;
}

.btn-hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(91, 91, 214, 0.4);
}

.btn-hero-ghost {
  background: white;
  color: var(--accent);
  padding: 13px 28px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid #e5e2f8;
  box-shadow: 0 2px 8px rgba(91, 91, 214, 0.06);
  transition: 0.2s;
}

.btn-hero-ghost:hover {
  background: #f5f4ff;
  transform: translateY(-2px);
}

.tools-section {
  padding: 0 40px 48px;
}

.section-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 14px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.tool-card:hover {
  border-color: rgba(91, 91, 214, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(91, 91, 214, 0.12);
}

.tool-icon {
  font-size: 20px;
  width: 42px;
  height: 42px;
  background: #f0eeff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tool-info {
  flex: 1;
}

.tool-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.tool-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.tool-arrow {
  font-size: 14px;
  color: #c4b5fd;
  transition: 0.2s;
}

.tool-card:hover .tool-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ── LESSON OUTPUT ── */
#lessonOutput {
  padding: 1rem 0;
}

.plan-header {
  background: linear-gradient(135deg, #5b5bd6, #7c3aed);
  color: white;
  padding: 16px 20px;
  border-radius: 14px;
  margin-bottom: 18px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: 0.2s;
}

.result-card:hover {
  border-color: rgba(91, 91, 214, 0.25);
  transform: translateY(-1px);
}

.result-label {
  display: flex;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.result-label::before {
  content: '◈';
  margin-right: 8px;
  color: #7c3aed;
}

.result-content {
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--text);
  font-size: 13px;
}

.beautiful-download-btn {
  background: var(--surface);
  color: var(--text);
  padding: 11px 22px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  font-family: "Sora", sans-serif;
}

.beautiful-download-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ── QUIZ CARDS ── */
.quiz-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.quiz-results-header h3 {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.btn-copy-main {
  background: var(--accent);
  color: white;
  border: none;
  padding: 7px 16px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-family: "Sora", sans-serif;
}

.btn-copy-main:hover {
  background: var(--accent2);
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.forge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: 0.2s;
}

.forge-card:hover {
  border-color: rgba(91, 91, 214, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(91, 91, 214, 0.1);
}

.card-badge {
  display: inline-block;
  background: #ede9ff;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.card-question {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 14px;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.option-pill {
  background: #faf9ff;
  border: 1px solid #e5e2f8;
  padding: 9px 13px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text);
}

.option-pill .letter {
  background: #ede9ff;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  margin-right: 10px;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  gap: 10px;
}

.correct-tag {
  display: flex;
  color: #059669;
  font-size: 12px;
  flex: 1;
}

.check-icon {
  margin-right: 6px;
  font-weight: bold;
}

.copy-card-btn {
  background: #f0eeff;
  color: var(--accent);
  border: 1px solid #e5e2f8;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
  font-family: "Sora", sans-serif;
}

.copy-card-btn:hover {
  background: #ede9ff;
}

.copy-card-btn.success {
  background: #d1fae5;
  border-color: #059669;
  color: #059669;
}

/* ── LOADER ── */
.loader-container {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #ede9ff;
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
}

#toast.success {
  background: #059669;
}

/* ── RUBRIC ── */
.rubric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.rubric-box {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid;
}

.rubric-box h4 {
  margin: 0 0 8px;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.rubric-box textarea {
  width: 100%;
  height: 80px;
  border: none;
  background: transparent;
  font-size: 13px;
  resize: none;
  outline: none;
  font-family: "Sora", sans-serif;
  line-height: 1.4;
  color: var(--text);
}

.box-red {
  background: #fff5f5;
  border-color: #fecaca;
}

.box-red h4 {
  color: #dc2626;
}

.box-orange {
  background: #fff7ed;
  border-color: #fed7aa;
}

.box-orange h4 {
  color: #ea580c;
}

.box-blue {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.box-blue h4 {
  color: #2563eb;
}

.box-green {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.box-green h4 {
  color: #16a34a;
}

/* ── EXAM FORGE ── */
.input-selection-area {
  background: var(--surface);
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.input-selection-area .field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.forge-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #5b5bd6, #7c3aed);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  font-family: "Sora", sans-serif;
  box-shadow: 0 4px 16px rgba(91, 91, 214, 0.25);
}

.forge-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(91, 91, 214, 0.35);
}

.action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  font-family: "Sora", sans-serif;
  box-shadow: var(--shadow);
}

.btn-pdf {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  font-family: "Sora", sans-serif;
}

.exam-paper-preview {
  background: white;
  color: black;
  padding: 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 600px;
  font-family: "Times New Roman", Times, serif;
  text-align: left;
  box-shadow: var(--shadow);
}

#examOutputContent {
  line-height: 1.6;
  color: #000;
}

.exam-header-main {
  text-align: center;
  border-bottom: 2px solid #000;
  margin-bottom: 18px;
  padding-bottom: 10px;
}

.exam-subject-title {
  font-size: 20px;
  font-weight: bold;
  text-transform: uppercase;
  margin: 5px 0;
}

.exam-meta-info {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  margin-top: 10px;
}

.q-item {
  margin-bottom: 18px;
}

.q-marks {
  float: right;
  font-weight: bold;
}

.passage-box {
  border: 1px solid #ccc;
  padding: 14px;
  margin: 14px 0;
  font-style: italic;
}

/* ── MISC ── */
#assessmentArea {
  font-family: 'Courier New', monospace;
  background: #faf9ff;
  padding: 20px 20px 20px 36px;
  border: 1px dashed #e5e2f8;
  border-radius: 10px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
}

#assessmentArea b,
#assessmentArea strong {
  display: block;
  margin-top: 12px;
  color: var(--accent);
  font-family: "Sora", sans-serif;
}

#planContent,
#quizContent {
  background: #faf9ff;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid #e5e2f8;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ── PRINT ── */
@media print {

  #sidebar,
  .topbar {
    display: none !important;
  }

  #main {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  .input-selection-area,
  .action-bar {
    display: none !important;
  }

  .exam-paper-preview {
    box-shadow: none;
    border: none;
    padding: 0;
  }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  #sidebar {
    width: var(--sidebar-collapsed);
  }

  #sidebar .nav-label,
  #sidebar .sidebar-section-label,
  #sidebar .logo-sub,
  #sidebar .sidebar-footer {
    display: none;
  }

  #sidebar .nav-link {
    justify-content: center;
    padding: 12px;
  }

  #main {
    margin-left: var(--sidebar-collapsed);
  }

  .module-content {
    padding: 0 16px 32px;
  }

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

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

  .card {
    padding: 20px;
  }

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

  .hero {
    padding: 48px 20px 36px;
  }

  .tools-section {
    padding: 0 20px 40px;
  }
}

/* ── LESSON PLAN TABLE ── */
.lp-table {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.lp-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  border-bottom: 1px solid var(--border);
}

.lp-row-last { border-bottom: none; }

.lp-label {
  padding: 16px 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: #faf9ff;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
}

.lp-value {
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}

.lp-sub-row {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  position: relative;
}

.lp-sub-row:last-child { border-bottom: none; padding-bottom: 0; }
.lp-sub-row:first-child { padding-top: 0; }

.lp-sub-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: none;
}

#lp-learningObjectives,
.lp-sub-row > span[id^="lp-"] {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.lp-text-content { flex: 1; line-height: 1.6; }

.lp-loading {
  color: var(--accent);
  font-style: italic;
  font-size: 12px;
  opacity: 0.7;
}

/* ── QUIZ FORGE OUTPUT ── */
.qf-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.qf-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qf-copy-all-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: "Sora", sans-serif;
  transition: 0.2s;
}

.qf-copy-all-btn:hover { opacity: 0.88; }

.qf-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.qf-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.qf-item:last-child { border-bottom: none; }

.qf-item-header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.qf-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  background: #ede9ff;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.qf-question {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  flex: 1;
}

.qf-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 36px;
}

.qf-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 7px;
  background: #faf9ff;
  border: 1px solid transparent;
}

.qf-option.qf-correct {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
  font-weight: 600;
}

.qf-letter {
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  width: 18px;
  flex-shrink: 0;
}

.qf-option.qf-correct .qf-letter { color: #15803d; }

.qf-opt-text { flex: 1; }

.qf-tick {
  font-size: 13px;
  color: #15803d;
  font-weight: 800;
}

.qf-copy-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 5px;
  cursor: pointer;
  font-family: "Sora", sans-serif;
  transition: 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.qf-copy-btn:hover { background: #ede9ff; color: var(--accent); border-color: var(--accent); }
.qf-copy-btn-done  { background: #f0fdf4 !important; color: #15803d !important; border-color: #bbf7d0 !important; }

.qf-copy-q {
  margin-left: auto;
  flex-shrink: 0;
}

/* ── EXAM PAPER PREVIEW ── */
.ep-wrap {
  font-family: "Times New Roman", Times, serif;
  color: #000;
  font-size: 14px;
  line-height: 1.6;
}

.ep-header {
  text-align: center;
  border-bottom: 2px solid #000;
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.ep-school  { font-size: 13px; font-weight: normal; }
.ep-board   { font-size: 13px; font-weight: normal; margin-bottom: 6px; }
.ep-title   { font-size: 20px; font-weight: bold; text-transform: uppercase; margin: 6px 0; }

.ep-meta {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 13px;
  margin-top: 8px;
  border-top: 1px solid #000;
  padding-top: 6px;
}

.ep-instruction {
  font-size: 12px;
  font-style: italic;
  margin-top: 8px;
  color: #333;
}

.ep-group {
  margin-bottom: 24px;
}

.ep-group-title {
  font-size: 14px;
  font-weight: bold;
  text-decoration: underline;
  margin-bottom: 4px;
}

.ep-group-instruction {
  font-size: 12px;
  font-style: italic;
  color: #444;
  margin-bottom: 10px;
}

.ep-question {
  margin-bottom: 14px;
}

.ep-q-row {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.ep-q-num {
  font-weight: bold;
  flex-shrink: 0;
  min-width: 22px;
}

.ep-q-text {
  flex: 1;
  line-height: 1.5;
}

.ep-q-marks {
  font-weight: bold;
  flex-shrink: 0;
  margin-left: 8px;
  color: #333;
}

.ep-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
  padding-left: 28px;
  margin-top: 6px;
  font-size: 13px;
}

.ep-option { padding: 2px 0; }

.ep-end {
  text-align: center;
  font-weight: bold;
  border-top: 1px solid #000;
  padding-top: 10px;
  margin-top: 20px;
  font-size: 13px;
}

/* ── AVATAR GENERATOR ── */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
}

.avatar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  background: #faf9ff;
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: 0.2s;
}

.avatar-item:hover {
  border-color: rgba(91,91,214,0.3);
  box-shadow: 0 4px 16px rgba(91,91,214,0.1);
}

.avatar-item img {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: block;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.avatar-username {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  word-break: break-all;
  max-width: 100%;
}

.avatar-dl-btn {
  background: var(--accent);
  color: white;
  border: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: 0.2s;
  font-family: "Sora", sans-serif;
}

.avatar-dl-btn:hover { opacity: 0.85; transform: scale(1.1); }

/* ── AVATAR GENERATOR v2 ── */
.av-style-preview {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 0 4px;
}

.av-preview-img {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: 0.2s;
}

.av-preview-img:hover { border-color: var(--accent); transform: scale(1.1); }

.av-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.av-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.av-placeholder {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: #f0eeff;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.av-spinner {
  width: 22px; height: 22px;
  border: 3px solid #e5e2f8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.av-info-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #f0eeff;
  border: 1px solid #e5e2f8;
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 20px;
}

.av-info-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ── COPY BUTTON (shared) ── */
.copy-field-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: "Sora", sans-serif;
  transition: 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 8px;
}

.copy-field-btn:hover { background: #ede9ff; color: var(--accent); border-color: var(--accent); }
.copy-field-btn.copied { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }

.assign-q-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.assign-q-row:last-child { border-bottom: none; }
.assign-q-text { flex: 1; font-size: 14px; line-height: 1.6; color: var(--text); }


/* ── NOTICE GENERATOR ── */
.ng-form-card {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.ng-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .ng-top { grid-template-columns: 1fr; }
}

.ng-section-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

.ng-type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.ng-chip {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: #faf9ff;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  user-select: none;
}

.ng-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f0eeff;
}

.ng-chip.selected {
  background: linear-gradient(135deg, #5b5bd6, #7c3aed);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px rgba(91, 91, 214, 0.25);
}

.ng-options-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  align-items: flex-end;
}

/* Output panel */
.ng-right {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: 0;
}

.ng-output-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.ng-output-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}

.ng-output-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ng-action-btn {
  padding: 6px 13px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: "Sora", sans-serif;
  transition: 0.18s;
  white-space: nowrap;
}

.ng-action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f0eeff;
}

.ng-regen-btn {
  background: #f0eeff;
  color: var(--accent);
  border-color: #e5e2f8;
}

.ng-tabs {
  display: flex;
  background: #f0eeff;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 14px;
  border: 1px solid #e5e2f8;
}

.ng-tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  font-family: "Sora", sans-serif;
  transition: 0.18s;
}

.ng-tab.active {
  background: white;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(91, 91, 214, 0.1);
}

.ng-panel { flex: 1; }

.ng-content-box {
  background: #faf9ff;
  border: 1.5px solid #e5e2f8;
  border-radius: 12px;
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  min-height: 220px;
  max-height: 480px;
  overflow-y: auto;
}

.ng-sms-box {
  font-family: "Sora", sans-serif;
  font-size: 13px;
  background: #f0fdf4;
  border-color: #bbf7d0;
  min-height: 100px;
}

.ng-sms-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  padding-left: 4px;
}

/* ── NOTICE IMAGE GRID ── */
.ng-img-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.ng-img-label {
  font-size: 12px;
  color: var(--text-muted);
}

.ng-img-label strong {
  color: var(--text);
  font-weight: 700;
}

.ng-img-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 700px) {
  .ng-img-grid { grid-template-columns: repeat(2, 1fr); }
}

.ng-img-item {
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: #f0eeff;
  aspect-ratio: 16/10;
  position: relative;
}

.ng-img-item.ng-img-error {
  display: none;
}

.ng-img-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  background: #f0eeff;
}

.ng-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ng-img-wrap.loaded img {
  opacity: 1;
}

.ng-img-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 23, 64, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}

.ng-img-item:hover .ng-img-overlay {
  opacity: 1;
}

.ng-img-btn {
  padding: 6px 12px;
  border-radius: 7px;
  background: white;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: "Sora", sans-serif;
  text-decoration: none;
  transition: 0.15s;
  white-space: nowrap;
}

.ng-img-btn:hover {
  background: #ede9ff;
}

.ng-img-credit {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 10px;
  text-align: right;
}

.ng-img-credit a {
  color: var(--accent);
  text-decoration: none;
}

.ng-img-credit-line {
  font-size: 10px;
  color: var(--text-muted);
  padding: 5px 8px;
  background: var(--surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── DATA PORTER REGISTRY STATUS ── */
.registry-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 14px;
  background: #f0eeff;
  border: 1px solid #e5e2f8;
  border-radius: 10px;
  gap: 12px;
}

#registryCount {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.registry-clear-btn {
  font-size: 11px;
  font-weight: 700;
  color: #dc2626;
  background: white;
  border: 1px solid #fecaca;
  border-radius: 7px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: "Sora", sans-serif;
  transition: 0.15s;
  white-space: nowrap;
}

.registry-clear-btn:hover {
  background: #fff5f5;
  border-color: #dc2626;
}


/* ── STUDENT NOTES SECTION ── */
.notes-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.notes-section {
  background: #faf9ff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  transition: 0.2s;
}

.notes-section:hover {
  border-color: rgba(91, 91, 214, 0.25);
  box-shadow: 0 4px 12px rgba(91, 91, 214, 0.08);
}

.notes-section h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notes-content {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.resource-placeholder {
  background: white;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.resource-placeholder p {
  margin: 0;
}

.resource-placeholder img,
.resource-placeholder video,
.resource-placeholder iframe {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
}

.resource-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 8px 12px;
  background: #ede9ff;
  border-radius: 8px;
  transition: 0.2s;
}

.resource-link:hover {
  background: #ddd6fe;
  text-decoration: underline;
}


/* ── HISTORY PAGE ── */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.history-card {
  background: #faf9ff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: 0.2s;
}

.history-card:hover {
  border-color: rgba(91, 91, 214, 0.3);
  box-shadow: 0 4px 12px rgba(91, 91, 214, 0.08);
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.history-type {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-date {
  font-size: 10px;
  color: var(--text-muted);
}

.history-card-body {
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

.history-card-body p {
  margin: 4px 0;
}

.history-card-body strong {
  color: var(--accent);
  font-weight: 600;
}

.history-card-footer {
  display: flex;
  gap: 8px;
}

.history-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  font-family: "Sora", sans-serif;
}

.history-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.history-btn-danger {
  color: #ef4444;
  border-color: #fecaca;
}

.history-btn-danger:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 32px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: 0.2s;
}

.modal-close:hover {
  background: #f0eeff;
  color: var(--accent);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-body pre {
  background: #faf9ff;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  font-family: 'Courier New', monospace;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}
