/* ============================================================
   FitAI Web Dashboard — Dark Theme (mirrors Swift app palette)
   ============================================================ */

:root {
  --bg:       #0D0D10;
  --surface:  #15151D;
  --border:   #2A2A35;
  --text:     #FFFFFF;
  --text-sub: #888899;
  --accent:   #C3F53C;
  --accent2:  #7CF0A0;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- Layout ---- */

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 0 80px; /* space for bottom nav */
  min-height: 100vh;
}

.page {
  padding: 16px 20px 0;
}

/* ---- Top header ---- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

.page-header__greeting {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 2px;
}

.page-header__name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* ---- Avatar ---- */

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #000;
  flex-shrink: 0;
}

.avatar--large {
  width: 80px;
  height: 80px;
  font-size: 26px;
}

/* ---- Cards ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.card + .card { margin-top: 10px; }

.card-accent {
  background: var(--accent);
  border-radius: var(--radius-lg);
  padding: 18px;
  color: #000;
}

.card-accent__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.55;
  margin-bottom: 6px;
}

.card-accent__title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}

.card-accent__meta {
  font-size: 12px;
  opacity: 0.6;
  margin-top: 6px;
}

/* Progress bar */
.progress-bar {
  height: 6px;
  background: rgba(0,0,0,0.15);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: rgba(0,0,0,0.6);
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ---- Section title ---- */

.section-title {
  font-size: 17px;
  font-weight: 700;
  margin: 20px 0 12px;
}

/* ---- Week dots ---- */

.week-dots {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.week-dot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.week-dot__circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
  transition: all 0.2s;
}

.week-dot__circle--today {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}

.week-dot__circle--workout {
  border-color: var(--accent);
  color: var(--accent);
}

.week-dot__circle--rest {
  opacity: 0.4;
}

.week-dot__label {
  font-size: 10px;
  color: var(--text-sub);
  font-weight: 500;
}

.week-dot--today .week-dot__label {
  color: var(--accent);
  font-weight: 700;
}

/* ---- Stats grid ---- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.stat-cell {
  background: var(--surface);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-cell__value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.stat-cell__unit {
  font-size: 11px;
  color: var(--text-sub);
  font-weight: 400;
}

.stat-cell__label {
  font-size: 10px;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ---- Exercise rows ---- */

.exercise-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.exercise-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.exercise-row__num {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  flex-shrink: 0;
}

.exercise-row__info { flex: 1; min-width: 0; }

.exercise-row__name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exercise-row__meta {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 1px;
}

/* ---- Meal items ---- */

.meal-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

.meal-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.meal-item__name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.meal-item__foods {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.4;
}

.meal-item__kcal {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Macros row ---- */

.macros {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.macro-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-sub);
}

.macro-pill span { color: var(--text); }

/* ---- Workout type pills ---- */

.pill-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.pill {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 99px;
  background: rgba(195, 245, 60, 0.1);
  border: 1px solid rgba(195, 245, 60, 0.25);
  color: var(--accent);
}

/* ---- Day card (plan page) ---- */

.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 12px;
}

.day-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.day-card__name {
  font-size: 16px;
  font-weight: 700;
}

.day-card__body { padding: 14px 16px; }

.rest-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(136, 136, 153, 0.15);
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.workout-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(195, 245, 60, 0.12);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.subsection-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 14px 0 8px;
}

.subsection-title:first-child { margin-top: 0; }

/* ---- Nutrition summary ---- */

.nutrition-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.nutrition-summary__kcal {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.nutrition-summary__label {
  font-size: 12px;
  color: var(--text-sub);
}

.nutrition-summary__macros {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-sub);
  text-align: right;
}

/* ---- Empty state ---- */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-sub);
}

.empty-state__icon { font-size: 48px; margin-bottom: 12px; }
.empty-state__title { font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state__text { font-size: 14px; line-height: 1.5; }

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  padding: 13px 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  text-align: center;
  transition: opacity 0.15s;
}

.btn:active { opacity: 0.8; }

.btn-primary {
  background: var(--accent);
  color: #000;
  width: 100%;
}

.btn-ghost {
  background: transparent;
  color: var(--text-sub);
  border: 1px solid var(--border);
  font-size: 14px;
}

/* ---- Bottom Navigation ---- */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0));
  z-index: 100;
  max-width: 480px;
  margin: 0 auto;
}

/* Override fixed to be centred on desktop */
@media (min-width: 480px) {
  .bottom-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 480px;
  }
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  color: var(--text-sub);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: color 0.15s;
}

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

.nav-item svg { width: 22px; height: 22px; stroke-width: 1.8; }

/* ---- Login page ---- */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 20px;
}

.login-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 15px;
  color: var(--text-sub);
  text-align: center;
  margin-bottom: 40px;
  max-width: 280px;
  line-height: 1.5;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.login-note {
  font-size: 12px;
  color: var(--text-sub);
  text-align: center;
  line-height: 1.5;
}

/* ---- Divider ---- */

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ---- Profile header ---- */

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px 0;
  gap: 8px;
}

.profile-header__name {
  font-size: 20px;
  font-weight: 700;
  margin-top: 4px;
}

.goal-tag {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 99px;
  background: rgba(195, 245, 60, 0.12);
  color: var(--accent);
}

/* ---- Utils ---- */

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }

.text-sub { color: var(--text-sub); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.bold { font-weight: 700; }

.icon-label {
  display: flex;
  align-items: center;
  gap: 6px;
}
