/* ==========================================================================
   PNLE-REVIEW — Topics page
   NP tabs, NP cards, topic breakdown, next-review queue, quote and the
   topic dialog.
   ========================================================================== */

/* Fit-to-screen rows: top bar · tabs · NP cards · bottom */
.main--topics { --fit-rows: auto auto auto 1fr; }

/* ============================== Tabs ============================== */
.tp-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}
.tp-tabs .chips { margin-bottom: 0; }
.tp-tabs .chip { min-width: 64px; }
.tp-tabs .chip:not(.is-active) { background: var(--card-solid); border-color: var(--card-border); }
.tp-step { display: flex; gap: 8px; }

/* ============================== NP cards ============================== */
.np-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.np-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 176px;
  padding: 14px 16px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.np-tile:hover { transform: translateY(-2px); }
.np-tile.is-active { box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
.np-tile--green { background: var(--tint-green); border-color: var(--tint-green-border); }
.np-tile--blue { background: linear-gradient(180deg, var(--tint-blue), var(--subtle)); border-color: #d3e0f8; }
.np-tile--orange { background: var(--tint-orange); border-color: var(--tint-orange-border); }
.np-tile--pink { background: var(--tint-pink); border-color: var(--tint-pink-border); }
.np-tile--rose { background: var(--tint-rose); border-color: var(--tint-rose-border); }
:root[data-theme="dark"] .np-tile--blue { border-color: var(--card-border); }

.np-tile__head { display: flex; align-items: center; gap: 10px; }
.np-tile__head strong { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.np-tile__head small { display: block; font-size: 10px; color: var(--muted); }
.np-tile__badge {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
}
:root[data-theme="dark"] .np-tile__badge { background: rgba(255, 255, 255, 0.08); }
.np-tile__badge .icon { width: 15px; height: 15px; }
.np-tile--green .np-tile__badge { color: #2f9d7e; }
.np-tile--blue .np-tile__badge { color: var(--blue); }
.np-tile--orange .np-tile__badge { color: #d98a2b; }
.np-tile--pink .np-tile__badge { color: var(--pink); }
.np-tile--rose .np-tile__badge { color: #b0559a; }

.np-tile__pct { margin-top: auto; padding-top: 14px; font-size: 26px; font-weight: 600; color: var(--text); }
.ring--tile { align-self: center; width: 88px; height: 88px; margin: 10px 0 2px; }
.ring--tile .ring__label { font-size: 18px; }
.np-tile__ready { margin-top: 6px; font-size: 11.5px; font-weight: 500; color: var(--text); }
.np-tile__due { margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.np-tile.is-active .np-tile__ready,
.np-tile.is-active .np-tile__due { align-self: center; }

/* ============================== Bottom ============================== */
.tp-bottom {
  display: grid;
  grid-template-columns: minmax(0, 170fr) minmax(0, 175fr) minmax(0, 95fr);
  gap: 14px;
  min-height: 0;
}

/* ---------- Breakdown ---------- */
.breakdown { display: flex; flex-direction: column; padding: 14px 14px 10px 16px; }
.breakdown .card__title { font-size: 13.5px; }
.select--sm select { height: 28px; padding: 0 28px 0 10px; font-size: 10.5px; }
.select--sm .icon { right: 8px; width: 12px; height: 12px; margin-top: -6px; }

.topic-list { flex: 1; min-height: 0; max-height: 380px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.is-fit .topic-list { max-height: none; }
.topic-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 30px minmax(60px, 120px) 36px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 7px 6px;
  text-align: left;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}
.topic-row:hover { background: var(--primary-softer); }
.topic-row__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
}
.topic-row__icon .icon { width: 15px; height: 15px; }
.tone-rose { background: var(--tone-purple); color: #b0559a; }
.topic-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--text); }
.topic-row__name small { margin-left: 4px; font-size: 10px; color: var(--muted); }
.topic-row .bar { height: 7px; }
.topic-row__pct { text-align: right; font-size: 11px; color: var(--text-2); }
.topic-list__empty { padding: 30px 0; text-align: center; font-size: 12px; color: var(--muted); }

/* Confidence: 1–3 filled dots */
.conf { display: inline-flex; gap: 3px; }
.conf i { width: 6px; height: 6px; border-radius: 50%; background: var(--track); }
.conf--low i:nth-child(-n+1),
.conf--medium i:nth-child(-n+2),
.conf--high i { background: var(--primary); }

/* ---------- Next review ---------- */
.next-review { display: flex; flex-direction: column; padding: 14px 14px 10px 16px; }
.next-review .card__title { font-size: 13.5px; }
.review-list { flex: 1; min-height: 0; overflow-y: auto; }
.review-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--line);
}
.review-list li:last-child { border-bottom: 0; }
.review-row__main { display: flex; align-items: center; gap: 12px; min-width: 0; text-align: left; }
.review-row__main > span:last-child { min-width: 0; }
.review-row__main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
}
.review-row__main small { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.review-row__main:hover strong { color: var(--primary-600); }
.review-row .icon-btn { width: 28px; height: 28px; color: var(--text-2); }
.review-row .icon-btn .icon { width: 15px; height: 15px; }
.is-overdue { color: var(--pink) !important; }
.is-overdue .icon { width: 11px; height: 11px; }
.is-today { color: var(--primary-600) !important; font-weight: 600; }

/* ---------- Quote ---------- */
.tp-quote {
  min-height: 220px;
  padding: 0;
  background:
    url("../../assests/images/flowers-corner.svg") right -8px top 4px / 92px auto no-repeat,
    linear-gradient(180deg, #eef0fb 0%, #e3e9f7 100%);
}
.tp-quote::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  aspect-ratio: 280 / 320;
  background: url("../../assests/images/exam-quote.svg") center bottom / 100% auto no-repeat;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 40%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 40%);
  pointer-events: none;
}
.tp-quote__text {
  position: absolute;
  z-index: 1;
  top: 38%;
  left: 20px;
  right: 14px;
  font-size: 19px;
  line-height: 1.4;
  color: #2a3f73;   /* the art stays light in dark mode */
  transform: translateY(-50%) rotate(-5deg);
}
.tp-quote__text .note-heart { display: inline-block; vertical-align: middle; }

/* ============================== Topic dialog ============================== */
.modal--topic { width: min(480px, calc(100vw - 32px)); }
.topic-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--subtle);
  border-radius: 12px;
}
.topic-summary .ring { width: 80px; height: 80px; flex: none; }
.topic-summary .ring__label { font-size: 17px; }
.topic-summary dl { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.topic-summary dt { font-size: 10.5px; color: var(--muted); }
.topic-summary dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; color: var(--text); }
.modal--topic h3 { margin: 18px 0 8px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.segmented button {
  padding: 9px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.segmented button small { display: block; margin-top: 2px; font-size: 9.5px; font-weight: 400; color: var(--muted); }
.segmented button:hover { border-color: var(--primary); }
.segmented button.is-active { color: var(--primary-600); background: var(--primary-softer); border-color: var(--primary); }
.modal--topic .btn .icon { width: 14px; height: 14px; }
.modal--topic h3 small { margin-left: 6px; font-size: 10.5px; font-weight: 400; color: var(--muted); }

/* Topic dialog: PDFs to review */
.topic-pdfs { display: flex; flex-direction: column; gap: 6px; max-height: 188px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.topic-pdf {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.topic-pdf:hover { border-color: var(--primary); background: var(--primary-softer); }
.topic-pdf:focus-visible { outline: 0; box-shadow: var(--focus); }
.topic-pdf__icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; color: var(--red); background: var(--tone-pink); border-radius: 8px; }
.topic-pdf__icon .icon { width: 15px; height: 15px; }
.topic-pdf__info { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
.topic-pdf__info strong { overflow: hidden; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.topic-pdf__info small { font-size: 10.5px; color: var(--muted); }
.topic-pdf__info b { font-weight: 600; color: var(--primary-600); }
.topic-pdf > .icon { flex: none; width: 14px; height: 14px; color: var(--muted); }
.topic-pdfs__empty { display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: 11.5px; color: var(--muted); background: var(--card-solid); border: 1px dashed var(--card-border); border-radius: 10px; }
.topic-pdfs__empty .icon { flex: none; width: 18px; height: 18px; color: var(--primary); }
.topic-pdfs__empty a { font-weight: 600; color: var(--primary); }

/* ============================== Breakpoints ============================== */
@media (max-width: 1320px) {
  .np-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tp-bottom { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tp-quote { display: none; }
}
@media (max-width: 1024px) {
  .tp-bottom { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .np-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-step { display: none; }
  .topic-row { grid-template-columns: 28px minmax(0, 1fr) minmax(50px, 80px) 34px; }
  .topic-row .conf { display: none; }
}

/* Dark mode: keep the watercolor art, but on a deep wash so the card doesn't glare */
:root[data-theme="dark"] .tp-quote { background: url("../../assests/images/flowers-corner.svg") right -8px top 4px / 92px auto no-repeat, linear-gradient(180deg, #27325e 0%, #1c2647 100%); }
:root[data-theme="dark"] .tp-quote::before { opacity: 0.5; }
:root[data-theme="dark"] .tp-quote__text { color: var(--script) !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tp-quote { background: url("../../assests/images/flowers-corner.svg") right -8px top 4px / 92px auto no-repeat, linear-gradient(180deg, #27325e 0%, #1c2647 100%); }
  :root:not([data-theme="light"]) .tp-quote::before { opacity: 0.5; }
  :root:not([data-theme="light"]) .tp-quote__text { color: var(--script) !important; }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .np-tile--blue { border-color: var(--card-border); } }
:root[data-theme="dark"] .np-tile__badge, :root[data-theme="dark"] .np-tile__badge { background: rgba(255, 255, 255, 0.08); }

/* Topic dialog for one of your PDFs: open it in the viewer */
.topic-open {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 18px;
  padding: 12px 14px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--primary-softer);
  border: 1px solid var(--primary);
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.topic-open:hover { background: var(--primary-soft); }
.topic-open:focus-visible { outline: 0; box-shadow: var(--focus); }
.topic-open .topic-pdf__info strong { font-size: 13px; font-weight: 600; }
.topic-open > .icon { flex: none; width: 16px; height: 16px; color: var(--primary); }
.topic-list__empty a { font-weight: 600; color: var(--primary); }
