/* ============================================================
   FITNESS ADA — Design System
   Fonte: Claude Design "Fitness ADA Design System"
   Fundo quase-preto + cartões cinza-elevado + amarelo único de destaque.
   Sem sombras, sem glassmorphism, sem gradientes. Profundidade só por contraste.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@700;900&family=JetBrains+Mono:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* --- Cor: superfícies --- */
  --bg: #0A0A0A;
  --surface-card: #1E2329;
  --surface-inset: #14181C;
  --border: #2B3139;

  /* --- Cor: texto --- */
  --text-primary: #FFFFFF;
  --text-secondary: #848E9C;

  /* --- Cor: acento (único, escasso) --- */
  --accent: #FCD535;
  --on-accent: #0A0A0A;

  /* --- Cor: semântica (texto, nunca fundo de botão) --- */
  --success: #0ECB81;
  --danger: #F6465D;

  /* --- Tipografia --- */
  --font-display: 'Barlow Condensed', sans-serif; /* headlines, nav, botões — peso 900, maiúsculas */
  --font-body: 'Inter', sans-serif;                /* texto corrido */
  --font-mono: 'JetBrains Mono', monospace;        /* números — kcal, macros, peso, reps, séries */

  /* --- Espaçamento --- */
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* --- Raio --- */
  --radius-pill: 999px;
  --radius-sharp: 0;

  /* --- Layout --- */
  --sidebar-width: 240px;
  --tabbar-height: 68px;
  --breakpoint-desktop: 768px;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

input, button {
  font: inherit;
  color: inherit;
}

input {
  outline: none;
}

button {
  cursor: pointer;
}

::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* ============================================================
   TIPOGRAFIA
   ============================================================ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.03em;
}

.heading-xl {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 38px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
}

.heading-lg {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 28px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
}

.heading-md {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
}

.label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.text-muted {
  color: var(--text-secondary);
}

.value-mono {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px;
  border: none;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:not(:disabled):hover {
  opacity: 0.9;
}

.btn-primary {
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
}

.btn-secondary {
  border-radius: var(--radius-sharp);
  background: var(--surface-card);
  color: var(--text-primary);
}

/* ============================================================
   CARTÕES
   ============================================================ */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-sharp);
  padding: var(--space-lg);
}

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  width: 100%;
}

.form-field label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.form-field input {
  width: 100%;
  padding: 14px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
}

.form-field input::placeholder {
  color: var(--text-secondary);
}

.form-field input:focus {
  border-color: var(--accent);
}

.form-field select {
  width: 100%;
  padding: 14px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
}

.form-field select:focus {
  border-color: var(--accent);
}

.form-error {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
}

.form-message {
  font-family: var(--font-body);
  font-size: 13px;
  min-height: 18px;
}

.form-message.is-error {
  color: var(--danger);
}

.form-message.is-success {
  color: var(--success);
}

/* Toggle de opções (sexo, objetivo) — grupo de botões pílula, um selecionado de cada vez */
.toggle-group {
  display: flex;
  gap: 8px;
}

.toggle-option {
  flex: 1;
  padding: 12px 0;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--surface-inset);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
}

.toggle-option.is-selected {
  background: var(--accent);
  color: var(--on-accent);
}

/* ============================================================
   ECRÃ DE AUTENTICAÇÃO (login / registo)
   ============================================================ */
.auth-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.auth-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.auth-logo {
  width: 56px;
  height: 56px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo::after {
  content: '';
  width: 22px;
  height: 22px;
  background: var(--bg);
}

.auth-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 32px;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.auth-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-switch {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.auth-switch a {
  color: var(--accent);
}

/* ============================================================
   ECRÃ DE LOADING (router de entrada, transições de página)
   ============================================================ */
.loading-screen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-card);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   BARRA DE PROGRESSO
   ============================================================ */
.progress-track {
  width: 100%;
  height: 8px;
  background: var(--surface-inset);
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.progress-fill.is-danger {
  background: var(--danger);
}

/* ============================================================
   ESTADO VAZIO
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
  color: var(--text-secondary);
  font-size: 13px;
}

.empty-state .btn {
  width: auto;
  padding: 12px 24px;
}

/* ============================================================
   GRELHA DE CARTÕES
   ============================================================ */
.card-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

@media (min-width: 768px) {
  .card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
  }
}

.card-grid-2 {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

@media (min-width: 768px) {
  .card-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
  }
}

/* ============================================================
   NAVEGAÇÃO — tab bar (mobile) → sidebar (desktop)
   ============================================================ */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tabbar-height);
  background: var(--surface-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

.app-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  min-height: 44px;
  color: var(--text-secondary);
}

.app-nav-item.is-active {
  color: var(--accent);
}

.app-nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-nav-label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Ícones de navegação — formas geométricas simples, cor herdada (currentColor) do item pai */
.shape-dashboard {
  width: 16px;
  height: 16px;
  background: currentColor;
}

.shape-eat {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: currentColor;
}

.shape-workout {
  display: flex;
  align-items: center;
  gap: 2px;
}

.shape-workout span:nth-child(1),
.shape-workout span:nth-child(3) {
  width: 5px;
  height: 13px;
  background: currentColor;
  display: block;
}

.shape-workout span:nth-child(2) {
  width: 9px;
  height: 4px;
  background: currentColor;
  display: block;
}

.shape-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.shape-profile .head {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.shape-profile .body {
  width: 16px;
  height: 8px;
  border-radius: 8px 8px 0 0;
  background: currentColor;
}

.shape-progress {
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.shape-progress span:nth-child(1) {
  width: 4px;
  height: 8px;
  background: currentColor;
  display: block;
}

.shape-progress span:nth-child(2) {
  width: 4px;
  height: 13px;
  background: currentColor;
  display: block;
}

.shape-progress span:nth-child(3) {
  width: 4px;
  height: 17px;
  background: currentColor;
  display: block;
}

/* ============================================================
   CABEÇALHO DE ECRÃ (dashboard e futuros ecrãs de conteúdo)
   ============================================================ */
.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.btn-sm {
  width: auto;
  padding: 10px 20px;
  font-size: 12px;
}

.app-main {
  padding: var(--space-lg) var(--space-md) calc(var(--tabbar-height) + var(--space-lg));
}

@media (min-width: 768px) {
  .app-nav {
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    bottom: auto;
    height: 100vh;
    width: var(--sidebar-width);
    flex-shrink: 0;
    flex-direction: column;
    border-top: none;
    padding: 28px 0;
  }

  .app-nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    padding: 14px 24px;
  }

  .app-nav-label {
    font-size: 13px;
    letter-spacing: 0.04em;
  }

  .app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
  }

  .app-main {
    flex: 1;
    padding: 48px 40px;
  }

  .app-main-inner {
    max-width: 1160px;
    margin: 0 auto;
  }
}

/* ============================================================
   PESQUISA — input + resultados em lista
   ============================================================ */
.search-results {
  display: flex;
  flex-direction: column;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
}

.search-result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-inset);
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

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

.search-result-item:hover {
  background: var(--surface-card);
}

/* ============================================================
   LINHAS DE ALIMENTO REGISTADO (dentro de uma refeição)
   ============================================================ */
.food-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.food-row:first-child {
  border-top: none;
}

.food-row-name {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
}

.food-row-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.food-row-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}

.food-row-delete:hover {
  color: var(--danger);
}

/* ============================================================
   MODAL — adicionar / criar alimento
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface-card);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
  }

  .modal {
    max-height: 80vh;
  }
}

/* ============================================================
   CARTÃO CLICÁVEL (ex: escolha de split)
   ============================================================ */
.card-clickable {
  display: block;
  width: 100%;
  border: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

/* ============================================================
   TREINO ATIVO — layout foco + lista lateral
   ============================================================ */
.workout-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

@media (min-width: 768px) {
  .workout-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    align-items: start;
  }
}

.exercise-list {
  display: flex;
  flex-direction: column;
}

.exercise-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-left: none;
  border-right: none;
  border-bottom: none;
  background: none;
  text-align: left;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
}

.exercise-list-item:first-child {
  border-top: none;
}

.exercise-list-name {
  color: var(--text-primary);
}

.exercise-list-item.is-current .exercise-list-name {
  color: var(--accent);
}

.exercise-list-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.exercise-list-status.is-done {
  color: var(--success);
}

/* Linha de série (peso + reps + marcar) */
.set-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.set-row:first-child {
  border-top: none;
}

.set-row-label {
  width: 56px;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.set-row input {
  flex: 1;
  width: 0;
  min-width: 0;
  padding: 10px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
}

.set-row input:disabled {
  opacity: 0.6;
}

.set-row .btn {
  flex-shrink: 0;
}
