/* Learn IT's own rules on top of onlyati-ui (design tokens, components and base styles come from
   the library, see ../../../docs/web.md). Only what is specific to this app lives here; colors
   come from the library's tokens, never raw hex. */

/* ---------- small helpers ---------- */
.spread {
  justify-content: space-between;
  align-items: center;
}

.pad {
  padding: var(--sp-4);
  margin: 0;
}

.text-danger {
  color: var(--status-danger);
}

label.check {
  flex-direction: row;
  align-items: center;
  gap: var(--sp-2);
}

/* A "title only" window above page tabs: no body, so hide the empty body strip. */
.window.slim > .window-body:empty {
  display: none;
}

/* Inline "mint" forms (voucher / token panels) and the sidebar's add-chapter form. */
.form.mint {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-block-start: var(--sp-3);
}

.form.add-chapter {
  margin-block-start: var(--sp-2);
}

/* ---------- cards: title on its own line, badges on the line below ---------- */
.card-head {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-2);
}

/* ---------- catalog filter tags ---------- */
a.tag[aria-current] {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--bg-canvas);
}

/* ---------- home page ---------- */
.home-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-block-start: var(--sp-6);
}

.home-section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-3);
}

.continue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px auto;
  align-items: center;
  gap: var(--sp-4);
}

.continue-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.continue-lesson {
  font-weight: 700;
}

.continue-next,
.continue-progress span {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.continue-progress {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

@media (max-width: 599px) {
  .continue-item {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-2);
  }
}

/* ---------- chapter lists ---------- */
/* The split sidebar is a <details>, whose content wrapper doesn't give the library's flex layout a
   bounded height, so a long chapter list would stretch the whole sidebar instead of scrolling.
   Cap the list to the sidebar's max-height minus its title strip (side by side only; stacked,
   the library already caps it at 50vh). */
@container (min-width: 641px) {
  .split-side .window-body {
    max-height: calc(100vh - var(--appbar-height) - var(--sp-3) - 2 * var(--sp-4) - 3rem);
  }
}

.chapter-row-wrap {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.chapter-row-wrap .nav-row {
  flex: 1;
  min-width: 0;
}

.chapter-row-actions {
  display: flex;
  gap: 2px;
  flex: none;
}

.chapter-status {
  display: inline-flex;
  flex: none;
}

.chapter-status.completed {
  color: var(--status-completed);
}

.chapter-status.in-progress {
  color: var(--status-in-progress);
}

.chapter-status.untracked {
  color: var(--text-secondary);
}

/* ---------- Move / Copy tab ---------- */
.move-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--sp-3);
  align-items: start;
}

@media (max-width: 599px) {
  .move-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

select.multi-select {
  padding: var(--sp-1);
  width: 100%;
}

select.multi-select option {
  padding: var(--sp-1) var(--sp-2);
}

/* The gradient is what makes the selected colour apply in Chrome and Firefox listboxes. */
select.multi-select option:checked {
  background: var(--accent-primary) linear-gradient(0deg, var(--accent-primary), var(--accent-primary));
  color: var(--bg-canvas);
}

/* ---------- attachments ---------- */
.attachment-list {
  margin-block: var(--sp-4);
}

.attachment-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-6);
}

.attachment-list li {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  overflow-wrap: anywhere;
}

.attachment-size {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ---------- programs ---------- */
.program-lessons {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding-inline-start: var(--sp-6);
  margin: 0;
}

.program-available {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: 0;
  margin: 0;
  list-style: none;
}

.program-lessons-panel .window {
  margin-block-end: var(--sp-6);
}

.program-lessons-panel .badge {
  margin-inline-start: var(--sp-2);
}

/* ---------- mock login ---------- */
.mock-user-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.mock-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-control);
  background: var(--bg-canvas);
}
