/**
 * achievements.css — Achievement card styles, popup, progress bars, rarity theming
 * Dark theme consistent with URBot design system
 */

/* ---- Achievement Grid ---- */
.urbot-ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding: 16px 0;
}

/* ---- Achievement Card ---- */
.urbot-ach-card {
  position: relative;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 14px;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
  overflow: hidden;
}

.urbot-ach-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Rarity border colors */
.urbot-ach-card[data-rarity="common"] { border-color: #94a3b8; }
.urbot-ach-card[data-rarity="uncommon"] { border-color: #22c55e; }
.urbot-ach-card[data-rarity="rare"] { border-color: #3b82f6; }
.urbot-ach-card[data-rarity="epic"] { border-color: #a855f7; }
.urbot-ach-card[data-rarity="legendary"] {
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.15);
}

/* Unlocked cards get a subtle glow */
.urbot-ach-card.unlocked[data-rarity="common"] { background: rgba(148, 163, 184, 0.05); }
.urbot-ach-card.unlocked[data-rarity="uncommon"] { background: rgba(34, 197, 94, 0.05); }
.urbot-ach-card.unlocked[data-rarity="rare"] { background: rgba(59, 130, 246, 0.05); }
.urbot-ach-card.unlocked[data-rarity="epic"] { background: rgba(168, 85, 247, 0.08); }
.urbot-ach-card.unlocked[data-rarity="legendary"] {
  background: rgba(245, 158, 11, 0.08);
  animation: urbot-ach-legendary-glow 3s ease-in-out infinite;
}

@keyframes urbot-ach-legendary-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(245, 158, 11, 0.15); }
  50% { box-shadow: 0 0 24px rgba(245, 158, 11, 0.25); }
}

/* Locked card styling */
.urbot-ach-card.locked {
  opacity: 0.65;
  border-color: #1e293b;
}

.urbot-ach-card.locked:hover {
  opacity: 0.8;
}

/* ---- Card Icon ---- */
.urbot-ach-card-icon {
  font-size: 32px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Card Body ---- */
.urbot-ach-card-body {
  flex: 1;
  min-width: 0;
}

.urbot-ach-card-name {
  font-size: 15px;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.urbot-ach-card-desc {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.urbot-ach-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.urbot-ach-rarity {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.urbot-ach-points {
  color: #64748b;
}

.urbot-ach-card-date {
  font-size: 11px;
  color: #475569;
  margin-top: 4px;
}

/* ---- Progress Bar ---- */
.urbot-ach-progress-bar {
  width: 100%;
  height: 4px;
  background: #0f172a;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.urbot-ach-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease-out;
}

.urbot-ach-progress-text {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 6px;
}

/* ---- Locked Overlay ---- */
.urbot-ach-locked-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 16, 27, 0.6);
  border-radius: 12px;
  pointer-events: none;
}

.urbot-ach-lock-icon {
  font-size: 28px;
  opacity: 0.6;
}

/* ---- Popup Notification (injected by JS, styles here for consistency) ---- */
.urbot-ach-popup {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Category Section Headers ---- */
.urbot-ach-category-header {
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #1e293b;
  text-transform: capitalize;
}

/* ---- Summary Bar ---- */
.urbot-ach-summary {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 20px;
  background: #1e293b;
  border-radius: 12px;
  margin-bottom: 20px;
}

.urbot-ach-summary-stat {
  text-align: center;
}

.urbot-ach-summary-value {
  font-size: 24px;
  font-weight: 700;
  color: #f1f5f9;
}

.urbot-ach-summary-label {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

/* ---- Leaderboard ---- */
.urbot-ach-leaderboard {
  list-style: none;
  padding: 0;
  margin: 0;
}

.urbot-ach-leaderboard li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid #1e293b;
  font-size: 14px;
  color: #e2e8f0;
}

.urbot-ach-leaderboard li:last-child {
  border-bottom: none;
}

.urbot-ach-rank {
  font-weight: 700;
  color: #94a3b8;
  width: 28px;
  text-align: center;
}

.urbot-ach-rank-1 { color: #f59e0b; }
.urbot-ach-rank-2 { color: #94a3b8; }
.urbot-ach-rank-3 { color: #cd7f32; }

.urbot-ach-lb-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.urbot-ach-lb-points {
  font-weight: 600;
  color: #6366f1;
}

.urbot-ach-lb-count {
  font-size: 12px;
  color: #64748b;
}

/* ---- Recent Unlocks Feed ---- */
.urbot-ach-recent-feed {
  list-style: none;
  padding: 0;
  margin: 0;
}

.urbot-ach-recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #1e293b;
  font-size: 13px;
  color: #cbd5e1;
}

.urbot-ach-recent-item:last-child { border-bottom: none; }

.urbot-ach-recent-icon { font-size: 20px; flex-shrink: 0; }
.urbot-ach-recent-name { font-weight: 600; color: #f1f5f9; }
.urbot-ach-recent-user { color: #64748b; font-size: 12px; }
.urbot-ach-recent-time { color: #475569; font-size: 11px; margin-left: auto; flex-shrink: 0; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .urbot-ach-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .urbot-ach-summary {
    flex-wrap: wrap;
    gap: 16px;
  }

  .urbot-ach-popup {
    right: 8px !important;
    left: 8px !important;
    max-width: none !important;
  }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .urbot-ach-card,
  .urbot-ach-progress-fill {
    transition: none;
  }

  .urbot-ach-card.unlocked[data-rarity="legendary"] {
    animation: none;
  }

  .urbot-ach-popup {
    animation: none !important;
  }
}
