/* ==========================================================================
   ExamLearn - Topics (category listing + shared progress pieces)
   ========================================================================== */
.tpx-page {
    --tpx-surface: #ffffff;
    --tpx-border: #e9eef5;
    --tpx-ink: #0f172a;
    --tpx-ink-2: #475569;
    --tpx-muted: #64748b;
    --tpx-soft: #f8fafc;
    --tpx-accent: var(--t-600, #4f46e5);
    --tpx-accent-soft: var(--t-50, #eef2ff);
    --tpx-track: #e2e8f0;
    --tpx-done: #15803d;
    --tpx-done-soft: #dcfce7;
    --tpx-doing: #b45309;
    --tpx-doing-soft: #fef3c7;
    padding: 24px 0 56px;
}
[data-bs-theme="dark"] .tpx-page, html.dark-theme .tpx-page {
    --tpx-surface: #161b22;
    --tpx-border: #30363d;
    --tpx-ink: #f0f6fc;
    --tpx-ink-2: #c9d1d9;
    --tpx-muted: #8b949e;
    --tpx-soft: #0d1117;
    --tpx-accent: var(--t-400, #818cf8);
    --tpx-accent-soft: rgba(var(--t-400-rgb, 129, 140, 248), .14);
    --tpx-track: #30363d;
    --tpx-done: #4ade80;
    --tpx-done-soft: rgba(74, 222, 128, .12);
    --tpx-doing: #fbbf24;
    --tpx-doing-soft: rgba(251, 191, 36, .12);
}

.tpx-card {
    background: var(--tpx-surface); border: 1px solid var(--tpx-border);
    border-radius: 16px; padding: 18px; margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .03);
}
.tpx-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tpx-card-title { font-size: 15px; font-weight: 700; color: var(--tpx-ink); margin: 0; display: flex; align-items: center; gap: 8px; }
.tpx-card-title i { color: var(--tpx-accent); font-size: 14px; }
.tpx-link-sm { font-size: 12.5px; font-weight: 600; color: var(--tpx-accent); text-decoration: none; white-space: nowrap; }
.tpx-link-sm:hover { text-decoration: underline; }

/* ---------- Category navigation (sidebar on desktop, chip row on mobile) ---------- */
.tpx-cats { position: sticky; top: 96px; }
.tpx-cat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.tpx-cat {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
    font-size: 13.5px; font-weight: 500; color: var(--tpx-ink-2); text-decoration: none;
    transition: background .15s ease, color .15s ease;
}
.tpx-cat i { width: 18px; text-align: center; color: var(--tpx-muted); font-size: 14px; }
.tpx-cat .tpx-cat-name { flex: 1; min-width: 0; line-height: 1.3; }
.tpx-cat .tpx-cat-count {
    font-size: 11px; font-weight: 700; color: var(--tpx-muted); background: var(--tpx-soft);
    border: 1px solid var(--tpx-border); border-radius: 999px; padding: 1px 7px;
}
.tpx-cat:hover { background: var(--tpx-soft); color: var(--tpx-ink); }
.tpx-cat.active { background: var(--tpx-accent); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(var(--t-600-rgb, 79, 70, 229), .25); }
.tpx-cat.active i { color: #fff; }
.tpx-cat.active .tpx-cat-count { background: rgba(255, 255, 255, .2); border-color: transparent; color: #fff; }
[data-bs-theme="dark"] .tpx-cat.active, html.dark-theme .tpx-cat.active { background: var(--t-600, #4f46e5); }

/* ---------- Hero ---------- */
.tpx-hero {
    position: relative; overflow: hidden; border-radius: 20px; padding: 26px 28px; margin-bottom: 18px; color: #fff;
    background: radial-gradient(120% 140% at 100% 0%, rgba(168, 85, 247, .5) 0%, rgba(168, 85, 247, 0) 55%),
                linear-gradient(135deg, var(--t-950, #1e1b4b) 0%, var(--t-900, #312e81) 55%, var(--t-700, #4338ca) 100%);
}
.tpx-hero::after {
    content: ''; position: absolute; right: -60px; bottom: -90px; width: 240px; height: 240px; border-radius: 50%;
    border: 36px solid rgba(255, 255, 255, .06); pointer-events: none;
}
.tpx-crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; margin-bottom: 14px; color: rgba(255, 255, 255, .7); }
.tpx-crumbs a { color: rgba(255, 255, 255, .85); text-decoration: none; }
.tpx-crumbs a:hover { color: #fff; text-decoration: underline; }
.tpx-hero-row { display: flex; gap: 16px; align-items: flex-start; position: relative; z-index: 1; }
.tpx-hero-icon {
    width: 56px; height: 56px; flex-shrink: 0; border-radius: 16px; display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); font-size: 24px;
}
.tpx-hero h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; color: #fff; }
.tpx-hero p { margin: 0; color: rgba(255, 255, 255, .8); font-size: 14px; line-height: 1.6; max-width: 640px; }
.tpx-hero-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; position: relative; z-index: 1; }
.tpx-hero-stat {
    display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px;
    background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); color: rgba(255, 255, 255, .9);
    text-decoration: none;
}
.tpx-hero-stat strong { color: #fff; }
a.tpx-hero-stat:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.tpx-hero-progress { margin-top: 16px; position: relative; z-index: 1; max-width: 460px; }
.tpx-hero-progress .tpx-hp-top { display: flex; justify-content: space-between; font-size: 12.5px; color: rgba(255, 255, 255, .85); margin-bottom: 6px; }
.tpx-hero-progress .tpx-hp-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.tpx-hero-progress .tpx-hp-bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--t-300, #a5b4fc), #ffffff); }

/* ---------- Toolbar: search, tags, sort ---------- */
.tpx-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tpx-search { position: relative; flex: 1 1 260px; }
.tpx-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--tpx-muted); font-size: 13px; }
.tpx-search input {
    width: 100%; height: 42px; border-radius: 12px; border: 1px solid var(--tpx-border); background: var(--tpx-surface);
    color: var(--tpx-ink); padding: 0 36px 0 38px; font-size: 13.5px; outline: none;
}
.tpx-search input:focus { border-color: var(--tpx-accent); box-shadow: 0 0 0 3px rgba(var(--t-500-rgb, 99, 102, 241), .15); }
.tpx-search .tpx-search-clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--tpx-muted); text-decoration: none; font-size: 14px; }
.tpx-sort-btn {
    height: 42px; border-radius: 12px; border: 1px solid var(--tpx-border); background: var(--tpx-surface);
    color: var(--tpx-ink-2); font-size: 13px; padding: 0 14px; white-space: nowrap;
}
.tpx-sort-btn strong { color: var(--tpx-ink); }
.tpx-tags { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 8px; scrollbar-width: thin; }
.tpx-tag {
    flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px;
    font-size: 12.5px; font-weight: 500; color: var(--tpx-ink-2); background: var(--tpx-surface);
    border: 1px solid var(--tpx-border); text-decoration: none; transition: all .15s ease;
}
.tpx-tag:hover { border-color: var(--tpx-accent); color: var(--tpx-accent); }
.tpx-tag.active { background: var(--tpx-accent-soft); border-color: var(--tpx-accent); color: var(--tpx-accent); font-weight: 600; }
.tpx-results { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--tpx-muted); margin-bottom: 12px; }
.tpx-results strong { color: var(--tpx-ink); }
.tpx-filter-status { display: inline-flex; gap: 6px; }
.tpx-filter-status a {
    font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 8px; text-decoration: none;
    color: var(--tpx-muted); border: 1px solid transparent;
}
.tpx-filter-status a.active { color: var(--tpx-accent); background: var(--tpx-accent-soft); border-color: var(--tpx-accent); }

/* ---------- Topic cards ---------- */
.tpx-topic {
    position: relative; display: flex; flex-direction: column; height: 100%; padding: 18px;
    background: var(--tpx-surface); border: 1px solid var(--tpx-border); border-radius: 16px;
    text-decoration: none; color: inherit; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tpx-topic:hover { transform: translateY(-3px); border-color: rgba(var(--t-500-rgb, 99, 102, 241), .45); box-shadow: 0 12px 26px rgba(15, 23, 42, .08); }
.tpx-topic.is-done { border-color: rgba(21, 128, 61, .35); }
.tpx-topic-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.tpx-topic-ic {
    width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    background: var(--tpx-accent-soft); color: var(--tpx-accent); font-size: 18px;
}
.tpx-topic-num { font-size: 11px; font-weight: 700; color: var(--tpx-muted); letter-spacing: .04em; }
.tpx-topic h3 { font-size: 15px; font-weight: 700; color: var(--tpx-ink); margin: 0 0 6px; line-height: 1.35; }
.tpx-topic p {
    font-size: 12.8px; color: var(--tpx-muted); line-height: 1.55; margin: 0 0 14px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tpx-topic-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--tpx-border); }
.tpx-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tpx-muted); }
.tpx-meta i { font-size: 11px; }
.tpx-diff { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; text-transform: capitalize; }
.tpx-diff-easy { background: #dcfce7; color: #166534; }
.tpx-diff-medium { background: #fef3c7; color: #92400e; }
.tpx-diff-hard { background: #fee2e2; color: #991b1b; }
[data-bs-theme="dark"] .tpx-diff-easy, html.dark-theme .tpx-diff-easy { background: rgba(74, 222, 128, .14); color: #86efac; }
[data-bs-theme="dark"] .tpx-diff-medium, html.dark-theme .tpx-diff-medium { background: rgba(251, 191, 36, .14); color: #fcd34d; }
[data-bs-theme="dark"] .tpx-diff-hard, html.dark-theme .tpx-diff-hard { background: rgba(248, 113, 113, .14); color: #fca5a5; }

/* status badge + mini progress (always icon + text, never colour alone) */
.tpx-status { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.tpx-status-done { background: var(--tpx-done-soft); color: var(--tpx-done); }
.tpx-status-doing { background: var(--tpx-doing-soft); color: var(--tpx-doing); }
.tpx-mini { margin: -4px 0 12px; }
.tpx-mini-bar { height: 5px; border-radius: 999px; background: var(--tpx-track); overflow: hidden; }
.tpx-mini-bar span { display: block; height: 100%; border-radius: 999px; background: var(--tpx-accent); }
.tpx-topic.is-done .tpx-mini-bar span { background: var(--tpx-done); }
.tpx-mini-lbl { font-size: 11px; color: var(--tpx-muted); margin-top: 4px; }

.tpx-empty { text-align: center; padding: 48px 20px; }
.tpx-empty i { font-size: 38px; color: var(--tpx-muted); opacity: .5; margin-bottom: 12px; }
.tpx-empty h5 { color: var(--tpx-ink); font-weight: 700; }

/* ---------- Request banner ---------- */
.tpx-request {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 24px;
    padding: 18px 20px; border-radius: 16px; background: var(--tpx-accent-soft); border: 1px dashed var(--tpx-accent);
}
.tpx-request-ic { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--tpx-accent); color: #fff; flex-shrink: 0; }
.tpx-request h6 { margin: 0; font-weight: 700; color: var(--tpx-ink); font-size: 14.5px; }
.tpx-request p { margin: 0; font-size: 12.8px; color: var(--tpx-muted); }

/* ---------- Progress widget ---------- */
.tpx-prog { display: flex; align-items: center; gap: 16px; }
.tpx-donut { position: relative; width: 92px; height: 92px; flex-shrink: 0; }
.tpx-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.tpx-donut .trk { stroke: var(--tpx-track); }
.tpx-donut .val { stroke: var(--tpx-accent); transition: stroke-dasharray .6s ease; }
.tpx-donut-txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tpx-donut-txt b { font-size: 20px; font-weight: 800; color: var(--tpx-ink); line-height: 1; }
.tpx-donut-txt small { font-size: 10.5px; color: var(--tpx-muted); margin-top: 3px; }
.tpx-prog-rows { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.tpx-prog-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.8px; }
.tpx-prog-row span { color: var(--tpx-muted); }
.tpx-prog-row b { color: var(--tpx-ink); font-weight: 700; white-space: nowrap; }
.tpx-prog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.tpx-prog-tile { background: var(--tpx-soft); border: 1px solid var(--tpx-border); border-radius: 12px; padding: 10px 12px; }
.tpx-prog-tile b { display: block; font-size: 17px; font-weight: 800; color: var(--tpx-ink); line-height: 1.2; }
.tpx-prog-tile span { font-size: 11.5px; color: var(--tpx-muted); }
.tpx-prog-tile i { color: var(--tpx-accent); margin-right: 4px; }
.tpx-resume {
    display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px; border-radius: 12px; text-decoration: none;
    background: var(--tpx-accent-soft); color: var(--tpx-ink);
}
.tpx-resume i { color: var(--tpx-accent); }
.tpx-resume small { display: block; font-size: 11px; color: var(--tpx-muted); }
.tpx-resume b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpx-resume:hover { color: var(--tpx-ink); filter: brightness(.98); }
.tpx-empty-note { font-size: 12.5px; color: var(--tpx-muted); margin: 12px 0 0; }

/* guest prompt */
.tpx-guest { text-align: center; padding: 6px 4px 2px; }
.tpx-guest-ic {
    width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
    background: var(--tpx-accent-soft); color: var(--tpx-accent); font-size: 22px;
}
.tpx-guest h6 { font-weight: 700; color: var(--tpx-ink); margin-bottom: 6px; }
.tpx-guest p { font-size: 12.8px; color: var(--tpx-muted); margin-bottom: 14px; line-height: 1.55; }
.tpx-guest ul { list-style: none; padding: 0; margin: 0 0 14px; text-align: left; font-size: 12.5px; color: var(--tpx-ink-2); }
.tpx-guest li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.tpx-guest li i { color: var(--tpx-done); }
.tpx-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 11px;
    font-size: 13px; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer;
}
.tpx-btn-primary { background: var(--t-600, #4f46e5); color: #fff; }
.tpx-btn-primary:hover { background: var(--t-700, #4338ca); color: #fff; }
.tpx-btn-ghost { background: transparent; color: var(--tpx-accent); border-color: var(--tpx-accent); }
.tpx-btn-ghost:hover { background: var(--tpx-accent-soft); color: var(--tpx-accent); }

/* compact progress strip (shown above the list below 1200px) */
.tpx-strip { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tpx-strip .tpx-donut { width: 58px; height: 58px; }
.tpx-strip .tpx-donut-txt b { font-size: 14px; }
.tpx-strip-body { flex: 1; min-width: 180px; }
.tpx-strip-body b { color: var(--tpx-ink); font-size: 14px; }
.tpx-strip-body div { font-size: 12.5px; color: var(--tpx-muted); }

/* ---------- Quick links + exams ---------- */
.tpx-ql { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpx-ql a {
    display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 6px; border-radius: 12px; text-align: center;
    border: 1px solid var(--tpx-border); background: var(--tpx-soft); font-size: 11.5px; font-weight: 600; color: var(--tpx-ink-2);
    text-decoration: none; transition: all .15s ease;
}
.tpx-ql a:hover { border-color: var(--tpx-accent); color: var(--tpx-accent); transform: translateY(-2px); }
.tpx-ql .ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.ql-blue { background: #eff6ff; color: #2563eb; } .ql-indigo { background: var(--t-50, #eef2ff); color: var(--t-600, #4f46e5); }
.ql-green { background: #f0fdf4; color: #16a34a; } .ql-purple { background: #f5f3ff; color: #7c3aed; }
.ql-red { background: #fef2f2; color: #dc2626; } .ql-cyan { background: #ecfeff; color: #0891b2; }
[data-bs-theme="dark"] .tpx-ql .ic, html.dark-theme .tpx-ql .ic { background: rgba(255, 255, 255, .06); }
.tpx-exam { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--tpx-border); }
.tpx-exam:last-child { border-bottom: 0; padding-bottom: 0; }
.tpx-exam-ic { width: 34px; height: 34px; border-radius: 10px; background: #fef3c7; color: #d97706; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
[data-bs-theme="dark"] .tpx-exam-ic, html.dark-theme .tpx-exam-ic { background: rgba(251, 191, 36, .12); color: #fbbf24; }
.tpx-exam b { display: block; font-size: 13px; color: var(--tpx-ink); }
.tpx-exam small { font-size: 11.5px; color: var(--tpx-muted); }
.tpx-exam a { font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 8px; border: 1px solid var(--tpx-border); color: var(--tpx-accent); text-decoration: none; white-space: nowrap; }
.tpx-exam a:hover { border-color: var(--tpx-accent); }

/* ---------- Responsive ---------- */
@media (min-width: 1200px) {
    .tpx-side { position: sticky; top: 96px; }
}
@media (max-width: 991.98px) {
    .tpx-page { padding-top: 16px; }
    .tpx-cats { position: static; padding: 12px; }
    .tpx-cats .tpx-card-title { display: none; }
    .tpx-cat-list { flex-direction: row; overflow-x: auto; gap: 8px; padding-bottom: 4px; scrollbar-width: thin; }
    .tpx-cat-list li { flex-shrink: 0; }
    .tpx-cat { border: 1px solid var(--tpx-border); border-radius: 999px; padding: 7px 14px; }
    .tpx-cat .tpx-cat-name { white-space: nowrap; }
}
@media (max-width: 767.98px) {
    .tpx-hero { padding: 20px 18px; border-radius: 16px; }
    .tpx-hero h1 { font-size: 22px; }
    .tpx-hero p { font-size: 13px; }
    .tpx-hero-icon { width: 46px; height: 46px; font-size: 19px; border-radius: 13px; }
    .tpx-toolbar .dropdown { flex: 1 1 100%; }
    .tpx-sort-btn { width: 100%; text-align: left; }
}
@media (max-width: 575.98px) {
    .tpx-topic { padding: 14px; }
    .tpx-topic:hover { transform: none; }
    .tpx-topic-ic { width: 38px; height: 38px; font-size: 16px; }
    .tpx-request { flex-direction: column; align-items: stretch; text-align: left; }
    .tpx-request .tpx-btn { width: 100%; }
}
.tpx-page .min-w-0 { min-width: 0; }
