/* ============================================================
   Mobile-only stylesheet for /m/* routes.
   Tokens copy frontend/styles.css to keep both UIs in lockstep
   without forcing the desktop file to load on phones.
============================================================ */

:root {
  --bg: #0b0d12;
  --bg-2: #0f1219;
  --panel: #161a22;
  --panel-2: #1d2230;
  --panel-3: #252b3b;
  --border: #2a2f3e;
  --border-strong: #3a4156;
  --text: #eef1f8;
  --muted: #8a93a6;
  --muted-2: #6b7384;
  /* Fitness accent — violet, matches desktop /styles.css. See Brand.md
     for the per-app palette in the Claudinho family. */
  --accent: #a78bfa;
  --accent-strong: #8b5cf6;
  --good: #4ade80;
  --warn: #facc15;
  --bad: #f87171;
  --radius: 10px;
  --radius-sm: 6px;
  /* iOS safe areas — used so content never sits under the status bar / home
     indicator when the PWA runs full-screen. */
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  /* Prevent iOS rubber-band scroll on body — the .body region inside the app
     handles its own overflow. */
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* Layout shell — every /m/* page should follow:
     <div class="app">
       <header class="nav-top"> ... </header>
       <main class="body"> ... </main>
       <nav class="tab-bar"> ... </nav>
     </div>
*/
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
}

.nav-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 12px;
}
.nav-top .title { font-size: 17px; font-weight: 600; line-height: 1.2; }
.nav-top .sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.nav-top .icon-btn {
  background: transparent; border: none; color: var(--muted);
  font-size: 18px; padding: 8px 10px; cursor: pointer;
}

.body {
  flex: 1;
  overflow-y: auto;
  /* Bottom padding leaves room for the fixed .tab-bar (≈64 px of nav + the
     iOS home-indicator safe-area). Without this, the last item of the
     scrollable content would sit behind the tab bar. */
  padding: 8px 16px calc(80px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

/* Visual section heading — "💪 Treino", "🥗 Refeições", etc. */
.section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted);
  margin: 14px 0 6px;
  display: flex; justify-content: space-between; align-items: center;
}
.section-label .more { color: var(--muted-2); font-size: 12px; }

/* Cards — primary content container. */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.card.workout-card {
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
}

/* Buttons — large tap targets (≥44 px). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent-strong);
  color: #0a0c11;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 8px;
  min-height: 44px;
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn.success { background: var(--good); color: #0a0c11; }
.btn.danger  { background: var(--bad);  color: #0a0c11; }
.btn.small   { padding: 8px 12px; font-size: 13px; width: auto; margin-top: 0; min-height: 36px; }
.btn:active  { transform: translateY(1px); }
.btn:disabled { opacity: .4; pointer-events: none; }

/* Bottom tab bar — fixed to the viewport (not the flex container).
   This prevents the visible "jumping" you'd otherwise see while the
   page's body content is still loading: with the previous flex-end
   approach, an empty body left the tab bar floating mid-screen until
   data arrived. Body's bottom padding (see .body above) leaves room
   so content isn't covered. */
.tab-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding-top: 8px;
  padding-bottom: max(22px, var(--safe-bottom));
}
.tab-bar .tab {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  text-decoration: none;
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 0;
}
.tab-bar .tab .icon { font-size: 22px; line-height: 1; margin-bottom: 2px; }
.tab-bar .tab.active { color: var(--accent-strong); }

/* Sticky-bottom action area (e.g. "Finalizar treino"). */
.sticky-bottom {
  position: sticky; bottom: 0;
  padding: 12px 16px max(14px, var(--safe-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
  border-top: 1px solid var(--border);
}

/* Banners — alerts at the top of a screen. */
.banner {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  margin: 12px 0;
}
.banner.info { background: rgba(56,189,248,.12); border: 1px solid rgba(56,189,248,.35); color: var(--accent); }
.banner.warn { background: rgba(250,204,21,.12); border: 1px solid rgba(250,204,21,.35); color: var(--warn); }
.banner.bad  { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.35); color: var(--bad); }

/* Form inputs (login screen, future settings). */
.field {
  display: flex; flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.field-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted);
}
.field input[type=text],
.field input[type=password],
.field input[type=email],
.field input[type=number] {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px;          /* ≥16 px stops iOS auto-zooming on focus */
  color: var(--text);
  width: 100%;
}
.field input:focus {
  outline: none;
  border-color: var(--accent-strong);
}
.field .err { color: var(--bad); font-size: 12px; }

/* Utility */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny  { font-size: 11px; }
.spacer-lg { height: 24px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
