/* ============================================================================
 * BADGE
 * ============================================================================
 * Extrait de home.css lors du nettoyage pré-Bloc 3.
 * Toutes les couleurs/valeurs en dur ont été migrées vers tokens.css.
 * ============================================================================ */

/* ═══════════════════════════════════════════════════════════════
 * BADGE PROGRESS — 4 segments de progression sous l'heure
 * ═══════════════════════════════════════════════════════════════ */
.badge-progress {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 2; /* au-dessus du halo météo */
}

/* Rangée des 4 segments */
.badge-progress-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.badge-segment {
  height: 10px;
  border-radius: 999px;
  background: var(--white-soft-10);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-base) var(--ease-out);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Segment rempli — gradient lumineux marqué */
.badge-segment.done {
  background: linear-gradient(90deg, var(--green-bright) 0%, #38bdf8 60%, #4d97ff 100%);
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow:
    0 0 16px rgba(56, 189, 248, 0.7),
    0 0 4px rgba(56, 189, 248, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: segment-fill var(--duration-base) var(--ease-out);
}

@keyframes segment-fill {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

/* Segment "next" — pulse marqué pour la prochaine action */
.badge-segment.next {
  border-color: var(--accent-glow-medium);
  background: rgba(77, 151, 255, 0.16);
  animation: segment-pulse 2s ease-in-out infinite;
}

@keyframes segment-pulse {
  0%, 100% {
    box-shadow:
      inset 0 1px 2px rgba(0, 0, 0, 0.2),
      0 0 0 rgba(77, 151, 255, 0);
    border-color: var(--accent-glow-shadow);
  }
  50% {
    box-shadow:
      inset 0 1px 2px rgba(0, 0, 0, 0.2),
      0 0 16px rgba(77, 151, 255, 0.7);
    border-color: rgba(77, 151, 255, 0.8);
  }
}

/* Ligne info : label prochaine étape + compteur X/04 */
.badge-progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
}

.badge-progress-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.badge-progress-label .label-prefix {
  color: var(--text-dim);
  font-weight: 500;
}

.badge-progress-label .label-step {
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Correction #6 : compteur 0/04 supprimé — les 4 barres suffisent */

/* Quand journée terminée */
.badge-progress.done .badge-progress-label .label-step {
  color: var(--success);
}


/* ═══════════════════════════════════════════════════════════════
 * BADGER — Plus flash, animation plus marquée
 * ═══════════════════════════════════════════════════════════════ */
.badge-btn {
  height: 92px;
  border-radius: 24px;
  /* Couleurs dérivées des tokens thémables — change automatiquement avec le thème */
  background: linear-gradient(135deg,
    var(--badger-c1) 0%,
    var(--badger-c2) 25%,
    var(--badger-c3) 50%,
    var(--badger-c2) 75%,
    var(--badger-c1) 100%);
  color: #fff;
  font-size: 1.36rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  box-shadow:
    0 24px 56px var(--badger-shadow-1),
    0 8px 24px var(--badger-shadow-2),
    0 0 0 1px var(--white-soft-15),
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    inset 0 -3px 10px var(--badger-shadow-3);
  transition: transform var(--duration-fast) var(--ease-out);
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* Reflet brillant qui balaye le bouton */
.badge-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 100%);
  transform: skewX(-20deg);
  animation: badge-scan 3.5s ease-in-out infinite;
  pointer-events: none;
}

.badge-btn:active {
  transform: scale(0.985);
}

.badge-btn.done {
  background: linear-gradient(135deg, var(--success), var(--success-2));
  box-shadow:
    0 18px 44px rgba(16, 185, 129, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.badge-btn.done::after {
  display: none;
}

@keyframes pulse-badge {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 24px 56px var(--accent-glow-medium),
      0 6px 20px rgba(77, 151, 255, 0.32),
      inset 0 2px 0 rgba(255, 255, 255, 0.32),
      inset 0 -2px 8px rgba(20, 60, 140, 0.4);
  }
  50% {
    transform: scale(1.022);
    box-shadow:
      0 30px 70px rgba(77, 151, 255, 0.75),
      0 10px 28px var(--accent-glow-shadow),
      0 0 0 4px rgba(77, 151, 255, 0.18),
      inset 0 2px 0 rgba(255, 255, 255, 0.4),
      inset 0 -2px 8px rgba(20, 60, 140, 0.4);
  }
}

@keyframes badge-scan {
  0%, 80%, 100% { left: -50%; }
  40%, 50% { left: 110%; }
}

.badge-btn.pulse {
  animation: pulse-badge 1.8s ease-in-out infinite;
}


/* ═══════════════════════════════════════════════════════════════
 * BADGE EFFECT — Onde + flash quand on badge (au tap réussi)
 * ═══════════════════════════════════════════════════════════════ */

/* Conteneur du bouton doit permettre au ripple de déborder */
/* Pleine largeur — comme la card meal et les cards counter en dessous */
.badge-btn-wrap {
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
}
.badge-btn-wrap .badge-btn {
  display: block;
  width: 100%;
}

/* Flash blanc sur le bouton lui-même */
.badge-btn.flash::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  border-radius: inherit;
  animation: badge-flash 380ms ease-out forwards;
  pointer-events: none;
  z-index: 2;
}

@keyframes badge-flash {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Ondes concentriques qui partent du bouton — créées dynamiquement en JS */
.badge-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 2px solid var(--badger-c3);
  opacity: 0;
  pointer-events: none;
  animation: badge-ripple 700ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 1;
}

.badge-ripple:nth-child(2) { animation-delay: 100ms; border-color: var(--badger-c2); }
.badge-ripple:nth-child(3) { animation-delay: 200ms; border-color: var(--badger-c1); }

@keyframes badge-ripple {
  0%   { transform: scale(0.5); opacity: 0.9; border-width: 3px; }
  60%  { opacity: 0.4; }
  100% { transform: scale(8); opacity: 0; border-width: 0.5px; }
}

/* Étincelles qui s'envolent vers le haut */
.badge-spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--badger-c3);
  box-shadow: 0 0 8px var(--badger-c3);
  pointer-events: none;
  animation: badge-spark 800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  z-index: 1;
}
@keyframes badge-spark {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--spark-dx, 0), var(--spark-dy, -80px)) scale(0.2); opacity: 0; }
}
