/* Goodle v1 stylesheet — kept tight, no framework. The
   structure assumes the layout in internal/web/templates/. */

:root {
  --fg: #1f2933;
  --fg-muted: #6b7280;
  --bg: #fafbfc;
  --bg-card: #ffffff;
  --accent: #2156a5;
  --accent-fg: #ffffff;
  --border: #e3e8ee;
  --error-bg: #fde8e8;
  --error-fg: #9b1c1c;
  --info-bg: #e0f2fe;
  --info-fg: #075985;
  --radius: 6px;
  --max-width: 980px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.muted { color: var(--fg-muted); font-size: 0.9em; }

/* Header */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--fg);
}
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 1rem; align-items: center; }
.nav a, .nav .me { color: var(--fg); }
.nav .me { color: var(--fg-muted); }
.header-search { display: inline-flex; align-items: center; }
.header-search input {
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  width: 220px;
}
.bell { position: relative; display: inline-flex; align-items: center; line-height: 1; }
.bell-glyph { font-size: 1.1rem; }
.bell-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  background: #d92626;
  color: #fff;
  border-radius: 999px;
  padding: 0 6px;
  min-width: 18px;
  height: 18px;
  font-size: 0.7rem;
  line-height: 18px;
  font-weight: 600;
  text-align: center;
  /* The badge displays just the count; the "N unread" suffix
     in the markup is for screen readers — clip it. */
  max-width: 32px;
  overflow: hidden;
  white-space: nowrap;
}
/* Visually-hidden but screen-reader-readable text. The standard
   accessibility pattern — keeps the bell glyph visual while
   giving its link an accessible name. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.inline-form { display: inline; }
.link-btn {
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  text-align: center;
}

main.container { padding-top: 2rem; padding-bottom: 2rem; }

/* Cards */
.card {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  border: 1px solid var(--border);
}
.card.center {
  max-width: 420px;
  margin: 3rem auto;
}

/* Forms */
form.stacked { display: flex; flex-direction: column; gap: 1rem; }
form.stacked label { display: flex; flex-direction: column; gap: 0.25rem; }
form.stacked label > span { font-weight: 500; font-size: 0.9rem; }
form.stacked input, form.stacked textarea, form.stacked select {
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
form.stacked input:focus, form.stacked textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
button.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border: 0;
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 1rem;
  cursor: pointer;
}
button.primary:hover { filter: brightness(110%); }

/* Alerts / flashes */
.alert, .flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.alert.error, .flash.error {
  background: var(--error-bg);
  color: var(--error-fg);
}
.flash.info {
  background: var(--info-bg);
  color: var(--info-fg);
}

/* Dashboard */
.dash-block { margin-bottom: 2rem; }
.dash-block h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.badge {
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
}

.course-list, .notif-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.course-list li, .notif-list li {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.course-list li:last-child, .notif-list li:last-child { border-bottom: 0; }
.notif-list li.unread { background: #fff8e1; }

/* Course view */
section.section {
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
section.section h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem 0;
}
.section-summary { color: var(--fg-muted); margin-bottom: 0.75rem; }
.cm-list { list-style: none; padding: 0; margin: 0; }
.cm-list li { padding: 0.4rem 0; border-bottom: 1px dashed var(--border); }
.cm-list li:last-child { border-bottom: 0; }
.cm-label .label-body { color: var(--fg); }

/* Page activity body */
article.page { background: var(--bg-card); padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border); }
article.page .page-intro { color: var(--fg-muted); margin-bottom: 1rem; }
article.page .page-body { line-height: 1.6; }

.breadcrumbs { margin-bottom: 1rem; font-size: 0.9rem; }

/* Courses-list page */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: 0 0 0.25rem 0; }

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.course-card {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
  transition: box-shadow 0.1s ease, transform 0.1s ease;
}
.course-card:hover {
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.07);
  transform: translateY(-1px);
}
.course-card h3 { margin: 0 0 0.25rem 0; font-size: 1.05rem; }
.course-card-meta { margin-top: 0.6rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }

.tag {
  display: inline-block;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
}
.tag-hidden { background: #fee2e2; color: #991b1b; }

/* Notifications page */
.notif-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.notif-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0.75rem;
}
.notif-body { flex: 1; }
.notif-meta {
  margin-top: 0.25rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
  font-size: 0.85rem;
}
.notif-actions {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  flex-shrink: 0;
}
.link-btn.danger { color: #b91c1c; }

/* "Add activity" disclosure on the course page */
.add-activity {
  margin: 0 0 1.5rem 0;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.add-activity summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--accent);
}
.add-activity[open] summary { margin-bottom: 0.75rem; }

/* Assignment-specific */
.assign-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  margin: 1rem 0 1.5rem 0;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.assign-meta dt { font-weight: 500; color: var(--fg-muted); }
.assign-meta dd { margin: 0; }

.assign-teacher, .assign-student {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.assign-student textarea, .assign-teacher textarea {
  font-family: inherit;
  width: 100%;
}

.form-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* Forum-specific */
.forum-section { margin: 1.5rem 0; }
.forum-start, .forum-reply { margin-top: 1.5rem; }
.forum-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0 1.5rem 0;
}
.forum-post {
  background: var(--bg-card);
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.forum-post-deleted { opacity: 0.6; }
.forum-post-header { margin-bottom: 0.5rem; font-size: 0.9rem; }
.forum-post-subject { font-weight: 500; }
.forum-post-body { line-height: 1.6; }

/* Data tables */
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
table.data th, table.data td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.data th {
  background: var(--bg);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--fg-muted);
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover { background: #fafbfc; }

/* Question bank — two-column layout (categories on the left,
   questions for the selected category on the right). Stacks
   on narrow viewports. */
.qbank-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}
.qbank-sidebar { border-right: 1px solid var(--border); padding-right: 1rem; }
.qbank-sidebar h2 { font-size: 1rem; margin: 0 0 0.5rem 0; }
.qbank-sidebar .course-list li.active { font-weight: 600; }
.qbank-sidebar .course-list li.active a { color: var(--fg); }
.qbank-main { min-width: 0; }
@media (max-width: 720px) {
  .qbank-layout { grid-template-columns: 1fr; }
  .qbank-sidebar { border-right: 0; padding-right: 0; }
}
.answer-row {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.primary-link {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius);
  padding: 0.4rem 0.8rem;
  text-decoration: none;
  font-size: 0.9rem;
}
.primary-link:hover { filter: brightness(110%); text-decoration: none; }

/* Course page block regions (component 22). The grid collapses
   to a single column under 900px so the side regions stack
   below the main content on phones. */
.course-layout {
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  gap: 1.5rem;
  align-items: start;
}
.course-side { display: flex; flex-direction: column; gap: 1rem; }
.course-main { min-width: 0; }
.block {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.75rem 1rem;
}
.block-title { margin: 0 0 0.5rem 0; font-size: 1rem; }
.block-body { font-size: 0.9rem; }
.recent-activity { padding-left: 1rem; margin: 0; }
@media (max-width: 900px) {
  .course-layout { grid-template-columns: 1fr; }
}

/* Admin home dashboard cards (component 14). */
.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}
.admin-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 1rem;
}
.admin-card h3 { margin: 0 0 0.5rem; font-size: 0.9rem; text-transform: uppercase; color: var(--fg-muted); }
.admin-card-num { font-size: 2rem; font-weight: 600; line-height: 1; margin-bottom: 0.5rem; }
.admin-card .danger { color: #b91c1c; font-weight: 600; }
.admin-server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}
.admin-server-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 1rem; }
.admin-server-card h3 { margin: 0 0 0.5rem; font-size: 0.9rem; text-transform: uppercase; color: var(--fg-muted); }
table.kv { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.kv th, table.kv td { text-align: left; padding: 0.25rem 0.5rem; vertical-align: top; }
table.kv th { font-weight: normal; color: var(--fg-muted); width: 40%; }
table.kv thead th { color: var(--fg); font-weight: 600; width: auto; border-bottom: 1px solid #e5e7eb; }

/* mod_glossary */
.glossary-letters { margin: 0 0 1rem; font-size: 0.95rem; }
.glossary-letters a, .glossary-letters strong { display: inline-block; padding: 0.1rem 0.35rem; }
.glossary-letters strong { color: var(--accent); }
.glossary-entries dt { font-weight: 600; margin-top: 1rem; }
.glossary-entries dd { margin: 0.25rem 0 0 0; }
.entry-meta { display: flex; gap: 0.5rem; align-items: center; margin: 0.25rem 0 0 0; }
