/* My Learning page (js/pages/my-learning.js). Extends css/app.css; no new tokens. */

.page-learn .learn-unassigned { margin: -6px 0 20px; }

/* Progress panel: progress text and bar on the left, the single primary action on the right. */
.learn-panel {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.learn-progress-main { flex: 1 1 420px; min-width: 0; }
.learn-progress-line { font-size: 15px; margin-bottom: 8px; }
.learn-progress-main .progress { margin-bottom: 8px; }
.learn-progress-optional { margin-bottom: 8px; }
.learn-progress-note { line-height: 1.4; }

.learn-continue {
  flex: 0 1 400px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 24px;
  border-left: 1px solid var(--border);
}
.learn-continue-done { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.learn-continue-next { color: var(--text-2); line-height: 1.45; }
.learn-continue-hint { margin-top: 2px; }

/* Chapter outline: clickable chapter rows with a nested exercise list underneath. */
.learn-outline tbody tr.chapter-row { cursor: pointer; }
.learn-outline tbody tr.chapter-row:hover { background: var(--surface-2); }
.learn-outline tbody tr.chapter-row.is-expanded td { border-bottom-color: transparent; }
.learn-outline tr[hidden] { display: none; }
.learn-outline .chapter-detail td { padding: 0; background: var(--surface-2); }
/* .btn-sm adds height and horizontal padding; the toggle should sit flush with the title text. */
.learn-outline .learn-toggle { margin-top: 2px; padding: 0; height: auto; }
.learn-outline .cell-sub { max-width: 640px; }
/* The row after the last chapter row is its (possibly hidden) detail row, so the table's
   last-child rule never reaches the chapter row itself. */
.learn-outline tbody tr.chapter-row:nth-last-child(2):not(.is-expanded) td { border-bottom: 0; }
.learn-outline-note { margin-top: 6px; }

.learn-exercises { list-style: none; margin: 0; padding: 4px 12px 6px 28px; }
.learn-exercises-empty { padding: 8px 12px 10px 28px; }
.learn-exercise {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px auto;
  gap: 12px;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}
.learn-exercise:first-child { border-top: 0; }
.learn-exercise.is-next .learn-exercise-title a { font-weight: 600; }
.learn-exercise-title { min-width: 0; overflow-wrap: anywhere; }
.learn-exercise-flags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* Lists */
.learn-recent .list-item-aside, .learn-messages .list-item-aside { flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 900px) {
  .learn-panel { flex-direction: column; gap: 16px; }
  /* In column direction the flex-basis would become a fixed height, so reset it. */
  .learn-progress-main { flex: 0 0 auto; width: 100%; }
  .learn-continue { flex: 0 0 auto; width: 100%; min-width: 0; padding-left: 0; padding-top: 14px; border-left: 0; border-top: 1px solid var(--border); }
  .learn-exercise { grid-template-columns: minmax(0, 1fr) auto; }
  .learn-exercise-level { grid-column: 1; }
  .learn-exercise-flags { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 640px) {
  .learn-recent .list-item, .learn-messages .list-item { flex-direction: column; align-items: flex-start; }
  .learn-recent .list-item-aside, .learn-messages .list-item-aside { justify-content: flex-start; }
}
