/* discover-filters.css — filter sheet + capacity pill + providers screen
 * ─────────────────────────────────────────────────────────────────────────
 *   Reuses the project's tokens (--primary, --surface, --fg, etc.) — no
 *   invented colours. Sheet borrows the existing Sheet animation pattern.
 *
 *   On mobile the sheet is a 90vh bottom-sheet with a sticky footer;
 *   on ≥768 it centres into a 520-wide modal.
 * ─────────────────────────────────────────────────────────────────────── */

/* ── Capacity / enrolment pill — shown on CourseCard + CourseDetail ── */
.cap-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10.5px;
  line-height: 1;
  letter-spacing: 0.04em;
  font-weight: 600;
  white-space: nowrap;
  border: 0.5px solid transparent;
}
.cap-pill::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  opacity: 0.95;
}
.cap-pill.tone-success { background: color-mix(in oklab, var(--success) 12%, var(--surface)); color: var(--success); border-color: color-mix(in oklab, var(--success) 30%, transparent); }
.cap-pill.tone-warning { background: color-mix(in oklab, var(--warning) 14%, var(--surface)); color: oklch(0.45 0.13 70);     border-color: color-mix(in oklab, var(--warning) 36%, transparent); }
.cap-pill.tone-danger  { background: color-mix(in oklab, var(--danger)  10%, var(--surface)); color: var(--danger);  border-color: color-mix(in oklab, var(--danger)  28%, transparent); }
.cap-pill.tone-muted   { background: var(--bg-2); color: var(--fg-3);    border-color: var(--border); }
.cap-pill.tone-muted::before { background: var(--fg-3); }

.deadline-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10.5px;
  line-height: 1;
  letter-spacing: 0.04em;
  font-weight: 500;
  white-space: nowrap;
  background: color-mix(in oklab, var(--accent) 12%, var(--surface));
  color: oklch(0.42 0.10 50);
  border: 0.5px solid color-mix(in oklab, var(--accent) 28%, transparent);
}
[data-theme='dark'] .deadline-pill { color: oklch(0.82 0.10 60); }
.deadline-pill.urgent { background: color-mix(in oklab, var(--danger) 12%, var(--surface)); color: var(--danger); border-color: color-mix(in oklab, var(--danger) 30%, transparent); }

/* ── Active filter pill (shown above results) ── */
.active-filters-bar {
  padding: 4px 20px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 6px 0 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 0.5px solid color-mix(in oklab, var(--primary) 40%, transparent);
  font-size: 11.5px;
  font-weight: 500;
}
.active-filter-chip-x {
  appearance: none;
  border: 0;
  background: transparent;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--primary);
  cursor: pointer;
  opacity: 0.7;
}
.active-filter-chip-x:hover { opacity: 1; background: color-mix(in oklab, var(--primary) 12%, transparent); }
.active-filters-clear {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg-3);
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 2px 4px;
}

/* ── Discover Filters button ── */
.filters-trigger {
  appearance: none;
  border: 0.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 120ms, border-color 120ms;
}
.filters-trigger:hover { background: var(--bg-2); }
.filters-trigger.has-active {
  border-color: var(--primary);
  background: var(--primary-soft-2);
  color: var(--primary);
}
.filters-trigger-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 10.5px;
  font-weight: 600;
}

/* ── Filter sheet ── */
.df-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 20, 14, 0.35);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  animation: df-fade-in 180ms ease-out;
}
@keyframes df-fade-in { from { opacity: 0; } to { opacity: 1; } }

.df-sheet {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  background: var(--surface);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  animation: df-slide-up 240ms cubic-bezier(0.18, 0.7, 0.2, 1);
}
@keyframes df-slide-up { from { transform: translateY(40px); opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }

@media (min-width: 768px) {
  .df-backdrop { align-items: center; }
  .df-sheet {
    border-radius: 18px;
    max-height: 80vh;
  }
}

.df-handle {
  width: 36px; height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  margin: 8px auto 4px;
}
.df-head {
  padding: 8px 16px 12px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 0.5px solid var(--border);
}
.df-head-title {
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: -0.015em;
}

.df-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 12px;
  display: flex; flex-direction: column; gap: 18px;
}

.df-section { display: flex; flex-direction: column; gap: 8px; }
.df-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px;
}
.df-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.df-section-clear {
  appearance: none; border: 0; background: transparent;
  color: var(--fg-3); font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.df-chips {
  display: flex; flex-wrap: wrap;
  gap: 6px;
}
.df-chips-scroll {
  max-height: 192px;
  overflow-y: auto;
  padding: 4px;
  margin: -4px;
  scrollbar-width: thin;
}
.df-chip {
  appearance: none;
  border: 0.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex; align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.df-chip:hover { background: var(--bg-2); }
.df-chip.on {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: var(--primary);
}
.df-chip-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--fg-3);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}
.df-chip.on .df-chip-count {
  background: color-mix(in oklab, var(--primary-ink) 22%, var(--primary));
  color: var(--primary-ink);
}

.df-foot {
  border-top: 0.5px solid var(--border);
  padding: 12px 16px 14px;
  display: flex; align-items: center; gap: 10px;
}
.df-apply {
  flex: 1;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.df-apply-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--primary-ink) 22%, var(--primary));
  color: var(--primary-ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

/* Mobile-only "Browse by provider" entry inside Discover.
   Side-nav already has it on tablet/desktop, so hide there. */
.discover-browse-providers {
  appearance: none;
  background: transparent;
  border: 0;
  margin-top: 10px;
  padding: 6px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--fg-2);
  cursor: pointer;
}
.discover-browse-providers:hover { color: var(--primary); }
@media (min-width: 768px) {
  .discover-browse-providers { display: none; }
}

/* ── Providers screen ── */
.pv-summary {
  margin: 12px 20px 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
}
.pv-summary-stat { flex: 1; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.pv-summary-divider { width: 0.5px; align-self: stretch; background: var(--border); }
.pv-summary-num {
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--fg);
}
.pv-summary-label {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.pv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.pv-row-skel { cursor: default; }
.pv-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pv-row-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pv-row-sub {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--fg-3);
}

.pv-skel-pulse {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--surface-2) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: pv-shimmer 1.4s ease-in-out infinite;
}
@keyframes pv-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Provider courses screen */
.pv-hero {
  padding: 64px 20px 14px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.pv-hero-name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.018em;
  font-weight: 500;
  color: var(--fg);
  text-wrap: pretty;
}
.pv-hero-sub {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-2);
  letter-spacing: 0.02em;
}
.pv-hero-link {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
}
.pv-hero-link:hover { text-decoration: underline; }

/* On dark theme the sheet keeps its tone */
[data-theme='dark'] .df-backdrop { background: rgba(0,0,0,0.55); }

/* ── Profile sub-tabs ─────────────────────────────────────────────── */
.profile-tabs {
  margin: 4px 20px 12px;
  display: inline-flex;
  gap: 0;
  padding: 3px;
  background: var(--bg-2);
  border-radius: 12px;
  border: 0.5px solid var(--border);
  width: fit-content;
}
.profile-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg-2);
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 140ms, color 140ms, box-shadow 140ms;
}
.profile-tab:hover { color: var(--fg); }
.profile-tab.on {
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
}

/* ── Clickable wallet card on Home ────────────────────────────────── */
.wallet-clickable {
  cursor: pointer;
  position: relative;
  transition: box-shadow 180ms;
}
.wallet-clickable:hover { box-shadow: 0 4px 14px rgba(20,20,14,0.06), 0 1px 2px rgba(20,20,14,0.04); }
.wallet-clickable:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.wallet-cta-row {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}

/* ── Cert-upload spinner inside RecordScreen chip ─────────────────── */
.cert-upload-chip { display: inline-flex; align-items: center; gap: 4px; }
.cert-upload-spinner {
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  animation: cert-spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes cert-spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────────────────────────
   Discover · sticky filter & search bar
   The whole search/filter cluster pins to the top of the scroll
   container so it follows the user. A subtle border/blur appears
   only when not at the very top (so the bar looks weightless until
   it actually overlaps content).
   ───────────────────────────────────────────────────────────────── */
.discover-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  padding-top: 4px;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 0.5px solid transparent;
  transition: border-color 180ms, box-shadow 180ms;
}
/* Subtle elevation once the user starts scrolling past it.
   We can't directly detect scroll without JS, but `position: sticky`
   already drops a tiny shadow via the universal hover affordance — so
   apply a permanent thin border + small shadow always, which looks
   correct both at-top and after scrolling. */
.discover-sticky {
  box-shadow: 0 1px 0 0 var(--border);
}
[data-theme='dark'] .discover-sticky {
  background: color-mix(in oklab, var(--bg) 88%, transparent);
}

/* ─────────────────────────────────────────────────────────────────
   Profile sub-tabs — refreshed with more prominence
   Larger hit targets, full-width segmented control, sticky on scroll.
   ───────────────────────────────────────────────────────────────── */
.profile-tabs {
  margin: 8px 20px 14px;
  display: flex;
  gap: 4px;
  padding: 5px;
  background: var(--bg-2);
  border-radius: 14px;
  border: 0.5px solid var(--border);
  width: auto;
  position: sticky;
  top: 4px;
  z-index: 15;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.profile-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg-2);
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  cursor: pointer;
  text-align: center;
  transition: background 160ms, color 160ms, box-shadow 160ms, transform 120ms;
}
.profile-tab:hover { color: var(--fg); }
.profile-tab:active { transform: scale(0.98); }
.profile-tab.on {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(20,20,14,0.05), 0 4px 12px rgba(20,20,14,0.06);
}
[data-theme='dark'] .profile-tab.on { box-shadow: 0 2px 8px rgba(0,0,0,0.3); }

/* ─────────────────────────────────────────────────────────────────
   Record screen · view bar (In progress / History)
   Pill-shaped tabs sitting just below the header.
   ───────────────────────────────────────────────────────────────── */
.record-viewbar {
  margin: 10px 20px 14px;
  display: flex;
  gap: 6px;
  padding: 5px;
  background: var(--bg-2);
  border-radius: 14px;
  border: 0.5px solid var(--border);
}
.record-viewbar-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg-2);
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 160ms, color 160ms, box-shadow 160ms;
}
.record-viewbar-tab:hover { color: var(--fg); }
.record-viewbar-tab.on {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.record-viewbar-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--primary) 18%, transparent);
  color: var(--primary);
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  font-weight: 600;
}
.record-viewbar-tab:not(.on) .record-viewbar-badge {
  background: var(--bg-2);
  color: var(--fg-3);
}

/* "Manual log" CTA that sits below the active section */
.record-log-cta {
  appearance: none;
  width: 100%;
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  padding: 14px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  cursor: pointer;
  transition: border-color 160ms, color 160ms, background 160ms;
}
.record-log-cta:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft-2);
}

/* ─────────────────────────────────────────────────────────────────
   Session pill hover state
   ───────────────────────────────────────────────────────────────── */
.session-pill:hover { filter: brightness(1.03); }
.session-pill:active { transform: scale(0.94); }

/* ─────────────────────────────────────────────────────────────────
   Timeline rows in Record · clickable affordance
   ───────────────────────────────────────────────────────────────── */
.tl-item.is-clickable {
  position: relative;
  border-radius: 10px;
  transition: background 160ms;
}
.tl-item.is-clickable:hover { background: color-mix(in oklab, var(--primary) 4%, transparent); }
.tl-item.is-clickable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────
   RecordDetailSheet · certificate block
   ───────────────────────────────────────────────────────────────── */
.rx-cert-block {
  padding: 14px;
  background: var(--bg-2);
  border-radius: 14px;
  border: 0.5px solid var(--border);
}
.rx-cert-existing {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--surface);
  border-radius: 10px;
  border: 0.5px solid var(--border);
}
.rx-cert-existing-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: color-mix(in oklab, var(--success) 14%, var(--surface));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rx-cert-upload-cta {
  appearance: none;
  width: 100%;
  background: var(--surface);
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms, background 160ms;
  color: var(--fg);
  font: inherit;
}
.rx-cert-upload-cta:hover {
  border-color: var(--primary);
  background: var(--primary-soft-2);
}
.rx-cert-upload-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rx-cert-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rx-cert-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 10px;
  border: 0.5px solid var(--border);
  background: var(--surface);
}
.rx-cert-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 28px 16px;
  background: var(--surface);
  border-radius: 10px;
  border: 0.5px solid var(--border);
  color: var(--fg-2);
}
.rx-cert-preview-actions {
  display: flex;
  gap: 8px;
}
.rx-cert-preview-actions .btn {
  flex: 1;
  padding: 9px 12px;
  font-size: 12.5px;
}

.rx-del-confirm {
  margin-top: 14px;
  padding: 14px;
  background: color-mix(in oklab, var(--danger) 6%, var(--surface));
  border: 0.5px solid color-mix(in oklab, var(--danger) 30%, var(--border));
  border-radius: 12px;
}

/* ─────────────────────────────────────────────────────────────────
   Clickable reminder rows (Home inline list + Reminders sheet)
   ───────────────────────────────────────────────────────────────── */
.reminder-row {
  transition: border-color 160ms, background 160ms, transform 120ms;
}
.reminder-row:hover {
  border-color: var(--border-strong);
  background: color-mix(in oklab, var(--primary) 4%, var(--surface));
}
.reminder-row:active { transform: scale(0.99); }
.reminder-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
