/* ===== MOVA — tema web (espelha o app Flutter) ===== */
:root {
  --primary: #B7E61D;
  --primary-2: #89D200;
  --bg: #0B0F14;
  --card: #171C23;
  --elevated: #1E2530;
  --muted: #A5AAB2;
  --stroke: #2A3040;
  --danger: #FF4D4D;
  --success: #22C55E;
  --warning: #FACC15;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: #fff;
  overscroll-behavior: none;
}

/* Fundo global: bg.png + overlay preto 60% (igual ao MovaBg) */
#bg-layer {
  position: fixed; inset: 0; z-index: -2;
  background: url("../assets/bg.jpg") center/cover no-repeat;
}
#bg-overlay { position: fixed; inset: 0; z-index: -1; background: rgba(0,0,0,.60); }

#app { min-height: 100%; display: flex; flex-direction: column; }
.screen {
  flex: 1; display: flex; flex-direction: column;
  max-width: 480px; width: 100%; margin: 0 auto; padding: 24px;
  animation: fadeSlide .4s ease both;
}
@keyframes fadeSlide { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.spacer { flex: 1; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

h1 { font-size: 30px; font-weight: 900; margin: 0 0 6px; }
h2 { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.sub { color: var(--muted); line-height: 1.5; margin: 0 0 18px; }
.muted { color: var(--muted); }
.green { color: var(--primary); }

/* Cartões */
.card {
  background: rgba(23,28,35,.60);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
.card.tap { cursor: pointer; transition: transform .12s ease, border-color .2s; }
.card.tap:active { transform: scale(.98); }
.card.sel { border-color: var(--primary); background: rgba(183,230,29,.14); }

/* Inputs */
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input, textarea, select {
  width: 100%; padding: 14px; border-radius: 10px;
  background: var(--elevated); border: 1px solid var(--stroke);
  color: #fff; font-size: 16px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); }
.token-input {
  text-align: center; font-size: 28px; font-weight: 900; letter-spacing: 10px;
}

/* Botões */
.btn {
  width: 100%; padding: 15px; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 900; letter-spacing: .3px; cursor: pointer;
  color: #0B0F14; background: linear-gradient(135deg, #CFF63A, var(--primary-2));
  box-shadow: 0 3px 10px rgba(183,230,29,.25);
  transition: transform .12s ease, box-shadow .2s ease;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: scale(.96); box-shadow: 0 6px 22px rgba(183,230,29,.5); }
.btn:disabled { background: #ffffff1f; color: #ffffff4d; box-shadow: none; cursor: default; }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); box-shadow: none; }
.btn.sm { width: auto; padding: 10px 16px; font-size: 13px; }
.link { color: var(--primary); font-weight: 800; cursor: pointer; }

.error { color: var(--danger); font-size: 13px; margin: 8px 0 0; min-height: 16px; }
.hidden { display: none !important; }

/* Splash */
.hero-img {
  width: calc(100% + 48px); max-width: none; margin: 0 -24px -14px; display: block;
  transform-origin: center bottom;
  animation: breathe 7s ease-in-out infinite;
  filter: drop-shadow(0 12px 34px rgba(0,0,0,.6));
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.dots { display: flex; gap: 6px; justify-content: center; margin: 10px 0; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: #ffffff4d; transition: width .3s; }
.dot.on { width: 26px; background: var(--primary); }

/* Logo */
.brand { font-size: 26px; font-weight: 900; letter-spacing: 2px; }
.brand .x { color: var(--primary); }

/* Topbar + bottom nav */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.topbar h2 { margin: 0; }
.nav {
  position: sticky; bottom: 0; display: flex; justify-content: space-around;
  background: rgba(0,0,0,.55); backdrop-filter: blur(8px);
  border-top: 1px solid var(--stroke); padding: 10px 0;
  max-width: 480px; width: 100%; margin: 0 auto;
}
.nav button { background: none; border: none; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.nav button.on { color: var(--primary); }
.nav .ico { font-size: 20px; }

/* Badges / status */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 800; }
.badge.ativo { background: rgba(34,197,94,.18); color: var(--success); }
.badge.pendente { background: rgba(250,204,21,.18); color: var(--warning); }

/* Chat */
.chat-wrap { flex: 1; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding-bottom: 8px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.35; }
.msg.aluno { align-self: flex-end; background: linear-gradient(135deg,#CFF63A,var(--primary-2)); color: #0B0F14; border-bottom-right-radius: 4px; }
.msg.adm { align-self: flex-start; background: var(--elevated); border: 1px solid var(--stroke); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding-top: 8px; }
.chat-input input { flex: 1; }
.chat-input button { width: 52px; }

/* Exercícios */
.ex { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--stroke); }
.ex:last-child { border-bottom: none; }
.ex .n { width: 28px; height: 28px; border-radius: 8px; background: rgba(183,230,29,.14); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.ex .meta { color: var(--muted); font-size: 13px; }

.video { width: 100%; aspect-ratio: 16/9; border: none; border-radius: 12px; margin: 10px 0; }

/* Spinner */
.spin { width: 28px; height: 28px; border: 3px solid #ffffff33; border-top-color: var(--primary); border-radius: 50%; animation: rot 1s linear infinite; margin: 20px auto; }
@keyframes rot { to { transform: rotate(360deg); } }

.glow { animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 0%,100% { box-shadow: 0 3px 10px rgba(183,230,29,.25); } 50% { box-shadow: 0 4px 26px rgba(183,230,29,.55); } }

/* ===== Animações extras (Área do Personal) ===== */
.item { animation: fadeSlide .45s ease both; }
@keyframes pop { 0% { transform: scale(.85); opacity: 0; } 60% { transform: scale(1.03); } 100% { transform: scale(1); opacity: 1; } }
.pop { animation: pop .35s ease both; }
.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* FAB */
.fab {
  position: fixed; right: 18px; bottom: 84px; z-index: 5;
  width: auto; padding: 14px 20px; border: none; border-radius: 30px;
  font-weight: 900; color: #0B0F14; cursor: pointer;
  background: linear-gradient(135deg, #CFF63A, var(--primary-2));
  box-shadow: 0 6px 20px rgba(183,230,29,.45);
  display: flex; align-items: center; gap: 8px;
  animation: pop .35s ease both;
}
.fab:active { transform: scale(.95); }

/* Stat chips */
.stats { display: flex; gap: 10px; margin-bottom: 14px; }
.stat { flex: 1; background: rgba(23,28,35,.6); border: 1px solid var(--stroke); border-radius: 12px; padding: 12px; }
.stat .v { font-size: 22px; font-weight: 900; }
.stat .l { font-size: 12px; color: var(--muted); }

/* Section header */
.sec { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 10px 0 8px; }

/* Action grid */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action { background: rgba(30,37,48,.7); border: 1px solid var(--stroke); border-radius: 12px; padding: 16px; text-align: center; cursor: pointer; transition: transform .12s, border-color .2s; }
.action:active { transform: scale(.96); }
.action .ai { font-size: 24px; }
.action .at { font-size: 13px; font-weight: 700; margin-top: 6px; }

.row-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: rgba(183,230,29,.15); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; flex: none; }
.danger-text { color: var(--danger); }

/* ===== MELHORIA 2: VALIDAÇÕES, HISTÓRICO E GRÁFICOS ===== */

/* Validações */
.input-wrap { margin-bottom: 12px; position: relative; }
.input-wrap label { margin-top: 0; }
.input-wrap input { margin-bottom: 2px; }
.error-text { color: var(--danger); font-size: 11px; margin-top: 4px; display: block; font-weight: 600; }
.input-invalid { border-color: var(--danger) !important; box-shadow: 0 0 6px rgba(255, 77, 77, 0.2) !important; }
.input-valid { border-color: var(--primary) !important; box-shadow: 0 0 6px rgba(183, 230, 29, 0.2) !important; }

/* Histórico de Treinos e Peso */
.hist-item { display: flex; align-items: center; justify-content: space-between; padding: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--stroke); border-radius: 10px; margin-bottom: 8px; }
.hist-item .title { font-weight: 700; font-size: 14px; }
.hist-item .date { font-size: 12px; color: var(--muted); }
.hist-item .badge-check { color: var(--primary); font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 4px; }

/* Form de Registro de Peso */
.peso-form { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.peso-form > div { flex: 1; }
.peso-form button { flex: none; width: 100px; padding: 13px; font-weight: 800; border-radius: 10px; margin-top: 6px; }

/* Gráficos */
.chart-container { margin: 18px 0; background: rgba(23, 28, 35, 0.4); border: 1px solid var(--stroke); border-radius: var(--radius); padding: 16px; position: relative; }
.chart-title { font-size: 14px; font-weight: 800; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.chart-title span { color: var(--primary); }
.chart-svg { width: 100%; height: 160px; overflow: visible; }
.chart-path { stroke: var(--primary); stroke-width: 3.5; fill: none; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 8px rgba(183, 230, 29, 0.4)); }
.chart-area { fill: url(#chart-gradient); opacity: 0.15; }
.chart-point { fill: #0B0F14; stroke: var(--primary); stroke-width: 3; cursor: pointer; transition: r 0.2s; }
.chart-point:hover { r: 6; }
.chart-grid { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; stroke-dasharray: 4,4; }
.chart-axis-text { fill: var(--muted); font-size: 10px; font-weight: 600; font-family: sans-serif; }
.chart-tooltip { background: var(--elevated); border: 1px solid var(--primary); border-radius: 6px; padding: 4px 8px; font-size: 11px; font-weight: 700; color: #fff; position: absolute; pointer-events: none; opacity: 0; transition: opacity 0.2s; z-index: 10; }

/* ====== ELEMENTOS APP IDÊNTICO ====== */

/* Barra de Semana (Week Strip) */
.week-strip {
  display: flex;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 18px;
}
.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.week-day-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.week-day-label.today {
  color: var(--primary);
}
.week-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.3s ease;
}
.week-circle.done {
  background: linear-gradient(135deg, #CFF63A, var(--primary-2));
  color: #0B0F14;
  font-weight: 900;
  box-shadow: 0 0 8px rgba(183, 230, 29, 0.4);
}
.week-circle.today:not(.done) {
  border: 1.5px solid var(--primary);
  background: rgba(183, 230, 29, 0.12);
}
.week-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

/* Card Destaque (Workout Hero Card) */
.hero-card {
  height: 210px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  margin-bottom: 16px;
  cursor: pointer;
}
.hero-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 1;
}
.hero-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.8) 100%);
  z-index: 2;
}
.hero-card-content {
  position: absolute;
  inset: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 3;
}
.hero-badge {
  background: var(--primary);
  color: #000;
  font-size: 10px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 20px;
  align-self: flex-start;
  letter-spacing: 1.2px;
}
.hero-title {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 4px;
}
.hero-desc {
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}
.hero-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hero-meta {
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.hero-btn {
  background: var(--primary);
  color: #000;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Missões */
.mission-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.mission-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.3s ease;
}
.mission-icon-wrap.todo {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid #4A5568;
  color: #4A5568;
}
.mission-icon-wrap.done {
  background: rgba(183, 230, 29, 0.18);
  color: var(--primary);
}
.mission-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #B0BAC9;
}
.mission-title.done {
  color: var(--muted);
  text-decoration: line-through;
}
.mission-xp-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
}
.mission-xp-badge.todo {
  background: rgba(255, 255, 255, 0.06);
  color: #4A5568;
}
.mission-xp-badge.done {
  background: rgba(183, 230, 29, 0.2);
  color: var(--primary);
}

/* Water Tracker */
.water-grid {
  display: flex;
  gap: 6px;
  margin: 12px 0;
}
.water-glass {
  height: 30px;
  flex: 1;
  background: var(--elevated);
  border-radius: 6px;
  transition: background-color 0.3s ease;
}
.water-glass.filled {
  background: #3B82F6;
}

/* Refeições e Macros */
.macro-progress-row {
  margin-bottom: 12px;
}
.macro-header-line {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
}
.macro-bar-bg {
  height: 10px;
  background: var(--elevated);
  border-radius: 6px;
  overflow: hidden;
}
.macro-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

/* Gráfico Donut (Donut Chart) */
.donut-chart-wrap {
  width: 180px;
  height: 180px;
  margin: 0 auto 16px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}
.donut-ring {
  fill: transparent;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 16;
}
.donut-segment {
  fill: transparent;
  stroke-width: 16;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}
.donut-center-text {
  position: absolute;
  text-align: center;
}
.donut-center-text .kcal {
  font-size: 26px;
  font-weight: 900;
}
.donut-center-text .unit {
  font-size: 12px;
  color: var(--muted);
}

/* Avaliação / Fotos */
.photo-slots {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.photo-slot-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(23, 28, 35, 0.6);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
}
.photo-preview {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: var(--elevated);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--muted);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.photo-slot-info {
  flex: 1;
}
.photo-slot-title {
  font-size: 15px;
  font-weight: 800;
}
.photo-slot-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.2;
}
.photo-slot-status {
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--muted);
}
.photo-slot-status.done {
  color: var(--primary);
}

/* IA Chat */
.ai-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 14px;
}
.ai-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
  scrollbar-width: none;
}
.chips-scroll::-webkit-scrollbar {
  display: none;
}
.chip {
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.chip:active {
  background: var(--elevated);
}

/* FAQ expansion panel */
.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.faq-card {
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  background: rgba(23, 28, 35, 0.6);
  overflow: hidden;
}
.faq-header {
  padding: 16px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.faq-header:active {
  background: rgba(255,255,255,0.02);
}
.faq-arrow {
  transition: transform 0.3s;
}
.faq-card.open .faq-arrow {
  transform: rotate(180deg);
}
.faq-content {
  padding: 0 16px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  display: none;
}
.faq-card.open .faq-content {
  display: block;
}

/* Custom segmented control */
.segmented {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--stroke);
  padding: 2px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.segmented-item {
  flex: 1;
  text-align: center;
  padding: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.segmented-item.sel {
  background: var(--elevated);
  color: #fff;
}

/* Level Up / Gamificação progress bar */
.gamer-progress-bg {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  margin: 10px 0 4px;
  overflow: hidden;
}
.gamer-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  width: 0;
  transition: width 0.3s ease;
}

/* Concluir Treino Congrats */
.congrats-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 30px rgba(183,230,29,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 70px;
  margin: 40px auto 24px;
  animation: pop 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.congrats-stats {
  display: flex;
  gap: 12px;
  margin: 28px 0 16px;
}
.congrats-stat-card {
  flex: 1;
  background: rgba(23, 28, 35, 0.6);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.congrats-stat-card .val {
  font-size: 20px;
  font-weight: 900;
}
.congrats-stat-card .lbl {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}


