/* ==========================================================================
   Practice page extras (questionspractice.php, complete_questions.php)
   Loaded by questionspractice.php and complete_questions.php after css/style.css,
   so it works on its own.
   1. Topic list in the left rail: names left, question count in a grey box right
   2. "Show description" button in the topic bar
   3. Card shown after the last free question
   4. Left column layout + "Topic: ..." line (questionspractice.php, complete_questions.php)
   Colours use the site variables when present, with fixed fallbacks.
   ========================================================================== */

/* 1. Topic list ------------------------------------------------------------ */
.qp-rail .qp-topics { display: block; padding: 20px; background: var(--surface, #fff); border: 1px solid var(--line, #dfe6f1); border-radius: 16px; }
.qp-rail .qp-topics h2 { margin: 0 0 10px; font-size: 15px; font-weight: 500; line-height: 1.3; color: var(--ink, #0b1a33); }
.qp-rail .qp-topics-list { display: flex; flex-direction: column; gap: 2px; max-height: none; margin: 0; padding: 0; overflow: visible; list-style: none; }
.qp-rail .qp-topics-list li { margin: 0; padding: 0; list-style: none; }
.qp-rail .qp-topics-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -8px; padding: 7px 8px; border-radius: 8px; font-size: 14px; line-height: 1.35; color: var(--text, #33415c); text-decoration: none; }
.qp-rail .qp-topics-list a:hover { background: var(--accent-wash, #f3f6ff); color: var(--ink, #0b1a33); }
.qp-rail .qp-topics-list a[aria-current="page"] { background: var(--accent-soft, #e8efff); color: var(--accent-ink, #1646c2); font-weight: 500; }
.qp-rail .qp-topics-name { flex: 1 1 auto; min-width: 0; text-align: left; overflow-wrap: anywhere; }
.qp-rail .qp-topics-count {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  min-width: 34px; height: 28px; margin-left: auto; padding: 0 8px;
  border: 1px solid #dcdfe5; border-radius: 6px; background: #f1f3f6;
  font-size: 12px; font-weight: 500; line-height: 1; color: #4a5468;
}
.qp-rail .qp-topics-list a:hover .qp-topics-count { background: #e7eaef; border-color: #c9ced8; color: var(--ink, #0b1a33); }
.qp-rail .qp-topics-list a[aria-current="page"] .qp-topics-count { background: #fff; border-color: var(--accent-line, #bccdfb); color: var(--accent-ink, #1646c2); }

/* 2. Topic bar: "Show description" button --------------------------------- */
.qp-topic summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; list-style: none; cursor: pointer; }
.qp-topic summary::-webkit-details-marker { display: none; }
.qp-topic summary > .qp-topic-title { flex: 1 1 auto; min-width: 0; }
.qp-topic summary > span.qp-topic-toggle { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 6px 12px; border: 1px solid var(--accent-line, #bccdfb); border-radius: 8px; background: var(--accent-soft, #e8efff); font-size: 13px; font-weight: 500; color: var(--accent-ink, #1646c2); transition: background-color .15s, border-color .15s, color .15s; }
.qp-topic summary:hover > span.qp-topic-toggle { background: var(--accent, #1f5eff); border-color: var(--accent, #1f5eff); color: #fff; }
.qp-topic-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.qp-topic[open] .qp-topic-toggle svg { transform: rotate(180deg); }
.qp-topic[open] .qp-more, .qp-topic:not([open]) .qp-less { display: none; }
.qp-topic[open] .qp-topic-body { margin-top: 12px; padding: 14px 16px; border-radius: 8px; background: var(--accent-wash, #f3f6ff); color: var(--text, #33415c); }

/* 3. After the last free question ----------------------------------------- */
.qp-unlock { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; margin: 8px 0 16px; padding: 24px; border-radius: 16px; background: var(--night, #0b1a33); color: var(--on-night-muted, #9fb3d6); }
.qp-unlock-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: rgba(255, 255, 255, .1); color: var(--sky, #6ea8ff); }
.qp-unlock-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.qp-unlock h2 { margin: 0 0 4px; font-size: 19px; color: #fff; }
.qp-unlock p { margin: 0; font-size: 14px; }

/* 4. Left column layout ---------------------------------------------------- */
.qp-layout.qp-layout--rail { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.qp-layout--rail > .qp-rail { grid-column: 1; grid-row: 1; position: static; display: flex; flex-direction: column; gap: 16px; }
.qp-layout--rail > .qp-main { grid-column: 2; grid-row: 1; min-width: 0; }
.qp-hero-topic { margin: -6px 0 14px; font-size: 16px; color: var(--on-night-muted, #9fb3d6); }
.qp-hero-topic b { font-weight: 500; color: var(--sky, #6ea8ff); }
@media (max-width: 1099px) {
  .qp-layout.qp-layout--rail { grid-template-columns: 1fr; gap: 16px; }
  .qp-layout--rail > .qp-rail, .qp-layout--rail > .qp-main { grid-column: 1; grid-row: auto; }
}

@media (max-width: 767px) {
  .qp-unlock { grid-template-columns: 1fr; margin: 8px 20px 16px; padding: 22px 20px; }
  .qp-unlock .qp-btn { width: 100%; }
}
