/* Lecții index: chapter cards (listă), knowledge map (hartă), achievements. */

/* ---- Header tools ---- */
.lx-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-end;
  min-width: min(100%, 240px);
}

.lx-search {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xs);
  padding: 0 12px;
  height: 38px;
  flex: 1;
  min-width: 170px;
  max-width: 270px;
}
.lx-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  padding: 0;
}
.lx-search-clear {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: var(--r-pill);
  background: var(--sand);
  color: var(--muted);
}
.lx-search-clear:hover { background: var(--border); color: var(--ink); }
.lx-search-clear[hidden] { display: none; }

/* View panes: the [hidden] toggle must beat each pane's own `display` (a class
   selector otherwise outranks the UA `[hidden]{display:none}` rule, so the
   Listă/Hartă switch would show nothing). */
[data-lx-pane][hidden] { display: none !important; }

/* ---- Chapter cards (listă) ---- */
.lx-list { display: flex; flex-direction: column; gap: 14px; }

.lx-chapter { overflow: hidden; }

.lx-ch-head { padding: 16px 20px; cursor: pointer; display: flex; align-items: center; gap: 16px; }
.lx-ch-head:hover { background: var(--surface-2); }

.lx-ring { position: relative; width: 54px; height: 54px; flex: none; }
.lx-ring-frac {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--slate);
}

.lx-ch-main { flex: 1; min-width: 0; }
.lx-ch-title-row { display: flex; align-items: center; gap: 10px; }
.lx-ch-name { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.lx-ch-pass {
  background: var(--surface);
  border-radius: var(--r-pill);
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}
/* "lecție nouă" = new content available → teal-green pill (design line 1487). */
.lx-ch-pass--new { background: var(--teal-tint); color: var(--teal-ink); font-weight: 600; }
.lx-ch-meta { margin-top: 3px; font-size: 12.5px; color: var(--muted-2); }

.lx-ch-side { display: flex; align-items: center; gap: 22px; flex: none; }
.lx-ch-stats { display: flex; align-items: center; gap: 22px; }
.lx-ch-stat { text-align: right; }
.lx-ch-stat-label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.lx-ch-stat-val {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
}

.lx-chevron { flex: none; transition: transform .18s ease; }
.lx-chapter.is-open .lx-chevron { transform: rotate(180deg); }

/* Open chapter body sits on white (the card colour) so the list reads as a
   clean white card against the cream page, not a low-contrast tinted block. */
.lx-ch-body { display: none; border-top: 1px solid var(--divider); background: var(--card); }
.lx-chapter.is-open .lx-ch-body { display: block; }

/* ---- Lesson rows ---- */
.lx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  /* Indent rows so the icon/title align under the chapter name
     (header pad 20 + ring 54); reset to flush on mobile below. */
  padding: 11px 20px 11px 74px;
  color: inherit;
}
.lx-row + .lx-row { border-top: 1px solid var(--divider); }
.lx-row:hover { background: var(--surface); color: inherit; }

.lx-state { flex: none; }

.lx-row-main { flex: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.lx-row-title { font-size: 14px; font-weight: 500; color: var(--ink); }
.lx-row--new .lx-row-title { color: var(--muted-2); }
.lx-row--progress { background: var(--teal-tint-2); }
.lx-row--progress .lx-row-title { color: var(--teal-ink); font-weight: 600; }

.lx-badge {
  flex: none;
  background: var(--teal-tint);
  color: var(--teal-ink);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-pill);
}
.lx-tier {
  flex: none;
  background: #F9E9C8;
  color: var(--warn-ink);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-pill);
}

/* Right side of a lesson row: score OR action, then a fixed chevron slot. The
   value is right-aligned and the chevron slot is always reserved (ghosted on
   non-done rows), so every score/Începe/Continuă lines up on the same edge. */
.lx-row-right { flex: none; display: flex; align-items: center; gap: 8px; }
.lx-value { text-align: right; white-space: nowrap; }
.lx-score {
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.lx-row-chev { flex: none; }
.lx-row-chev--ghost { visibility: hidden; }
.lx-action { font-size: 13px; font-weight: 600; color: var(--teal); }
.lx-action--new { font-weight: 500; }

.lx-noresults {
  background: var(--card);
  border: 1px dashed var(--border-2);
  border-radius: var(--r-md);
  padding: 36px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lx-noresults[hidden] { display: none; }
.lx-noresults-title { font-size: 14.5px; font-weight: 600; color: var(--slate); }
.lx-noresults-sub { font-size: 13px; color: var(--muted-2); }

/* ---- Hartă (knowledge map) ---- */
.lx-map { padding: 22px 24px; }

.lx-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.lx-map-note { font-size: 13px; color: var(--muted); }
.lx-map-count { font-weight: 600; color: var(--ink); }

.lx-legend {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted-2);
}
.lx-legend-cell { width: 16px; height: 16px; border-radius: 5px; }
.lx-legend-gap { margin-left: 8px; }

.lx-map-row {
  display: flex;
  align-items: center;
  gap: 6px 14px;
  margin-bottom: 9px;
  flex-wrap: wrap;
}
/* Right-aligned single-line labels (ellipsis for long chapter names) + small
   cells, matching the dashboard map preview so the two read as one system. */
.lx-map-label { width: 208px; flex: none; display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; min-width: 0; }
.lx-map-ch { font-size: 12.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lx-map-n { font-size: 10.5px; color: var(--muted-2); flex: none; }

.lx-map-cells { display: flex; flex-wrap: wrap; gap: 5px; }
.lx-cell {
  width: 19px; height: 19px;
  border-radius: 5px;
  cursor: pointer;
  transition: opacity .2s, box-shadow .2s;
}
.lx-cell:hover { box-shadow: 0 0 0 2px rgba(15, 34, 48, .25); }
.lx-cell.is-selected { box-shadow: 0 0 0 2px var(--ink); }
/* The lesson currently being read — the map's one standing landmark. */
.lx-cell.is-current { box-shadow: 0 0 0 2px var(--teal); }
/* Search: the grid never loses a cell (that would reshuffle the map), the
   misses just fade back and the hits keep their colour and get a ring. */
.lx-cell.is-dim { opacity: .22; }
.lx-cell.is-hit { box-shadow: 0 0 0 2px var(--teal); }

.lx-map-foot { margin-top: 8px; font-size: 12px; color: var(--muted-2); }

@media (max-width: 767px) {
  .lx-ch-stats { display: none; }
  /* Mobile: label sits on its own left-aligned row above the cells. */
  .lx-map-label { width: 100%; justify-content: flex-start; }
  /* Mobile: rows go flush-left (icon under the ring), matching the design. */
  .lx-row { padding-left: 20px; }
}

/* ---- Realizări ---- */
.lx-achv { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.lx-achv-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lx-achv-count { font-size: 12px; color: var(--muted-2); }

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

.lx-achv-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.lx-achv-card.is-locked { border-style: dashed; border-color: var(--border-2); box-shadow: none; }
.lx-achv-ico--locked { filter: grayscale(1); opacity: .45; }

.lx-achv-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.lx-achv-card.is-locked .lx-achv-title { color: var(--muted-2); }
.lx-achv-desc { margin-top: 3px; font-size: 12px; line-height: 1.45; color: var(--muted-2); }

.lx-achv-earned {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--teal-ink);
}

.lx-achv-progress { margin-top: auto; display: flex; flex-direction: column; gap: 5px; }
.lx-achv-progress-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted-2); }

/* ---- Lessons index: mobile ---- */
@media (max-width: 640px) {
  /* Header tools stack: search on its own full-width row, segmented toggle
     full-width below it — matches the design's mobile header. */
  .lx-tools { flex-basis: 100%; gap: 10px; }
  .lx-search { flex: 1 1 100%; max-width: none; }
  .lx-tools .seg { flex: 1 1 100%; display: flex; }
  .lx-tools .seg-btn { flex: 1; justify-content: center; }
  /* Lesson rows stay single-line (icon + title); long titles wrap inside
     .lx-row-main so nothing overflows horizontally. */
  .lx-map { padding: 18px 16px; }
  .lx-map-cells { gap: 5px; }
  .lx-cell { width: 17px; height: 17px; }
}
