/* ===== Activity Page: Streaks & Milestones ===== */

.activity-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* --- Reusable icon circle --- */
.icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px -2px var(--icon-glow, rgba(0,0,0,.25)), inset 0 1px 1px rgba(255,255,255,.35);
  animation: iconPopIn .45s cubic-bezier(.34,1.56,.64,1) backwards;
}
.icon-circle::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255,255,255,.4), rgba(255,255,255,0) 55%);
  pointer-events: none;
}
.icon-circle svg {
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.18));
}
.icon-circle.lg { width: 48px; height: 48px; }
.icon-circle.lg svg { width: 24px; height: 24px; }
.icon-circle.sm { width: 30px; height: 30px; }
.icon-circle.sm svg { width: 16px; height: 16px; }

@keyframes iconPopIn {
  0% { transform: scale(.4); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

.icon-circle.tone-rank-0 { background: linear-gradient(135deg, #a1aebd, #64748b); --icon-glow: rgba(100,116,139,.45); }
.icon-circle.tone-rank-1 { background: linear-gradient(135deg, #f59e0b, #b45309); --icon-glow: rgba(217,119,6,.5); }
.icon-circle.tone-rank-2 { background: linear-gradient(135deg, #f1f5f9, #94a3b8); color: #1e293b; --icon-glow: rgba(148,163,184,.5); }
.icon-circle.tone-rank-3 { background: linear-gradient(135deg, #fde047, #f59e0b); --icon-glow: rgba(245,158,11,.55); }
.icon-circle.tone-rank-4 { background: linear-gradient(135deg, #7dd3fc, #818cf8); --icon-glow: rgba(99,102,241,.5); }

.icon-circle.tone-flame { background: linear-gradient(135deg, #fbbf24, #f97316 60%, #ea580c); --icon-glow: rgba(249,115,22,.55); }
.icon-circle.tone-flame.is-active svg { fill: rgba(255,255,255,.3); }
.icon-circle.tone-flame svg {
  transform-origin: 50% 85%;
  animation: flameFlicker 2.4s ease-in-out infinite;
}
@keyframes flameFlicker {
  0%, 100% { transform: scale(1, 1) rotate(0deg); }
  20% { transform: scale(0.93, 1.07) rotate(-3deg); }
  45% { transform: scale(1.07, 0.94) rotate(2deg); }
  70% { transform: scale(0.96, 1.04) rotate(-2deg); }
  85% { transform: scale(1.04, 0.97) rotate(1.5deg); }
}
.icon-circle.tone-flame.is-dim { background: linear-gradient(135deg, #fdba74, #fb923c); color: #fff; box-shadow: 0 4px 10px -2px rgba(249,115,22,.4), inset 0 1px 1px rgba(255,255,255,.3); }
.icon-circle.tone-flame.is-active { animation: iconPopIn .45s cubic-bezier(.34,1.56,.64,1) backwards, flamePulse 1.6s ease-in-out .45s infinite; }
@keyframes flamePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

.icon-circle.tone-target { background: linear-gradient(135deg, #67e8f9, #0ea5e9); --icon-glow: rgba(14,165,233,.5); }
.icon-circle.tone-users { background: linear-gradient(135deg, #a5b4fc, #6366f1); --icon-glow: rgba(99,102,241,.5); }
.icon-circle.tone-bag { background: linear-gradient(135deg, #fdba74, #f97316); --icon-glow: rgba(249,115,22,.5); }
.icon-circle.tone-cash { background: linear-gradient(135deg, #86efac, #22c55e); --icon-glow: rgba(34,197,94,.5); }
.icon-circle.tone-trophy { background: linear-gradient(135deg, #fde047, #f59e0b); --icon-glow: rgba(245,158,11,.55); }

/* --- Rank Card --- */
.rank-card {
  background: linear-gradient(135deg, #1e293b 0%, #334155 55%, #1e293b 100%);
  color: #fff;
  border: 1px solid rgba(255,255,255,.1);
  padding: 20px;
}
.rank-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.rank-card-text { display: flex; flex-direction: column; gap: 2px; }
.rank-name { font-size: 19px; font-weight: 700; }
.rank-sub { font-size: 13px; color: rgba(255,255,255,.65); }
.rank-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
  margin-bottom: 8px;
}
.rank-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  box-shadow: 0 0 8px rgba(129,140,248,.7);
  transition: width .6s ease;
}
.rank-progress-label {
  font-size: 12.5px;
  color: rgba(255,255,255,.7);
}

/* --- Streak Card --- */
.streak-card { padding: 18px; }
.streak-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.streak-text { display: flex; flex-direction: column; gap: 2px; }
.streak-days { font-size: 17px; font-weight: 700; }
.streak-sub { font-size: 12.5px; color: var(--text-muted, #888); }
.streak-pills {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.streak-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px;
  border-radius: 10px;
  background: var(--surface-alt, #f1f5f9);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #888);
}
.streak-pill.is-claimed {
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #fff;
  box-shadow: 0 2px 8px -2px rgba(249,115,22,.5);
}
.streak-pill.is-current {
  background: linear-gradient(135deg, #67e8f9, #0ea5e9);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(14,165,233,.25), 0 2px 10px -2px rgba(14,165,233,.5);
}

/* --- Milestones --- */
.milestone-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.milestone-card { padding: 14px; }
.milestone-label {
  font-size: 12.5px;
  color: var(--text-muted, #888);
  margin-bottom: 4px;
}
.milestone-value {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}
.milestone-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-alt, #f1f5f9);
  overflow: hidden;
}
.milestone-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  box-shadow: 0 0 8px rgba(34,197,94,.6);
  transition: width .6s ease;
}
.next-milestone-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(56,189,248,.08), rgba(129,140,248,.08));
  border: 1px dashed rgba(56,189,248,.35);
  font-size: 13.5px;
  font-weight: 600;
}

/* --- Badges --- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 14px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e5e7eb);
}
.badge-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt, #f1f5f9);
  color: var(--text-muted, #aaa);
  position: relative;
  overflow: hidden;
}
.badge-item-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255,255,255,.4), rgba(255,255,255,0) 55%);
  pointer-events: none;
}
.badge-item-icon svg { width: 22px; height: 22px; position: relative; z-index: 1; }
.badge-item.is-unlocked .badge-item-icon {
  background: linear-gradient(135deg, #fde047, #f59e0b);
  color: #fff;
  box-shadow: 0 4px 10px -2px rgba(245,158,11,.55), inset 0 1px 1px rgba(255,255,255,.4);
}
.badge-item.is-unlocked .badge-item-icon svg { filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.badge-item-title {
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
}
.badge-item.is-unlocked .badge-item-title { color: var(--text, #111); }
.badge-item:not(.is-unlocked) .badge-item-title { color: var(--text-muted, #999); }
.badge-item-desc {
  font-size: 10px;
  color: var(--text-muted, #999);
  line-height: 1.2;
}

/* --- Monthly Recap --- */
.recap-card { padding: 4px 16px; }
.recap-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border, #eee);
}
.recap-row:last-child { border-bottom: none; }
.recap-label { flex: 1; font-size: 13.5px; color: var(--text-muted, #888); }
.recap-value { font-size: 14.5px; font-weight: 700; }

/* --- Leaderboard Teaser --- */
.leaderboard-teaser-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(135deg, rgba(251,191,36,.1), rgba(249,115,22,.08));
  border: 1px solid rgba(251,191,36,.3);
  transition: transform .15s ease;
}
.leaderboard-teaser-card:active { transform: scale(0.98); }
.lb-teaser-text { flex: 1; font-size: 13.5px; font-weight: 600; }
.lb-teaser-arrow { font-size: 16px; color: var(--text-muted, #999); }

/* --- Lifetime Stats --- */
.lifetime-stats-card { padding: 4px 16px; }
.lifetime-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border, #eee);
  font-size: 13.5px;
}
.lifetime-stat-row:last-child { border-bottom: none; }
.lifetime-stat-row span:first-child { color: var(--text-muted, #888); }
.lifetime-stat-row span:last-child { font-weight: 700; }

/* --- Extra color & life pass --- */
.icon-circle.tone-rank-0 { background: linear-gradient(135deg, #4ade80, #16a34a); --icon-glow: rgba(34,197,94,.5); }

.activity-main {
  background:
    radial-gradient(circle at 8% 0%, rgba(56,189,248,.08), transparent 40%),
    radial-gradient(circle at 92% 15%, rgba(168,85,247,.08), transparent 40%);
  border-radius: 18px;
}

.activity-main .ui-card {
  box-shadow: 0 2px 14px rgba(15,23,42,.07);
}

.streak-card {
  background: linear-gradient(145deg, rgba(251,146,60,.12), rgba(255,255,255,0) 55%), var(--card-bg, #fff);
  border: 1px solid rgba(251,146,60,.25);
}

.milestone-card.tone-tasks {
  background: linear-gradient(145deg, rgba(99,102,241,.12), rgba(255,255,255,0) 55%), var(--card-bg, #fff);
  border: 1px solid rgba(99,102,241,.25);
}
.milestone-card.tone-tasks .milestone-fill {
  background: linear-gradient(90deg, #818cf8, #6366f1);
  box-shadow: 0 0 8px rgba(99,102,241,.6);
}
.milestone-card.tone-tasks .milestone-track {
  background: rgba(99,102,241,.16);
  border: 1px solid rgba(99,102,241,.2);
}

.milestone-card.tone-referrals {
  background: linear-gradient(145deg, rgba(34,197,94,.12), rgba(255,255,255,0) 55%), var(--card-bg, #fff);
  border: 1px solid rgba(34,197,94,.25);
}
.milestone-card.tone-referrals .milestone-track {
  background: rgba(34,197,94,.16);
  border: 1px solid rgba(34,197,94,.2);
}

.rank-progress-track { border: 1px solid rgba(255,255,255,.1); }

.badge-item:not(.is-unlocked) {
  background: linear-gradient(145deg, rgba(99,102,241,.06), rgba(255,255,255,0) 60%), var(--card-bg, #fff);
  border: 1px dashed rgba(99,102,241,.35);
}
.badge-item:not(.is-unlocked) .badge-item-icon {
  background: rgba(99,102,241,.14);
  color: rgba(99,102,241,.65);
}

.activity-main .section-label {
  display: flex;
  align-items: center;
  gap: 7px;
}
.activity-main .section-label::before {
  content: "";
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, #38bdf8, #818cf8);
  display: inline-block;
  flex-shrink: 0;
}

.recap-card, .lifetime-stats-card {
  background: linear-gradient(145deg, rgba(56,189,248,.07), rgba(255,255,255,0) 55%), var(--card-bg, #fff);
}

@media (max-width: 420px) {
  .badge-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .badge-item { padding: 10px 6px; }
}
