/* ══════════════════════════════════════════════════════════════════════
   uni-ux.css — shared UX layer for the universities + programs pages.

   Loaded AFTER universities.css, so it only ADDS affordances (sticky
   toolbars, category jump bar, grouped browsing, empty-state actions)
   and never restyles cards, hero, or modals. Theme-safe: every colour
   is a token or a color-mix() of one, so light/dark both work.

     1. Sticky filter / search toolbar
     2. Deep-link scroll offsets (programs → universities#all-universities)
     3. Search box clear button
     4. Grid bottom bar (floating "load more" pill)
     5. Empty state: actions + suggestion chips
     6. Programs page: controls, jump bar, grouped list, toolbar
   ══════════════════════════════════════════════════════════════════════ */

/* 1 ── Sticky toolbars ──────────────────────────────────────────────── */
/* --uni-sticky-top is measured from the live fixed navbar at runtime
   (setupSticky in the JS) so it stays correct when the nav height
   changes between breakpoints. */
.uni-sticky-sentinel { height: 1px; margin-top: -1px; pointer-events: none; }

#uniFilters,
#progControls {
  position: sticky;
  top: var(--uni-sticky-top, 72px);
  z-index: 40;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid transparent;
  transition: background-color .22s ease, border-color .22s ease, box-shadow .22s ease;
}
#uniFilters.is-stuck,
#progControls.is-stuck {
  background: color-mix(in srgb, var(--color-bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  border-bottom-color: var(--color-border);
  box-shadow: 0 10px 24px -20px rgba(15, 23, 42, .6);
}

/* 2 ── Deep-link offsets ────────────────────────────────────────────── */
/* The site scrolls smoothly (html { scroll-behavior: smooth }), so an
   in-page link lands under the fixed navbar. Give every jump target a
   landing offset below the nav + sticky toolbar. */
#all-universities,
#top-universities,
#faq,
#saved-programs,
.uni-hero-section,
.uni-filter-bar {
  scroll-margin-top: calc(var(--uni-sticky-top, 72px) + 20px);
}

/* 3 ── Search clear button ──────────────────────────────────────────── */
.uni-search-clear {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: none; border-radius: 50%;
  background: color-mix(in srgb, var(--color-ink-muted) 15%, transparent);
  color: var(--color-ink-soft);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.uni-search-clear svg { width: 15px; height: 15px; display: block; }
.uni-search-clear:hover { background: color-mix(in srgb, var(--color-primary) 18%, transparent); color: var(--color-primary); }
.uni-search-clear:active { transform: scale(.9); }
.uni-search-clear[hidden] { display: none; }

/* 4 ── Grid bottom bar ──────────────────────────────────────────────── */
/* Only on desktop: the pagination row floats over the grid as a glass
   pill, so "load more" is reachable without scrolling to the bottom. */
@media (min-width: 721px) {
  .uni-pagination {
    position: sticky;
    bottom: var(--space-4);
    z-index: 25;
    width: fit-content;
    margin-left: auto; margin-right: auto;
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--color-bg) 84%, transparent);
    backdrop-filter: blur(14px) saturate(1.5);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
    box-shadow: 0 12px 32px -18px rgba(15, 23, 42, .55);
  }
  .uni-pagination.is-fresh { animation: uniPulse .6s ease; }
  @keyframes uniPulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.045); }
    100% { transform: scale(1); }
  }
}
#uniLoadMore { transition: transform .16s ease, background .2s ease, box-shadow .2s ease; }
#uniLoadMore:hover { transform: translateY(-1px); }
#uniLoadMore:active { transform: translateY(0) scale(.98); }

/* 5 ── Empty state: actions + suggestion chips ──────────────────────── */
.uni-ux-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-ink);
  font: inherit; font-size: var(--text-sm); font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.uni-ux-btn:hover { border-color: var(--color-primary); color: var(--color-primary); transform: translateY(-1px); }
.uni-ux-btn.is-primary {
  background: var(--gradient-primary); border-color: transparent; color: #fff;
  box-shadow: 0 6px 20px -10px rgba(124, 58, 237, .7);
}
.uni-ux-btn.is-primary:hover { color: #fff; box-shadow: 0 10px 26px -10px rgba(124, 58, 237, .85); }
.uni-ux-btn.is-sm { padding: 7px 14px; font-size: var(--text-xs); }

.uni-empty-actions {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  justify-content: center; margin-top: var(--space-6);
}
.uni-empty-chips-label {
  margin-top: var(--space-6); margin-bottom: var(--space-3);
  font-size: var(--text-xs); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--color-ink-muted);
}
.uni-empty-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.uni-empty-chip {
  padding: 6px 14px; border-radius: var(--radius-full);
  border: 1px solid var(--color-border); background: transparent;
  color: var(--color-ink-soft); font: inherit; font-size: var(--text-xs);
  font-weight: 600; cursor: pointer;
  transition: all .16s ease;
}
.uni-empty-chip:hover {
  border-color: var(--color-primary); color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

/* A one-line hint under the count when results are filtered. */
.uni-active-filters {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  justify-content: center; margin-top: var(--space-2);
  font-size: var(--text-xs); color: var(--color-ink-muted);
}
.uni-active-filter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  color: var(--color-primary); font-weight: 600;
}
.uni-active-filter button {
  border: none; background: none; padding: 0; cursor: pointer;
  color: inherit; font: inherit; font-size: 1em; line-height: 1; opacity: .7;
}
.uni-active-filter button:hover { opacity: 1; }

/* ══ 6 ── Programs page ═════════════════════════════════════════════ */

.prog-search-row {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  max-width: 640px; margin: 0 auto var(--space-4);
}

/* Category jump bar — one tap to a group, with live counts. */
.prog-jump {
  display: flex; gap: 8px;
  max-width: 940px; margin: 0 auto;
  padding: 2px 2px 6px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scroll-snap-type: x proximity;
}
.prog-jump::-webkit-scrollbar { height: 4px; }
.prog-jump::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 999px; }
.prog-jump-chip {
  flex: 0 0 auto; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-full);
  border: 1px solid var(--color-border); background: var(--color-bg-card);
  color: var(--color-ink-soft); font: inherit;
  font-size: var(--text-xs); font-weight: 600; white-space: nowrap;
  cursor: pointer; transition: all .16s ease;
}
.prog-jump-chip b { font-weight: 700; opacity: .6; }
.prog-jump-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.prog-jump-chip.is-active {
  background: var(--gradient-primary); border-color: transparent; color: #fff;
}
.prog-jump-chip.is-active b { opacity: .8; }

/* Result toolbar — the count now sits ABOVE the grid (it used to be
   below all 885 cards, where nobody saw it). */
.prog-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--space-3);
  margin-bottom: var(--space-5);
}
#progCount { margin: 0; text-align: left; color: var(--color-ink-soft); font-size: var(--text-sm); }
.prog-clear {
  border: none; background: none; padding: 4px 0; cursor: pointer;
  color: var(--color-primary); font: inherit;
  font-size: var(--text-sm); font-weight: 600;
}
.prog-clear:hover { text-decoration: underline; }
.prog-clear[hidden] { display: none; }

/* Grouped browse mode: one section per category, sticky headers. */
#progGrid.is-grouped { display: block; }
.prog-group { margin-bottom: var(--space-10, 3rem); }
.prog-group-head {
  position: sticky;
  top: calc(var(--uni-sticky-top, 72px) + var(--uni-ctrl-h, 52px));
  z-index: 20;
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px 2px;
  margin-bottom: var(--space-4);
  background: color-mix(in srgb, var(--color-bg) 91%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  scroll-margin-top: calc(var(--uni-sticky-top, 72px) + var(--uni-ctrl-h, 52px) + 8px);
}
.prog-group-ico { font-size: 1.3rem; line-height: 1; }
.prog-group-title { margin: 0; font-size: var(--text-lg); font-weight: 700; }
.prog-group-count {
  padding: 2px 10px; border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--color-primary); font-size: var(--text-xs); font-weight: 700;
}
.prog-group-toggle {
  margin-left: auto;
  border: 1px solid var(--color-border); background: var(--color-bg-card);
  border-radius: var(--radius-full); padding: 7px 14px;
  color: var(--color-ink-soft); font: inherit;
  font-size: var(--text-xs); font-weight: 600; white-space: nowrap;
  cursor: pointer; transition: all .16s ease;
}
.prog-group-toggle:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* The count line under the sticky toolbar of the universities page gets
   a little more presence so it reads as a status bar, not a footnote. */
.uni-count { font-weight: 500; }

/* A relaxed search fallback (universities.js) says so, so loose matches
   never pass themselves off as exact ones. */
.uni-relaxed-note {
  grid-column: 1 / -1;
  padding: 10px 14px;
  margin-bottom: var(--space-4);
  border: 1px dashed color-mix(in srgb, var(--color-primary) 40%, transparent);
  border-radius: var(--radius-lg, 14px);
  background: color-mix(in srgb, var(--color-primary) 7%, transparent);
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
}

/* ── Small screens: don't let the sticky stack eat the viewport ─────── */
@media (max-width: 720px) {
  #uniFilters { position: static; }
  .prog-group-head { position: static; }
  .prog-jump { padding-bottom: 4px; }
  .uni-empty-actions .uni-ux-btn { flex: 1 1 auto; justify-content: center; }
}
