/* Public course catalogue (/courses) and course page (/courses/{slug}). Uses the site's colours from app.css. */

/* ---- Catalogue header ---- */
.cat-hero, .cd-hero { position: relative; overflow: hidden; color: #fff;
  background: var(--g-700); }
.cat-hero .container, .cd-hero .container { position: relative; }
.cat-hero { padding: 8rem 0 4.6rem; }
.cat-hero h1 { color: #fff; font-size: clamp(2rem, 4.6vw, 3.3rem); font-weight: 800; letter-spacing: -.03em; margin: 1rem 0 .8rem; }
.cat-hero .lead { color: rgba(255, 255, 255, .86); max-width: 40rem; font-size: clamp(1rem, 1.5vw, 1.15rem); }

.cat-search { position: relative; display: flex; gap: .5rem; align-items: center; max-width: 46rem; margin-top: 1.7rem; padding: .45rem; background: #fff; border-radius: 20px; box-shadow: 0 22px 50px rgba(0, 0, 0, .28); }
.cat-search > i { position: absolute; left: 1.25rem; color: var(--g-600); pointer-events: none; }
.cat-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: .85rem 1rem .85rem 2.6rem; font-size: 1.02rem; color: var(--ink); border-radius: 14px; }
.cat-search input::placeholder { color: #7d82a3; }
.cat-search:focus-within { box-shadow: 0 22px 50px rgba(0, 0, 0, .28), 0 0 0 4px rgba(255, 165, 0, .55); }
.cat-search .btn { padding: .8rem 1.5rem; border-radius: 14px; font-weight: 700; }

.cat-topics { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1.1rem; font-size: .88rem; color: rgba(255, 255, 255, .8); }
.cat-topics a { color: #fff; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; padding: .28rem .85rem; font-weight: 600; text-decoration: none; transition: background .2s; }
.cat-topics a:hover { background: rgba(255, 255, 255, .26); color: #fff; }
.cat-stats { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; margin-top: 1.5rem; color: rgba(255, 255, 255, .8); font-size: .9rem; }
.cat-stats strong { color: var(--gold); font-size: 1.15rem; margin-right: .25rem; }

/* ---- Filters ---- */
.cat-main { padding: 2.6rem 0 4rem; background: var(--bg); }
.filter-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: .4rem 1.1rem 1.1rem; box-shadow: var(--shadow-sm); }
.filter-group { border: 0; margin: 0; padding: 1rem 0 .6rem; border-bottom: 1px solid var(--line); min-width: 0; }
.filter-title { float: none; width: auto; padding: 0; margin: 0 0 .5rem; font-size: .82rem; font-weight: 800; color: var(--muted); }
.filter-opt { display: flex; align-items: center; gap: .6rem; padding: .48rem .6rem; margin: 0 -.3rem; border-radius: 11px; cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--ink); transition: background .15s; }
.filter-opt:hover { background: var(--g-50); }
.filter-opt input { accent-color: var(--g-700); width: 1rem; height: 1rem; flex: none; margin: 0; }
.filter-opt .n { margin-left: auto; font-size: .74rem; font-weight: 700; background: var(--g-100); color: var(--g-800); border-radius: 999px; padding: .08rem .55rem; }
.filter-opt:has(input:checked) { background: var(--g-100); color: var(--g-900); }
.filter-actions { padding-top: 1.1rem; }
@media (min-width: 992px) { .filter-panel { position: sticky; top: 5.4rem; } .filter-actions .btn[type="submit"] { display: none; } .filter-actions { padding-top: .9rem; } }
.filter-panel.offcanvas-lg { --bs-offcanvas-width: 320px; }
@media (max-width: 991.98px) { .filter-panel { background: var(--bg); } .filter-card { border: 0; box-shadow: none; background: transparent; padding: 0; } .filter-group { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1rem .6rem; margin-bottom: .8rem; } }

/* ---- Toolbar, summary, chips ---- */
.cat-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; margin-bottom: 1rem; }
.cat-toolbar label { font-size: .85rem; font-weight: 700; color: var(--muted); margin: 0; }
.cat-toolbar .form-select { width: auto; min-width: 12.5rem; padding-top: .5rem; padding-bottom: .5rem; font-weight: 600; }
.cat-summary { margin-bottom: 1.1rem; color: var(--muted); }
.cat-summary strong { color: var(--ink); }
.cat-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .7rem; }
.cat-chip { display: inline-flex; align-items: center; gap: .45rem; background: #fff; border: 1px solid var(--g-200); color: var(--g-900); border-radius: 999px; padding: .3rem .5rem .3rem .8rem; font-size: .84rem; font-weight: 700; text-decoration: none; }
.cat-chip i:first-child { color: var(--g-600); font-size: .78rem; }
.cat-chip .x { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--g-100); font-size: .68rem; transition: background .15s, color .15s; }
.cat-chip:hover .x { background: #c0392b; color: #fff; }
.cat-clear { font-size: .84rem; font-weight: 700; margin-left: .3rem; }
#catalogResults { transition: opacity .18s; min-height: 20rem; scroll-margin-top: 5.5rem; }
#catalogResults.is-loading { opacity: .45; pointer-events: none; }
.cat-pager { margin-top: 2rem; }
.cat-empty { text-align: center; padding: 3.2rem 1.4rem; background: #fff; border: 1px dashed var(--g-200); border-radius: 22px; color: var(--muted); }
.cat-empty > i { font-size: 2.4rem; color: var(--g-600); opacity: .7; margin-bottom: .8rem; }
.cat-empty h3 { font-size: 1.2rem; }
.cat-filter-toggle { margin-bottom: .3rem; }
.cat-help { padding: 3.4rem 0; }

/* ---- Course card ---- */
.pc-card { display: flex; flex-direction: column; height: 100%; background: #fff; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .22s, box-shadow .22s, border-color .22s; }
.pc-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: var(--g-200); }
.pc-cover { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; color: #fff; background: linear-gradient(135deg, hsl(var(--h, 152) 55% 26%), hsl(calc(var(--h, 152) + 24) 60% 40%)); }
.pc-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.pc-card:hover .pc-cover img { transform: scale(1.06); }
.pc-glyph { position: absolute; right: -10px; bottom: -18px; font-size: 7.5rem; opacity: .2; transform: rotate(-8deg); }
.pc-level { position: absolute; left: 12px; top: 12px; background: rgba(255, 255, 255, .93); color: var(--g-900); font-size: .72rem; font-weight: 800; padding: .25rem .65rem; border-radius: 999px; box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.pc-price { flex: none; background: var(--g-100); color: var(--g-800); font-weight: 800; font-size: .76rem; padding: .18rem .7rem; border-radius: 999px; }
.pc-price.paid { background: var(--gold-100); color: #6b4a00; }
.pc-lock { position: absolute; right: 12px; top: 12px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .55); font-size: .8rem; }
.pc-body { display: flex; flex-direction: column; flex: 1; padding: 1.1rem 1.2rem 1.25rem; }
.pc-cat { align-self: flex-start; font-size: .82rem; font-weight: 800; color: var(--g-700); }
.pc-body h3 { font-size: 1.1rem; margin: .5rem 0 .45rem; line-height: 1.3; }
.pc-body h3 a { color: var(--ink); text-decoration: none; }
.pc-body h3 a:hover { color: var(--g-700); }
.pc-body p { color: var(--muted); font-size: .9rem; margin-bottom: .9rem; flex: 1; }
.pc-meta { display: flex; flex-wrap: wrap; gap: .3rem 1rem; color: var(--muted); font-size: .8rem; font-weight: 600; margin-bottom: 1rem; }
.pc-meta i { color: var(--g-600); margin-right: .3rem; }
.pc-actions { display: flex; gap: .55rem; }
.pc-actions .btn { flex: 1; font-weight: 700; padding-left: .6rem; padding-right: .6rem; white-space: nowrap; }
.pc-actions .btn:first-child:not(:last-child) { flex: 0 0 auto; }
.pc-actions .btn.disabled { opacity: 1; pointer-events: none; }

/* ---- Course page ---- */
.cd-hero { padding: 7.5rem 0 3.6rem; }
@media (min-width: 992px) { .cd-hero { padding-bottom: 4.4rem; } }
.cd-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; font-size: .85rem; margin-bottom: 1.2rem; }
.cd-crumb a { color: rgba(255, 255, 255, .85); font-weight: 600; text-decoration: none; }
.cd-crumb a:hover { color: #fff; text-decoration: underline; }
.cd-crumb i { font-size: .6rem; opacity: .6; }
.cd-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.cd-badges span { background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; padding: .25rem .8rem; font-size: .78rem; font-weight: 800; }
.cd-badges .free { background: var(--g-100); color: var(--g-900); border-color: var(--g-100); }
.cd-badges .paid { background: var(--gold); color: #3a2a00; border-color: var(--gold); }
.cd-badges .lock { background: #b3263e; border-color: #b3263e; }
.cd-hero h1 { color: #fff; font-size: clamp(1.9rem, 4.2vw, 3rem); font-weight: 800; letter-spacing: -.03em; margin-bottom: .8rem; }
.cd-hero .lead { color: rgba(255, 255, 255, .88); font-size: 1.1rem; max-width: 42rem; }
.cd-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.6rem; margin-top: 1.3rem; font-weight: 600; font-size: .92rem; color: rgba(255, 255, 255, .9); }
.cd-meta i { color: var(--gold); margin-right: .45rem; }

.cd-body { padding: 2.4rem 0 4.5rem; background: #fff; }
@media (min-width: 992px) { .cd-body { padding-top: 2.8rem; } .cd-join { margin-top: -11.5rem; position: sticky; top: 5.5rem; } }
.cd-block { margin-bottom: 2.6rem; }
.cd-block h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 1rem; }
.cd-about { color: var(--text); font-size: 1.02rem; line-height: 1.75; }
.cd-about p:last-child { margin-bottom: 0; }

.cd-curric .accordion-item { border: 1px solid var(--line); border-radius: 16px !important; overflow: hidden; margin-bottom: .7rem; }
.cd-curric .accordion-button { gap: .8rem; font-weight: 700; color: var(--ink); background: #fff; box-shadow: none; padding: 1rem 1.1rem; }
.cd-curric .accordion-button:not(.collapsed) { background: var(--g-50); color: var(--g-900); }
.cd-curric .accordion-button small { font-weight: 600; color: var(--muted); margin-right: .4rem; white-space: nowrap; }
.cd-modnum { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: var(--g-700); color: #fff; font-size: .82rem; font-weight: 800; }
.cd-lessons { list-style: none; margin: 0; padding: .3rem 1.1rem .7rem; }
.cd-lessons li { display: flex; align-items: center; gap: .75rem; padding: .62rem 0; border-top: 1px dashed var(--line); font-size: .93rem; }
.cd-lessons li:first-child { border-top: 0; }
.cd-lessons li > i { color: var(--g-600); font-size: .95rem; flex: none; }
.cd-lessons li > span { flex: 1; min-width: 0; }
.cd-lessons em { font-style: normal; color: var(--gold-600); font-size: .85rem; }
.cd-lessons small { color: var(--muted); font-weight: 600; white-space: nowrap; }
.cd-lessons li.has-preview { flex-wrap: wrap; }
.cd-preview-btn { margin-left: auto; font-weight: 700; white-space: nowrap; }
.cd-preview-modal .modal-body { background: #000; }
.cd-preview-player { position: relative; aspect-ratio: 16 / 9; background: #000; display: flex; align-items: center; justify-content: center; }
.cd-preview-player iframe, .cd-preview-player video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.cd-preview-loading { color: rgba(255, 255, 255, .8); font-size: .9rem; display: flex; align-items: center; }

.cd-instructor { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: 18px; }
.cd-avatar { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--g-800), var(--g-500)); color: #fff; font-size: 1.4rem; font-weight: 800; }

.cd-join { background: #fff; border: 1px solid var(--line); border-radius: 24px; overflow: hidden; box-shadow: 0 24px 60px rgba(7, 7, 63, .18); }
.cd-cover { position: relative; aspect-ratio: 16 / 9; overflow: hidden; color: #fff; background: linear-gradient(135deg, hsl(var(--h, 152) 55% 26%), hsl(calc(var(--h, 152) + 24) 60% 40%)); }
.cd-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cd-join-body { padding: 1.3rem 1.4rem 1.4rem; }
.cd-price { font-size: 2rem; font-weight: 800; color: var(--g-800); line-height: 1; margin-bottom: 1.1rem; }
.cd-price.paid { color: var(--ink); }
.cd-price small { font-size: .82rem; font-weight: 600; color: var(--muted); margin-left: .5rem; }
.cd-sub { margin: .8rem 0 0; font-size: .84rem; color: var(--muted); }
.cd-note { display: flex; gap: .8rem; align-items: flex-start; padding: .9rem 1rem; border-radius: 14px; background: var(--gold-100); border: 1px solid #f1dca0; color: #6b4a00; }
.cd-note.locked { background: #fdf0f2; border-color: #f6c5cf; color: #8f2035; }
.cd-note > i { margin-top: .2rem; font-size: 1.1rem; }
.cd-incl { list-style: none; margin: 1.3rem 0 0; padding: 1.1rem 0 0; border-top: 1px solid var(--line); display: grid; gap: .6rem; font-size: .92rem; font-weight: 600; }
.cd-incl i { width: 1.4rem; color: var(--g-600); }
.cd-share { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 1.2rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.cd-share span { font-size: .82rem; font-weight: 800; color: var(--muted); margin-right: .2rem; }

@media (prefers-reduced-motion: reduce) { .pc-card, .pc-cover img, #catalogResults { transition: none; } .pc-card:hover { transform: none; } }
@media (max-width: 575.98px) { .cat-search .btn { padding-left: 1rem; padding-right: 1rem; } .cat-search input { padding-left: 2.4rem; } .cat-toolbar { justify-content: space-between; } }
