/* ==========================================================================
   ParaPrep, Progress & Analytics (Brief 14) page styles.
   Layered on styles.css (design tokens + base components). Only adds what the
   summary tiles, strengths/weaknesses columns and trend chart need. Shared
   chrome (footer/demo-bar/gate) mirrors tracks.css so the page reads identically.
   ========================================================================== */

/* ---- Shared chrome (matches tracks.css / mcq.css) ---------------------- */
.footer-rich {
  max-width: 1000px; margin: 0 auto; padding: 1.5rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between;
  color: var(--muted); font-size: .8rem;
}
.footer-rich a { color: var(--muted); }
.footer-rich a:hover { color: var(--teal-dark); }
.footer-rich .legal-links { display: flex; gap: 1rem; flex-wrap: wrap; }

.demo-bar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: #eef5f4; border: 1px dashed var(--teal); color: var(--teal-dark);
  border-radius: var(--radius); padding: .6rem .9rem; margin-bottom: 1.5rem; font-size: .82rem;
}
.demo-bar strong { font-weight: 700; }
.demo-bar .spacer { margin-left: auto; }
.btn.tiny { padding: .35rem .7rem; font-size: .8rem; }

.loading-msg { color: var(--muted); padding: 2rem 0; text-align: center; }

/* ---- Upgrade prompt (paid gate) ---------------------------------------- */
.gate {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff; border-radius: var(--radius); padding: 2.2rem; box-shadow: var(--shadow);
}
.gate .lock { font-size: 2rem; }
.gate h2 { margin: .4rem 0 .5rem; font-size: 1.6rem; }
.gate p { margin: 0 0 1.2rem; opacity: .95; max-width: 60ch; }
.gate .gate-actions { display: flex; gap: .7rem; flex-wrap: wrap; }
.btn.on-teal { background: #fff; color: var(--teal-dark); }
.btn.on-teal:hover { background: #eef3ff; }
.gate .btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); }
.gate .btn.ghost:hover { background: rgba(255,255,255,.12); }
.gate ul.preview { margin: 1.3rem 0 0; padding: 0 0 0 1.1rem; opacity: .95; font-size: .92rem; }
.gate ul.preview li { margin: .25rem 0; }

/* ---- Section headings (this page loads only styles.css + this) ---------- */
.section-head { font-size: 1.15rem; margin: 1.8rem 0 .25rem; letter-spacing: -.01em; }

/* ---- Page head: title + level toggle ----------------------------------- */
.analytics-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.analytics-head .view-title { margin: 0 0 .25rem; }
.analytics-head .view-sub { margin: 0; }

/* ---- Empty / new-user state -------------------------------------------- */
.analytics-empty {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.analytics-empty .empty-icon { font-size: 2.4rem; line-height: 1; flex-shrink: 0; }
.analytics-empty h3 { margin: 0 0 .3rem; font-size: 1.15rem; }
.analytics-empty p { margin: 0 0 .8rem; color: var(--muted); font-size: .92rem; max-width: 56ch; }
.empty-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---- Summary tiles ----------------------------------------------------- */
.tiles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: .5rem;
}
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .1rem;
  text-decoration: none; color: inherit;
  transition: transform .12s ease, box-shadow .12s ease;
}
a.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(20,50,55,.12); }
.tile-icon { font-size: 1.4rem; }
.tile-value { font-size: 2rem; font-weight: 800; color: var(--teal-dark); line-height: 1.1; }
.tile-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tile-sub { font-size: .85rem; color: var(--muted); margin-top: .15rem; }
.tile-cta { margin-top: .6rem; font-size: .82rem; font-weight: 700; color: var(--teal); }
a.tile:hover .tile-cta { color: var(--teal-dark); }
.tile.is-empty .tile-value { color: var(--muted); }
.tile.is-empty .tile-cta { color: var(--amber); }

/* ---- Strengths & weaknesses -------------------------------------------- */
.topics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.topic-col {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; box-shadow: var(--shadow);
}
.topic-col h4 { margin: 0 0 .15rem; font-size: 1rem; }
.topic-col.weak h4::before { content: "⚠ "; color: var(--amber); }
.topic-col.strong h4::before { content: "★ "; color: var(--green); }
.topic-hint { margin: 0 0 .9rem; color: var(--muted); font-size: .82rem; }
.topic-empty { color: var(--muted); font-size: .88rem; margin: .4rem 0 0; }

.topic-list { list-style: none; margin: 0; padding: 0; }
.topic-list li { margin-bottom: .8rem; }
.topic-list li:last-child { margin-bottom: 0; }
.topic-link { text-decoration: none; color: inherit; display: block; border-radius: 8px; padding: .25rem; margin: -.25rem; }
.topic-link:hover { background: var(--teal-soft); }
.topic-main { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.topic-name { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-pct { font-weight: 800; font-size: .92rem; color: var(--ink); flex-shrink: 0; }
.topic-list .bar { height: 8px; margin-top: .3rem; }
.topic-list .bar > span { width: 0; }
.topic-list .bar > span.weak { background: var(--amber); }
.topic-list .bar > span.strong { background: var(--green); }
.topic-meta { font-size: .76rem; color: var(--muted); margin-top: .25rem; }
.topic-go { color: var(--teal); font-weight: 700; }
.topic-link:hover .topic-go { color: var(--teal-dark); }

/* ---- Trend chart ------------------------------------------------------- */
.trend-card { padding: 1.2rem 1.3rem; }
.trend-empty { color: var(--muted); font-size: .9rem; margin: .2rem 0; }
.trend-svg { width: 100%; height: auto; display: block; }
.trend-svg .grid { stroke: var(--line); stroke-width: 1; }
.trend-svg .ylabel, .trend-svg .xlabel { fill: var(--muted); font-size: 11px; }
.trend-svg .ylabel { text-anchor: end; }
.trend-svg .xlabel { text-anchor: middle; }
.trend-svg .ptlabel { fill: var(--teal-dark); font-size: 11px; font-weight: 700; text-anchor: middle; }
.trend-svg .trend-line { stroke: var(--teal); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.trend-svg .dot { fill: #fff; stroke: var(--teal); stroke-width: 2.5; }

/* ---- Focus visibility (accessibility) ---------------------------------- */
a.tile:focus-visible,
.topic-link:focus-visible,
.btn:focus-visible,
.level-toggle button:focus-visible,
.footer-rich a:focus-visible {
  outline: 2px solid var(--teal-dark); outline-offset: 2px;
}

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 640px) {
  .topics-grid { grid-template-columns: 1fr; }
  .analytics-head { flex-direction: column; }
  .analytics-head .level-toggle { margin-left: 0; }
}
