/* Progressão Eterna 2.0 — Animações Fluidas, Spotify Integrado & Recuperação Inteligente */
@keyframes pe-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pe-dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pe-sheet-up {
  from { opacity: 0.4; transform: translateY(36px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pe-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pe-pop {
  0% { opacity: 0; transform: scale(0.75); }
  70% { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes pe-pulse-ring {
  0% { opacity: 0.9; transform: scale(0.75); }
  80%, 100% { opacity: 0; transform: scale(1.45); }
}
@keyframes pe-pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.72; }
}
@keyframes pe-heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}
@keyframes pe-complete-flash {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50% { box-shadow: 0 0 0 12px rgba(52, 211, 153, 0); }
  100% { box-shadow: none; }
}

.view-enter { animation: pe-fade-up 0.3s var(--ease) both; }
.home-layout > *, .training-block-grid > *, .catalog-list > * {
  animation: pe-fade-up 0.34s var(--ease) both;
}
.training-block-grid > :nth-child(2), .catalog-list > :nth-child(2) { animation-delay: 0.04s; }
.training-block-grid > :nth-child(3), .catalog-list > :nth-child(3) { animation-delay: 0.08s; }
.training-block-grid > :nth-child(4), .catalog-list > :nth-child(4) { animation-delay: 0.12s; }

.workout-screen.workout-start .warmup-card,
.workout-screen.workout-start .exercise-card { animation: pe-fade-up 0.36s var(--ease) both; }
.workout-screen.series-complete .rest-card { animation: pe-fade-up 0.32s var(--ease) both, pe-complete-flash 0.55s var(--ease); }

/* Abandoned / Stale Workout Recovery Modal */
.recovery-dialog { max-width: 520px; }
.recovery-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 18px;
}
.recovery-stat {
  padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft);
}
.recovery-stat span { display: block; font-size: 0.72rem; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 680; }
.recovery-stat strong { display: block; margin-top: 4px; font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.recovery-actions { display: grid; gap: 10px; margin-top: 18px; }
.recovery-actions .button { width: 100%; }

/* =========================================================
   SPOTIFY INTEGRATED WORKOUT WIDGET (PERSISTENT)
   ========================================================= */
.spotify-widget-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  width: min(400px, calc(100vw - 24px));
  pointer-events: none;
}
.spotify-widget-root > * { pointer-events: auto; }

/* Compact Mini-Bar (stays alive during workout & navigation) */
.spotify-minibar {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--spotify-line);
  border-radius: 18px;
  background: var(--surface-glass);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow-lg), var(--inset-top);
  overflow: hidden;
  animation: pe-fade-up 0.25s var(--ease) both;
}
.spotify-minibar-progress {
  position: absolute; inset: 0 0 auto 0; height: 2.5px; background: rgba(30, 215, 96, 0.16);
}
.spotify-minibar-progress > span {
  display: block; height: 100%; width: var(--sp-progress, 0%);
  background: var(--spotify); transition: width 0.4s linear;
}
.spotify-minibar-info {
  min-width: 0; flex: 1; display: flex; align-items: center; gap: 9px;
  background: transparent; padding: 2px 4px; text-align: left;
}
.spotify-minibar-badge {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px;
  display: grid; place-items: center; background: var(--spotify-soft); color: var(--spotify);
}
.spotify-minibar-badge svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.spotify-minibar-text { min-width: 0; }
.spotify-minibar-text strong { display: block; font-size: 0.8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spotify-minibar-text span { display: block; font-size: 0.68rem; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.spotify-mini-controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.sp-ctrl-btn {
  display: inline-grid; place-items: center; min-width: 36px; height: 36px; padding: 0 7px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface-soft);
  color: var(--text); font-size: 0.7rem; font-weight: 760;
  transition: transform 0.12s var(--ease), background 0.16s var(--ease);
}
.sp-ctrl-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sp-ctrl-btn.sp-play { background: var(--spotify); border-color: var(--spotify); color: #05160b; }
.sp-ctrl-btn:active { transform: scale(0.92); }

/* Expanded Spotify Drawer */
.spotify-drawer {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px;
  border: 1px solid var(--spotify-line);
  border-radius: 22px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg), var(--inset-top);
  max-height: min(80dvh, 640px);
  overflow-y: auto;
  animation: pe-dialog-in 0.24s var(--ease) both;
}
.spotify-drawer.is-collapsed { display: none; }
.spotify-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spotify-drawer-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.spotify-drawer-title strong { display: block; font-size: 0.96rem; font-weight: 740; }
.spotify-drawer-title > div > span { display: block; font-size: 0.74rem; color: var(--text-soft); }
.spotify-drawer-actions { display: flex; gap: 6px; }
.spotify-embed-shell {
  width: 100%; min-height: 152px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); background: #0c0e12;
}
.spotify-embed-shell iframe { display: block; width: 100%; border: 0; border-radius: 14px; }

.spotify-transport {
  display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 8px;
}
.spotify-transport .button { min-height: 42px; padding: 8px 10px; font-size: 0.78rem; border-radius: 12px; }
.spotify-transport .button.sp-primary { background: var(--spotify); border-color: var(--spotify); color: #05160b; font-weight: 760; }

.spotify-link-form { display: grid; gap: 8px; }
.spotify-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.spotify-link-row input { min-height: 44px; font-size: 0.86rem; padding: 8px 12px; }
.spotify-link-row .button { min-height: 44px; padding: 0 14px; font-size: 0.8rem; }

.spotify-saved-list { display: flex; flex-wrap: wrap; gap: 6px; }
.spotify-saved-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-soft);
  color: var(--text); font-size: 0.74rem; font-weight: 620;
}
.spotify-saved-chip.is-active { border-color: var(--spotify-line); background: var(--spotify-soft); color: var(--spotify); }
.spotify-saved-remove {
  background: transparent; color: var(--text-faint); padding: 0 2px; font-size: 0.85rem; line-height: 1;
}
.spotify-tip { margin: 0; font-size: 0.74rem; color: var(--text-soft); line-height: 1.5; }
.spotify-open-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-soft);
  color: var(--text); font-size: 0.78rem; font-weight: 640; text-decoration: none;
}
.spotify-open-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }

/* Positioning on mobile so it never covers bottom nav */
@media (max-width: 820px) {
  .spotify-widget-root {
    left: 10px; right: 10px; width: auto;
    bottom: calc(var(--nav-height) + 10px + env(safe-area-inset-bottom));
  }
  body.workout-active .spotify-widget-root {
    bottom: max(10px, env(safe-area-inset-bottom));
  }
  body:not(.workout-active):has(.active-workout-dock.is-visible) .spotify-widget-root:not(.is-expanded) {
    bottom: calc(var(--nav-height) + 126px + env(safe-area-inset-bottom));
  }
  .spotify-drawer { border-radius: 22px; max-height: 76dvh; }
}


/* =========================================================
   PROGRESSÃO ETERNA 3.0 — ANIMAÇÕES TÁTEIS EM TODOS OS BOTÕES
   E COMPONENTES TEMÁTICOS (SEMANA, NÍVEL, EXECUÇÃO & APOIO)
   ========================================================= */

/* Universal tactile spring feedback for EVERY interactive control */
.button,
.icon-button,
.nav-button,
.spotify-nav-btn,
.training-block-card,
.catalog-media-button,
.catalog-copy,
.catalog-chevron,
.filter-chips button,
.segmented button,
.switch,
.calendar-day,
.sp-ctrl-btn,
.spotify-saved-chip,
.spotify-open-link,
.level-option,
.frequency-option,
.workout-home-link,
.next-preview,
.day-pick-row,
.choice-chip,
.week-card-interactive,
.settings-drawer > summary,
.history-item > summary,
.guide-item > summary,
.set-options > summary {
  transition:
    transform 0.16s var(--ease-spring),
    background-color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    box-shadow 0.22s var(--ease),
    color 0.18s var(--ease),
    opacity 0.18s var(--ease);
}

.button:active,
.icon-button:active,
.nav-button:active,
.spotify-nav-btn:active,
.filter-chips button:active,
.segmented button:active,
.switch:active,
.calendar-day:active,
.sp-ctrl-btn:active,
.spotify-saved-chip:active,
.spotify-open-link:active,
.level-option:active,
.frequency-option:active,
.workout-home-link:active,
.next-preview:active,
.day-pick-row:active,
.choice-chip:active,
.week-card-interactive:active {
  transform: scale(0.965);
}

.button.primary {
  overflow: hidden;
}
.button.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.18) 50%, transparent 75%);
  transform: translateX(-120%);
  transition: transform 0.65s var(--ease);
  pointer-events: none;
}
.button.primary:hover::after {
  transform: translateX(120%);
}

.nav-button[aria-current="page"] svg {
  animation: pe-nav-pop 0.32s var(--ease-spring) both;
}
@keyframes pe-nav-pop {
  0% { transform: scale(0.82); }
  65% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.settings-drawer[open] > .settings-drawer-body,
.guide-item[open] > p,
.set-options[open] > *:not(summary),
.progression-details[open] > .progression-units {
  animation: pe-fade-up 0.24s var(--ease) both;
}

/* Interactive Week Card with 7-day preview */
.week-card-interactive {
  width: 100%;
  text-align: left;
  color: inherit;
  cursor: pointer;
  display: block;
}
.week-card-interactive:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-md), var(--inset-top);
}
.week-day-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  margin-top: 14px;
}
.week-day-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 2px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 0.66rem;
  font-weight: 680;
  color: var(--text-faint);
}
.week-day-pill i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
}
.week-day-pill.is-training {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--text);
}
.week-day-pill.is-training i {
  background: var(--accent);
}
.week-day-pill.is-done {
  border-color: color-mix(in srgb, var(--success) 48%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}
.week-day-pill.is-done i {
  background: var(--success);
}
.week-day-pill.is-today {
  box-shadow: inset 0 0 0 1.5px var(--text);
}
.week-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
  color: var(--text-soft);
}
.week-card-foot strong {
  color: var(--accent);
  font-weight: 680;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.week-card-foot strong svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}

/* Beautiful Schedule / Routine Modal (Treino vs Descanso ativo · Alongamento) */
.schedule-dialog { max-width: 520px; }
.schedule-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 0.82rem;
  color: var(--text-soft);
}
.schedule-summary-bar strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.schedule-list {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}
.day-pick-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  text-align: left;
  color: var(--text);
}
.day-pick-row:hover {
  border-color: var(--line-strong);
}
.day-pick-row[aria-pressed="true"] {
  border-color: var(--accent-line);
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--surface-soft) 80%, transparent));
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent-glow) 40%, transparent);
}
.day-pick-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.day-pick-badge {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--surface-strong);
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 760;
}
.day-pick-row[aria-pressed="true"] .day-pick-badge {
  background: var(--accent-solid);
  color: #fff;
}
.day-pick-copy strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
}
.day-pick-copy span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-soft);
  margin-top: 1px;
}
.day-pick-status {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 720;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  white-space: nowrap;
}
.day-pick-row[aria-pressed="true"] .day-pick-status {
  border-color: var(--accent-line);
  background: var(--accent-solid);
  color: #fff;
}

/* Upgraded Level Selection Cards (in theme) */
.level-card-option {
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  text-align: left;
  color: var(--text);
}
.level-card-option:hover {
  border-color: var(--line-strong);
}
.level-card-option[aria-pressed="true"] {
  border-color: var(--accent);
  background: linear-gradient(145deg, var(--accent-soft), var(--surface-soft));
  box-shadow: 0 0 0 1px var(--accent-line), 0 8px 24px color-mix(in srgb, var(--accent-glow) 35%, transparent);
}
.level-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.level-card-top strong {
  font-size: 1rem;
  font-weight: 760;
}
.level-card-desc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-soft);
  line-height: 1.48;
}
.level-metas-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.level-meta-box {
  padding: 7px 6px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}
.level-meta-box b {
  display: block;
  font-size: 0.86rem;
  font-weight: 780;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.level-meta-box span {
  display: block;
  font-size: 0.64rem;
  color: var(--text-faint);
  margin-top: 1px;
}

/* Themed Quality & Assistance Choice Chips (replaces native OS dropdowns) */
.chip-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.chip-field > span {
  font-size: 0.8rem;
  font-weight: 680;
  color: var(--text-soft);
}
.choice-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.choice-chip {
  min-height: 40px;
  padding: 8px 13px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 640;
}
.choice-chip:hover {
  border-color: var(--accent-line);
  color: var(--text);
}
.choice-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.choice-chip[data-chip-value="pain"][aria-pressed="true"] {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

/* Clean mobile settings rows (no overlapping text/controls) */
@media (max-width: 820px) {
  .setting-row {
    flex-direction: row;
    align-items: center;
  }
  .setting-row:has(.segmented) {
    align-items: flex-start;
  }
  .setting-row:has(.segmented) .setting-action {
    width: 100%;
    margin-left: 0;
  }
  .setting-row:has(.segmented) .segmented {
    width: 100%;
    grid-auto-columns: 1fr;
  }
  .level-metas-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* =========================================================
   PROGRESSÃO ETERNA 4.0 — ANIMAÇÕES FLUIDAS, FEEDBACK TÁTIL,
   CALENDÁRIO INTELIGENTE LATERAL & PERFIL PREMIUM
   ========================================================= */

@keyframes pe-stagger-in {
  0% { opacity: 0; transform: translateY(16px) scale(0.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pe-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(220%); }
}
@keyframes pe-float-glow {
  0%, 100% { opacity: 0.72; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}
@keyframes pe-num-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.22); color: var(--accent); }
  100% { transform: scale(1); }
}
@keyframes pe-live-blink {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 208, 63, 0.55); }
  50% { opacity: 0.75; transform: scale(1.18); box-shadow: 0 0 0 6px rgba(244, 208, 63, 0); }
}
@keyframes pe-spark-fly {
  0% { opacity: 1; transform: translate(-50%, -50%) translate(0, 0) scale(1) rotate(0deg); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) translate(var(--tx, 0px), var(--ty, -60px)) scale(0.35) rotate(var(--rot, 180deg)); }
}
@keyframes pe-float-badge {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.85); }
  20% { opacity: 1; transform: translate(-50%, -14px) scale(1.05); }
  80% { opacity: 1; transform: translate(-50%, -34px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -52px) scale(0.95); }
}
@keyframes pe-ring-breathe {
  0%, 100% { filter: drop-shadow(0 0 10px var(--accent-glow)); }
  50% { filter: drop-shadow(0 0 22px var(--accent-glow)); }
}
@keyframes pe-card-slide {
  from { opacity: 0; transform: translateX(12px) scale(0.99); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

/* Vibrant ambient depth & staggered entrances across every view */
.view-enter > * {
  animation: pe-stagger-in 0.4s var(--ease) both;
}
.view-enter > :nth-child(2) { animation-delay: 0.05s; }
.view-enter > :nth-child(3) { animation-delay: 0.1s; }
.view-enter > :nth-child(4) { animation-delay: 0.15s; }
.view-enter > :nth-child(5) { animation-delay: 0.2s; }

.quick-metrics > *,
.history-list > *,
.progress-list > *,
.warmup-list > * {
  animation: pe-stagger-in 0.36s var(--ease) both;
}
.quick-metrics > :nth-child(2), .warmup-list > :nth-child(2), .history-list > :nth-child(2) { animation-delay: 0.05s; }
.quick-metrics > :nth-child(3), .warmup-list > :nth-child(3), .history-list > :nth-child(3) { animation-delay: 0.1s; }
.history-list > :nth-child(4) { animation-delay: 0.14s; }

.home-hero::after {
  content: "";
  position: absolute;
  top: -60px; right: -50px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  pointer-events: none;
  animation: pe-float-glow 5s ease-in-out infinite;
}

/* Shimmering alive progress bars */
.progress-track > span,
.week-segment.done,
.rest-progress > span {
  position: relative;
  overflow: hidden;
}
.progress-track > span::after,
.week-segment.done::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  animation: pe-shimmer 2.6s var(--ease) infinite;
}

/* Vibrant hover lift on cards */
.metric-card,
.week-card,
.recommendation,
.catalog-card,
.history-item {
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), box-shadow 0.24s var(--ease);
}
@media (hover: hover) {
  .metric-card:hover,
  .catalog-card:hover,
  .history-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-line);
    box-shadow: var(--shadow-md), var(--inset-top);
  }
}

.metric-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%),
    var(--surface);
}
.metric-card .metric-value {
  background: linear-gradient(135deg, var(--text), color-mix(in srgb, var(--accent) 40%, var(--text)));
  -webkit-background-clip: text;
  background-clip: text;
}

/* Counter pop animation */
.is-popping {
  animation: pe-num-pop 0.28s var(--ease-spring);
}

/* Live Workout Session Clock with Pulsing Dot */
.session-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pe-live-blink 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
.session-time.is-paused .session-live-dot {
  background: var(--warning);
  animation: none;
  box-shadow: none;
}
.workout-screen .exercise-card,
.workout-screen .rest-card,
.workout-screen .summary-card {
  animation: pe-stagger-in 0.34s var(--ease) both;
}
.rest-ring-progress {
  animation: pe-ring-breathe 2.6s ease-in-out infinite;
}

/* Celebration Particle Burst Layer */
.pe-celebration-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  overflow: hidden;
}
.pe-spark {
  position: fixed;
  width: var(--sz, 8px);
  height: var(--sz, 8px);
  border-radius: var(--br, 3px);
  background: var(--clr, #f4d03f);
  box-shadow: 0 0 10px var(--clr, #f4d03f);
  animation: pe-spark-fly var(--dur, 0.72s) var(--ease) forwards;
}
.pe-float-pill {
  position: fixed;
  padding: 7px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--success), #16a34a);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 28px rgba(22, 163, 74, 0.42);
  white-space: nowrap;
  animation: pe-float-badge 1.05s var(--ease) forwards;
}

/* =========================================================
   CALENDÁRIO INTELIGENTE + PAINEL LATERAL INTERATIVO (EVOLUÇÃO)
   ========================================================= */
.calendar-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(280px, 0.88fr);
  gap: 18px;
  align-items: start;
  margin-top: 20px;
}
.calendar-card {
  padding: clamp(18px, 2.4vw, 24px);
}
.calendar-day {
  position: relative;
  min-height: 52px;
  border-radius: 13px;
  font-weight: 700;
}
.calendar-day:hover {
  border-color: var(--accent-line);
  background: var(--surface-strong);
  transform: translateY(-1px);
}
.calendar-day.is-selected {
  border-color: var(--accent) !important;
  background: linear-gradient(145deg, var(--accent-soft), color-mix(in srgb, var(--surface-soft) 70%, transparent)) !important;
  box-shadow: 0 0 0 2px var(--accent-line), 0 6px 18px color-mix(in srgb, var(--accent-glow) 35%, transparent);
  color: var(--text) !important;
}
.calendar-day.concluído.is-selected {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 45%, transparent);
}
.calendar-day-dot {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 2px;
  background: transparent;
}
.calendar-day.concluído .calendar-day-dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.calendar-day.parcial .calendar-day-dot { background: var(--warning); }
.calendar-day.previsto .calendar-day-dot { background: var(--accent); opacity: 0.75; }

.calendar-legend-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 14px 0 12px;
  font-size: 0.74rem;
  color: var(--text-soft);
}
.calendar-legend-pills span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.calendar-legend-pills i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Compact Side/Inline Day Detail Card */
.day-inspector-card {
  padding: clamp(18px, 2.4vw, 24px);
  display: grid;
  gap: 14px;
  border-color: var(--line-strong);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%),
    var(--surface);
  animation: pe-card-slide 0.28s var(--ease) both;
}
.day-inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.day-inspector-head h3 {
  margin: 2px 0 0;
  font-size: 1.15rem;
  font-weight: 760;
  text-transform: capitalize;
}
.day-inspector-sub {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.55;
}
.day-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.day-stat-pill {
  padding: 11px 10px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  text-align: center;
}
.day-stat-pill strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.day-stat-pill span {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  color: var(--text-faint);
  font-weight: 600;
}
.day-rest-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}
.day-rest-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--success-soft);
  color: var(--success);
}
.day-rest-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.day-rest-box strong {
  display: block;
  font-size: 0.94rem;
}
.day-rest-box > div > span {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* Well-spaced Reschedule Box (never glued to the date input!) */
.day-reschedule-box {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  margin-top: 2px;
  border-top: 1px solid var(--line);
}
.day-reschedule-box .field {
  margin: 0;
}
.day-reschedule-box .button {
  width: 100%;
  margin-top: 2px;
}

.day-session-details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.day-session-details > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 680;
  color: var(--accent);
  list-style: none;
}
.day-session-details > summary::-webkit-details-marker { display: none; }
.day-session-details .history-results {
  margin-top: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

/* =========================================================
   PERFIL HERO PREMIUM & TROCA DE FOTO EM 1 TOQUE (MAIS)
   ========================================================= */
.profile-hero-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: clamp(20px, 3vw, 28px);
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
  background:
    radial-gradient(circle at 95% 10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    var(--surface);
}
.profile-avatar-trigger {
  position: relative;
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring);
}
.profile-avatar-trigger:hover { transform: scale(1.04); }
.profile-avatar-trigger:active { transform: scale(0.94); }
.profile-avatar-trigger .profile-avatar {
  width: 84px;
  height: 84px;
  font-size: 1.65rem;
  border: 2.5px solid var(--accent);
  box-shadow: 0 10px 28px var(--accent-glow);
}
.profile-avatar-cam {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-solid));
  border: 2.5px solid var(--surface);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.profile-avatar-cam svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
}
.profile-hero-info {
  min-width: 0;
  flex: 1;
}
.profile-hero-info h2 {
  margin: 0 0 4px;
  font-size: 1.32rem;
  font-weight: 780;
}
.profile-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}
.profile-hero-hint {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* Mobile Responsive Refinements for Calendar Workspace & Profile Hero */
@media (max-width: 860px) {
  .calendar-workspace {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .profile-hero-card {
    flex-direction: column;
    text-align: center;
    gap: 14px;
  }
  .profile-hero-meta,
  .profile-hero-card .profile-actions {
    justify-content: center;
  }
}


/* =========================================================
   PROGRESSÃO ETERNA 4.1 — MOTOR DE ANIMAÇÕES INTERATIVAS
   (RIPPLE EM BOTÕES, TRANSIÇÕES DE TREINO, BARRA DE PROGRESSO
   ANIMADA E ENTRADA DE EXERCÍCIOS)
   ========================================================= */

/* 1. Interactive Click/Tap Ripple Wave on ALL buttons & interactive cards */
.pe-ripple-host {
  position: relative;
  overflow: hidden;
}
.pe-ripple-wave {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.44) 0%, rgba(255, 255, 255, 0.16) 55%, transparent 72%);
  animation: pe-ripple-expand 0.56s var(--ease) forwards;
  z-index: 4;
}
:root[data-theme="light"] .button.secondary .pe-ripple-wave,
:root[data-theme="light"] .button.text .pe-ripple-wave,
:root[data-theme="light"] .icon-button .pe-ripple-wave,
:root[data-theme="light"] .calendar-day .pe-ripple-wave {
  background: radial-gradient(circle, rgba(186, 140, 12, 0.22) 0%, rgba(237, 203, 67, 0.12) 55%, transparent 72%);
}
@keyframes pe-ripple-expand {
  0% { opacity: 0.95; transform: translate(-50%, -50%) scale(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* Crisp press bounce for buttons */
.button.pe-tap-pop,
.icon-button.pe-tap-pop {
  animation: pe-btn-rebound 0.34s var(--ease-spring);
}
@keyframes pe-btn-rebound {
  0% { transform: scale(1); }
  35% { transform: scale(0.94); }
  75% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

/* 2. Workout Launch ("Começar treino") Cinematic Entrance */
.workout-screen.workout-start {
  animation: pe-workout-bg-in 0.42s var(--ease) both;
}
.workout-screen.workout-start .workout-top {
  animation: pe-slide-down 0.38s var(--ease) both;
}
.workout-screen.workout-start .workout-progress {
  animation: pe-fade-up 0.4s var(--ease) 0.06s both;
}
.workout-screen.workout-start .warmup-card,
.workout-screen.workout-start .exercise-card {
  animation: pe-workout-launch 0.52s var(--ease) 0.08s both;
}
@keyframes pe-workout-bg-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes pe-slide-down {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pe-workout-launch {
  0% { opacity: 0; transform: translateY(28px) scale(0.95); }
  70% { opacity: 1; transform: translateY(-3px) scale(1.006); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 3. Forward Slide into Next Set (Warmup -> Set 1 & "Pular descanso" -> Next Set) */
.workout-screen.set-enter .exercise-card {
  animation: pe-slide-in-right 0.44s var(--ease) both;
}
.workout-screen.rest-skipped .exercise-card {
  animation: pe-turbo-enter 0.42s var(--ease) both;
}
.workout-screen.rest-skipped .target-box,
.workout-screen.set-enter .target-box {
  animation: pe-target-pop 0.5s var(--ease-spring) 0.12s both;
}
@keyframes pe-slide-in-right {
  0% { opacity: 0; transform: translateX(34px) scale(0.975); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes pe-turbo-enter {
  0% { opacity: 0; transform: translateX(48px) scale(0.96); filter: brightness(1.15); }
  65% { opacity: 1; transform: translateX(-4px) scale(1.008); filter: brightness(1.04); }
  100% { opacity: 1; transform: translateX(0) scale(1); filter: brightness(1); }
}
@keyframes pe-target-pop {
  0% { opacity: 0.7; transform: scale(0.94); }
  60% { opacity: 1; transform: scale(1.03); box-shadow: 0 0 0 6px var(--accent-soft); }
  100% { opacity: 1; transform: scale(1); box-shadow: none; }
}

/* 4. Set Completed ("Fiz as repetições" / "Anotar série") -> Rest / Summary Transition */
.workout-screen.series-complete .rest-card {
  animation: pe-rest-arrive 0.46s var(--ease) both, pe-complete-flash 0.7s var(--ease);
}
.workout-screen.series-complete .rest-ring-wrap {
  animation: pe-pop 0.52s var(--ease-spring) 0.08s both;
}
.workout-screen.series-complete .summary-card {
  animation: pe-workout-launch 0.52s var(--ease) both, pe-complete-flash 0.8s var(--ease);
}
@keyframes pe-rest-arrive {
  0% { opacity: 0; transform: translateY(20px) scale(0.955); }
  70% { opacity: 1; transform: translateY(-2px) scale(1.008); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Rest Timer +/-30s Adjustment Pulse */
.rest-card.is-adjusted .rest-timer {
  animation: pe-num-pop 0.34s var(--ease-spring);
}

/* 5. Dynamic Animated Workout Progress Bar (grows from previous % to new %) */
.workout-progress .progress-track {
  position: relative;
  height: 9px;
  overflow: visible;
  border-radius: 999px;
  background: var(--surface-strong);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.28);
}
.workout-progress .progress-track > span {
  position: relative;
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-solid), var(--accent), #fff099);
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 0.68s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.workout-progress .progress-track > span::before {
  content: "";
  position: absolute;
  top: 50%;
  right: -3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px 2px var(--accent), 0 0 18px 4px var(--accent-glow);
  transform: translateY(-50%) scale(0);
  opacity: 0;
  transition: transform 0.25s var(--ease-spring), opacity 0.25s var(--ease);
}
.workout-progress .progress-track.has-fill > span::before {
  transform: translateY(-50%) scale(0.85);
  opacity: 0.9;
}
.workout-progress .progress-track.is-advancing > span {
  box-shadow: 0 0 20px var(--accent), 0 0 34px var(--accent-glow);
}
.workout-progress .progress-track.is-advancing > span::before {
  transform: translateY(-50%) scale(1.35);
  opacity: 1;
}
.workout-progress .progress-track.is-complete > span {
  background: linear-gradient(90deg, #16a34a, var(--success), #6ee7b7);
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.55);
}
.workout-progress .progress-track.is-complete > span::before {
  background: #ffffff;
  box-shadow: 0 0 12px 3px var(--success);
}
.workout-progress-label.is-popping {
  animation: pe-num-pop 0.42s var(--ease-spring);
}

/* 6. Entering an Exercise (Video Modal, Preview Modal & Catalog Accordion) */
.video-overlay.pe-exercise-overlay {
  animation: pe-overlay-fade 0.24s var(--ease) both;
}
@keyframes pe-overlay-fade {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to { opacity: 1; backdrop-filter: blur(12px); }
}
.video-dialog.pe-exercise-enter,
.preview-dialog.pe-exercise-enter {
  animation: pe-exercise-modal-in 0.38s var(--ease) both;
}
@keyframes pe-exercise-modal-in {
  0% { opacity: 0; transform: translateY(28px) scale(0.92); }
  70% { opacity: 1; transform: translateY(-2px) scale(1.006); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.video-dialog.pe-exercise-enter .video-player {
  animation: pe-video-reveal 0.44s var(--ease) 0.06s both;
}
@keyframes pe-video-reveal {
  0% { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}
.video-dialog.pe-exercise-enter .video-guidance > h3 {
  animation: pe-fade-up 0.34s var(--ease) 0.12s both;
}
.video-dialog.pe-exercise-enter .guidance-grid > *,
.catalog-card.expanded .guidance-grid > * {
  animation: pe-stagger-in 0.34s var(--ease) both;
}
.video-dialog.pe-exercise-enter .guidance-grid > :nth-child(2),
.catalog-card.expanded .guidance-grid > :nth-child(2) { animation-delay: 0.06s; }
.video-dialog.pe-exercise-enter .guidance-grid > :nth-child(3),
.catalog-card.expanded .guidance-grid > :nth-child(3) { animation-delay: 0.12s; }
.video-dialog.pe-exercise-enter .guidance-grid > :nth-child(4),
.catalog-card.expanded .guidance-grid > :nth-child(4) { animation-delay: 0.18s; }

.catalog-card.expanded .catalog-detail {
  animation: pe-accordion-open 0.32s var(--ease) both;
  transform-origin: top center;
}
@keyframes pe-accordion-open {
  0% { opacity: 0; transform: translateY(-8px) scaleY(0.96); }
  100% { opacity: 1; transform: translateY(0) scaleY(1); }
}

/* Mobile bottom-sheet hero enter for exercise modal */
@media (max-width: 820px) {
  .video-dialog.pe-exercise-enter {
    animation: pe-exercise-sheet-in 0.36s var(--ease) both;
  }
  @keyframes pe-exercise-sheet-in {
    0% { opacity: 0.35; transform: translateY(56px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
  }
}


/* =========================================================
   PROGRESSÃO ETERNA 4.2 — FÍSICA NATIVA & FLUIDEZ TOTAL
   (ONDA PERSISTENTE DE TOQUE, SAÍDA DE MODAIS, INDICADOR
   DESLIZANTE NA BARRA E TRANSIÇÕES SUAVES ENTRE TELAS)
   ========================================================= */

/* 1. Persistent Touch Layer (never cut off when a screen re-renders!) */
.pe-touch-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 600;
  overflow: hidden;
}
.pe-global-ripple {
  position: fixed;
  width: var(--r-size, 96px);
  height: var(--r-size, 96px);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0.15);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.42) 0%, rgba(244, 208, 63, 0.26) 46%, transparent 72%);
  box-shadow: 0 0 18px rgba(244, 208, 63, 0.24);
  animation: pe-global-wave 0.56s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
:root[data-theme="light"] .pe-global-ripple {
  background: radial-gradient(circle, rgba(186, 140, 12, 0.26) 0%, rgba(237, 203, 67, 0.14) 50%, transparent 74%);
}
@keyframes pe-global-wave {
  0% { opacity: 0.95; transform: translate(-50%, -50%) scale(0.15); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.45); }
}

/* Tactile Press & Rebound on EVERY interactive control */
.pe-is-pressing {
  transform: scale(0.955) !important;
  filter: brightness(1.06);
}
.pe-tap-pop {
  animation: pe-btn-rebound 0.36s cubic-bezier(0.34, 1.45, 0.64, 1);
}

/* 2. Smooth Modal & Bottom-Sheet Exit Animation */
.overlay.is-closing {
  animation: pe-overlay-out 0.2s cubic-bezier(0.4, 0, 1, 1) forwards !important;
  pointer-events: none;
}
.overlay.is-closing .dialog {
  animation: pe-dialog-out 0.2s cubic-bezier(0.4, 0, 1, 1) forwards !important;
}
@keyframes pe-overlay-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes pe-dialog-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(16px) scale(0.96); }
}
@media (max-width: 820px) {
  .overlay.is-closing .dialog {
    animation: pe-sheet-out 0.21s cubic-bezier(0.4, 0, 1, 1) forwards !important;
  }
  @keyframes pe-sheet-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(44px); }
  }
}

/* 3. Sliding Pill Indicator on Mobile Bottom Nav & Desktop Sidebar */
.desktop-nav {
  position: relative;
}
.nav-sliding-pill {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent-glow) 32%, transparent);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition:
    transform 0.36s cubic-bezier(0.34, 1.32, 0.64, 1),
    width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease;
}
.mobile-bottom-nav .nav-button,
.desktop-nav .nav-button {
  position: relative;
  z-index: 1;
}
.mobile-bottom-nav.has-sliding-pill .nav-button[aria-current="page"],
.desktop-nav.has-sliding-pill .nav-button[aria-current="page"] {
  background: transparent !important;
  box-shadow: none !important;
}

/* 4. View Transitions API crossfade + subtle glide */
::view-transition-old(root) {
  animation: pe-vt-out 0.16s cubic-bezier(0.4, 0, 1, 1) both;
}
::view-transition-new(root) {
  animation: pe-vt-in 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes pe-vt-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-4px); }
}
@keyframes pe-vt-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}


/* =========================================================
   PROGRESSÃO ETERNA 4.3 — WHOOSH + FADE EM TODAS AS TELAS,
   DESTAQUE AO ABRIR O TREINO & RESPOSTA TÁTIL COMPLETA
   ========================================================= */

/* Smooth theme crossfade across surfaces */
body,
.card,
.desktop-sidebar,
.mobile-bottom-nav,
.button,
.icon-button,
.setting-row,
.day-pick-row,
.level-card-option,
.choice-chip,
.calendar-day {
  transition:
    transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1),
    background-color 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.26s cubic-bezier(0.22, 1, 0.36, 1),
    color 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Comfortable desktop hover lift on every button */
@media (hover: hover) {
  .button:not(:disabled):hover {
    transform: translateY(-2px);
  }
  .button.primary:not(:disabled):hover {
    box-shadow: 0 14px 34px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  .button.secondary:not(:disabled):hover {
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
  }
  .icon-button:not(:disabled):hover {
    transform: translateY(-1.5px);
  }
}

/* 1. Unmistakable Whoosh + Fade View Transition (PC & Mobile) */
#view-root.view-leaving {
  opacity: 0;
  transform: translateY(-12px) scale(0.99);
  filter: blur(3px);
  transition:
    opacity 0.14s cubic-bezier(0.4, 0, 1, 1),
    transform 0.14s cubic-bezier(0.4, 0, 1, 1),
    filter 0.14s ease;
  pointer-events: none;
}

.view-enter {
  animation: pe-whoosh-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes pe-whoosh-in {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.985);
    filter: blur(5px);
  }
  65% {
    opacity: 1;
    filter: blur(0px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0px);
  }
}

/* Staggered cascade for children inside every page */
.view-enter > * {
  animation: pe-stagger-in 0.44s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.view-enter > :nth-child(1) { animation-delay: 0.02s; }
.view-enter > :nth-child(2) { animation-delay: 0.07s; }
.view-enter > :nth-child(3) { animation-delay: 0.12s; }
.view-enter > :nth-child(4) { animation-delay: 0.17s; }
.view-enter > :nth-child(5) { animation-delay: 0.22s; }

/* Spotlight accent glow when arriving via "Ver meu treino" */
.pe-card-spotlight {
  animation: pe-stagger-in 0.44s cubic-bezier(0.22, 1, 0.36, 1) both, pe-spotlight-glow 1.15s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}
@keyframes pe-spotlight-glow {
  0% {
    border-color: var(--accent);
    box-shadow: 0 0 0 0 var(--accent-glow), var(--shadow-md);
  }
  35% {
    border-color: var(--accent);
    box-shadow: 0 0 0 5px var(--accent-soft), 0 16px 42px var(--accent-glow);
  }
  100% {
    border-color: var(--line);
    box-shadow: var(--shadow-sm), var(--inset-top);
  }
}

/* Calendar month slide animations */
.calendar-grid.pe-cal-prev {
  animation: pe-cal-from-left 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.calendar-grid.pe-cal-next {
  animation: pe-cal-from-right 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes pe-cal-from-left {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes pe-cal-from-right {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Pause / Resume smooth state transition inside workout */
.workout-screen.is-toggling-pause .exercise-card,
.workout-screen.is-toggling-pause .rest-card {
  animation: pe-pause-pulse 0.34s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.paused-banner {
  animation: pe-slide-down 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes pe-pause-pulse {
  0% { transform: scale(1); }
  45% { transform: scale(0.985); }
  100% { transform: scale(1); }
}


/* Shape em Casa Gold Accent Overrides for PE 4.4 Release Layer */
.rest-ring-progress {
  stroke: var(--accent-solid);
}
.choice-chip[data-chip-value="controlled"][aria-pressed="true"],
.choice-chip[data-chip-value="easy"][aria-pressed="true"] {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
  box-shadow: none;
}
.pe-float-pill.is-gold {
  background: linear-gradient(135deg, #f0ca38, #f7df6e);
  color: #141108;
  box-shadow: 0 10px 28px var(--accent-glow);
}
.calendar-day.is-done .calendar-day-dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.calendar-day.is-partial .calendar-day-dot { background: var(--warning); }
.calendar-day.is-planned .calendar-day-dot { background: var(--accent); opacity: 0.85; }
.calendar-day.is-done.is-selected {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 45%, transparent);
}


/* ==========================================================================
   FIX MOBILE DEFINITIVO — BARRA DE ABAS SEMPRE FIXA + TOQUES SUTIS NO CELULAR
   ========================================================================== */

/* 1. Keep Bottom Navigation Bar ALWAYS fixed & visible on mobile (never scroll to find it!) */
@media (max-width: 820px) {
  .mobile-bottom-nav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    z-index: 60 !important;
    width: 100% !important;
    transform: none !important;
  }
  body:not(.workout-active) main {
    padding-bottom: calc(var(--nav-height, 76px) + 28px + env(safe-area-inset-bottom)) !important;
  }
}

/* 2. Remove exaggerated touch/scroll animations on mobile — keep ONLY subtle tab fades! */
@media (max-width: 820px), (hover: none), (pointer: coarse) {
  .pe-touch-layer,
  .pe-global-ripple {
    display: none !important;
    animation: none !important;
  }
  .pe-is-pressing,
  .pe-tap-pop {
    transform: none !important;
    filter: none !important;
    animation: none !important;
  }
  /* No jumpy scale/bounce when resting a finger or scrolling over cards, videos, or buttons */
  .card:active,
  .catalog-card:active,
  .catalog-media-button:active,
  .catalog-copy:active,
  .catalog-chevron:active,
  .training-block-card:active,
  .shape-ex-card:active,
  .shape-routine-row:active,
  .shape-ab-card:active,
  .shape-workout-photo:active,
  .week-card-interactive:active,
  .level-card-option:active,
  .day-pick-row:active,
  .pdf-row-btn:active,
  .calendar-day:active,
  .button:active,
  .icon-button:active,
  .nav-button:active,
  .filter-chips button:active,
  .segmented button:active,
  .choice-chip:active {
    transform: none !important;
    filter: none !important;
  }
  .card:hover,
  .shape-ex-card:hover,
  .shape-routine-row:hover,
  .shape-ab-card:hover,
  .shape-ex-card:hover .shape-ex-photo img,
  .shape-routine-row:hover .shape-routine-thumb img,
  .shape-ab-card:hover .shape-ab-bg img {
    transform: none !important;
  }
  /* Ultra-subtle, smooth tab transitions only (no blur, no heavy slide/stagger) */
  #view-root.view-leaving {
    opacity: 0 !important;
    transform: none !important;
    filter: none !important;
    transition: opacity 0.11s ease !important;
  }
  .view-enter {
    animation: mobile-subtle-fade 0.2s cubic-bezier(0.22, 1, 0.36, 1) both !important;
  }
  .view-enter > * {
    animation: none !important;
  }
  .pe-card-spotlight {
    animation: none !important;
  }
  @keyframes mobile-subtle-fade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
  }
}


/* ==========================================================================
   V5.0 / V3.0 — ERGONOMIA DA TELA DE TREINO NO CELULAR (RESPIRO + CLAREZA)
   ========================================================================== */

/* Subtle, compact video pill that never covers the exercise image */
.exercise-media-overlay,
.shape-video-pill {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(8, 9, 12, 0.74);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.exercise-media-overlay svg,
.shape-video-pill svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
  stroke: currentColor;
  flex-shrink: 0;
}

/* Clear, high-visibility Quick-Feel Card (Concluir série em 1 toque) */
.quick-feel-card {
  display: grid;
  gap: 12px;
  padding: 16px 14px;
  border-radius: 18px;
  border: 1px solid var(--accent-line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 55%, var(--surface-soft)), var(--surface-soft));
  box-shadow: var(--shadow-sm);
}
.quick-feel-head {
  display: grid;
  gap: 4px;
  text-align: center;
}
.quick-feel-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 760;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.quick-feel-sub {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 660;
  color: var(--accent);
  line-height: 1.35;
}
.quick-feel-grid {
  gap: 10px !important;
}
.quick-feel-btn {
  min-height: 68px !important;
  padding: 11px 6px !important;
  gap: 4px !important;
  border-radius: 14px !important;
}
.quick-feel-btn strong {
  font-size: 0.85rem !important;
}
.quick-feel-btn span {
  font-size: 0.71rem !important;
}
.quick-feel-adaptive-note {
  margin: 2px 4px 0;
  font-size: 0.74rem;
  line-height: 1.42;
  color: var(--text-soft);
  text-align: center;
}

/* Clear, unmistakable secondary drawer for custom reps / assistance / pain */
.adjust-drawer {
  margin-top: 2px !important;
  border-radius: 16px !important;
  border: 1px solid var(--line-strong) !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-sm);
}
.adjust-drawer > summary {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 14px 15px !important;
  color: var(--text) !important;
  cursor: pointer;
}
.adjust-drawer-copy {
  display: grid;
  gap: 3px;
  text-align: left;
  min-width: 0;
}
.adjust-drawer-title {
  font-size: 0.86rem;
  font-weight: 720;
  color: var(--text);
  line-height: 1.3;
}
.adjust-drawer-hint {
  font-size: 0.75rem;
  font-weight: 520;
  color: var(--text-soft);
  line-height: 1.35;
}
.adjust-drawer > summary::after {
  content: "Ajustar ▾" !important;
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  font-size: 0.73rem !important;
  font-weight: 720;
  color: var(--accent) !important;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.adjust-drawer[open] > summary::after {
  content: "Fechar ▴" !important;
  transform: none !important;
}
.adjust-drawer-body {
  padding: 8px 15px 16px !important;
  gap: 14px !important;
  border-top: 1px solid var(--line);
}

/* Mobile-specific breathing room (Galaxy S23 & all mobile screens) */
@media (max-width: 820px) {
  .workout-screen {
    padding: max(14px, env(safe-area-inset-top)) 14px max(96px, calc(84px + env(safe-area-inset-bottom))) !important;
  }
  .workout-top {
    gap: 8px !important;
    margin-bottom: 14px !important;
  }
  .exercise-card,
  .rest-card,
  .intro-card,
  .summary-card {
    padding: 22px 18px !important;
    border-radius: 22px !important;
  }
  .exercise-card h1 {
    margin: 12px 0 6px !important;
    line-height: 1.15;
  }
  .exercise-subtitle {
    margin-bottom: 18px !important;
  }
  .workout-layout {
    gap: 20px !important;
  }
  .workout-media {
    grid-template-columns: 122px minmax(0, 1fr) !important;
    gap: 8px 14px !important;
    align-items: start !important;
  }
  .exercise-media-overlay,
  .shape-video-pill {
    right: 6px !important;
    bottom: 6px !important;
    min-height: 21px !important;
    padding: 0 7px !important;
    gap: 4px !important;
    font-size: 0.62rem !important;
  }
  .exercise-media-overlay svg,
  .shape-video-pill svg {
    width: 9px !important;
    height: 9px !important;
  }
  .target-box {
    margin-bottom: 18px !important;
    padding: 15px 16px !important;
  }
  .actual-entry {
    gap: 14px !important;
    margin-bottom: 16px !important;
  }
  .workout-secondary-row {
    gap: 10px !important;
    margin-top: 14px !important;
  }
}

@media (max-width: 360px) {
  .workout-media {
    grid-template-columns: 104px minmax(0, 1fr) !important;
  }
}

/* Shape em Casa: let 16:9 workout photo breathe cleanly above cue on mobile */
@media (max-width: 820px) {
  .workout-media {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
  }
  .shape-workout-photo {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    border-radius: 16px !important;
  }
  .workout-direct-cue {
    margin: 0 !important;
    padding: 12px 14px !important;
    font-size: 0.86rem !important;
    line-height: 1.5 !important;
  }
  .shape-video-pill {
    right: 10px !important;
    bottom: 10px !important;
    min-height: 26px !important;
    padding: 0 10px !important;
    font-size: 0.7rem !important;
  }
  .shape-video-pill svg {
    width: 11px !important;
    height: 11px !important;
  }
}
