/* ===========================================================================
   Collections / Catalog page — ported from the ceshive "All Courses" prototype
   (cesdesigns/ceshive: pages.jsx AllCoursesPage + ProgramCard, components.jsx
   FilterDrawer/Rating, tokens.css shared catalog layout).

   Standalone, page-scoped stylesheet linked only by Views/Website/Collections.cshtml
   so the catalog look ships without touching any theme bundle. References the theme's
   design tokens (--c-*, --r-*, --fs-*, --sh-*) with literal fallbacks so it degrades
   gracefully on themes that don't define them.
   =========================================================================== */

.collections-page { background: var(--c-surface, #fff); }

/* ----- page head ----- */
.collections-page .cat__head {
  background: var(--c-surface-alt, #fff9f1);
  border-bottom: 1px solid var(--c-line, #e5e5e5);
  padding: 28px 0 32px;
}
.collections-page .cat__head h1 {
  margin: 8px 0 6px;
  font-family: var(--font-headline, sans-serif);
  font-size: var(--fs-32, 32px); font-weight: 700; letter-spacing: -0.02em;
  color: var(--c-text, #1c1d1a);
}
.collections-page .cat__sub { margin: 0; color: var(--c-muted, #666); font-size: var(--fs-14, 14px); }
.collections-page .bcrumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--c-muted, #666); }
.collections-page .bcrumbs a { color: var(--c-primary, #b61c1b); font-weight: 600; text-decoration: none; }
.collections-page .bcrumbs a:hover { text-decoration: underline; }
.collections-page .bcrumbs i { color: #9da2ad; font-size: 15px; line-height: 1; }

/* ----- body (full-width, off-canvas filters — no persistent sidebar) ----- */
.collections-page .cat__body { padding: 32px 24px; }
.collections-page .cat__body--full { display: block; }

/* ----- sortbar ----- */
.collections-page .cat__sortbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--c-surface, #fff);
  border: 1px solid var(--c-line, #e5e5e5); border-radius: var(--r-3, 10px);
  margin-bottom: 16px; font-size: var(--fs-14, 14px); color: var(--c-muted, #666);
  flex-wrap: wrap; row-gap: 10px;
}
.collections-page .cat__sortbar strong { color: var(--c-text, #1c1d1a); font-size: var(--fs-15, 15px); }
.collections-page .cat__filters-btn { flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px; }
.collections-page .cat__sortbar__end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.collections-page .cat__sortbar__end label { font-size: 14px; color: var(--c-muted, #666); }
.collections-page .flt-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px;
  background: var(--c-primary, #b61c1b); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: var(--r-pill, 999px);
}

/* ----- active filter chips ----- */
.collections-page .flt-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.collections-page .flt-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px 6px 12px;
  background: var(--c-primary-50, #fdeeee); border: 1px solid var(--c-primary-100, #f5d4d4);
  border-radius: var(--r-pill, 999px); font: inherit; font-size: var(--fs-13, 13px); font-weight: 600;
  color: var(--c-primary-600, #92180f); cursor: pointer; text-decoration: none;
}
.collections-page .flt-chip:hover { background: var(--c-primary-100, #f5d4d4); border-color: var(--c-primary, #b61c1b); }
.collections-page .flt-chip i { font-size: 13px; line-height: 1; }
.collections-page .flt-chips__clear {
  background: transparent; border: 0; font: inherit; font-size: var(--fs-13, 13px);
  font-weight: 600; color: var(--c-primary, #b61c1b); cursor: pointer; padding: 6px 4px; text-decoration: none;
}
.collections-page .flt-chips__clear:hover { text-decoration: underline; }

/* ----- product grid ----- */
.collections-page .ac__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 1180px) { .collections-page .ac__grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .collections-page .ac__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .collections-page .ac__grid { grid-template-columns: 1fr; } }

/* ----- product card (.pcard) ----- */
.collections-page .pcard {
  background: var(--c-surface, #fff); border: 1px solid var(--c-line, #e5e5e5);
  border-radius: var(--r-3, 10px); overflow: hidden;
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.collections-page .pcard:hover { box-shadow: var(--sh-2, 0 4px 16px rgba(20,22,26,.08)); border-color: #c8d3cd; transform: translateY(-2px); }
.collections-page .pcard__thumb { position: relative; aspect-ratio: 16 / 9; background: var(--c-surface-alt, #fff9f1); }
.collections-page .pcard__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.collections-page .pcard__chip {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--font-mono, sans-serif);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 700; padding: 4px 8px; border-radius: 4px;
  background: var(--c-primary, #b61c1b); color: #fff;
}
.collections-page .pcard__chip--bundle { background: var(--c-accent, #f4bf3a); color: #2a1e00; }
.collections-page .pcard__chip--download { background: var(--c-ink, #1c1d1a); color: #fff; }
.collections-page .pcard__ce {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; padding: 4px 8px;
}
.collections-page .pcard__body {
  padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1;
}
.collections-page .pcard__title {
  margin: 0; font-size: var(--fs-15, 15px); font-weight: 700;
  line-height: 1.3; color: var(--c-text, #1c1d1a);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.6em;
}
.collections-page .pcard__desc {
  margin: 0; font-size: 12px; color: var(--c-muted, #666); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.collections-page .pcard__meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--c-muted, #666); margin-top: 2px;
}
.collections-page .pcard__meta span { display: inline-flex; align-items: center; gap: 4px; }
.collections-page .pcard__meta i { font-size: 13px; line-height: 1; }
.collections-page .pcard__meta .pcard__meta--ce { color: var(--c-primary-600, #92180f); }
.collections-page .pcard__priceRow {
  display: flex; align-items: baseline; gap: 8px;
  margin-top: auto; padding-top: 8px; border-top: 1px solid var(--c-line-2, #f0f0f0);
}
.collections-page .pcard__price { font-weight: 800; font-size: var(--fs-18, 18px); color: var(--c-text, #1c1d1a); }
.collections-page .pcard__price-ce {
  font-size: 11px; font-weight: 700; color: var(--c-primary-600, #92180f);
  background: var(--c-primary-50, #fdeeee); padding: 2px 7px; border-radius: 4px; margin-left: auto;
}

/* ----- rating ----- */
.collections-page .rating { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-13, 13px); }
.collections-page .rating__score { font-weight: 700; color: #8a5a00; font-family: var(--font-nav, sans-serif); }
.collections-page .rating__stars { display: inline-flex; gap: 1px; color: var(--c-accent, #f4bf3a); line-height: 1; }
.collections-page .rating__stars i { font-size: 13px; }
.collections-page .rating__count { color: var(--c-muted, #666); }

/* ----- empty state ----- */
.collections-page .cat__empty {
  background: var(--c-surface, #fff); border: 1px dashed var(--c-line, #e5e5e5); border-radius: var(--r-3, 10px);
  padding: 40px; text-align: center;
  display: flex; flex-direction: column; gap: 12px; align-items: center; color: var(--c-muted, #666);
}
.collections-page .cat__empty i { font-size: 28px; }

/* ----- pager ----- */
.collections-page .pager { display: flex; gap: 6px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.collections-page .pager__btn {
  min-width: 38px; height: 38px; padding: 0 10px;
  border: 1px solid var(--c-line, #e5e5e5); background: var(--c-surface, #fff);
  color: var(--c-text, #1c1d1a); font-weight: 600;
  border-radius: var(--r-2, 6px); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.collections-page .pager__btn:hover { border-color: var(--c-primary, #b61c1b); color: var(--c-primary, #b61c1b); }
.collections-page .pager__btn--on { background: var(--c-ink, #1c1d1a); color: #fff; border-color: var(--c-ink, #1c1d1a); }
.collections-page .pager__btn--on:hover { color: #fff; }

/* ----- filter drawer (off-canvas) ----- */
.collections-page .flt-drawer { position: fixed; inset: 0; z-index: 500; display: flex; pointer-events: none; visibility: hidden; }
.collections-page .flt-drawer.open { pointer-events: auto; visibility: visible; }
.collections-page .flt-drawer__backdrop {
  position: absolute; inset: 0; background: rgba(21, 34, 43, 0.42);
  backdrop-filter: blur(2px); border: 0; cursor: pointer; pointer-events: auto;
  opacity: 0; transition: opacity .2s ease;
}
.collections-page .flt-drawer.open .flt-drawer__backdrop { opacity: 1; }
.collections-page .flt-drawer__panel {
  position: relative; z-index: 1; width: min(100%, 340px); max-width: 100vw; height: 100%;
  background: var(--c-surface, #fff); box-shadow: var(--sh-3, 0 16px 48px rgba(20,22,26,.14));
  display: flex; flex-direction: column; pointer-events: auto;
  transform: translateX(-100%); transition: transform .24s ease;
}
.collections-page .flt-drawer.open .flt-drawer__panel { transform: translateX(0); }
.collections-page .flt-drawer__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--c-line, #e5e5e5); flex-shrink: 0;
}
.collections-page .flt-drawer__title { font-weight: 700; font-size: var(--fs-16, 16px); color: var(--c-text, #1c1d1a); }
.collections-page .flt-drawer__title em { color: var(--c-primary, #b61c1b); font-style: normal; font-weight: 700; }
.collections-page .flt-drawer__actions { display: flex; align-items: center; gap: 8px; }
.collections-page .flt-drawer__close {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border: 1px solid var(--c-line, #e5e5e5); border-radius: var(--r-2, 6px);
  background: var(--c-surface, #fff); cursor: pointer; color: var(--c-text, #1c1d1a);
}
.collections-page .flt-drawer__close:hover { background: var(--c-surface-alt, #fff9f1); border-color: var(--c-primary, #b61c1b); }
.collections-page .flt-drawer__body { flex: 1; overflow-y: auto; padding: 8px 20px 24px; }
.collections-page .cat__clear {
  background: transparent; border: 0; color: var(--c-primary, #b61c1b);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.collections-page .cat__clear:hover { text-decoration: underline; }

/* ----- filter groups ----- */
.collections-page .flt-grp { border-top: 1px solid var(--c-line, #e5e5e5); padding: 12px 0; }
.collections-page .flt-grp:first-of-type { border-top: 0; }
.collections-page .flt-grp__hd {
  width: 100%; background: transparent; border: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; font: inherit; font-weight: 700; font-size: var(--fs-14, 14px);
  cursor: pointer; color: var(--c-text, #1c1d1a);
}
.collections-page .flt-grp__hd i { transition: transform .18s ease; color: #5a6071; font-size: 18px; line-height: 1; }
.collections-page .flt-grp.collapsed .flt-grp__hd i { transform: rotate(-90deg); }
.collections-page .flt-grp__bd { padding-top: 6px; }
.collections-page .flt-grp.collapsed .flt-grp__bd { display: none; }
.collections-page .flt-scroll { max-height: 240px; overflow-y: auto; padding-right: 4px; }

.collections-page .flt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px; cursor: pointer; min-height: 36px; color: var(--c-text, #1c1d1a);
}
.collections-page .flt:hover { color: var(--c-primary, #b61c1b); }
.collections-page .flt input { flex-shrink: 0; accent-color: var(--c-primary, #b61c1b); width: 16px; height: 16px; }
.collections-page .flt__lbl { font-size: var(--fs-14, 14px); }
.collections-page .flt__count { margin-left: auto; font-size: 12px; color: var(--c-muted, #666); font-family: var(--font-mono, sans-serif); }

/* price range + CE state inputs inside the drawer */
.collections-page .flt-range { display: flex; gap: 10px; padding: 6px 4px; }
.collections-page .flt-range input,
.collections-page .flt-select {
  width: 100%; padding: 9px 12px; min-height: 40px;
  border: 1px solid var(--c-line, #e5e5e5); border-radius: var(--r-2, 6px);
  background: var(--c-surface, #fff); color: var(--c-text, #1c1d1a); font: inherit; font-size: var(--fs-14, 14px);
}
.collections-page .flt-range input:focus,
.collections-page .flt-select:focus { outline: none; border-color: var(--c-primary, #b61c1b); }
.collections-page .flt-sub { padding: 4px 4px 0; }
.collections-page .flt-sub label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--c-muted, #666); }
.collections-page .flt-apply {
  margin-top: 10px; width: 100%; padding: 9px 14px; min-height: 40px;
  background: var(--c-primary, #b61c1b); color: #fff; border: 0; border-radius: var(--r-2, 6px);
  font: inherit; font-weight: 600; cursor: pointer;
}
.collections-page .flt-apply:hover { background: var(--c-primary-600, #92180f); }

/* sections that render below the product list */
.collections-page .collections-sections { margin-top: 40px; }

@media (max-width: 640px) {
  .collections-page .cat__body { padding: 24px 16px; }
  .collections-page .cat__sortbar__end { width: 100%; margin-left: 0; }
}
