/* Gamification styles — leaderboards, awards, streaks, trophy case.
   Reuses the app's brand tokens (core.css :root) so it inherits admin branding.
   Additive only; no Bootstrap. Mobile-responsive. */

/* ── Rep dashboard "Awards & Standings" strip ─────────────────────────── */
.gam-strip { margin: 0 0 18px; }
.gam-standings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.gam-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  border-left: 4px solid var(--brand-accent, #1a6fc4);
}
.gam-card-lbl {
  font-size: .66rem; color: #888; text-transform: uppercase;
  letter-spacing: .05em; font-weight: 600; margin-bottom: 4px;
}
.gam-card-leader { font-size: .95rem; font-weight: 700; color: var(--brand-primary, #1a1a2e); line-height: 1.25; }
.gam-card-leader .gam-trophy { font-size: 1.05rem; }
.gam-card-me { font-size: .74rem; color: #555; margin-top: 4px; }
.gam-card-me strong { color: var(--brand-accent, #1a6fc4); }

/* Highlight the card when the current rep is the leader */
.gam-card.is-leader {
  border-left-color: #f0b400;
  background: linear-gradient(180deg, #fffdf5 0%, #fff 60%);
}

/* ── Recent wins list (rep) + Hall of Fame (admin) ────────────────────── */
.gam-wins { margin-top: 12px; }
.gam-win-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  border: 1px solid #f0f0f0;
  margin-bottom: 6px; background: #fff;
}
.gam-win-ico { font-size: 1.15rem; width: 1.5rem; text-align: center; flex: none; }
.gam-win-txt { flex: 1; font-size: .84rem; color: var(--brand-primary, #1a1a2e); }
.gam-win-txt .gam-win-rep { font-weight: 700; }
.gam-win-date { font-size: .7rem; color: #999; flex: none; }

/* ── Medals ───────────────────────────────────────────────────────────── */
.gam-medal-1 { color: #d4af37; }
.gam-medal-2 { color: #9aa4ad; }
.gam-medal-3 { color: #b06a33; }

/* ── Streak flame (Phase 2) ───────────────────────────────────────────── */
.gam-flame {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 700; color: #e8590c;
}
.gam-flame .gam-flame-ico { animation: flamePulse 1.6s ease-in-out infinite; display: inline-block; }
@keyframes flamePulse {
  0%, 100% { transform: scale(1); filter: none; }
  50% { transform: scale(1.18); filter: drop-shadow(0 0 4px rgba(232,89,12,.55)); }
}

/* ── Trophy shine (award highlight) ───────────────────────────────────── */
@keyframes trophyShine {
  0% { transform: rotate(0deg); }
  15% { transform: rotate(-10deg); }
  30% { transform: rotate(8deg); }
  45% { transform: rotate(-4deg); }
  60%, 100% { transform: rotate(0deg); }
}
.gam-trophy-anim { display: inline-block; animation: trophyShine 2.4s ease-in-out infinite; }

/* ── Badge trophy tile (Phase 4) ──────────────────────────────────────── */
.gam-badge-tile {
  display: inline-flex; flex-direction: column; align-items: center;
  width: 84px; padding: 10px 6px; border-radius: 10px; text-align: center;
  background: #fff; border: 1px solid #eee; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.gam-badge-tile.locked { opacity: .38; filter: grayscale(1); }
.gam-badge-tile .gam-badge-ico { font-size: 1.7rem; line-height: 1; }
.gam-badge-tile .gam-badge-name { font-size: .64rem; font-weight: 600; margin-top: 5px; color: #444; }
.gam-badge-tile.tier-gold { border-color: #d4af37; }
.gam-badge-tile.tier-silver { border-color: #b8c0c8; }

/* ── Admin settings + hall-of-fame page bits ──────────────────────────── */
.gam-set-group { margin-bottom: 22px; }
.gam-set-group h3 {
  font-size: .95rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--brand-primary, #1a1a2e); margin: 0 0 10px; border-bottom: 2px solid #f0f0f0; padding-bottom: 6px;
}
.gam-set-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 10px 0; border-bottom: 1px solid #f6f6f6;
}
.gam-set-row .gam-set-main { flex: 1; }
.gam-set-row .gam-set-label { font-weight: 600; font-size: .9rem; color: var(--brand-primary, #1a1a2e); }
.gam-set-row .gam-set-desc { font-size: .76rem; color: #777; margin-top: 2px; }
.gam-set-row .gam-set-control { flex: none; }
.gam-set-row input[type="text"], .gam-set-row input[type="number"] {
  width: 130px; padding: 6px 8px; border: 1px solid #ccc; border-radius: 5px; font-size: .85rem;
}
.gam-set-row input.gam-emoji { width: 64px; text-align: center; font-size: 1.1rem; }

/* Simple toggle switch reusing brand accent */
.gam-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.gam-switch input { opacity: 0; width: 0; height: 0; }
.gam-switch .gam-slider {
  position: absolute; cursor: pointer; inset: 0; background: #ccc;
  transition: .25s; border-radius: 24px;
}
.gam-switch .gam-slider:before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: #fff; transition: .25s; border-radius: 50%;
}
.gam-switch input:checked + .gam-slider { background: var(--brand-success, #28a745); }
.gam-switch input:checked + .gam-slider:before { transform: translateX(20px); }

.gam-badge-edit {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #f6f6f6;
}
.gam-badge-edit .gam-badge-ico-lg { font-size: 1.5rem; width: 2rem; text-align: center; }

/* ── Top Rep History widgets (day/week/month) ─────────────────────────── */
.gam-hist-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.gam-hist { padding: 12px 14px; }
.gam-hist-hdr {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px; font-weight: 700; font-size: .88rem; color: var(--brand-primary, #1a1a2e);
}
.gam-hist-hdr select {
  font-size: .76rem; padding: 3px 6px; border: 1px solid #ccc; border-radius: 5px; background: #fff;
}
.gam-hist-list { display: flex; flex-direction: column; gap: 3px; max-height: 340px; overflow-y: auto; }
.gam-hist-row {
  display: flex; align-items: baseline; gap: 8px; padding: 6px 8px; border-radius: 6px;
  border: 1px solid #f2f2f2; background: #fff;
}
.gam-hist-when { font-size: .72rem; color: #888; width: 5.6rem; flex: none; }
.gam-hist-who { flex: 1; font-weight: 600; font-size: .82rem; color: var(--brand-primary, #1a1a2e); }
.gam-hist-metric { font-size: .72rem; color: var(--brand-accent, #1a6fc4); font-weight: 700; flex: none; }
.gam-hist-empty { font-size: .8rem; color: #999; padding: 10px 4px; }

/* ── Sales streak heatmap (contribution calendar) ─────────────────────── */
.gam-heat { display: flex; gap: 3px; overflow-x: auto; padding: 4px 0; }
.gam-heat-col { display: flex; flex-direction: column; gap: 3px; }
.gam-heat-cell { width: 13px; height: 13px; border-radius: 3px; background: #ebedf0; }
.gam-heat-cell.l1 { background: #9be9a8; }
.gam-heat-cell.l2 { background: #40c463; }
.gam-heat-cell.l3 { background: #30a14e; }
.gam-heat-cell.l4 { background: #216e39; }
.gam-heat-legend { display: flex; align-items: center; gap: 4px; font-size: .68rem; color: #888; margin-top: 6px; }

/* ── Pace & records tiles ─────────────────────────────────────────────── */
.gam-pace-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gam-pace-tile {
  background: #fff; border-radius: 8px; padding: 10px 12px; text-align: center;
  border: 1px solid #eee; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.gam-pace-val { font-size: 1.5rem; font-weight: 800; color: var(--brand-primary, #1a1a2e); }
.gam-pace-lbl { font-size: .64rem; color: #888; text-transform: uppercase; letter-spacing: .04em; }
.gam-pace-tile.record { border-color: #f0b400; background: linear-gradient(180deg, #fffdf5, #fff); }
.gam-record-flag {
  display: inline-block; font-size: .6rem; font-weight: 800; color: #b8860b;
  background: #fff3bf; border-radius: 10px; padding: 1px 7px; margin-top: 3px;
}

/* ── Mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .gam-standings { grid-template-columns: 1fr; }
  .gam-set-row { flex-direction: column; gap: 8px; }
  .gam-set-row .gam-set-control { align-self: flex-start; }
  .gam-hist-grid { grid-template-columns: 1fr; }
  .gam-pace-grid { grid-template-columns: repeat(3, 1fr); }
}
