/* FitMeat — design tokens & global styles */

:root {
  --bg: #F7F7F4;
  --surface: #FFFFFF;
  --surface-2: #F1F1ED;
  --ink: #0B0B0C;
  --ink-2: #3F3F46;
  --ink-3: #71717A;
  --ink-4: #A1A1AA;
  --line: #E6E6E1;
  --line-2: #ECECE8;

  --accent: #D7FF3A;
  --accent-ink: #0B0B0C;
  --accent-soft: #EEFFB0;

  --fire: #FF6B35;
  --good: #16A34A;
  --info: #2E6FF2;

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.03);
  --shadow:   0 2px 6px rgba(0,0,0,0.05), 0 10px 28px rgba(0,0,0,0.05);

  --font: 'Vazirmatn', -apple-system, system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #0A0A0B;
  --surface: #141416;
  --surface-2: #1C1C1F;
  --ink: #FAFAFA;
  --ink-2: #D4D4D8;
  --ink-3: #A1A1AA;
  --ink-4: #71717A;
  --line: #232328;
  --line-2: #1E1E22;
  --accent-soft: #2A3300;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
  --shadow:   0 2px 6px rgba(0,0,0,0.5), 0 10px 28px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; font-family: var(--font); }
body {
  background: #E5E5DF;
  color: var(--ink);
  font-feature-settings: 'ss01', 'cv11';
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
}

[data-theme="dark"] body { background: #0a0a0a; }

button { font-family: inherit; cursor: pointer; border: none; background: none; padding: 0; color: inherit; }
input, textarea, select { font-family: inherit; }
::-webkit-scrollbar { width: 0; height: 0; }

/* APP SHELL */
.fm-app {
  background: var(--bg);
  color: var(--ink);
  height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-feature-settings: 'ss01';
  position: relative;
  overflow: hidden;
  padding-top: 54px;
}

.fm-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 110px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.fm-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* HEADER */
.fm-header {
  padding: 12px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg);
}

.fm-greet {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fm-greet-hi { font-size: 13px; color: var(--ink-3); font-weight: 400; }
.fm-greet-name { font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -0.3px; }

.fm-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  position: relative;
  flex-shrink: 0;
}
.fm-avatar.lime { background: var(--accent); color: var(--accent-ink); }

.fm-icon-btn {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  color: var(--ink);
  flex-shrink: 0;
}
.fm-icon-btn:active { transform: scale(0.96); }
.fm-icon-btn .dot {
  position: absolute;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--fire);
  margin-top: -16px; margin-right: -16px;
}

/* BOTTOM TAB BAR */
.fm-tabs {
  position: absolute;
  bottom: 18px;
  left: 14px; right: 14px;
  height: 68px;
  background: var(--ink);
  border-radius: 26px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  z-index: 20;
}
[data-theme="dark"] .fm-tabs { background: var(--surface); border: 1px solid var(--line); }

.fm-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,0.55);
  height: 100%;
  position: relative;
  font-size: 10px;
  font-weight: 500;
}
.fm-tab.active { color: var(--accent); }
.fm-tab.active::before {
  content: '';
  position: absolute;
  top: 8px;
  width: 28px; height: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.fm-tab svg { width: 22px; height: 22px; stroke-width: 1.7; }

/* CARDS */
.fm-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  border: 1px solid var(--line);
}
.fm-card.dense { padding: 14px; border-radius: var(--radius); }
.fm-card.feature {
  background: var(--ink);
  color: #fff;
  border: none;
}
.fm-card.lime {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
}

/* PILLS / CHIPS */
.fm-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}
.fm-pill.lime { background: var(--accent); color: var(--accent-ink); }
.fm-pill.dark { background: var(--ink); color: #fff; }
.fm-pill.ghost { background: transparent; border: 1px solid var(--line); }
.fm-pill svg { width: 13px; height: 13px; }

/* BUTTONS */
.fm-btn {
  height: 52px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  padding: 0 22px;
  letter-spacing: -0.2px;
}
.fm-btn.lime { background: var(--accent); color: var(--accent-ink); }
.fm-btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.fm-btn.full { width: 100%; }
.fm-btn.sm { height: 38px; font-size: 13px; padding: 0 14px; border-radius: 12px; }

/* SECTION HEADER */
.fm-sec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px;
}
.fm-sec-title { font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.fm-sec-link { font-size: 12px; color: var(--ink-3); font-weight: 500; }

/* PAGE TITLE */
.fm-page-title {
  padding: 6px 20px 4px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.6px;
  line-height: 1.1;
}
.fm-page-sub {
  padding: 0 20px 10px;
  font-size: 13px;
  color: var(--ink-3);
}

/* RING */
.fm-ring {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 50%;
}
.fm-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.fm-ring-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}

/* PROGRESS BAR */
.fm-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.fm-bar > div { height: 100%; background: var(--ink); border-radius: 999px; }
.fm-bar.lime > div { background: var(--accent); }

/* LIST ROW */
.fm-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.fm-row:last-child { border-bottom: none; }

/* Number badge */
.fm-num {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  color: var(--ink-2);
}
.fm-num.lime { background: var(--accent); color: var(--accent-ink); }

/* PLACEHOLDER (for images) */
.fm-ph {
  background: repeating-linear-gradient(
    135deg,
    var(--surface-2) 0 8px,
    var(--bg) 8px 16px
  );
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 10px;
  text-align: center;
  padding: 8px;
}
[data-theme="dark"] .fm-ph {
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 8px, var(--surface) 8px 16px);
}

/* Streak flame (no SVG) using single accent */
.fm-streak {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ink);
  color: #fff;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}
.fm-streak-num { color: var(--accent); }

/* Toggle / switch */
.fm-switch {
  width: 46px; height: 28px; border-radius: 999px;
  background: var(--surface-2);
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.fm-switch::after {
  content: '';
  position: absolute;
  top: 3px; right: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform .2s;
}
.fm-switch.on { background: var(--ink); }
.fm-switch.on::after { transform: translateX(-18px); background: var(--accent); }

/* ROLE SWITCH (header pill) */
.fm-role {
  display: inline-flex;
  background: var(--surface);
  border-radius: 999px;
  padding: 4px;
  border: 1px solid var(--line);
  gap: 2px;
}
.fm-role button {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}
.fm-role button.active {
  background: var(--ink);
  color: var(--accent);
}

/* CALENDAR STRIP */
.fm-cal {
  display: flex;
  gap: 6px;
  padding: 4px 20px 12px;
  overflow-x: auto;
}
.fm-cal-day {
  flex: 0 0 46px;
  height: 60px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px;
}
.fm-cal-day .d { font-size: 10px; color: var(--ink-3); }
.fm-cal-day .n { font-size: 17px; font-weight: 700; }
.fm-cal-day.done {
  background: var(--surface);
  border-color: var(--ink);
}
.fm-cal-day.done::after {
  content: '';
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent);
  margin-top: 2px;
}
.fm-cal-day.today { background: var(--ink); border-color: var(--ink); }
.fm-cal-day.today .d { color: rgba(255,255,255,0.7); }
.fm-cal-day.today .n { color: var(--accent); }
.fm-cal-day.miss { opacity: 0.7; }

/* TAGS GRID */
.fm-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fm-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* SAFE BLOCK PADDING */
.fm-block { padding: 0 20px; }

/* SUBTLE DIVIDER */
.fm-hr { height: 1px; background: var(--line); margin: 8px 0; }

/* WORKOUT PLAYER */
.fm-player {
  position: absolute;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding-top: 54px;
}
.fm-player-top {
  padding: 0 20px 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.fm-player-card {
  margin: 0 14px;
  background: var(--surface);
  border-radius: 28px;
  padding: 16px;
  border: 1px solid var(--line);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* SHEET */
.fm-sheet {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  padding: 12px 20px 24px;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.08);
  z-index: 30;
}
.fm-sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--line);
  margin: 0 auto 14px;
}

/* MISC */
.tabular { font-feature-settings: 'tnum'; }
.lh-1 { line-height: 1; }
.fm-big-num { font-size: 44px; font-weight: 800; letter-spacing: -1px; }
.fm-mini-cap { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }

/* CHAT */
.fm-chat-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
}
.fm-chat-bubble.me {
  background: var(--ink);
  color: #fff;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.fm-chat-bubble.them {
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* CHIPS for muscle/equipment */
.fm-chip {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}
.fm-chip.active {
  background: var(--ink);
  color: var(--accent);
  border-color: var(--ink);
}

/* SCROLL hide */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }
