/* ═══════════════════════════════════════════════════════════════════
   STATS
   ═══════════════════════════════════════════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.375rem 1.375rem 1.125rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.stats-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent-light), transparent);
  opacity: 0.6;
  transition: opacity 0.2s;
}
.stats-card:hover {
  border-color: var(--border-warm);
  box-shadow: var(--shadow-warm);
  transform: translateY(-2px);
}
.stats-card:hover::after { opacity: 1; }

.stats-bg-icon {
  position: absolute;
  bottom: 0.5rem;
  right: 0.75rem;
  font-size: 3rem;
  opacity: 0.07;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}
.stats-bg-icon--text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.25rem;
  color: var(--accent);
}

.stats-number {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
  margin-bottom: 0.375rem;
  text-shadow: 0 0 30px rgba(232,145,10,0.3);
}
.stats-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Meta row (unique beers / breweries) */
.stats-meta-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.stats-meta-sep {
  opacity: 0.4;
}

.stats-section {
  margin-bottom: 2.25rem;
}
.stats-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.125rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--border);
}
.stats-section-header h3 {
  font-size: 1rem;
  font-family: var(--font-display);
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}
.stats-section-header .section-icon {
  font-size: 1rem;
  opacity: 0.65;
}
.stats-section h3 {
  margin-bottom: 1rem;
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-display);
}

/* Top beers */
.stats-top-list { display: flex; flex-direction: column; gap: 0.5rem; }

.stats-top-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.stats-top-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--border-warm);
  transition: background 0.2s;
}
.stats-top-item:hover { border-color: var(--border-warm); box-shadow: var(--shadow-warm); }
.stats-top-item:hover::before { background: var(--accent); }

.stats-top-item[data-rank="1"]::before { background: #fbbf24; }
.stats-top-item[data-rank="2"]::before { background: #94a3b8; }
.stats-top-item[data-rank="3"]::before { background: #c97b3a; }

.stats-rank {
  font-size: 1.3rem;
  width: 1.75rem;
  flex-shrink: 0;
  text-align: center;
  line-height: 1;
}
.stats-top-info { flex: 1; min-width: 0; }
.stats-beer-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats-brewery   { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.stats-count {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.875rem;
  background: var(--accent-glow2);
  border: 1px solid rgba(232,145,10,0.15);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* Pro divider */
.pro-stats-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0 2rem;
}
.pro-stats-divider::before,
.pro-stats-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.pro-stats-divider::after {
  background: linear-gradient(270deg, var(--border), transparent);
}
.pro-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #0c0a07;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 1rem;
  border-radius: var(--radius-pill);
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(232,145,10,0.25);
}

/* Heatmap */
.heatmap-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem 1rem;
  overflow-x: auto;
}
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(53, 1fr);
  grid-template-rows: repeat(7, 1fr);
  grid-auto-flow: column;
  gap: 3px;
  padding: 0.125rem 0 0.375rem;
  min-width: 0;
}

.hm-cell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  transition: transform 0.1s, box-shadow 0.1s;
}
.hm-cell:hover { transform: scale(1.5); }

.hm-empty { background: transparent; }
.hm-0     { background: var(--bg-elevated); border: 1px solid var(--border); }
.hm-1     { background: rgba(232,145,10,0.22); }
.hm-2     { background: rgba(232,145,10,0.44); }
.hm-3     { background: rgba(232,145,10,0.68); }
.hm-4     { background: var(--accent); box-shadow: 0 0 6px rgba(232,145,10,0.55); }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.625rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.heatmap-legend .hm-cell { flex-shrink: 0; }

/* Trend chart */
.trend-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem 0.5rem;
}
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 160px;
  padding-bottom: 2rem;
  position: relative;
  overflow-x: auto;
}
.trend-chart::before {
  content: '';
  position: absolute;
  bottom: 2rem; left: 0; right: 0;
  height: 1px;
  background: var(--border);
  pointer-events: none;
}

.trend-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 28px;
  height: 100%;
  position: relative;
}
.trend-col:hover .trend-bar-fill { filter: brightness(1.2); }

.trend-val {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 3px;
  white-space: nowrap;
}

.trend-bar-track {
  flex: 1;
  width: 100%;
  background: var(--bg-elevated);
  border-radius: 4px 4px 0 0;
  position: relative;
  overflow: hidden;
  min-height: 4px;
}

.trend-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, var(--accent-light), var(--accent-dark));
  border-radius: 4px 4px 0 0;
  transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -2px 10px rgba(232, 145, 10, 0.25);
}

.trend-label {
  position: absolute;
  bottom: -1.6rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Bar chart */
.bar-chart { display: flex; flex-direction: column; gap: 0.75rem; }

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 2.5rem 2.75rem;
  align-items: center;
  gap: 0.75rem;
}
.bar-label {
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  flex: 1;
  background: var(--bg-elevated);
  border-radius: var(--radius-pill);
  height: 10px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent-light));
  border-radius: var(--radius-pill);
  transition: width 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), transparent);
  border-radius: var(--radius-pill);
}
.bar-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
}
.bar-pct {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: right;
}

/* Brewery ranking */
.brewery-ranking { display: flex; flex-direction: column; gap: 0.5rem; }

.brewery-rank-item {
  display: grid;
  grid-template-columns: 2.25rem 1fr auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.brewery-rank-item:hover { border-color: var(--border-warm); box-shadow: var(--shadow-warm); }

.rank-num  {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  text-align: center;
}
.rank-name   { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-count  { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.rank-rating {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  background: var(--accent-glow2);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(232,145,10,0.2);
  white-space: nowrap;
}

/* ── Stats: Mobile ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .brewery-rank-item {
    grid-template-columns: 2rem 1fr auto;
    grid-template-rows: auto auto;
  }
  .rank-rating {
    grid-column: 3;
    grid-row: 1;
  }
  .rank-count {
    grid-column: 2;
    grid-row: 2;
  }
  .stats-meta-row { flex-wrap: wrap; }
  .trend-chart    { height: 120px; }
}

/* ═══════════════════════════════════════════════════════════════════
   ACHIEVEMENTS
   ═══════════════════════════════════════════════════════════════════ */

.achievements-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.875rem;
}

.achievement-badge {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: default;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.achievement-badge.unlocked {
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  box-shadow: 0 0 12px rgba(232, 145, 10, 0.2), inset 0 1px 0 rgba(232,145,10,0.1);
}
.achievement-badge.unlocked:hover {
  transform: scale(1.2) rotate(-4deg);
  box-shadow: 0 0 24px rgba(232, 145, 10, 0.45);
}

.achievement-badge.locked {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  filter: grayscale(1) opacity(0.3);
}
.achievement-badge.locked:hover { transform: scale(1.1); filter: grayscale(1) opacity(0.5); }

