/* =============================================================
   QUETES / HAUT FAITS - Modale compacte et fluide
   ============================================================= */

.quests-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.quests-overlay.active { display: flex; }

.quests-container {
  background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9),
              0 0 0 1px rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  color: white;
  overflow: hidden;
}

/* ==================== HEADER ==================== */
.quests-header {
  padding: 18px 24px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(186, 85, 211, 0.15));
  border-bottom: 2px solid rgba(255, 215, 0, 0.35);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.quests-header-left { flex: 1; min-width: 0; }
.quests-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.quests-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
}
.quests-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.quests-claimable {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}
.quests-claimable.has-claim {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 165, 0, 0.2));
  border-color: rgba(255, 215, 0, 0.6);
  color: #FFD700;
  animation: claimablePulse 2s ease-in-out infinite;
}
@keyframes claimablePulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 215, 0, 0); }
  50%      { box-shadow: 0 0 12px rgba(255, 215, 0, 0.5); }
}
.quests-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.quests-close:hover {
  background: rgba(255, 59, 48, 0.3);
  transform: rotate(90deg);
}

/* ==================== TABS ==================== */
.quests-tabs {
  display: flex;
  background: rgba(0,0,0,0.2);
  border-bottom: 2px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.quests-tabs::-webkit-scrollbar { height: 6px; }
.quests-tabs::-webkit-scrollbar-thumb {
  background: rgba(255,215,0,0.4);
  border-radius: 3px;
}
.quest-tab {
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.quest-tab:hover {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.85);
}
.quest-tab.active {
  color: #FFD700;
  border-bottom-color: #FFD700;
  background: rgba(255, 215, 0, 0.08);
}

/* ==================== BODY ==================== */
.quests-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.quests-body::-webkit-scrollbar { width: 8px; }
.quests-body::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.quests-body::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.45);
  border-radius: 4px;
}

.quests-loading,
.quests-empty {
  text-align: center;
  padding: 50px 20px;
  color: rgba(255,255,255,0.45);
  font-size: 14px;
}

/* ==================== CARTE QUETE (compacte) ==================== */
.quest-card {
  display: grid;
  grid-template-columns: 56px 1fr 140px;
  gap: 22px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 10px;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.04),
    rgba(255,255,255,0.015));
  border: 1px solid rgba(255,255,255,0.07);
  transition: all 0.2s ease;
  min-height: 80px;
  position: relative;
}
.quest-card:hover {
  background: linear-gradient(135deg,
    rgba(255,255,255,0.07),
    rgba(255,255,255,0.03));
  border-color: rgba(255,255,255,0.12);
}
.quest-card.is-claimable {
  border-color: rgba(255, 215, 0, 0.7);
  background: linear-gradient(135deg,
    rgba(255, 215, 0, 0.10),
    rgba(255, 165, 0, 0.05));
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.20);
  animation: claimableCardPulse 2.4s ease-in-out infinite;
}
@keyframes claimableCardPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(255, 215, 0, 0.20); }
  50%      { box-shadow: 0 0 24px rgba(255, 215, 0, 0.45); }
}
.quest-card.all-done {
  opacity: 0.45;
  filter: grayscale(0.4);
}

/* ICON */
.quest-icon {
  width: 56px;
  height: 56px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 6px;
  flex-shrink: 0;
  overflow: visible;
  /* z-index pour que le badge T1 passe au-dessus des cartes adjacentes */
  z-index: 2;
}
.quest-icon img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  image-rendering: pixelated;
  display: block;
}
.quest-tier-badge {
  position: absolute;
  top: -6px;
  left: -6px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.25);
  letter-spacing: 0.3px;
  z-index: 3;
}

/* INFO */
.quest-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.quest-info-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.quest-name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quest-state-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.quest-state-badge.claimable {
  background: rgba(255, 215, 0, 0.25);
  color: #FFD700;
  border: 1px solid rgba(255, 215, 0, 0.55);
}
.quest-state-badge.claimed {
  background: rgba(76, 175, 80, 0.2);
  color: #81c784;
  border: 1px solid rgba(76, 175, 80, 0.4);
}
.quest-desc {
  margin: 0;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* PROGRESS BAR */
.quest-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.quest-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(0,0,0,0.5);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.05);
}
.quest-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 3px;
  transition: width 0.5s ease;
}
.quest-progress-label {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  font-weight: 700;
  font-family: 'Courier New', monospace;
  min-width: 56px;
  text-align: right;
  white-space: nowrap;
}

/* ACTION (boutons / récompenses) — colonne fixe à droite */
.quest-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 130px;
}
.quest-claim-btn {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #000;
  border: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  box-shadow: 0 3px 8px rgba(255, 215, 0, 0.35);
  white-space: nowrap;
}
.quest-claim-btn:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 5px 12px rgba(255, 215, 0, 0.5);
}
.quest-claim-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.quest-all-done-mark {
  font-size: 11px;
  font-style: italic;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
}

/* REWARD */
.quest-reward {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.quest-reward-coins {
  font-size: 13px;
  font-weight: 800;
  color: #FFD700;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.quest-reward-giftbox {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 2px solid #888;
  background: rgba(0,0,0,0.4);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.quest-reward-giftbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 600px) {
  .quest-card {
    grid-template-columns: 48px 1fr;
    gap: 10px;
  }
  .quest-icon { width: 48px; height: 48px; padding: 4px; }
  .quest-action {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 4px;
  }
  .quest-name { font-size: 13px; }
  .quest-desc { font-size: 11px; }
}
