/* ==========================================================================
   Footer Nudges & Encouragement Modals
   ========================================================================== */

/* Button positioning context & overflow safety */
#site-footer,
#site-footer .footer-zone,
#site-footer .footer-zone-left,
#site-footer .footer-session-line {
  overflow: visible !important;
}

#site-footer .footer-points-wallet,
#site-footer .footer-leaderboard-button {
  position: relative;
}

#site-footer .footer-points-wallet:has(.footer-nudge-bubble),
#site-footer .footer-leaderboard-button:has(.footer-nudge-bubble) {
  z-index: 35;
}

/* --------------------------------------------------------------------------
   Floating Nudge Bubbles ("Nuvolette")
   -------------------------------------------------------------------------- */
.footer-nudge-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  border: 1.5px solid #ffffff;
  pointer-events: auto;
  transition:
    transform 160ms cubic-bezier(0.175, 0.885, 0.32, 1.275),
    filter 160ms ease,
    box-shadow 160ms ease;
  animation:
    footer-nudge-pop 320ms cubic-bezier(0.175, 0.885, 0.32, 1.275) both,
    footer-nudge-float 2.8s ease-in-out 320ms infinite;
}

.footer-nudge-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--nudge-tail-color, #d97706);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.22));
}

/* Points Nudge: Warm amber / gold exclamation mark */
.footer-nudge-points {
  --nudge-tail-color: #d97706;
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #ffffff;
  box-shadow:
    0 4px 14px rgba(217, 119, 6, 0.55),
    0 2px 5px rgba(0, 0, 0, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

/* Trophy Nudge: Champion gold medal / rank */
.footer-nudge-trophy {
  --nudge-tail-color: #d97706;
  background: linear-gradient(135deg, #fef08a 0%, #f59e0b 55%, #d97706 100%);
  color: #0f172a;
  box-shadow:
    0 4px 16px rgba(245, 158, 11, 0.6),
    0 2px 5px rgba(0, 0, 0, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.7);
}

.footer-nudge-bubble:hover {
  transform: translateX(-50%) translateY(-3px) scale(1.1);
  filter: brightness(1.1);
}

.footer-nudge-bubble:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

.footer-nudge-bubble.is-dismissing {
  animation: footer-nudge-exit 200ms ease forwards;
}

/* Subtle halo pulse */
.footer-nudge-pulse {
  position: absolute;
  inset: -3px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  opacity: 0;
  pointer-events: none;
  animation: footer-nudge-halo 2.4s cubic-bezier(0.25, 1, 0.5, 1) infinite;
}

@keyframes footer-nudge-float {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-4px);
  }
}

@keyframes footer-nudge-pop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(8px) scale(0.4);
  }
  70% {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px) scale(1.12);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

@keyframes footer-nudge-exit {
  0% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(4px) scale(0.6);
  }
}

@keyframes footer-nudge-halo {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  60%,
  100% {
    transform: scale(1.45);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   Encouragement Modals Dialog Styling
   -------------------------------------------------------------------------- */
.nudge-dialog {
  width: min(94vw, 580px);
  max-height: min(90vh, 740px);
  box-sizing: border-box;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 24px;
  overflow: hidden;
  background: #ffffff;
  color: #172033;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.35);
  scrollbar-width: none;
}

.nudge-dialog::-webkit-scrollbar {
  display: none;
}

.nudge-dialog::backdrop {
  background: rgba(15, 23, 42, 0.58);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.nudge-dialog-shell {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 740px);
  overflow-y: auto;
}

/* Header */
.nudge-dialog-header,
.nudge-dialog header.nudge-dialog-header,
dialog.nudge-dialog header {
  position: relative;
  display: grid !important;
  grid-template-columns: 48px minmax(0, 1fr) 36px !important;
  gap: 16px !important;
  align-items: center !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  box-sizing: border-box !important;
  padding: 24px 26px 20px !important;
  color: #ffffff !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  background:
    radial-gradient(
      circle at 85% 15%,
      rgba(251, 191, 36, 0.22),
      transparent 45%
    ),
    linear-gradient(135deg, #172033 0%, #0f172a 100%);
}

.nudge-dialog-header.is-points,
.nudge-dialog header.nudge-dialog-header.is-points,
dialog.nudge-dialog header.is-points {
  background:
    radial-gradient(
      circle at 85% 15%,
      rgba(250, 204, 21, 0.28),
      transparent 45%
    ),
    linear-gradient(135deg, #0b2e23 0%, #071e17 100%);
}

.nudge-header-icon {
  display: inline-flex;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  font-size: 26px;
  line-height: 1;
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
  box-sizing: border-box;
  flex-shrink: 0;
}

.nudge-header-icon .material-symbols-outlined {
  font-size: 28px;
  font-variation-settings: 'FILL' 1;
}

.nudge-header-headings {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.nudge-header-overline {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fbbf24;
}

.nudge-header-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
  color: #ffffff;
  overflow-wrap: break-word;
}

.nudge-header-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #cbd5e1;
  overflow-wrap: break-word;
}

.nudge-dialog-close {
  display: inline-flex;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease;
  flex-shrink: 0;
}

.nudge-dialog-close:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

/* Body */
.nudge-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 26px 26px;
  background: #f8fafc;
}

/* Highlight Card */
.nudge-card-highlight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.nudge-card-highlight-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nudge-card-highlight-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nudge-card-highlight-val {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
}

.nudge-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Stats Triple Pillars (for Leaderboard/Trophy) */
.nudge-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.nudge-stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14px 8px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.nudge-stat-icon {
  font-size: 22px;
  margin-bottom: 4px;
}

.nudge-stat-icon.material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

.nudge-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.nudge-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-top: 2px;
}

/* Ways to Spend List */
.nudge-ways-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nudge-ways-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.nudge-ways-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nudge-way-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  transition:
    transform 140ms ease,
    border-color 140ms ease;
}

.nudge-way-item:hover {
  transform: translateY(-1px);
  border-color: #cbd5e1;
}

.nudge-way-icon {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f1f5f9;
  font-size: 20px;
}

.nudge-way-info strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}

.nudge-way-info p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #64748b;
}

/* Callout Box */
.nudge-callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}

.nudge-callout.is-amber {
  background: #fffbeb;
  border-color: #fef3c7;
  color: #78350f;
}

.nudge-callout-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 1px;
}

.nudge-callout-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: inherit;
}

.nudge-callout-text p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: inherit;
  opacity: 0.92;
}

.nudge-callout-text p + p {
  margin-top: 6px;
}

/* Footer Actions */
.nudge-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 6px;
}

.nudge-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    filter 160ms ease,
    background 160ms ease;
}

.nudge-btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: 0;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3);
}

.nudge-btn-primary.is-champion {
  background: linear-gradient(135deg, #172033 0%, #0f172a 100%);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
}

.nudge-btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.nudge-btn-secondary {
  background: transparent;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.nudge-btn-secondary:hover {
  background: #f1f5f9;
  color: #334155;
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .nudge-dialog {
    border-radius: 20px;
  }
  .nudge-dialog-header {
    padding: 18px 18px 16px;
  }
  .nudge-dialog-body {
    padding: 18px;
    gap: 14px;
  }
  .nudge-stats-grid {
    gap: 8px;
  }
  .nudge-stat-box {
    padding: 10px 4px;
  }
  .nudge-stat-value {
    font-size: 17px;
  }
  .nudge-dialog-actions {
    flex-direction: column;
    width: 100%;
  }
  .nudge-btn {
    width: 100%;
  }
}
