@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Inter:wght@400;500;600&display=swap');
@import url('tokens.css');

* { box-sizing: border-box; }

html { -webkit-tap-highlight-color: transparent; }

/* Anel de foco no tom da marca em vez do azul/amarelo padrão do navegador
   (visível só pra navegação por teclado — não aparece em clique de mouse/toque) */
button, a, input, [tabindex] {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: var(--weight-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--font-title);
  font-weight: var(--weight-title);
  margin: 0 0 var(--space-sm);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

h1 { font-size: clamp(1.5rem, 5vw, 1.85rem); }
h2 { font-size: clamp(1rem, 3.4vw, 1.15rem); margin-bottom: var(--space-sm); }

p { margin: 0 0 var(--space-sm); }

.eyebrow {
  font-family: var(--font-title);
  font-weight: var(--weight-medium);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-action-dark);
  margin: 0 0 6px;
}

#app-root {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-md);
  padding-bottom: var(--space-xl);
}

.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-lg) var(--space-md);
}

.fade-in {
  animation: card-fade-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.journey-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.stage-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff; /* os ícones de estágio usam currentColor */
}

.stage-badge svg { width: 26px; height: 26px; }

.week-label {
  margin: 0;
  font-weight: var(--weight-medium);
  color: var(--color-text-soft);
  font-size: 0.8rem;
}

.streak-label {
  margin: 3px 0 0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.streak-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-secondary);
  display: inline-block;
}

.day-pill {
  margin-left: auto;
  background: var(--color-bg-card);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-family: var(--font-title);
  font-weight: var(--weight-medium);
  font-size: 0.85rem;
  white-space: nowrap;
}

.day-pill span {
  color: var(--color-text-soft);
  font-weight: var(--weight-body);
}

.missions-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.missions-count {
  font-size: 0.8rem;
  color: var(--color-text-soft);
  font-variant-numeric: tabular-nums;
}

.mission-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-lg);
}

.mission-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-divider);
  cursor: pointer;
  position: relative;
}

.mission-item:last-child { border-bottom: none; }

.mission-checkbox {
  position: absolute;
  opacity: 0;
  width: 24px;
  height: 24px;
  margin: 0;
  cursor: pointer;
}

.mission-check {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid var(--color-text-soft);
  background: var(--color-bg);
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.mission-check::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(40deg) scale(0);
  transition: transform 0.15s ease;
}

.mission-checkbox:checked + .mission-check {
  background: var(--color-action);
  border-color: var(--color-action);
}

.mission-checkbox:checked + .mission-check::after {
  transform: rotate(40deg) scale(1);
}

.mission-checkbox:focus-visible + .mission-check {
  outline: 2px solid var(--color-action);
  outline-offset: 2px;
}

.mission-text {
  font-size: 0.95rem;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.mission-checkbox:checked ~ .mission-text {
  color: var(--color-text-soft);
  text-decoration: line-through;
  text-decoration-color: var(--color-text-soft);
}

.microaula {
  margin-bottom: var(--space-lg);
}

.microaula p {
  white-space: pre-line;
  font-size: 0.98rem;
}

.checkin-hint {
  color: var(--color-text-soft);
  font-size: 0.82rem;
  margin-top: -8px;
}

.checkin-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 10px 0;
}

.checkin-field span.checkin-label {
  font-size: 0.88rem;
  color: var(--color-text-soft);
  min-width: 64px;
}

.checkin-field .checkin-value {
  font-size: 0.85rem;
  font-weight: var(--weight-medium);
  color: var(--color-action-dark);
  min-width: 16px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.checkin-field input[type="range"] {
  --range-value: 50%;
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--color-action) 0%,
    var(--color-action) var(--range-value),
    var(--color-track) var(--range-value),
    var(--color-track) 100%
  );
  outline: none;
  cursor: pointer;
}

.checkin-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-action);
  box-shadow: var(--shadow-button);
  cursor: pointer;
  border: 3px solid var(--color-bg-card);
  margin-top: -1px;
}

.checkin-field input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-action);
  box-shadow: var(--shadow-button);
  cursor: pointer;
  border: 3px solid var(--color-bg-card);
}

.checkin-field input[type="range"]::-moz-range-track {
  background: transparent;
}

.btn-primary {
  display: inline-block;
  background: var(--color-action);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 15px 28px;
  font-family: var(--font-title);
  font-weight: var(--weight-medium);
  font-size: 1rem;
  box-shadow: var(--shadow-button);
  cursor: pointer;
  width: 100%;
  text-align: center;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(46, 139, 79, 0.25);
}

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--color-action-dark);
  border: none;
  padding: 10px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  cursor: pointer;
  width: 100%;
  text-align: center;
}

.option-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: var(--space-lg) 0;
}

.option-btn {
  padding: 15px 20px !important;
  font-size: 0.98rem;
  font-weight: var(--weight-medium);
  border: 1.5px solid rgba(46, 139, 79, 0.35) !important;
  border-radius: var(--radius-pill) !important;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.option-btn:active { transform: scale(0.98); }

.option-btn:hover {
  background: rgba(46, 139, 79, 0.08);
  border-color: var(--color-action) !important;
}

.badge-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 12px);
  opacity: 0;
  background: var(--color-action-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-weight: var(--weight-medium);
  font-size: 0.9rem;
  box-shadow: var(--shadow-button);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.badge-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.badge-toast-icon {
  width: 18px;
  height: 18px;
  color: var(--color-stage-flor);
  flex-shrink: 0;
}

body.onboarding-body {
  min-height: 100vh;
  min-height: 100dvh;
}

body.onboarding-body #app-root {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg) var(--space-md);
}

body.onboarding-body #steps { width: 100%; }

.onboarding-step {
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.hero-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  display: block;
}

.access-code-input {
  width: 100%;
  padding: 15px 16px;
  border-radius: var(--radius-small);
  border: 1.5px solid var(--color-divider);
  font-size: 1rem;
  font-family: var(--font-body);
  text-align: center;
  margin-bottom: var(--space-md);
  background: var(--color-bg-card);
  color: var(--color-text);
}

.access-code-input:focus {
  outline: none;
  border-color: var(--color-action);
}

.access-code-input::placeholder {
  color: var(--color-text-soft);
  opacity: 0.7;
}

.field-error {
  color: #B23B3B;
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-top: var(--space-sm);
}

.onboarding-step p.subtitle {
  color: var(--color-text-soft);
  margin-bottom: var(--space-lg);
  font-size: 0.98rem;
}

.step-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: var(--space-lg);
}

.step-progress span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-divider);
  transition: background 0.2s ease, width 0.2s ease;
}

.step-progress span.active {
  background: var(--color-action);
  width: 18px;
  border-radius: 3px;
}

.disclaimer {
  font-size: 0.75rem;
  color: var(--color-text-soft);
  text-align: center;
  margin-top: var(--space-lg);
  line-height: 1.4;
  padding: 0 var(--space-sm);
}

/* --- Reinício da jornada --- */

.reset-section {
  text-align: center;
  margin-top: var(--space-xl);
  padding-bottom: var(--space-lg);
}

.btn-reset {
  background: none;
  border: none;
  color: var(--color-text-soft);
  font-size: 0.78rem;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  transition: color 0.15s ease, background 0.15s ease;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-reset:hover {
  color: var(--color-text);
  background: rgba(0,0,0,0.04);
}

/* Modal overlay */
.reset-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 var(--space-md) var(--space-md);
  animation: overlay-in 0.2s ease;
}

.reset-modal-overlay[hidden] {
  display: none;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Modal card */
.reset-modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-card) var(--radius-card) var(--radius-small) var(--radius-small);
  padding: var(--space-lg) var(--space-md) var(--space-md);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.15);
  text-align: center;
  animation: modal-slide-up 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modal-slide-up {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.reset-modal-icon {
  font-size: 2rem;
  margin: 0 0 var(--space-sm);
}

.reset-modal h2 {
  margin-bottom: var(--space-sm);
}

.reset-modal p {
  font-size: 0.93rem;
  color: var(--color-text-soft);
  margin-bottom: var(--space-sm);
}

.reset-modal-note {
  font-size: 0.82rem !important;
  background: rgba(46, 139, 79, 0.07);
  border-radius: var(--radius-small);
  padding: 10px 12px;
  color: var(--color-action-dark) !important;
  margin-bottom: var(--space-lg) !important;
}

.reset-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- Sistema de Abas (Navegação Inferior) --- */

.app-container {
  padding-bottom: 80px; /* Evita que a barra inferior sobreponha o conteúdo */
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 64px;
  background: var(--color-bg-card);
  border-top: 1px solid var(--color-divider);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 150;
  padding: 0 var(--space-xs);
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--color-text-soft);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: var(--weight-medium);
  cursor: pointer;
  padding: 8px;
  flex: 1;
  transition: color 0.15s ease;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: transform 0.15s ease;
}

.nav-item:active svg {
  transform: scale(0.9);
}

.nav-item.active {
  color: var(--color-action);
}

/* Cabecalho de Abas secundarias */
.tab-header {
  margin: var(--space-sm) 0 var(--space-md);
  padding: 0 var(--space-xs);
}

.tab-header h1 {
  margin-bottom: 4px;
}

.tab-header .subtitle {
  color: var(--color-text-soft);
  font-size: 0.9rem;
  margin: 0;
}

/* --- Aba: Guia de Chás --- */

.cha-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.cha-group {
  border-bottom: 1px solid var(--color-divider);
  padding-bottom: var(--space-md);
}

.cha-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.cha-group h3 {
  margin: var(--space-xs) 0 6px;
  font-size: 1.05rem;
}

.cha-group p {
  font-size: 0.88rem;
  margin-bottom: 8px;
  color: var(--color-text);
}

.cha-group p strong {
  color: var(--color-text-soft);
}

.cha-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: var(--weight-medium);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cha-badge.digestivo {
  background: rgba(46, 139, 79, 0.12);
  color: var(--color-action-dark);
}

.cha-badge.tonico {
  background: rgba(184, 121, 79, 0.12);
  color: var(--color-secondary);
}

.cha-badge.calmante {
  background: rgba(140, 110, 74, 0.12);
  color: var(--color-stage-semente);
}

/* --- Aba: Progresso --- */

.chart-container {
  text-align: center;
}

.chart-container h3 {
  font-size: 0.95rem;
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

.empty-hint {
  font-size: 0.88rem;
  color: var(--color-text-soft);
  padding: var(--space-md) var(--space-sm);
  line-height: 1.5;
}

.svg-wrapper {
  height: 140px;
  width: 100%;
  margin-bottom: var(--space-sm);
}

.trend-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-x-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--color-text-soft);
  padding: 0 4px;
}

/* Conquistas (Badges) */
.badge-card {
  padding: var(--space-md) !important;
}

.badge-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.badge-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-small);
  border: 1px solid var(--color-divider);
  transition: background 0.15s ease;
}

.badge-item.earned {
  background: rgba(46, 139, 79, 0.04);
  border-color: rgba(46, 139, 79, 0.2);
}

.badge-item.locked {
  opacity: 0.55;
  background: rgba(0, 0, 0, 0.01);
}

.badge-icon {
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.badge-info h4 {
  font-size: 0.9rem;
  margin: 0 0 2px;
  color: var(--color-text);
}

.badge-info p {
  font-size: 0.78rem;
  color: var(--color-text-soft);
  margin: 0;
}

/* --- Aba: Posso Comer? --- */

.search-card {
  padding: var(--space-md) !important;
}

.search-box {
  position: relative;
  margin-bottom: var(--space-md);
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border-radius: var(--radius-small);
  border: 1.5px solid var(--color-divider);
  font-size: 0.95rem;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s ease;
}

.search-box input:focus {
  border-color: var(--color-action);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--color-text-soft);
  pointer-events: none;
}

.food-section {
  margin-bottom: var(--space-md);
}

.food-section:last-child {
  margin-bottom: 0;
}

.food-cat-title {
  font-size: 0.85rem;
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
  padding-bottom: 4px;
  border-bottom: 1.5px solid var(--color-divider);
}

.food-cat-title.status-rec { color: var(--color-action-dark); border-color: rgba(46, 139, 79, 0.25); }
.food-cat-title.status-mod { color: var(--color-secondary); border-color: rgba(184, 121, 79, 0.25); }
.food-cat-title.status-evt { color: #b23b3b; border-color: rgba(178, 59, 59, 0.25); }

.food-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.food-list li {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--color-text);
}

.food-list li strong {
  color: var(--color-text);
  font-weight: var(--weight-medium);
}

.no-results-hint {
  font-size: 0.88rem;
  color: var(--color-text-soft);
  text-align: center;
  padding: var(--space-md) var(--space-sm);
  line-height: 1.5;
}

/* --- Botão de Dev (Next Day) --- */

.btn-dev-next {
  display: block;
  margin: 10px auto 0;
  background: none;
  border: none;
  color: var(--color-secondary);
  font-size: 0.78rem;
  font-family: var(--font-body);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  transition: color 0.15s ease, background 0.15s ease;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-dev-next:hover {
  color: var(--color-text);
  background: rgba(184, 121, 79, 0.08);
}

/* --- Reprodutor de Áudio (Microaula) --- */
.audio-player {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-small);
  padding: 12px 16px;
  margin-bottom: var(--space-md);
}

.btn-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-action);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: var(--shadow-button);
  transition: transform 0.12s ease, background 0.12s ease;
}

.btn-play:active {
  transform: scale(0.95);
}

.btn-play:hover {
  background: var(--color-action-dark);
}

.play-icon {
  width: 18px;
  height: 18px;
  margin-left: 2px; /* Ajuste óptico do play */
}

.audio-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audio-title {
  font-size: 0.85rem;
  font-weight: var(--weight-medium);
  color: var(--color-text);
  line-height: 1.2;
}

.audio-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--color-track);
  border-radius: 2px;
  overflow: hidden;
}

.audio-progress-filled {
  height: 100%;
  background: var(--color-action);
}

.audio-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.audio-time {
  font-size: 0.72rem;
  color: var(--color-text-soft);
  font-variant-numeric: tabular-nums;
}

.audio-tag {
  font-size: 0.65rem;
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  color: var(--color-secondary);
  background: rgba(184, 121, 79, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

/* --- Transcrição Expansível (Microaula) --- */

.btn-toggle-text {
  background: var(--color-bg);
  border: 1px dashed var(--color-divider);
  color: var(--color-action-dark);
  padding: 10px 16px;
  border-radius: var(--radius-small);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: var(--weight-medium);
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease;
  margin-bottom: var(--space-sm);
  display: block;
}

.btn-toggle-text:hover {
  background: rgba(46, 139, 79, 0.04);
  border-color: var(--color-action);
}

.microaula-text-container {
  overflow: hidden;
  max-height: 2000px;
  opacity: 1;
  transition: max-height 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease, margin 0.25s ease;
  margin-top: var(--space-sm);
}

.microaula-text-container.collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  margin-top: 0 !important;
  pointer-events: none;
}
