/* ═══════════════════════════════════════════════════════════
   FCC Achievement Badges Premium — achievements-premium.css
   Scoped to #achievements / .ach-* classes (modal uses .ach-modal-overlay,
   appended to <body>). Loads after the core stylesheets so it wins ties.
   ═══════════════════════════════════════════════════════════ */

#achievements,
.ach-modal-overlay {
  --ach-purple: #8b5cf6;
  --ach-purple-deep: #6d28d9;
  --ach-ink: #1f2340;
  --ach-muted: #6b6688;
  --ach-line: rgba(139, 92, 246, 0.16);
  --ach-green: #16a34a;
  --ach-card-shadow: 0 18px 45px rgba(76, 54, 130, 0.12);
}

#achievements .ach-shell {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 40px;
}

/* ── Hero banner ─────────────────────────────────────────── */
#achievements .ach-hero {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(115deg, #ece3ff 0%, #e9dcff 38%, #f3ddf6 70%, #e4d2fb 100%);
  border: 1px solid var(--ach-line);
  border-radius: 28px;
  padding: 30px 34px 28px;
  box-shadow: var(--ach-card-shadow);
  overflow: hidden;
}

#achievements .ach-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 88% 8%, rgba(255, 255, 255, 0.6) 0%, transparent 42%),
    radial-gradient(circle at 70% 90%, rgba(244, 188, 255, 0.35) 0%, transparent 45%),
    radial-gradient(circle at 5% 100%, rgba(255, 255, 255, 0.4) 0%, transparent 38%);
  pointer-events: none;
}

#achievements .ach-hero-main {
  position: relative;
  z-index: 1;
  min-width: 0;
  flex: 1 1 auto;
}

#achievements .ach-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.16);
  color: var(--ach-purple-deep);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  margin-bottom: 12px;
}

#achievements .ach-hero-title {
  margin: 0 0 8px;
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 800;
  color: var(--ach-ink);
  letter-spacing: -0.02em;
}

#achievements .ach-hero-subtitle {
  margin: 0 0 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ach-muted);
}

#achievements .ach-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
}

#achievements .ach-stat-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 138px;
  padding: 10px 16px 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(109, 40, 217, 0.08);
  backdrop-filter: blur(6px);
}

#achievements .ach-stat-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 13px;
}

#achievements .ach-stat-icon--purple { background: linear-gradient(135deg, #ede4ff, #ddd0ff); }
#achievements .ach-stat-icon--green { background: linear-gradient(135deg, #e2f8ea, #cdf0db); }
#achievements .ach-stat-icon--orange { background: linear-gradient(135deg, #ffeede, #ffe0c2); }
#achievements .ach-stat-icon--pink { background: linear-gradient(135deg, #ffe4ef, #ffd2e4); }

#achievements .ach-stat-body {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

#achievements .ach-stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ach-muted);
}

#achievements .ach-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--ach-ink);
}

#achievements .ach-stat-sub {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ach-muted);
}

/* Hero trophy artwork */
#achievements .ach-hero-art {
  position: relative;
  z-index: 1;
  flex: 0 1 clamp(170px, 21vw, 280px);
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#achievements .ach-hero-glow {
  position: absolute;
  width: 78%;
  height: 78%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0%, rgba(250, 215, 255, 0.45) 45%, transparent 70%);
  filter: blur(4px);
}

#achievements .ach-hero-trophy {
  position: relative;
  font-size: clamp(96px, 11vw, 138px);
  line-height: 1;
  filter: drop-shadow(0 18px 26px rgba(180, 120, 30, 0.35));
}

#achievements .ach-hero-rosette {
  position: absolute;
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1;
  filter: drop-shadow(0 8px 14px rgba(76, 54, 130, 0.3));
}

#achievements .ach-hero-rosette--blue { left: 6%; bottom: 8%; transform: rotate(-12deg); }
#achievements .ach-hero-rosette--purple { right: 4%; bottom: 4%; transform: rotate(10deg); }

#achievements .ach-hero-spark {
  position: absolute;
  color: #f6b73c;
  text-shadow: 0 0 14px rgba(255, 214, 90, 0.9);
}

#achievements .ach-hero-spark--1 { top: 12%; left: 2%; font-size: 22px; }
#achievements .ach-hero-spark--2 { top: 4%; right: 14%; font-size: 14px; color: #fb923c; }
#achievements .ach-hero-spark--3 { bottom: 30%; right: -2%; font-size: 18px; }

/* ── Badge Journey header ────────────────────────────────── */
#achievements .ach-journey-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 6px 0;
}

#achievements .ach-journey-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

#achievements .ach-journey-spark {
  font-size: 22px;
  margin-top: 2px;
  filter: drop-shadow(0 4px 8px rgba(139, 92, 246, 0.35));
}

#achievements .ach-journey-title {
  margin: 0 0 3px;
  font-size: 24px;
  font-weight: 800;
  color: var(--ach-ink);
  letter-spacing: -0.01em;
}

#achievements .ach-journey-sub {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ach-muted);
}

#achievements .ach-filter-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 10px 38px 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--ach-line);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236d28d9' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 16px center;
  color: var(--ach-ink);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(109, 40, 217, 0.08);
  cursor: pointer;
}

#achievements .ach-filter-select:focus-visible {
  outline: 2px solid var(--ach-purple);
  outline-offset: 2px;
}

/* ── Kid cards ───────────────────────────────────────────── */
#achievements .ach-kid-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 26px;
  padding: 24px 26px 26px;
  box-shadow: var(--ach-card-shadow);
  backdrop-filter: blur(8px);
}

#achievements .ach-kid-head {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

#achievements .ach-kid-id {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1 1 auto;
  min-width: 0;
}

#achievements .ach-avatar {
  position: relative;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #fbd3e9, #d8c5ff);
  box-shadow: 0 8px 20px rgba(109, 40, 217, 0.18), 0 0 0 3px rgba(255, 255, 255, 0.9);
}

#achievements .ach-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#achievements .ach-avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--ach-purple-deep);
}

#achievements .ach-avatar-fallback--emoji { font-size: 32px; }

#achievements .ach-kid-name {
  margin: 0 0 5px;
  font-size: 23px;
  font-weight: 800;
  color: var(--ach-ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#achievements .ach-kid-mark { font-size: 17px; }

#achievements .ach-kid-sub {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ach-muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

#achievements .ach-kid-streak-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 7px;
  background: #ede4ff;
  color: var(--ach-purple-deep);
  font-size: 13px;
  font-weight: 800;
}

#achievements .ach-kid-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

#achievements .ach-kid-progress-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ach-ink);
}

#achievements .ach-kid-bar {
  width: 210px;
  max-width: 40vw;
  height: 9px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.16);
  overflow: hidden;
}

#achievements .ach-kid-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #a855f7 0%, #8b5cf6 55%, #6d28d9 100%);
  transition: width 0.4s ease;
}

#achievements .ach-journey-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid var(--ach-line);
  background: #fff;
  color: var(--ach-purple-deep);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(109, 40, 217, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#achievements .ach-journey-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(109, 40, 217, 0.18);
}

/* ── Badge grid ──────────────────────────────────────────── */
#achievements .ach-badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

#achievements .ach-badge-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px 16px;
  border-radius: 20px;
  border: 1px solid rgba(139, 92, 246, 0.12);
  background: #fff;
  text-align: center;
  min-height: 168px;
  box-shadow: 0 8px 20px rgba(76, 54, 130, 0.07);
}

#achievements .ach-badge-card.is-unlocked { border-color: rgba(139, 92, 246, 0.2); }
#achievements .ach-badge-card.ach-tone-gold { background: linear-gradient(180deg, #fffaef 0%, #fff3d6 100%); }
#achievements .ach-badge-card.ach-tone-green { background: linear-gradient(180deg, #f4fcf5 0%, #e3f7e8 100%); }
#achievements .ach-badge-card.ach-tone-red { background: linear-gradient(180deg, #fff6f4 0%, #ffe8e2 100%); }
#achievements .ach-badge-card.ach-tone-purple { background: linear-gradient(180deg, #faf6ff 0%, #efe4ff 100%); }
#achievements .ach-badge-card.ach-tone-blue { background: linear-gradient(180deg, #f4f9ff 0%, #e2efff 100%); }

#achievements .ach-badge-card.is-locked {
  background: linear-gradient(180deg, #fbfaff 0%, #f3f1fa 100%);
}

#achievements .ach-badge-corner {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
}

#achievements .ach-badge-card.is-unlocked .ach-badge-corner {
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  color: #92400e;
  box-shadow: 0 4px 10px rgba(251, 191, 36, 0.45);
}

#achievements .ach-badge-card.is-locked .ach-badge-corner {
  background: rgba(120, 113, 145, 0.14);
  font-size: 11px;
  filter: grayscale(1);
  opacity: 0.85;
}

#achievements .ach-badge-art {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 18px rgba(76, 54, 130, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

#achievements .ach-badge-emoji {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(76, 54, 130, 0.2));
}

#achievements .ach-badge-card.is-locked .ach-badge-art {
  background: linear-gradient(180deg, #ece9f5, #e2dded);
  box-shadow: inset 0 2px 6px rgba(76, 54, 130, 0.12);
}

#achievements .ach-badge-card.is-locked .ach-badge-emoji {
  filter: grayscale(1) opacity(0.75);
  font-size: 30px;
}

#achievements .ach-badge-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ach-ink);
  line-height: 1.3;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
}

#achievements .ach-badge-card.is-locked .ach-badge-name { color: #5a5572; }

#achievements .ach-badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
}

#achievements .ach-badge-status--unlocked {
  background: #dcf5e4;
  color: #15803d;
}

#achievements .ach-badge-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-size: 10px;
}

#achievements .ach-badge-status--notyet {
  background: rgba(120, 113, 145, 0.12);
  color: var(--ach-muted);
}

#achievements .ach-badge-progress {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#achievements .ach-badge-bar {
  width: 82%;
  height: 7px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.16);
  overflow: hidden;
}

#achievements .ach-badge-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #a855f7, #6d28d9);
}

#achievements .ach-badge-bar-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ach-muted);
}

/* ── Journey modal ───────────────────────────────────────── */
.ach-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(31, 35, 64, 0.45);
  backdrop-filter: blur(3px);
}

.ach-modal {
  width: min(440px, 100%);
  max-height: 84vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 24px;
  padding: 22px 24px 24px;
  box-shadow: 0 28px 70px rgba(31, 35, 64, 0.35);
}

.ach-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.ach-modal-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  color: var(--ach-ink);
}

.ach-modal-close {
  border: none;
  background: rgba(139, 92, 246, 0.1);
  color: var(--ach-purple-deep);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}

.ach-journey-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ach-journey-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--ach-line);
  background: #fbfaff;
}

.ach-journey-item.is-unlocked { background: #f6fdf7; border-color: rgba(34, 197, 94, 0.25); }

.ach-journey-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 21px;
  background: #ede4ff;
}

.ach-journey-item.is-locked .ach-journey-icon { background: #eceaf3; filter: grayscale(1); opacity: 0.8; }

.ach-journey-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ach-journey-name { font-size: 14.5px; font-weight: 700; color: var(--ach-ink); }
.ach-journey-date { font-size: 12.5px; font-weight: 600; color: var(--ach-muted); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 920px) {
  #achievements .ach-hero {
    flex-direction: column-reverse;
    align-items: stretch;
    padding: 24px 22px;
  }

  #achievements .ach-hero-art { min-height: 150px; flex-basis: auto; }
  #achievements .ach-hero-trophy { font-size: 92px; }

  #achievements .ach-kid-progress { align-items: flex-start; }
  #achievements .ach-kid-bar { max-width: none; width: min(260px, 100%); }
}

@media (max-width: 640px) {
  #achievements .ach-shell { gap: 16px; }
  #achievements .ach-hero { border-radius: 22px; }
  #achievements .ach-hero-stats { display: grid; grid-template-columns: 1fr 1fr; }
  #achievements .ach-stat-chip { min-width: 0; padding: 10px 12px; }
  #achievements .ach-stat-value { font-size: 19px; }

  #achievements .ach-journey-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  #achievements .ach-kid-card { padding: 18px 16px 20px; border-radius: 22px; }
  #achievements .ach-kid-head { gap: 14px; }
  #achievements .ach-journey-btn { width: 100%; justify-content: center; }
  #achievements .ach-badge-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
}
