/* APSe Quest - Estilos customizados */

:root {
  --esmeralda: #2E7D32;
  --indigo2: #4527A0;
  --agua: #4DB6AC;
  --geloo: #FFFFFF;
  --cinza-claro: #E5E7EB;
  --cinza-escuro: #374151;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Cards com hover */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(69, 39, 160, 0.12);
}

/* Botões */
.btn-primary {
  background: linear-gradient(135deg, var(--esmeralda) 0%, var(--agua) 100%);
  color: white;
  padding: 0.65rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(46, 125, 50, 0.35);
}
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: white;
  color: var(--cinza-escuro);
  padding: 0.65rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  border: 1px solid #d1d5db;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-secondary:hover { background: #f9fafb; border-color: var(--agua); }

.btn-danger {
  background: #dc2626; color: white; padding: 0.65rem 1.25rem;
  border-radius: 0.5rem; font-weight: 600; border: none; cursor: pointer;
  transition: all 0.2s; display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-danger:hover { background: #b91c1c; }

.btn-purple {
  background: var(--indigo2); color: white; padding: 0.65rem 1.25rem;
  border-radius: 0.5rem; font-weight: 600; border: none; cursor: pointer;
  transition: all 0.2s; display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-purple:hover { background: #371f87; box-shadow: 0 6px 20px rgba(69, 39, 160, 0.35); }

/* Badge / Status pills */
.pill { padding: 2px 10px; border-radius: 9999px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.pill-pendente { background: #fef3c7; color: #92400e; }
.pill-andamento { background: #ccfbf1; color: #115e59; }
.pill-concluida { background: #dcfce7; color: #166534; }
.pill-cancelada { background: #fee2e2; color: #991b1b; }

.pill-baixa { background: #e0e7ff; color: #3730a3; }
.pill-media { background: #cffafe; color: #155e75; }
.pill-alta { background: #fed7aa; color: #9a3412; }
.pill-urgente { background: #fecaca; color: #7f1d1d; }

/* Sidebar */
.sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1rem; border-radius: 0.5rem;
  color: #cbd5e1; font-weight: 500; cursor: pointer;
  transition: all 0.18s ease;
}
.sidebar-link:hover { background: rgba(255,255,255,0.08); color: white; transform: translateX(2px); }
.sidebar-link.active {
  background: linear-gradient(135deg, var(--esmeralda), var(--agua));
  color: white; box-shadow: 0 4px 14px rgba(46, 125, 50, 0.45);
}
.sidebar-link i { width: 18px; text-align: center; }

/* Stat card */
.stat-card {
  background: white; border-radius: 1rem; padding: 1.25rem;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--esmeralda), var(--agua));
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,0.08); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--indigo2), #7c4dff); }
.stat-card.amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat-card.rose::before { background: linear-gradient(90deg, #e11d48, #fb7185); }

/* Progress bar nivel */
.level-bar {
  height: 12px; background: #e5e7eb; border-radius: 9999px; overflow: hidden; position: relative;
}
.level-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--esmeralda), var(--agua), var(--indigo2));
  border-radius: 9999px; transition: width 0.6s ease;
  background-size: 200% 100%; animation: levelShine 4s linear infinite;
}
@keyframes levelShine { 0%{background-position:0% 50%} 100%{background-position:200% 50%} }

/* Badge / Conquista */
.badge-card {
  background: white; border-radius: 1rem; padding: 1rem; text-align: center;
  border: 2px solid #e5e7eb; transition: all 0.2s;
  position: relative;
}
.badge-card.unlocked {
  border-color: var(--indigo2);
  background: linear-gradient(135deg, #f5f3ff 0%, #ecfdf5 100%);
  box-shadow: 0 4px 14px rgba(69, 39, 160, 0.18);
}
.badge-card.unlocked .badge-icon {
  background: linear-gradient(135deg, var(--indigo2), var(--esmeralda));
  color: white;
  box-shadow: 0 0 18px rgba(77, 182, 172, 0.55);
}
.badge-card.locked { opacity: 0.55; filter: grayscale(0.6); }
.badge-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: #e5e7eb; color: #9ca3af;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; margin-bottom: 0.5rem;
  transition: all 0.2s;
}
.badge-card:hover { transform: translateY(-3px); }

/* Pódio Top 3 */
.podio { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 12px; align-items: end; max-width: 700px; margin: 0 auto; }
.podio-step {
  background: white; border: 2px solid #e5e7eb; border-radius: 1rem 1rem 0.5rem 0.5rem;
  padding: 1rem 0.75rem; text-align: center; transition: all 0.2s;
  position: relative;
}
.podio-step:hover { transform: translateY(-4px); box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.podio-1 { border-color: #fbbf24; background: linear-gradient(180deg, #fffbeb 0%, white 100%); height: 240px; }
.podio-2 { border-color: #94a3b8; background: linear-gradient(180deg, #f1f5f9 0%, white 100%); height: 200px; }
.podio-3 { border-color: #d97706; background: linear-gradient(180deg, #fed7aa 0%, white 100%); height: 170px; }

.podio-medal {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px; font-weight: 800;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.medal-1 { background: linear-gradient(135deg, #fbbf24, #d97706); }
.medal-2 { background: linear-gradient(135deg, #cbd5e1, #64748b); }
.medal-3 { background: linear-gradient(135deg, #fb923c, #c2410c); }

.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo2), var(--esmeralda));
  color: white; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-xl { width: 96px; height: 96px; font-size: 32px; }

/* Inputs */
.input {
  width: 100%; padding: 0.6rem 0.85rem;
  border: 1px solid #d1d5db; border-radius: 0.5rem;
  font-size: 14px; outline: none; transition: all 0.15s;
}
.input:focus { border-color: var(--esmeralda); box-shadow: 0 0 0 3px rgba(46,125,50,0.12); }

.label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 0.3rem; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 1rem; backdrop-filter: blur(2px);
}
.modal-content {
  background: white; border-radius: 1rem; max-width: 600px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}

/* Tabela */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase;
  color: #6b7280; font-weight: 700; padding: 10px 12px; border-bottom: 1px solid #e5e7eb; background: #f9fafb;}
.tbl td { padding: 12px; border-bottom: 1px solid #f1f5f9; font-size: 14px; color: #1f2937; }
.tbl tr.row:hover { background: #f8fafc; }

/* Scrollbar simples */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Mobile sidebar */
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
}

/* Abas de Rankings */
.rank-tab {
  padding: 0.7rem 1.1rem; border-radius: 0.6rem; font-weight: 600;
  background: #f8fafc; color: #475569; border: 1px solid transparent;
  cursor: pointer; transition: all 0.18s ease;
  display: inline-flex; align-items: center; gap: 0.5rem; font-size: 14px;
}
.rank-tab:hover { background: #ecfdf5; color: var(--esmeralda); border-color: #a7f3d0; }
.rank-tab-active {
  background: linear-gradient(135deg, var(--esmeralda), var(--agua));
  color: white !important; border-color: transparent;
  box-shadow: 0 4px 14px rgba(46, 125, 50, 0.35);
}
.rank-tab-active:hover { filter: brightness(1.05); color: white; }

/* Linha de ranking com barra de progresso */
.rank-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0.75rem; border-radius: 0.7rem;
  background: #f8fafc; border: 1px solid #e2e8f0;
  transition: all 0.15s ease;
}
.rank-row:hover { background: #f1f5f9; transform: translateX(2px); }
.rank-row-1 { background: linear-gradient(90deg, #fffbeb 0%, white 100%); border-color: #fde68a; }
.rank-row-2 { background: linear-gradient(90deg, #f1f5f9 0%, white 100%); border-color: #cbd5e1; }
.rank-row-3 { background: linear-gradient(90deg, #fed7aa 0%, white 100%); border-color: #fdba74; }
.rank-pos {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--indigo2); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex-shrink: 0;
}
.rank-row-1 .rank-pos { background: linear-gradient(135deg, #fbbf24, #d97706); box-shadow: 0 2px 8px rgba(217,119,6,0.4); }
.rank-row-2 .rank-pos { background: linear-gradient(135deg, #cbd5e1, #64748b); }
.rank-row-3 .rank-pos { background: linear-gradient(135deg, #fb923c, #c2410c); }
.rank-bar { height: 6px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.rank-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* KPI cards (comparativo) */
.kpi-card {
  background: white; border-radius: 1rem; padding: 1.25rem;
  border: 1px solid #e5e7eb; position: relative; overflow: hidden;
  transition: all 0.2s ease;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,0.08); }
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--esmeralda), var(--agua));
}
.kpi-card.kpi-emerald::before { background: linear-gradient(90deg, var(--esmeralda), #4ade80); }
.kpi-card.kpi-indigo::before { background: linear-gradient(90deg, var(--indigo2), #7c4dff); }
.kpi-card.kpi-amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.kpi-card.kpi-agua::before { background: linear-gradient(90deg, var(--agua), #5eead4); }
.kpi-label { font-size: 12px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; gap: 0.4rem; }
.kpi-value { font-size: 28px; font-weight: 800; color: #0f172a; margin-top: 0.35rem; }

/* Notificação */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: white; border-radius: 0.6rem; padding: 0.8rem 1rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  border-left: 4px solid var(--esmeralda);
  z-index: 100; min-width: 240px; animation: slideIn 0.25s ease;
}
.toast.error { border-left-color: #dc2626; }
@keyframes slideIn { from{transform:translateY(20px); opacity:0} to{transform:translateY(0); opacity:1} }
