/* ═══════════════════════════════════════════════
   RedditGacha — Collection + Missions
═══════════════════════════════════════════════ */

/* ─── Collection header ──────────────────────── */

.collection-header {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.collection-header h2 {
  font-size: 22px;
  font-weight: 800;
}

.collection-stats {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--text-secondary);
  align-items: center;
  flex-wrap: wrap;
}

.collection-stats span { font-weight: 600; }

/* Rarity breakdown pills */
.col-rarity-breakdown {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.rarity-pip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-surface);
}

.rarity-pip strong { margin-left: 2px; }

.rarity-pip-LR  { border-color: var(--rarity-LR);  color: var(--rarity-LR);  background: rgba(255,215,0,.06); }
.rarity-pip-UR  { border-color: var(--rarity-UR);  color: var(--rarity-UR);  background: rgba(255,69,0,.06); }
.rarity-pip-SSR { border-color: var(--rarity-SSR); color: var(--rarity-SSR); background: rgba(156,39,176,.06); }
.rarity-pip-SR  { border-color: var(--rarity-SR);  color: var(--rarity-SR);  background: rgba(0,121,211,.06); }
.rarity-pip-R   { border-color: var(--rarity-R);   color: var(--rarity-R);   background: rgba(0,200,83,.06); }
.rarity-pip-UC  { border-color: var(--rarity-UC);  color: var(--rarity-UC); }
.rarity-pip-C   { border-color: var(--rarity-C);   color: var(--rarity-C); }

.collection-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.filter-group select {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-surface3);
  border: 1px solid var(--border-dk);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.filter-group select:focus {
  border-color: var(--reddit-orange);
  outline: none;
}

/* ─── Collection grid ────────────────────────── */

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 210px);
  gap: 16px;
  justify-content: start;
  align-items: stretch;
  transition: opacity 0.2s ease;
}

.collection-grid--fading {
  opacity: 0.3;
}

/* Direct .card children (no wrap) also stretch to row height */
.collection-grid > .card {
  height: 100%;
}

/* Card entrance animation */
.collection-card-enter {
  animation: collectionCardIn 0.35s cubic-bezier(.23,1,.32,1) both;
  animation-delay: var(--card-delay, 0ms);
}

@keyframes collectionCardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Empty state */
.collection-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
  font-size: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-dk);
}

.collection-empty p {
  margin-bottom: 8px;
}

.collection-no-results {
  width: 100%;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 15px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-dk);
}

/* ─── Card detail in modal ───────────────────── */

.card-detail-modal {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.card-detail-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-detail-media {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-surface3);
}

.card-detail-media img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
}

.card-detail-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
  padding-right: 4px;
}

.card-detail-title::-webkit-scrollbar { width: 4px; }
.card-detail-title::-webkit-scrollbar-thumb { background: var(--border-dk); border-radius: 4px; }

.card-detail-meta {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-detail-stats {
  display: flex;
  gap: 16px;
  background: var(--bg-surface3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.detail-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-stat-label { font-size: 11px; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; }
.detail-stat-value { font-size: 22px; font-weight: 800; }
.detail-stat-value.atk { color: #E53935; }
.detail-stat-value.def { color: #1565C0; }

.card-detail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-thread-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  white-space: normal;
  max-height: 180px;
  overflow: auto;
}

@media (max-width: 860px) {
  .card-detail-modal { flex-direction: column; }
  .card-detail-media img { max-height: 200px; }
}

/* ═══════════════════════════════════════════════
   Missions view
═══════════════════════════════════════════════ */

.missions-view-inner {
  max-width: 700px;
  margin: 0 auto;
}

.missions-view-inner h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}

.missions-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.missions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

/* ─── Mission item ───────────────────────────── */

.mission-item {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  animation: missionItemIn 0.35s cubic-bezier(.23,1,.32,1) both;
  animation-delay: var(--mission-delay, 0ms);
}

@keyframes missionItemIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.mission-item:hover:not(.completed) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--reddit-orange);
}

.mission-item.completed {
  opacity: 0.5;
  border-color: #00C853;
}

/* Bonus mission — gold accent */
.mission-item.mission-bonus {
  border-style: dashed;
  border-color: rgba(255, 200, 30, 0.4);
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(255, 200, 30, 0.04) 100%);
}
.mission-item.mission-bonus:hover:not(.completed) {
  border-color: rgba(255, 200, 30, 0.7);
}
.mission-item.mission-bonus.completed {
  border-color: rgba(255, 200, 30, 0.5);
}

.mission-icon { font-size: 22px; flex-shrink: 0; }

.mission-text { flex: 1; min-width: 0; }

/* ─── Name row with tier badge ───────────────── */

.mission-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.mission-name {
  font-size: 14px;
  font-weight: 600;
}

.mission-tier-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.tier-easy   { background: rgba(0, 200, 83, 0.12);  color: #00a843; }
.tier-medium { background: rgba(255, 152, 0, 0.12); color: #e08000; }
.tier-hard   { background: rgba(229, 57, 53, 0.12); color: #c62828; }
.tier-bonus  { background: rgba(255, 200, 30, 0.15); color: #b8860b; }

.mission-desc { font-size: 12px; color: var(--text-secondary); }

/* ─── Mission progress bar ───────────────────── */

.mission-progress-wrap {
  width: 100%;
  margin-top: 6px;
}

.mission-progress-bar {
  height: 4px;
  background: var(--bg-surface3);
  border-radius: 2px;
  overflow: hidden;
}

.mission-progress-fill {
  height: 100%;
  background: var(--reddit-orange);
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
}

.mission-progress-label {
  font-size: 11px;
  color: var(--text-meta);
  margin-top: 3px;
}

/* ─── Mission reward ─────────────────────────── */

.mission-reward {
  font-size: 12px;
  font-weight: 700;
  color: var(--reddit-orange);
  background: rgba(255,69,0,.08);
  padding: 4px 10px;
  border-radius: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

.mission-item.mission-bonus .mission-reward {
  color: #b8860b;
  background: rgba(255, 200, 30, 0.12);
}

/* ─── Mission check circle ───────────────────── */

.mission-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-dk);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: var(--bg-surface);
  transition: all 0.3s cubic-bezier(.23,1,.32,1);
}

.mission-item.completed .mission-check {
  background: #00C853;
  border-color: #00C853;
  color: #fff;
  animation: checkPop 0.4s cubic-bezier(.17,.67,.29,1.35);
}

@keyframes checkPop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ─── Mission completion celebration ─────────── */

.mission-complete-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.mission-complete-burst::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0,200,83,.2) 0%, transparent 70%);
  animation: missionBurst 0.6s ease-out forwards;
}

@keyframes missionBurst {
  0%   { opacity: 1; transform: scale(0.5); }
  100% { opacity: 0; transform: scale(2); }
}

/* ─── Login streak card ──────────────────────── */

.missions-streak {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: border-color 0.4s ease, background 0.4s ease;
}

.missions-streak.streak-hot {
  border-color: rgba(255,69,0,.35);
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(255,69,0,.05) 100%);
}

/* Streak header row */
.streak-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.streak-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.streak-icon {
  font-size: 28px;
  display: inline-block;
}

.streak-icon-hot {
  animation: flamePulse 1.8s ease-in-out infinite;
}

@keyframes flamePulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.15) rotate(-3deg); filter: brightness(1.15); }
}

.streak-count-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.streak-number {
  font-size: 30px;
  font-weight: 800;
  color: var(--reddit-orange);
}

.streak-unit {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.streak-tier-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,69,0,.1);
  color: var(--reddit-orange);
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}

.streak-shield-badge {
  font-size: 12px;
  font-weight: 700;
  background: rgba(100, 160, 255, 0.12);
  color: #4a80e0;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(100, 160, 255, 0.25);
}

/* ─── 7-day calendar ─────────────────────────── */

.streak-calendar {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.streak-cal-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.streak-cal-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface3);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.streak-cal-dot.checked {
  background: var(--reddit-orange);
  border-color: var(--reddit-orange);
  color: #fff;
}

.streak-cal-dot.today {
  border-color: var(--reddit-orange);
  transform: scale(1.1);
}

.streak-cal-dot.checked.today {
  box-shadow: 0 0 0 3px rgba(255,69,0,.2);
}

.streak-cal-label {
  font-size: 10px;
  color: var(--text-meta);
  font-weight: 500;
}

.streak-cal-label.today {
  color: var(--reddit-orange);
  font-weight: 700;
}

/* ─── Milestone progress ─────────────────────── */

.streak-milestone-wrap {
  margin-top: 4px;
}

.streak-milestone-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  margin-bottom: 6px;
  gap: 8px;
}

.streak-milestone-info strong {
  color: var(--reddit-orange);
}

.streak-milestone-reward {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.streak-milestone-bar {
  height: 6px;
  background: var(--bg-surface3);
  border-radius: 3px;
  overflow: hidden;
}

.streak-milestone-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--reddit-orange), #ff7733);
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}
