/* ==========================================================================
   Gamification, Rank System & Daily Quests Styles
   Cấp bậc: Sắt -> Đồng -> Vàng -> Bạch kim -> Kim cương -> Cao thủ -> Đại cao thủ -> Thách đấu
   ========================================================================== */

:root {
  --rank-iron: #71717a;
  --rank-bronze: #b45309;
  --rank-gold: #d97706;
  --rank-platinum: #0d9488;
  --rank-diamond: #2563eb;
  --rank-master: #7c3aed;
  --rank-grandmaster: #e11d48;
  --rank-challenger: #ea580c;
}

/* Header Rank Badge */
.header-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  user-select: none;
  background: #f4f4f5;
  color: #3f3f46;
}

.header-rank-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.rank-iron { background: #f4f4f5; color: #52525b; border-color: #d4d4d8; }
.rank-bronze { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.rank-gold { background: #fffbeb; color: #b45309; border-color: #fcd34d; }
.rank-platinum { background: #f0fdfa; color: #0f766e; border-color: #99f6e4; }
.rank-diamond { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.rank-master { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.rank-grandmaster { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.rank-challenger {
  background: linear-gradient(135deg, #fff7ed, #fef2f2);
  color: #c2410c;
  border-color: #fed7aa;
  box-shadow: 0 0 10px rgba(234, 88, 12, 0.2);
}

/* Rank Modal */
.rank-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: rankFadeIn 0.2s ease;
}

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

.rank-modal-card {
  background: #ffffff;
  border-radius: 24px;
  width: min(650px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  position: relative;
  display: flex;
  flex-direction: column;
}

.rank-modal-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rank-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-modal-close {
  background: #f1f5f9;
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 18px;
  color: #64748b;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}

.rank-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.rank-modal-body {
  padding: 24px 28px;
}

/* Current Rank Spotlight */
.rank-current-spotlight {
  background: linear-gradient(135deg, #faf5ff, #f3e8ff);
  border: 2px solid #e9d5ff;
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}

.rank-spotlight-icon {
  font-size: 54px;
  line-height: 1;
  margin-bottom: 8px;
  display: inline-block;
  animation: rankBounce 2s infinite ease-in-out;
}

@keyframes rankBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.rank-spotlight-name {
  font-size: 24px;
  font-weight: 900;
  color: #581c87;
  letter-spacing: 0.5px;
}

.rank-spotlight-xp {
  font-size: 15px;
  color: #7e22ce;
  font-weight: 700;
  margin: 4px 0 16px;
}

.rank-progress-container {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  height: 12px;
  padding: 2px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-bottom: 8px;
}

.rank-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed, #a855f7);
  transition: width 0.5s ease;
}

.rank-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6b21a8;
  font-weight: 600;
}

/* Rank Tier Grid */
.rank-tiers-title {
  font-size: 15px;
  font-weight: 800;
  color: #1e293b;
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rank-tier-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

@media (max-width: 560px) {
  .rank-tier-list {
    grid-template-columns: 1fr;
  }
}

.rank-tier-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  transition: all 0.2s;
}

.rank-tier-card.unlocked {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.rank-tier-card.active {
  border-width: 2px;
  border-color: #7c3aed;
  background: #fbf9ff;
}

.rank-tier-card.locked {
  opacity: 0.55;
  background: #f8fafc;
}

.rank-tier-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.rank-tier-info {
  flex: 1;
  min-width: 0;
}

.rank-tier-info strong {
  display: block;
  font-size: 14px;
  color: #0f172a;
}

.rank-tier-info small {
  font-size: 11px;
  color: #64748b;
}

/* Daily Quests Section */
.quests-container {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px;
}

.quest-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s;
}

.quest-item:last-child {
  margin-bottom: 0;
}

.quest-item.completed {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.quest-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quest-icon {
  font-size: 24px;
}

.quest-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.quest-desc {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.quest-reward {
  font-size: 12px;
  font-weight: 800;
  color: #15803d;
  background: #dcfce7;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.quest-status-btn {
  border: 0;
  background: #6657d9;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.quest-status-btn:hover {
  background: #5849c8;
}

.quest-done-tag {
  color: #16a34a;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Home Rank Card */
.home-rank-card {
  border: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #ffffff, #faf5ff);
  border-radius: 18px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 20px 0 32px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(102, 87, 217, 0.06);
}

.home-rank-card:hover {
  transform: translateY(-2px);
  border-color: #d8b4fe;
  box-shadow: 0 8px 24px rgba(102, 87, 217, 0.12);
}

@media (max-width: 680px) {
  .home-rank-card {
    flex-direction: column;
    align-items: flex-start;
  }
}

