/* =========================================================
   FECHAMENTO MENSAL — Dashboard Blu
   ========================================================= */

.month-recap-overlay {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: grid;
  place-items: center;
  padding: clamp(16px, 2vw, 34px);
  color: #fff;
  background:
    radial-gradient(circle at 50% -10%, rgba(0, 202, 255, .18), transparent 36%),
    radial-gradient(circle at 8% 90%, rgba(245, 158, 11, .15), transparent 32%),
    rgba(2, 7, 20, .975);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .45s ease, visibility .45s ease;
  overflow: hidden;
}

.month-recap-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.month-recap-shell {
  position: relative;
  z-index: 2;
  width: min(1600px, 96vw);
  max-height: 94vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: clamp(12px, 1.5vh, 22px);
  padding: clamp(22px, 2.3vw, 42px);
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: clamp(24px, 2.4vw, 42px);
  background: linear-gradient(145deg, rgba(8, 17, 38, .96), rgba(3, 9, 24, .94));
  box-shadow: 0 34px 100px rgba(0, 0, 0, .48), inset 0 1px rgba(255, 255, 255, .05);
  overflow: hidden;
  transform: translateY(22px) scale(.985);
  transition: transform .55s cubic-bezier(.2, .8, .2, 1);
}

.month-recap-overlay.show .month-recap-shell {
  transform: translateY(0) scale(1);
}

.month-recap-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 12%, rgba(255,255,255,.035) 48%, transparent 76%);
}

.month-recap-header,
.month-recap-panel-title,
.month-recap-footer {
  position: relative;
  z-index: 1;
}

.month-recap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.month-recap-kicker,
.month-recap-panel-title span,
.month-countdown-kicker {
  display: block;
  color: #38d8ff;
  font-size: clamp(11px, .9vw, 16px);
  font-weight: 900;
  letter-spacing: .22em;
}

.month-recap-header h2 {
  margin: 4px 0 2px;
  font-size: clamp(35px, 4vw, 74px);
  line-height: .98;
  letter-spacing: -.045em;
}

.month-recap-header p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, .67);
  font-size: clamp(14px, 1.25vw, 22px);
}

.month-recap-trophy {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: clamp(74px, 7vw, 124px);
  aspect-ratio: 1;
  border: 1px solid rgba(251, 191, 36, .28);
  border-radius: 28px;
  background: radial-gradient(circle at 35% 25%, rgba(251, 191, 36, .28), rgba(245, 158, 11, .08));
  box-shadow: 0 18px 46px rgba(245, 158, 11, .13);
  font-size: clamp(42px, 4.4vw, 78px);
  animation: monthRecapTrophyFloat 3.4s ease-in-out infinite;
}

.month-recap-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(9px, .9vw, 16px);
}

.month-recap-metric {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: clamp(14px, 1.35vw, 23px);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 22px;
  background: rgba(255, 255, 255, .045);
}

.month-recap-metric.is-primary {
  border-color: rgba(0, 202, 255, .28);
  background: linear-gradient(135deg, rgba(0, 202, 255, .13), rgba(255, 255, 255, .035));
}

.month-recap-metric span,
.month-recap-metric small {
  color: rgba(255, 255, 255, .62);
  font-size: clamp(11px, .82vw, 15px);
}

.month-recap-metric strong {
  overflow: hidden;
  color: #fff;
  font-size: clamp(22px, 2vw, 38px);
  line-height: 1.05;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.month-recap-metric.is-primary strong {
  color: #67e8ff;
}

.month-recap-goal-bar {
  height: 8px;
  margin-top: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}

.month-recap-goal-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00caff, #67e8f9);
  box-shadow: 0 0 18px rgba(0, 202, 255, .42);
  transition: width 1.1s ease;
}

.month-recap-content {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: clamp(10px, 1.2vw, 20px);
}

.month-recap-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(15px, 1.4vw, 24px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 24px;
  background: rgba(255, 255, 255, .035);
  overflow: hidden;
}

.month-recap-panel-title h3 {
  margin: 2px 0 0;
  font-size: clamp(20px, 1.7vw, 31px);
}

.month-recap-podium {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(8px, 1.1vw, 18px);
  padding-top: 4px;
}

.month-recap-podium-item {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 16px 10px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 22px 22px 14px 14px;
  background: rgba(255,255,255,.045);
  text-align: center;
}

.month-recap-podium-item.is-1 {
  min-height: 92%;
  border-color: rgba(251, 191, 36, .3);
  background: linear-gradient(180deg, rgba(251, 191, 36, .15), rgba(255,255,255,.035));
}

.month-recap-podium-item.is-2 { min-height: 75%; }
.month-recap-podium-item.is-3 { min-height: 64%; }

.month-recap-medal {
  position: absolute;
  top: -17px;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(28px, 2.6vw, 48px);
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.35));
}

.month-recap-avatar {
  width: clamp(66px, 5.6vw, 100px);
  aspect-ratio: 1;
  margin-top: 7px;
  border: 4px solid rgba(255,255,255,.12);
  border-radius: 999px;
  overflow: hidden;
  background: #111a30;
  box-shadow: 0 14px 26px rgba(0,0,0,.28);
}

.month-recap-podium-item.is-1 .month-recap-avatar {
  width: clamp(78px, 6.5vw, 118px);
  border-color: rgba(251,191,36,.55);
}

.month-recap-avatar img,
.month-recap-avatar-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.month-recap-avatar-fallback {
  display: grid;
  place-items: center;
  color: #e7faff;
  background: linear-gradient(135deg, #0ea5e9, #1e3a8a);
  font-size: clamp(24px, 2.2vw, 40px);
  font-weight: 900;
}

.month-recap-podium-item b {
  width: 100%;
  overflow: hidden;
  font-size: clamp(13px, 1.08vw, 19px);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.month-recap-podium-item strong {
  color: #67e8ff;
  font-size: clamp(15px, 1.25vw, 23px);
}

.month-recap-podium-item small {
  color: rgba(255,255,255,.57);
  font-size: clamp(10px, .73vw, 13px);
}

.month-recap-sectors {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  overflow: hidden;
}

.month-recap-sector {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: 8px 12px;
  padding: 11px 13px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 15px;
  background: rgba(255,255,255,.035);
}

.month-recap-sector > div:first-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.month-recap-sector strong {
  overflow: hidden;
  font-size: clamp(12px, .88vw, 16px);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.month-recap-sector span {
  color: rgba(255,255,255,.5);
  font-size: clamp(9px, .67vw, 12px);
}

.month-recap-sector b {
  align-self: center;
  color: #fff;
  font-size: clamp(12px, .86vw, 16px);
  white-space: nowrap;
}

.month-recap-sector-bar {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  overflow: hidden;
}

.month-recap-sector-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00caff, #a5f3fc);
}

.month-recap-empty {
  width: 100%;
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: 20px;
  color: rgba(255,255,255,.58);
  text-align: center;
}

.month-recap-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 2px;
}

.month-recap-footer strong {
  color: #67e8ff;
  font-size: clamp(14px, 1.15vw, 21px);
}

.month-recap-footer span {
  color: rgba(255,255,255,.48);
  font-size: clamp(11px, .85vw, 15px);
  text-align: right;
}

.month-recap-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.month-recap-confetti i {
  position: absolute;
  top: -9vh;
  left: var(--x);
  width: 8px;
  height: 18px;
  border-radius: 2px;
  background: #38d8ff;
  transform: rotate(var(--rotate));
  opacity: .75;
  animation: monthRecapConfetti var(--duration) linear infinite;
  animation-delay: var(--delay);
}

.month-recap-confetti i:nth-child(3n) { background: #fbbf24; }
.month-recap-confetti i:nth-child(4n) { background: #a78bfa; }
.month-recap-confetti i:nth-child(5n) { background: #34d399; }

/* Cronômetro substitui visualmente o prêmio, sem remover o DOM original. */
.prize-card .month-countdown-panel {
  display: none;
}

.prize-card.show-month-countdown > .card-heading,
.prize-card.show-month-countdown > #prizeBox {
  display: none !important;
}

.prize-card.show-month-countdown {
  position: relative;
  display: grid !important;
  place-items: center;
  overflow: hidden !important;
  border-color: rgba(239, 68, 68, .28) !important;
  background: radial-gradient(circle at 50% 35%, rgba(239, 68, 68, .18), transparent 62%) !important;
}

.prize-card.show-month-countdown .month-countdown-panel {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.month-countdown-kicker {
  color: #fca5a5;
  letter-spacing: .15em;
}

.month-countdown-panel strong {
  color: #ff3434;
  font-variant-numeric: tabular-nums;
  font-size: clamp(46px, 5.2vw, 98px);
  line-height: .95;
  letter-spacing: -.055em;
  text-shadow: 0 0 18px rgba(255, 30, 30, .26), 0 0 42px rgba(255, 30, 30, .13);
}

.month-countdown-panel small {
  color: rgba(255,255,255,.6);
  font-size: clamp(11px, .9vw, 16px);
}

.prize-card.show-month-countdown.is-final-hour {
  animation: monthCountdownPulse 1.2s ease-in-out infinite;
}

.prize-card.show-month-countdown.is-final-hour .month-countdown-panel strong {
  color: #ff1515;
}

@keyframes monthRecapTrophyFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}

@keyframes monthRecapConfetti {
  0% { transform: translate3d(0, -10vh, 0) rotate(0deg); }
  100% { transform: translate3d(40px, 115vh, 0) rotate(720deg); }
}

@keyframes monthCountdownPulse {
  0%, 100% { box-shadow: inset 0 0 0 rgba(239,68,68,0); }
  50% { box-shadow: inset 0 0 70px rgba(239,68,68,.12); }
}

@media (max-width: 1100px) {
  .month-recap-shell {
    max-height: 96vh;
    overflow-y: auto;
  }

  .month-recap-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .month-recap-content {
    grid-template-columns: 1fr;
  }

  .month-recap-podium {
    min-height: 290px;
  }
}

@media (max-width: 700px) {
  .month-recap-overlay { padding: 8px; }
  .month-recap-shell { width: 100%; padding: 18px; border-radius: 22px; }
  .month-recap-header h2 { font-size: 34px; }
  .month-recap-trophy { display: none; }
  .month-recap-metrics { grid-template-columns: 1fr 1fr; }
  .month-recap-sectors { grid-template-columns: 1fr; }
  .month-recap-footer { align-items: flex-start; flex-direction: column; }
  .month-recap-footer span { text-align: left; }
}

/* Em TVs mais fracas, mantém o visual e reduz animações contínuas. */
html.is-tv .month-recap-shell {
  width: min(1650px, 96vw);
}

html.is-tv .month-recap-confetti i:nth-child(n+19) {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .month-recap-overlay,
  .month-recap-shell,
  .month-recap-goal-bar i {
    transition: none !important;
  }

  .month-recap-trophy,
  .month-recap-confetti i,
  .prize-card.show-month-countdown.is-final-hour {
    animation: none !important;
  }
}
