/* Bump@r design system — lifted from the prototype
   (Bumpr Honours standalone): Fredoka display + Nunito body,
   cream/pastel background, rainbow strip, medal gradients,
   pill buttons with a 3D press shadow, soft white cards. */

:root {
  --bg: #FFFDF6;
  --ink: #2B2A33;
  --ink-soft: #5B5A66;
  --muted: #8B8A94;
  --faint: #B0AFB8;
  --line: #EEEBE2;
  --line-strong: #E4E1D8;
  --track: #F1EFE8;
  --chipbg: #F8F6F0;
  --coral: #FF6B5E;
  --coral-press: #E24A3E;
  --yellow: #F5B301;
  --yellow-ink: #8A6300;
  --green: #3FB984;
  --green-ink: #2E7D52;
  --sky: #3BA7E0;
  --sky-press: #2A87BA;
  --purple: #8B5CF6;
  --rainbow: linear-gradient(90deg, #FF6B5E, #F5B301, #3FB984, #3BA7E0, #8B5CF6);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(160deg, #FFF6E0 0%, #F0F8FF 55%, #F5F0FF 100%) fixed;
  font-family: 'Nunito', sans-serif;
  color: var(--ink);
}

h1, h2, h3 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
}

h1 { font-size: 30px; margin: 0.4em 0; }
h2 { font-size: 22px; margin: 1.2em 0 0.5em; }
h3 { font-size: 18px; margin: 0 0 0.5em; }

p { font-weight: 600; color: var(--ink-soft); }

.muted { color: var(--muted); font-weight: 600; }
.muted-sm { color: var(--muted); font-weight: 700; font-size: 12px; }

a { color: var(--sky); font-weight: 800; }

/* ---- shell: rainbow strip + top bar + centered content ---- */

.rainbow { height: 5px; background: var(--rainbow); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 26px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }

.logo-tile {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--sky);
  box-shadow: 0 3px 0 var(--sky-press);
  display: grid; place-items: center;
  color: #fff;
  font: 700 19px 'Fredoka', sans-serif;
}

.wordmark { font: 600 19px 'Fredoka', sans-serif; }
.wordmark span { color: var(--coral); }

.role-pill {
  margin-left: 6px;
  font-size: 12px; font-weight: 800;
  color: var(--muted);
  background: var(--track);
  padding: 4px 10px;
  border-radius: 100px;
}

.user { display: flex; align-items: center; gap: 12px; }
.user-meta { text-align: right; }
.user-meta .name { font-weight: 800; font-size: 14px; }

.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #FFE1DD;
  display: grid; place-items: center;
  font: 700 15px 'Fredoka', sans-serif;
  color: var(--coral-press);
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 26px 22px 60px;
}

.wrap-narrow { max-width: 480px; }

/* ---- cards, chips, badges, banners ---- */

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.04);
}

.chip {
  display: inline-block;
  background: var(--chipbg);
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
  margin: 3px 3px 3px 0;
}

.chip.done { background: #DFF5E9; color: var(--green-ink); }

/* clickable "who holds what" summary rows (teacher earned-award ledger).
   NB: a different .pick-row exists below for the student cert picker —
   keep this class name distinct so the two never collide. */
.holder-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s, border-color 0.06s;
}
.holder-row:hover { border-color: var(--sky); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.04); }
.holder-row:active { transform: translateY(1px); }
.holder-row strong { margin-right: 4px; }
.holder-row .chip { margin: 0; }
.holder-count { margin-left: auto; color: var(--muted); font-weight: 800; white-space: nowrap; }

.badge {
  background: #FFE9A6;
  color: var(--yellow-ink);
  border-radius: 100px;
  padding: 4px 12px;
  font: 700 13px 'Fredoka', sans-serif;
}

.badge.big { font-size: 17px; padding: 10px 20px; display: inline-block; margin: 4px; }

.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #FFF3E0;
  border: 2px solid #FBE3B8;
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 16px;
}

/* ---- buttons: pill + 3D press shadow (the prototype look) ---- */

button {
  font: 700 15px 'Fredoka', sans-serif;
  padding: 10px 20px;
  border: none;
  border-radius: 100px;
  background: var(--coral);
  color: #fff;
  box-shadow: 0 4px 0 var(--coral-press);
  cursor: pointer;
  margin: 6px 6px 2px 0;
  transition: transform 0.06s, box-shadow 0.06s;
}

button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--coral-press); }

button:disabled {
  background: var(--track);
  color: var(--faint);
  box-shadow: none;
  cursor: default;
}

button.ghost, button[style*="background: #888"], button[style*="background:#888"] {
  background: #fff !important;
  color: var(--ink-soft) !important;
  border: 2px solid var(--line-strong);
  box-shadow: none;
}

/* ---- forms ---- */

label { display: block; margin: 10px 0; font-weight: 800; font-size: 14px; }

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 11px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line-strong);
  border-radius: 10px;
}

input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); }

input[type="checkbox"], input[type="radio"] {
  display: inline;
  width: auto;
  margin: 0 8px 0 0;
}

/* In-app colour palette — replaces the native <input type=color>,
   whose picker popup's eyedropper could orphan itself and freeze the
   browser. Grid: grey column + 12 hues × 5 shades, no eyedropper
   (it hangs Edge here). .swatch beats the chunky base button style. */
.swatches {
  display: grid;
  grid-template-columns: repeat(13, 26px);
  gap: 4px;
  margin: 10px 0 4px;
  width: max-content;
  max-width: 100%;
}
button.swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, .12);
  box-shadow: none;
  cursor: pointer;
}
button.swatch:active { transform: none; box-shadow: none; }
button.swatch.sel {
  box-shadow: 0 0 0 3px var(--ink);
  transform: scale(1.1);
}

/* ---- ruleset builder ---- */

.rb-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
}
.rb-row input, .rb-row select {
  display: inline-block;
  width: auto;
  margin-top: 0;
}
.rb-row input[type="number"] { width: 72px; }
.rb-row input:not([type]) { flex: 1; }
.rb-row select { flex: 1; }
.rb-handle {
  cursor: grab;
  user-select: none;
  font-size: 18px;
  color: var(--line-strong);
}

/* ---- teacher: a student's full certificate record (Students tab) ---- */

/* Action buttons on their own line under the student name/info. */
.card-actions { margin-top: 10px; }

.cert-record {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--line-strong);
}
.cert-filter { margin-bottom: 10px; }

/* Student: "take these papers to the office" call-to-action on a
   pending application. Amber, so it reads as an action to take. */
.reception-note {
  background: #FFF3E0;
  border: 1px solid #FBE3B8;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 8px 0;
  font-weight: 700;
  color: var(--yellow-ink);
}
.reception-note strong { color: var(--yellow-ink); }
.cert-line {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.9;
}
.cert-line:last-child { border-bottom: none; }
.cert-line .tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--chipbg);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 2px 9px;
  margin-left: 4px;
  white-space: nowrap;
}

/* ---- certificate picker (swap / bonus hand-in) ---- */

.picker {
  background: var(--chipbg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 10px;
}

.pick-row {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  margin: 8px 0;
  cursor: pointer;
}

textarea { font-family: Consolas, monospace; font-size: 13px; }

/* ---- tabs (teacher) — prototype sidebar-button styling ---- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0;
}

.tabs button {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
  padding: 11px 16px;
  margin: 0;
}

.tabs button.active {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
  box-shadow: 0 3px 0 var(--coral-press);
}

/* ---- progress bars & tier medals ---- */

.bar {
  background: var(--track);
  border-radius: 100px;
  height: 12px;
  overflow: hidden;
  margin: 10px 0;
}

.bar-fill {
  background: linear-gradient(90deg, #3FB984, #7BE0A8);
  height: 100%;
  border-radius: 100px;
  transition: width 0.4s;
}

.medal {
  width: 54px; height: 54px;
  flex: none;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
  display: grid; place-items: center;
  font: 700 19px 'Fredoka', sans-serif;
  color: #fff;
  background: linear-gradient(145deg, #C9B8F4, #8B5CF6, #6C3FD8);
}

.tier-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.tier-head .title { font: 600 20px 'Fredoka', sans-serif; }
.tier-head .pct { font-size: 13px; font-weight: 800; color: var(--muted); }

.tier.locked { opacity: 0.55; }
.tier.earned { border: 2px solid #E0B33F; }

.ready { font-size: 14px; font-weight: 800; color: var(--green-ink); }

.card.used { opacity: 0.6; }

/* A spent certificate: gently faded card, but its attribution badge
   ("Used for Bronze" etc.) keeps full colour — fade the parts, not
   the whole card, so the badge still pops. */
.cert.used {
  background: #F7F5EF;
  border-color: #E6E2D6;
}

/* Origin tag, pinned top-right: 💻 digital (issued in-app) vs
   🧾 paper (recorded in). The card reserves room so long titles
   wrap under it instead of colliding. */
.card.cert { position: relative; padding-right: 104px; }
.cert-source {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--chipbg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.cert.used > .chip,
.cert.used > strong,
.cert.used > .muted { opacity: 0.55; }

/* ---- toast notifications: float, never push the layout ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #1C1B22;
  color: #fff;
  border-radius: 14px;
  border-left: 5px solid var(--green);
  padding: 13px 20px;
  font-weight: 700;
  font-size: 14.5px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  max-width: min(92vw, 560px);
  z-index: 100;
  animation: toast-in 0.25s ease;
}

.toast.error { border-left-color: var(--coral); }

/* Persistent load-failure banner — stays put until the next good load,
   unlike the toast. In-flow at the top of .content so it can't be missed. */
.load-error {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: #FDECEC;
  border: 1.5px solid var(--coral);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
  font-weight: 700;
  color: #8A1C1C;
}
.load-error button {
  margin-left: auto;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
}

/* ---- hover tooltips (the prototype's bp-tip) ---- */

.tip-wrap { position: relative; cursor: help; }

.tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 238px;
  background: #1C1B22;
  color: #fff;
  border-radius: 12px;
  padding: 11px 13px;
  font: 600 12.5px/1.45 'Nunito', sans-serif;
  text-align: left;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 60;
}

.tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #1C1B22;
}

.tip-head {
  display: block;
  font: 700 11px 'Fredoka', sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #F5B301;
  margin-bottom: 4px;
}

.tip-wrap:hover .tip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- current-goal / all-honours toggle ---- */

.view-toggle {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 4px;
  gap: 4px;
  margin: 0 0 14px;
}

.view-toggle button {
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  margin: 0;
  padding: 8px 16px;
  font-size: 14px;
}

.view-toggle button:active { transform: none; }

.view-toggle button.active {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 3px 0 var(--coral-press);
}

/* Wildcard on/off — a plain inline checkbox beside the view toggle. */
.wildcard-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0 10px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-soft);
  cursor: pointer;
}
.wildcard-toggle input { margin: 0; }

/* ---- the honour journey hero (prototype's dark panel) ---- */

.journey {
  background: linear-gradient(135deg, #3A2F5E 0%, #252336 65%);
  border-radius: 22px;
  padding: 26px 30px 32px;
  color: #fff;
  margin-bottom: 22px;
}

.journey-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.j-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #F5B301;
  margin-bottom: 4px;
}

.j-label.dim { color: #B0AFB8; }

.j-title { font: 600 24px 'Fredoka', sans-serif; }

.j-medals { display: flex; margin-bottom: 12px; }

.j-tier {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.j-tier.locked { opacity: 0.55; }

.j-medal {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  display: grid;
  place-items: center;
  font: 700 21px 'Fredoka', sans-serif;
  color: #fff;
}

.j-medal .j-state {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #2B2A33;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}

.j-name {
  font: 600 13.5px 'Fredoka', sans-serif;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.j-pct { font-size: 12px; font-weight: 800; color: #B0AFB8; }

.j-bar {
  display: flex;
  height: 18px;
  border-radius: 100px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
}

.j-seg { flex: 1; position: relative; border-right: 2px solid rgba(0, 0, 0, 0.35); }
.j-seg:last-child { border-right: none; }

.j-fill { position: absolute; inset: 0 auto 0 0; height: 100%; }

.filter-bar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-bar label { flex: 1; min-width: 160px; }

.earned-strip { margin: 0 0 14px; }
.earned-strip .medal {
  width: 40px; height: 40px;
  display: inline-grid;
  font-size: 14px;
  margin-right: 6px;
  vertical-align: middle;
}

/* ---- Google sign-in ---- */

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  color: #3c4043;
  border: 1.5px solid #DADCE0;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}
.google-btn:hover { background: #F7F8F8; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }
.google-btn:active { background: #EEF0F1; }
.google-btn svg { width: 18px; height: 18px; flex: none; }

/* "or" divider between Google and the email/password fallback */
.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #E6E6EC;
}

/* ---- landing hero (index) ---- */

.hero { text-align: center; padding: 30px 10px 6px; }

.hero h1 {
  font: 600 44px/1.05 'Fredoka', sans-serif;
  margin: 0 auto 12px;
  max-width: 18ch;
}

.hero .accent-sky { color: var(--sky); }
.hero .accent-coral { color: var(--coral); }

.hero p {
  margin: 0 auto 22px;
  max-width: 46ch;
  font-size: 17px;
  color: var(--ink-soft);
}

.hero-pill {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 100px;
  background: #FFE9A6;
  color: var(--yellow-ink);
  font: 700 13px 'Fredoka', sans-serif;
  margin-bottom: 16px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 6px 0 34px;
  flex-wrap: wrap;
}

.btn-hero {
  display: inline-block;
  padding: 15px 30px;
  border-radius: 100px;
  font: 700 18px 'Fredoka', sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.btn-hero.coral {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 5px 0 var(--coral-press);
}

.btn-hero.outline {
  background: #fff;
  border: 2.5px solid var(--ink);
  color: var(--ink);
}

.medal-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  margin-top: 8px;
}

.medal-row .medal { width: 84px; height: 84px; font-size: 30px; }
.medal-row .tilt-l { transform: rotate(-8deg); }
.medal-row .tilt-r { transform: rotate(8deg); }
.medal-row .big-medal { width: 110px; height: 110px; font-size: 42px; }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.step-num {
  width: 48px; height: 48px;
  border-radius: 14px;
  color: #fff;
  display: grid; place-items: center;
  font: 700 22px 'Fredoka', sans-serif;
  margin-bottom: 14px;
}

.step-title { font: 600 20px 'Fredoka', sans-serif; margin-bottom: 4px; }

/* ---- app layout: sidebar + content (the prototype shell) ---- */

.layout {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 72px);
}

.sidebar {
  width: 230px;
  flex: none;
  padding: 22px 14px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.sidebar button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  margin: 0 0 6px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font: 700 15px 'Fredoka', sans-serif;
  box-shadow: none;
}

.sidebar button:active { transform: none; }

.sidebar button.active { background: var(--coral); color: #fff; }

.sidebar button .ico { width: 22px; text-align: center; }

.content {
  flex: 1;
  min-width: 0;
  padding: 26px 30px 60px;
  max-width: 980px;
}

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 10px;
  }
  .sidebar button { width: auto; }
}
