/* ============================================================
   Weekly Grind Tracker — Visual Gamer
   Estilo HUD/RPG: barras de progresso animadas com glow neon
   ============================================================ */

/* Animações principais */
@keyframes grind-bar-fill {
  from { width: 0%; }
  to   { width: var(--bar-width, 0%); }
}

@keyframes grind-pulse-orange {
  0%, 100% { box-shadow: 0 0 8px 2px rgba(251, 146, 60, 0.5); }
  50%       { box-shadow: 0 0 20px 6px rgba(251, 146, 60, 0.8); }
}

@keyframes grind-pulse-cyan {
  0%, 100% { box-shadow: 0 0 8px 2px rgba(167, 139, 250, 0.5); }
  50%       { box-shadow: 0 0 20px 6px rgba(167, 139, 250, 0.8); }
}

@keyframes goal-blast {
  0%   { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); transform: scale(1); }
  30%  { box-shadow: 0 0 40px 15px rgba(250, 204, 21, 0.7); transform: scale(1.01); }
  70%  { box-shadow: 0 0 20px 5px rgba(250, 204, 21, 0.3); transform: scale(1); }
  100% { box-shadow: 0 0 8px 2px rgba(250, 204, 21, 0.1); transform: scale(1); }
}

@keyframes goal-badge-pop {
  0%   { transform: scale(0) rotate(-10deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes grind-shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes grind-flicker {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.85; }
}

/* ---- Container Principal ---- */
#weekly-grind-widget {
  position: relative;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(20, 30, 55, 0.95) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: border-color 0.3s ease;
  backdrop-filter: blur(4px);
}

#weekly-grind-widget::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
              radial-gradient(ellipse at bottom right, rgba(251, 146, 60, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

#weekly-grind-widget:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

/* ---- Header do Widget ---- */
.grind-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.grind-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.grind-title-icon {
  font-size: 1.3rem;
  animation: grind-flicker 3s ease-in-out infinite;
}

.grind-title-text {
  font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.grind-week-label {
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 500;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.grind-settings-btn {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  color: #818cf8;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.grind-settings-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  color: #a5b4fc;
}

/* ---- Grid de Barras ---- */
.grind-bars-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .grind-bars-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Bloco de uma Barra ---- */
.grind-bar-block {
  position: relative;
}

.grind-bar-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  gap: 0.5rem;
}

.grind-bar-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.grind-bar-label-icon {
  font-size: 0.85rem;
}

.grind-bar-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: #e2e8f0;
  white-space: nowrap;
}

.grind-bar-value .current {
  font-size: 1rem;
}

.grind-bar-value .separator {
  color: #475569;
  margin: 0 0.15rem;
}

.grind-bar-value .goal {
  color: #64748b;
  font-size: 0.75rem;
}

.grind-bar-percent {
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.25rem;
}

/* ---- Track (fundo) da Barra ---- */
.grind-bar-track {
  position: relative;
  height: 24px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 9999px;
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

/* ---- Fill (preenchimento) das Barras ---- */
.grind-bar-fill {
  height: 100%;
  border-radius: 9999px;
  width: var(--bar-width, 0%);
  transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

/* Shimmer sobre o fill */
.grind-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: grind-shimmer 2s linear infinite;
}

/* ---- HORAS: laranja gradiente ---- */
.grind-bar-fill.hours {
  background: linear-gradient(90deg, #ea580c 0%, #f97316 40%, #fbbf24 80%, #fde68a 100%);
  animation: grind-pulse-orange 1.8s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(251, 146, 60, 0.6);
}

/* ---- QUESTÕES: roxo–ciano ---- */
.grind-bar-fill.questions {
  background: linear-gradient(90deg, #6d28d9 0%, #8b5cf6 40%, #06b6d4 80%, #67e8f9 100%);
  animation: grind-pulse-cyan 1.8s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.6);
}


/* ---- Estado: META BATIDA ---- */
#weekly-grind-widget.goal-reached-hours {
  animation: goal-blast 1.2s ease-out forwards;
}

.grind-bar-fill.hours.goal-reached {
  background: linear-gradient(90deg, #fbbf24 0%, #fde68a 50%, #ffffff 100%);
  animation: grind-pulse-orange 1s ease-in-out infinite, grind-shimmer 1s linear infinite;
}

.grind-bar-fill.questions.goal-reached {
  background: linear-gradient(90deg, #8b5cf6 0%, #06b6d4 50%, #a5f3fc 100%);
  animation: grind-pulse-cyan 1s ease-in-out infinite;
}

/* ---- Badge META BATIDA ---- */
.grind-goal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  color: #1a0a00;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  animation: goal-badge-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  margin-left: 0.5rem;
  vertical-align: middle;
  white-space: nowrap;
}

.grind-goal-badge.questions {
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  color: #fff;
}

/* ---- Rodapé da Barra: ritmo diário ---- */
.grind-bar-pace {
  margin-top: 0.35rem;
  font-size: 0.66rem;
  color: #475569;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.grind-bar-pace .pace-highlight {
  color: #94a3b8;
  font-weight: 600;
}

/* ---- Texto "sem meta definida" ---- */
.grind-no-goal {
  text-align: center;
  padding: 0.75rem;
  color: #475569;
  font-size: 0.8rem;
}

.grind-no-goal a {
  color: #818cf8;
  cursor: pointer;
  text-decoration: underline;
}

/* ---- Modal de configuração de metas ---- */
#weekly-goals-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

#weekly-goals-modal-backdrop.visible {
  opacity: 1;
  pointer-events: all;
}

.weekly-goals-modal {
  background: linear-gradient(135deg, #0f172a, #111827);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 16px;
  padding: 1.75rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.6);
  animation: goal-badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.weekly-goals-modal h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.weekly-goals-modal p.subtitle {
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 1.25rem;
}

.weekly-goals-modal .goal-input-group {
  margin-bottom: 1rem;
}

.weekly-goals-modal label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.weekly-goals-modal input[type="number"] {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  color: #f1f5f9;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.65rem 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.weekly-goals-modal input[type="number"]:focus {
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.weekly-goals-modal .modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.weekly-goals-modal .btn-cancel {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.65rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.weekly-goals-modal .btn-cancel:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.weekly-goals-modal .btn-save {
  flex: 2;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.65rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.weekly-goals-modal .btn-save:hover {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
  transform: translateY(-1px);
}
