/* Courses landing + per-course pages */
/* Light blue background applied site-wide on any page that loads courses.css.
   Keep the masthead (logo + nav) white with a thin divider so it stays legible. */
body { background: #eaf2fb; }
.masthead,
.masthead .greedy-nav { background: #fff; }
.masthead { border-bottom: 1px solid #d7e2ee; }

.courses-wrap { max-width: 960px; margin: 2.5rem auto; padding: 0 1.5rem; }
.courses-wrap h1 { margin-top: 0; }

/* Subtle "Report an error" link near the bottom of the landing page. */
.report-link-row { margin-top: 3rem; text-align: right; }
.report-link-row a {
  font-size: .85rem; color: #888; text-decoration: none;
  border-bottom: 1px dotted #bbb;
}
.report-link-row a:hover { color: #2f5d8c; border-bottom-color: #2f5d8c; }

/* Report modal */
.report-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  padding: 1rem;
}
.report-modal-backdrop[hidden] { display: none; }
.report-modal {
  background: #fff; border-radius: 8px; padding: 1.75rem 1.75rem 1.5rem;
  max-width: 540px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.report-modal h2 { margin: 0 0 .5rem; }
.report-help { color: #555; font-size: .9rem; margin: 0 0 1rem; }
.report-modal label {
  display: block; font-weight: 600; font-size: .9rem;
  margin: .85rem 0 .25rem;
}
.report-modal input, .report-modal select, .report-modal textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid #ccc; border-radius: 4px;
  font-size: 1rem; font-family: inherit; box-sizing: border-box;
}
.report-modal textarea { resize: vertical; }
.report-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }
.report-btn {
  padding: .5rem 1rem; border: 0; border-radius: 4px; font-size: .95rem;
  cursor: pointer;
}
.report-btn.primary { background: #2f5d8c; color: #fff; }
.report-btn.primary:hover:not(:disabled) { background: #244a70; }
.report-btn.primary:disabled { opacity: .6; cursor: not-allowed; }
.report-btn.secondary { background: #e5e7eb; color: #333; }
.report-btn.secondary:hover { background: #d1d5db; }
.report-msg { margin-top: .75rem; min-height: 1.2em; font-size: .9rem; }
.report-msg.error { color: #b00; }
.report-msg.ok { color: #060; }

/* Landing page cards */
.course-grid {
  display: grid; gap: 1.5rem; margin-top: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.course-card {
  display: block; padding: 2rem 1.5rem; border: 1px solid #ddd;
  border-radius: 8px; text-decoration: none; color: inherit;
  background: #fff; transition: transform .1s, box-shadow .1s, border-color .1s;
}
.course-card:hover {
  transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08);
  border-color: #2f5d8c; text-decoration: none;
}
.course-card h2 { margin: 0 0 .5rem; color: #2f5d8c; }
.course-card p  { margin: 0; color: #555; font-size: .95rem; }

/* Per-course header */
.course-header { border-bottom: 1px solid #ddd; padding-bottom: 1rem;
  margin-bottom: 1.5rem; }
.course-status { margin: .5rem 0 0; }
.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 4px;
  font-size: .85rem; font-weight: 600;
}
.badge.ok     { background: #e6f4ea; color: #1b6b34; }
.badge.locked { background: #fff3cd; color: #8a6d00; }

/* Lesson accordion */
.lesson-list { display: flex; flex-direction: column; gap: .5rem; }
.lesson {
  border: 1px solid #ddd; border-radius: 6px; background: #fff;
  overflow: hidden;
}
.lesson > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1rem; user-select: none;
}
.lesson > summary::-webkit-details-marker { display: none; }
.lesson > summary:hover { background: #f6f8fa; }
.lesson .lesson-num {
  font-variant-numeric: tabular-nums; font-weight: 700;
  color: #2f5d8c; min-width: 2.5ch;
}
.lesson .lesson-title { flex: 1; font-weight: 500; }
.lesson .lock-icon { color: #8a6d00; }
.lesson .done-icon { color: #1b6b34; font-weight: 700; font-size: 1.1em; }
.lesson.completed .lesson-title { color: #1b6b34; }
.lesson-body .resource.disabled {
  opacity: .5; pointer-events: none;
}

/* Course-level "extra" tile (e.g. Practice F=ma Exam) — sized like a lesson
   row but flat blue so it stands out as an end-of-course action. */
.lesson-extra {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1rem;
  border: 1px solid #2f5d8c;
  background: #f1f6fb;
  border-radius: 6px;
  text-decoration: none; color: inherit;
}
.lesson-extra:hover {
  background: #e3edf6;
  text-decoration: none; color: inherit;
}
.lesson-extra .lesson-extra-icon {
  height: 1.5rem; width: auto; flex-shrink: 0;
}
.lesson-extra .lesson-title { color: #2f5d8c; font-weight: 600; }
.lesson-extra.locked {
  border-color: #ccc; background: #f8f8f8;
}
.lesson-extra.locked .lesson-num,
.lesson-extra.locked .lesson-title { color: #555; }
.lesson.locked > summary { color: #888; }
.lesson.locked > summary:hover { background: #fff8e1; }

.lesson-body {
  padding: 0 1rem 1rem;
}
.lesson-readings {
  margin-bottom: .75rem;
  font-size: .9rem;
  color: #555;
}
.lesson-readings:empty { display: none; }
.lesson-readings .readings-label { font-weight: 700; color: #2f5d8c; }
.lesson-resources {
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.lesson-body .resource {
  flex: 1 1 auto; min-width: 140px; text-align: center;
  padding: .6rem .8rem; border: 1px solid #ccc; border-radius: 4px;
  text-decoration: none; color: #2f5d8c; background: #f8fafc;
}
.lesson-body .resource:hover {
  background: #2f5d8c; color: #fff; border-color: #2f5d8c;
  text-decoration: none;
}

/* Upgrade-required modal */
.cp-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.cp-modal {
  background: #fff; max-width: 460px; width: 90%;
  padding: 2rem; border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.cp-modal h2 { margin-top: 0; color: #b00; }
.cp-modal-actions {
  display: flex; gap: .75rem; margin-top: 1.25rem;
  justify-content: flex-end; flex-wrap: wrap;
}
.cp-btn-primary, .cp-btn-secondary {
  display: inline-block; padding: .6rem 1.2rem; border-radius: 4px;
  cursor: pointer; font-size: 1rem; border: 0; text-decoration: none;
}
.cp-btn-primary { background: #2f5d8c; color: #fff; }
.cp-btn-primary:hover { background: #244a70; text-decoration: none; color: #fff; }
.cp-btn-secondary { background: #e5e7eb; color: #333; }
.cp-btn-secondary:hover { background: #d1d5db; }
