/* ═══════════════════════════════════════════════════════════════
   ACHIEVEMENTS — Grid, Badges, Toast, Progress
   ═══════════════════════════════════════════════════════════════ */

/* ── Header ───────────────────────────────────────────────── */
.kc-ach-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.kc-ach-title {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: #d4a545;
}

.kc-ach-count {
  font-family: 'Crimson Text', serif;
  font-size: 0.95rem;
  color: rgba(220, 200, 160, 0.7);
}

/* ── Category Filter Buttons ──────────────────────────────── */
.kc-ach-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding: 0 4px;
}

.kc-ach-filter-btn {
  background: rgba(60, 40, 20, 0.6);
  border: 1px solid rgba(160, 120, 60, 0.3);
  color: rgba(220, 200, 160, 0.7);
  font-family: 'Crimson Text', serif;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.kc-ach-filter-btn:hover {
  background: rgba(80, 55, 25, 0.8);
  border-color: rgba(200, 160, 80, 0.5);
  color: #d4a545;
}

.kc-ach-filter-btn.active {
  background: linear-gradient(135deg, rgba(160, 120, 40, 0.4), rgba(120, 80, 20, 0.6));
  border-color: #d4a545;
  color: #d4a545;
  font-weight: 600;
}

/* ── Achievement Grid ─────────────────────────────────────── */
.kc-ach-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 4px 20px;
}

/* ── Achievement Card ─────────────────────────────────────── */
.kc-ach-card {
  background: linear-gradient(145deg, rgba(50, 35, 15, 0.9), rgba(30, 20, 8, 0.95));
  border: 1px solid rgba(160, 120, 60, 0.25);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.kc-ach-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(212, 165, 69, 0.3), transparent);
}

.kc-ach-card:hover {
  border-color: rgba(212, 165, 69, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.kc-ach-card.unlocked {
  border-color: rgba(212, 165, 69, 0.4);
}

.kc-ach-card.unlocked::before {
  background: linear-gradient(90deg, transparent, rgba(212, 165, 69, 0.6), transparent);
}

.kc-ach-card.locked {
  opacity: 0.65;
}

/* ── Icon ─────────────────────────────────────────────────── */
.kc-ach-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 6px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.kc-ach-card.locked .kc-ach-icon {
  filter: grayscale(1) brightness(0.5) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* ── Name ─────────────────────────────────────────────────── */
.kc-ach-name {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  color: #d4a545;
  margin-bottom: 4px;
  line-height: 1.2;
  min-height: 2em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kc-ach-card.locked .kc-ach-name {
  color: rgba(160, 130, 80, 0.5);
}

/* ── Progress Bar ─────────────────────────────────────────── */
.kc-ach-progress {
  width: 100%;
  height: 4px;
  background: rgba(80, 60, 30, 0.5);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.kc-ach-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b6914, #d4a545);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.kc-ach-card.unlocked .kc-ach-progress-fill {
  background: linear-gradient(90deg, #4a8c2a, #6abf3a);
}

/* ── Progress Text ────────────────────────────────────────── */
.kc-ach-progress-text {
  font-family: 'Crimson Text', serif;
  font-size: 0.55rem;
  color: rgba(220, 200, 160, 0.5);
  margin-top: 2px;
}

.kc-ach-card.unlocked .kc-ach-progress-text {
  color: rgba(106, 191, 58, 0.7);
}

/* ═══════════════════════════════════════════════════════════════
   ACHIEVEMENT DETAIL POPUP
   ═══════════════════════════════════════════════════════════════ */
.kc-ach-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: achFadeIn 0.2s ease;
}

.kc-ach-detail {
  background: linear-gradient(160deg, #2a1e0e, #1a120a);
  border: 2px solid rgba(212, 165, 69, 0.4);
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 340px;
  width: 90%;
  text-align: center;
  position: relative;
}

.kc-ach-detail-icon {
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.6));
}

.kc-ach-detail.locked .kc-ach-detail-icon {
  filter: grayscale(1) brightness(0.4) drop-shadow(0 3px 8px rgba(0, 0, 0, 0.6));
}

.kc-ach-detail-name {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: #d4a545;
  margin-bottom: 8px;
}

.kc-ach-detail-desc {
  font-family: 'Crimson Text', serif;
  font-size: 0.9rem;
  color: rgba(220, 200, 160, 0.8);
  font-style: italic;
  margin-bottom: 12px;
}

.kc-ach-detail-progress {
  width: 100%;
  height: 8px;
  background: rgba(80, 60, 30, 0.5);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.kc-ach-detail-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b6914, #d4a545);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.kc-ach-detail.unlocked .kc-ach-detail-progress-fill {
  background: linear-gradient(90deg, #4a8c2a, #6abf3a);
}

.kc-ach-detail-progress-label {
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: rgba(220, 200, 160, 0.6);
  margin-bottom: 12px;
}

.kc-ach-detail-reward {
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: #d4a545;
  padding: 6px 12px;
  background: rgba(160, 120, 40, 0.15);
  border-radius: 6px;
  display: inline-block;
}

.kc-ach-detail-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: rgba(220, 200, 160, 0.5);
  font-size: 1.2rem;
  cursor: pointer;
}

.kc-ach-detail-close:hover {
  color: #d4a545;
}

/* ═══════════════════════════════════════════════════════════════
   ACHIEVEMENT UNLOCK TOAST
   ═══════════════════════════════════════════════════════════════ */
.kc-ach-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  z-index: 10000;
  background: linear-gradient(145deg, #2a1e0e, #1a120a);
  border: 2px solid #d4a545;
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 0 30px rgba(212, 165, 69, 0.3), 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: achToastIn 0.5s ease forwards, achToastOut 0.5s ease 4.5s forwards;
  min-width: 280px;
  max-width: 400px;
}

.kc-ach-toast-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(212, 165, 69, 0.4));
}

.kc-ach-toast-body {
  flex: 1;
}

.kc-ach-toast-label {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  color: rgba(212, 165, 69, 0.7);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 2px;
}

.kc-ach-toast-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: #d4a545;
  line-height: 1.2;
}

.kc-ach-toast-desc {
  font-family: 'Crimson Text', serif;
  font-size: 0.8rem;
  color: rgba(220, 200, 160, 0.7);
  font-style: italic;
}

.kc-ach-toast-reward {
  font-family: 'Crimson Text', serif;
  font-size: 0.75rem;
  color: #d4a545;
  margin-top: 2px;
}

/* ── Toast Animations ─────────────────────────────────────── */
@keyframes achToastIn {
  from { transform: translateX(-50%) translateY(-120px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes achToastOut {
  from { transform: translateX(-50%) translateY(0); opacity: 1; }
  to { transform: translateX(-50%) translateY(-120px); opacity: 0; }
}

@keyframes achFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Gold Shimmer on toast border ─────────────────────────── */
.kc-ach-toast::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  background: linear-gradient(90deg, transparent, rgba(212, 165, 69, 0.4), transparent);
  background-size: 200% 100%;
  animation: achShimmer 2s ease infinite;
  z-index: -1;
}

@keyframes achShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .kc-ach-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .kc-ach-icon { width: 52px; height: 52px; }
  .kc-ach-name { font-size: 0.6rem; }
  .kc-ach-toast { min-width: 240px; max-width: 320px; }
  .kc-ach-toast-icon { width: 44px; height: 44px; }
}

@media (max-width: 480px) {
  .kc-ach-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .kc-ach-icon { width: 48px; height: 48px; }
  .kc-ach-name { font-size: 0.55rem; }
  .kc-ach-filters { gap: 4px; }
  .kc-ach-filter-btn { font-size: 0.65rem; padding: 3px 8px; }
}
