/* ═══════════════════════════════════════════════════════
   DESAFIO TRILHA — CSS do Modo Desafio
   ═══════════════════════════════════════════════════════ */

:root {
  --des-primary: #8b5cf6;
  --des-primary-dark: #6d28d9;
  --des-green: #10b981;
  --des-red: #ef4444;
  --des-gold: #f59e0b;
  --des-gray: #6b7280;
  --des-light: #f3f4f6;
  --des-radius: 16px;
  --des-shadow: 0 4px 24px rgba(139,92,246,0.10);
}

/* ── Hero ────────────────────────────────────────────── */
.des-hero {
  background: linear-gradient(135deg, var(--des-primary) 0%, var(--des-primary-dark) 100%);
  color: #fff;
  padding: 1.2rem 0 1rem;
  position: sticky;
  top: 56px; /* abaixo da navbar */
  z-index: 90;
  box-shadow: 0 2px 16px rgba(139,92,246,0.18);
}
.des-hero .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.des-hero-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.des-hero-stats {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}
.des-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
.des-stat i { font-size: 0.75rem; }
a.des-stat-link {
  color: inherit;
  text-decoration: none;
  background: rgba(255,255,255,0.25);
  cursor: pointer;
  transition: background 0.2s;
}
a.des-stat-link:hover { background: rgba(255,255,255,0.35); color: inherit; }

/* ── Hero hints (regras do jogo) ─────────────────────── */
.des-hero-hints {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.5rem 0 0.15rem;
}
.des-hero-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}
.des-hero-hint i { font-size: 0.65rem; }
.des-hero-hint.green { background: rgba(16,185,129,0.2); color: #a7f3d0; }
.des-hero-hint.red { background: rgba(239,68,68,0.2); color: #fecaca; }
.des-hero-hint.gold { background: rgba(245,158,11,0.2); color: #fde68a; }

/* ── Barra de progresso trilha ───────────────────────── */
.des-progress-bar {
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  height: 6px;
  width: 100%;
  margin-top: 0.7rem;
  overflow: hidden;
}
.des-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #34d399, #10b981);
  border-radius: 20px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* ── Trilha de nós ───────────────────────────────────── */
.des-trail {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 1.2rem 0;
  overflow-x: auto;
  scroll-behavior: smooth;
}
.des-trail::-webkit-scrollbar { height: 4px; }
.des-trail::-webkit-scrollbar-thumb { background: var(--des-primary); border-radius: 4px; }

.des-node {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  transition: all 0.3s;
  position: relative;
}
.des-node.done {
  background: var(--des-green);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}
.des-node.current {
  background: var(--des-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(139,92,246,0.25);
  animation: desPulse 2s ease-in-out infinite;
}
.des-node.locked {
  background: var(--des-light);
  color: var(--des-gray);
  border: 2px dashed #d1d5db;
}
.des-connector {
  flex: 1;
  min-width: 16px;
  max-width: 40px;
  height: 3px;
  background: #e5e7eb;
  transition: background 0.4s;
}
.des-connector.done {
  background: var(--des-green);
}

/* ── Card da questão ─────────────────────────────────── */
.des-card {
  background: #fff;
  border-radius: var(--des-radius);
  box-shadow: var(--des-shadow);
  padding: 1.8rem;
  animation: desSlideIn 0.45s ease;
  position: relative;
  overflow: hidden;
}
.des-enunciado {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.6;
  color: #1f2937;
  margin-bottom: 1.5rem;
}
.des-questao-badge {
  display: inline-block;
  background: rgba(139,92,246,0.1);
  color: var(--des-primary);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
  margin-bottom: 0.8rem;
}

/* ── Opções ──────────────────────────────────────────── */
.des-opcoes {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.des-opcao {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
  color: #374151;
  position: relative;
}
.des-opcao:hover:not(.disabled) {
  border-color: var(--des-primary);
  background: rgba(139,92,246,0.04);
  transform: translateX(4px);
}
.des-opcao-letter {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  background: var(--des-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--des-gray);
  transition: all 0.2s;
}
.des-opcao:hover:not(.disabled) .des-opcao-letter {
  background: var(--des-primary);
  color: #fff;
}
.des-opcao.selecionada {
  border-color: var(--des-primary);
  background: rgba(139,92,246,0.06);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}
.des-opcao.selecionada .des-opcao-letter {
  background: var(--des-primary);
  color: #fff;
}

/* Botão confirmar */
.des-confirmar-wrap {
  margin-top: 1rem;
  text-align: center;
  animation: desFeedbackIn 0.25s ease;
}
.des-btn-confirmar {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 2rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--des-primary), #6d28d9);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(139,92,246,0.25);
}
.des-btn-confirmar:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(139,92,246,0.35);
}
.des-btn-confirmar:active {
  transform: scale(0.97);
}

.des-opcao.correta {
  border-color: var(--des-green) !important;
  background: rgba(16,185,129,0.06);
}
.des-opcao.correta .des-opcao-letter {
  background: var(--des-green);
  color: #fff;
}
.des-opcao.errada {
  border-color: var(--des-red) !important;
  background: rgba(239,68,68,0.06);
}
.des-opcao.errada .des-opcao-letter {
  background: var(--des-red);
  color: #fff;
}
.des-opcao.disabled {
  pointer-events: none;
  opacity: 0.7;
}

/* ── Feedback ────────────────────────────────────────── */
.des-feedback {
  margin-top: 1.2rem;
  border-radius: 12px;
  padding: 1rem 1.2rem;
  animation: desFeedbackIn 0.35s ease;
  display: none;
}
.des-feedback.show { display: block; }
.des-feedback.correta {
  background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(52,211,153,0.08));
  border: 1px solid rgba(16,185,129,0.2);
  color: #065f46;
}
.des-feedback.errada {
  background: linear-gradient(135deg, rgba(239,68,68,0.08), rgba(248,113,113,0.08));
  border: 1px solid rgba(239,68,68,0.2);
  color: #991b1b;
}
.des-feedback-title {
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}
.des-feedback-comment {
  font-size: 0.88rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(0,0,0,0.06);
  color: #4b5563;
}

/* ── Sidebar gamificação ─────────────────────────────── */
.des-sidebar {
  background: #fff;
  border-radius: var(--des-radius);
  box-shadow: var(--des-shadow);
  padding: 1.2rem;
}
.des-sidebar-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--des-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.8rem;
}
.des-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.88rem;
}
.des-sidebar-item:last-child { border-bottom: none; }
.des-sidebar-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.des-sidebar-icon.purple { background: rgba(139,92,246,0.1); color: var(--des-primary); }
.des-sidebar-icon.green { background: rgba(16,185,129,0.1); color: var(--des-green); }
.des-sidebar-icon.gold { background: rgba(245,158,11,0.1); color: var(--des-gold); }
.des-sidebar-icon.red { background: rgba(239,68,68,0.1); color: var(--des-red); }
.des-sidebar-value {
  font-weight: 700;
  margin-left: auto;
  font-size: 0.95rem;
}

/* ── Empty state ─────────────────────────────────────── */
.des-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--des-gray);
}
.des-empty i { font-size: 2.5rem; margin-bottom: 0.8rem; color: #d1d5db; }

/* ── Animações ───────────────────────────────────────── */
@keyframes desPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(139,92,246,0.25); }
  50% { box-shadow: 0 0 0 8px rgba(139,92,246,0.10); }
}
@keyframes desSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes desFeedbackIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes desShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
@keyframes desBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ── Mini Ranking Sidebar ────────────────────────────── */
.des-mini-rank-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.35rem;
  border-radius: 8px;
  font-size: 0.8rem;
  transition: background 0.2s;
}
.des-mini-rank-item:hover { background: #f9fafb; }
.des-mini-rank-item.is-me { background: rgba(139,92,246,0.06); }

.des-mini-pos {
  width: 22px; height: 22px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.55rem; color: #fff; flex-shrink: 0;
}
.des-mini-pos.p1 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.des-mini-pos.p2 { background: linear-gradient(135deg, #94a3b8, #64748b); }
.des-mini-pos.p3 { background: linear-gradient(135deg, #d97706, #92400e); }
.des-mini-pos.pn { background: #e5e7eb; color: #64748b; }
.des-mini-pos i { font-size: 0.5rem; }

.des-mini-avatar {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.58rem; overflow: hidden;
}
.des-mini-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}

.des-mini-name {
  flex: 1; font-weight: 600; color: #1f2937;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.des-mini-you {
  font-size: 0.5rem; background: #8b5cf6; color: #fff;
  padding: 0.04rem 0.25rem; border-radius: 4px; font-weight: 700;
  vertical-align: middle; margin-left: 0.15rem;
}

.des-mini-stars { display: flex; gap: 1px; flex-shrink: 0; }
.des-mini-stars .s-on { color: #fbbf24; font-size: 0.55rem; }
.des-mini-stars .s-off { color: #d1d5db; font-size: 0.55rem; }

.des-mini-resets {
  font-size: 0.65rem; color: #6b7280; font-weight: 600;
  flex-shrink: 0; min-width: 26px; text-align: right;
}
.des-mini-resets i { font-size: 0.48rem; }

.des-mini-me-sep {
  height: 1px; background: #e5e7eb; margin: 0.3rem 0.35rem;
}

.des-mini-footer {
  font-size: 0.68rem; color: #9ca3af; text-align: center;
  padding-top: 0.5rem; border-top: 1px dashed #e5e7eb; margin-top: 0.4rem;
}
.des-mini-footer i { margin-right: 0.2rem; }

/* ── Responsivo ──────────────────────────────────────── */
@media (max-width: 767px) {
  .des-hero { top: 0; padding: 0.8rem 0; }
  .des-hero-title { font-size: 1rem; }
  .des-card { padding: 1.2rem; }
  .des-enunciado { font-size: 1rem; }
  .des-node { width: 30px; height: 30px; min-width: 30px; font-size: 0.65rem; }
  .des-sidebar { margin-top: 1rem; }
}
