/* ═══════════════════════════════════════════
   GymBuddy Pro — components.css
   Cards · Buttons · Inputs · Badges · Pills ·
   Check Items · Water · Progress · Streak ·
   Modals · Plan Cards
   ═══════════════════════════════════════════ */

/* ── CARD ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px var(--shadow);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title-right {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.95); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-lg { padding: 14px 24px; font-size: 16px; border-radius: var(--radius); }

/* ── INPUTS ── */
.input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.inp {
  flex: 1;
  padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  outline: none;
  transition: border-color .2s;
  background: #fff;
  color: var(--text);
}
.inp:focus { border-color: var(--primary); }
.inp::placeholder { color: var(--muted); font-size: 13px; }
.inp-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
  display: block;
}
.inp-group { margin-bottom: 14px; }

/* ── GOAL PILLS (3-way selector) ── */
.goal-pills {
  display: flex;
  background: #F0F4F8;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
  gap: 3px;
}
.goal-pill {
  flex: 1;
  padding: 9px 6px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  line-height: 1.3;
}
.goal-pill.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

/* ── TOGGLE (Veg / Non-Veg etc.) ── */
.toggle-row {
  display: flex;
  background: #F0F4F8;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 16px;
  gap: 3px;
}
.toggle-opt {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}
.toggle-opt.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 6px rgba(0,0,0,.09);
}
.toggle-opt.active.veg { color: var(--green); }
.toggle-opt.active.nonveg { color: var(--red); }

/* ── LEVEL CHIPS ── */
.chips-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chips-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 22px;
  border: 2px solid var(--border);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  color: var(--muted);
  white-space: nowrap;
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.chip.today {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── CHECK ITEMS ── */
.check-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid #F4F4F4;
  cursor: pointer;
  user-select: none;
}
.check-item:last-child { border-bottom: none; }
.cbox {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-radius: 7px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  background: #fff;
}
.check-item.done .cbox {
  background: var(--green);
  border-color: var(--green);
}
.check-item.done .cbox::after {
  content: '✓';
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}
.clabel {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  transition: all .15s;
  flex: 1;
}
.csub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.check-item.done .clabel { text-decoration: line-through; color: var(--muted); }
.creps {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── RULE TILES ── */
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rule-tile {
  background: #F7FAFC;
  border-radius: 12px;
  padding: 13px 10px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  border: 2px solid transparent;
}
.rule-tile.on { background: var(--green-light); border-color: var(--green); }
.rule-emoji { font-size: 26px; line-height: 1; }
.rule-lbl { font-size: 11px; color: var(--muted); margin-top: 6px; font-weight: 600; }
.rule-tile.on .rule-lbl { color: var(--green); }

/* ── WATER TRACKER ── */
.water-center { text-align: center; padding: 4px 0; }
.water-big {
  font-size: 52px;
  font-weight: 800;
  color: var(--blue);
  line-height: 1;
}
.water-big small { font-size: 16px; font-weight: 400; color: var(--muted); }
.water-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.glasses-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}
.glass-dot {
  font-size: 28px;
  cursor: pointer;
  opacity: .2;
  transition: all .2s;
  transform: scale(.9);
}
.glass-dot.on { opacity: 1; transform: scale(1); }
.water-btns { display: flex; justify-content: center; gap: 14px; }
.wbtn {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  font-size: 26px;
  cursor: pointer;
  font-weight: 700;
  transition: transform .15s;
}
.wbtn:active { transform: scale(.88); }
.wbtn.minus { background: #FFF0F0; color: var(--red); }
.wbtn.plus  { background: var(--blue-light); color: var(--blue); }

/* ── QUICK STATS STRIP ── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.stat-mini {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 11px 8px;
  text-align: center;
  box-shadow: 0 2px 8px var(--shadow);
}
.stat-mini-icon { font-size: 20px; line-height: 1; }
.stat-mini-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  margin-top: 3px;
  line-height: 1;
}
.stat-mini-lbl { font-size: 9px; color: var(--muted); margin-top: 2px; font-weight: 600; }

/* ── STATS 2-COL GRID ── */
.stats-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat-box {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 8px var(--shadow);
}
.stat-val { font-size: 26px; font-weight: 800; line-height: 1; }
.stat-lbl { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── PROGRESS BARS ── */
.pbar-wrap {
  background: #EDF2F7;
  border-radius: 10px;
  height: 9px;
  margin-top: 7px;
  overflow: hidden;
}
.pbar { height: 100%; border-radius: 10px; transition: width .6s ease; }
.pbar-green  { background: linear-gradient(90deg, #4CAF50, #8BC34A); }
.pbar-blue   { background: linear-gradient(90deg, #2196F3, #64B5F6); }
.pbar-orange { background: linear-gradient(90deg, #FF6B35, #FF9800); }
.pbar-purple { background: linear-gradient(90deg, #9C27B0, #E040FB); }
.pbar-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 3px;
}
.pbar-pct { font-weight: 700; }

/* ── STREAK ROW ── */
.streak-row { display: flex; gap: 7px; justify-content: center; }
.sday {
  width: 36px; height: 36px;
  border-radius: 9px;
  border: 2px solid #EDF2F7;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  color: var(--muted);
}
.sday.done { background: var(--green); border-color: var(--green); color: #fff; }
.sday.today-s { border-color: var(--primary); color: var(--primary); }

/* ── MEAL ROWS ── */
.meal-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #F6F6F6;
}
.meal-row:last-child { border-bottom: none; }
.meal-ico { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.meal-time {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.meal-food { font-size: 14px; font-weight: 500; margin-top: 2px; line-height: 1.4; }
.meal-cal { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── WEIGHT LOG ── */
.wentry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #F4F4F4;
  font-size: 14px;
}
.wentry:last-child { border-bottom: none; }
.we-date { color: var(--muted); font-size: 12px; }
.we-val { font-weight: 800; color: var(--primary); }
.we-del {
  color: #FC8181;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
}

/* ── BODY MEASUREMENT GRID ── */
.measure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.measure-box {
  background: #F7FAFC;
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.measure-lbl { font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.measure-val { font-size: 22px; font-weight: 800; color: var(--primary); }
.measure-unit { font-size: 11px; color: var(--muted); }
.measure-inp {
  width: 100%;
  padding: 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 15px;
  text-align: center;
  outline: none;
  font-weight: 700;
  color: var(--text);
  margin-top: 6px;
  transition: border-color .2s;
}
.measure-inp:focus { border-color: var(--primary); }

/* ── ACHIEVEMENT BADGES ── */
.ach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ach-card {
  background: #F7FAFC;
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  border: 2px solid transparent;
  transition: all .2s;
}
.ach-card.unlocked {
  background: #FFFBEB;
  border-color: #F6AD55;
}
.ach-emoji { font-size: 32px; line-height: 1; }
.ach-name { font-size: 12px; font-weight: 700; margin-top: 6px; color: var(--text); }
.ach-desc { font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.3; }
.ach-card.locked .ach-emoji { filter: grayscale(1); opacity: .4; }
.ach-card.locked .ach-name { color: var(--muted); }

/* ── PLAN CARDS ── */
.plan-card {
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 12px;
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}
.plan-card.current { border-color: var(--primary); }
.plan-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.plan-emoji { font-size: 28px; }
.plan-name { font-size: 18px; font-weight: 800; }
.plan-price { font-size: 24px; font-weight: 800; }
.plan-period { font-size: 13px; color: var(--muted); }
.plan-perday { font-size: 11px; color: var(--muted); margin-top: 2px; }
.plan-features { margin-top: 12px; }
.plan-feature {
  font-size: 13px;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.plan-feature::before { content: '✅'; font-size: 13px; }
.plan-btn { margin-top: 14px; }
.current-badge {
  position: absolute;
  top: 12px; right: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 22px;
}

/* ── REFERRAL CARD ── */
.referral-code-box {
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  margin-bottom: 14px;
}
.referral-code {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 2px;
}
.referral-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ref-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.ref-stat {
  background: #fff;
  border-radius: var(--radius-xs);
  padding: 12px 8px;
  text-align: center;
  box-shadow: 0 1px 6px var(--shadow);
}
.ref-stat-val { font-size: 20px; font-weight: 800; color: var(--primary); }
.ref-stat-lbl { font-size: 10px; color: var(--muted); margin-top: 2px; font-weight: 600; }
.share-btns { display: flex; gap: 8px; }
.share-btn {
  flex: 1;
  padding: 11px 8px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.share-wa { background: #25D366; color: #fff; }
.share-ig { background: linear-gradient(135deg,#E1306C,#833AB4); color: #fff; }
.share-copy { background: #F0F4F8; color: var(--text); }

/* ── AI CHAT MODAL ── */
.ai-fab {
  position: fixed;
  bottom: calc(var(--nav) + 16px);
  right: 16px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(102,126,234,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 90;
  transition: transform .2s;
}
.ai-fab:active { transform: scale(.92); }
.ai-modal {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 430px;
  margin: 0 auto;
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,.15);
  z-index: 300;
  transform: translateY(100%);
  transition: transform .3s ease;
  max-height: 80vh;
  display: flex; flex-direction: column;
}
.ai-modal.open { transform: translateY(0); }
.ai-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.ai-modal-title { font-size: 16px; font-weight: 700; flex: 1; }
.ai-close-btn {
  background: none; border: none;
  font-size: 22px; color: var(--muted);
  cursor: pointer; padding: 4px;
}
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.6;
}
.ai-bubble.bot {
  background: #F0F4F8;
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ai-bubble.user {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ai-input-row {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}
.ai-inp {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 22px;
  font-size: 14px;
  outline: none;
}
.ai-inp:focus { border-color: var(--primary); }
.ai-send {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── SUPPLEMENT ITEM ── */
.supp-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #F4F4F4;
}
.supp-item:last-child { border-bottom: none; }
.supp-emoji { font-size: 28px; flex-shrink: 0; }
.supp-name { font-size: 14px; font-weight: 700; }
.supp-dose { font-size: 12px; color: var(--primary); font-weight: 600; margin-top: 2px; }
.supp-time { font-size: 11px; color: var(--muted); margin-top: 1px; }
.supp-note { font-size: 11px; color: var(--blue); margin-top: 2px; }

/* ── WEEKLY PLAN TABLE ── */
.week-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.week-table th, .week-table td {
  padding: 8px 10px;
  font-size: 12px;
  text-align: left;
  border-bottom: 1px solid #F4F4F4;
}
.week-table th {
  font-weight: 700;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}
.week-table tr.today-row td { background: var(--primary-light); font-weight: 700; }

/* ── BADGE COLOURS ── */
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.b-chest    { background: #FFF0E6; color: #FF6B35; }
.b-back     { background: #E8F5E9; color: #2E7D32; }
.b-legs     { background: #E3F2FD; color: #1565C0; }
.b-shoulder { background: #F3E5F5; color: #6A1B9A; }
.b-full     { background: #FFFDE7; color: #F57F17; }
.b-cardio   { background: #FCE4EC; color: #880E4F; }
.b-rest     { background: #E0F2F1; color: #00695C; }
.b-arms     { background: #FBE9E7; color: #BF360C; }
.b-silver   { background: #ECEFF1; color: #455A64; }
.b-gold     { background: #FFF8E1; color: #FF8F00; }
.b-diamond  { background: #E3F2FD; color: #1565C0; }
.b-platinum { background: #F3E5F5; color: #6A1B9A; }

/* ── GREETING CARD ── */
.greeting-card {
  background: linear-gradient(135deg, var(--primary), #FF9800);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.greeting-card::after {
  content: '💪';
  position: absolute;
  right: -8px; top: -8px;
  font-size: 72px;
  opacity: .12;
  transform: rotate(10deg);
}
.greeting-name { font-size: 20px; font-weight: 800; }
.greeting-date { font-size: 12px; opacity: .85; margin-top: 2px; }
.greeting-affirmation {
  font-size: 13px;
  opacity: .95;
  margin-top: 10px;
  line-height: 1.5;
  font-style: italic;
  background: rgba(255,255,255,.15);
  padding: 8px 12px;
  border-radius: 10px;
}

/* ── GYM INFO BANNER ── */
.gym-banner {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 10px var(--shadow);
}
.gym-logo {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.gym-name { font-size: 15px; font-weight: 700; }
.gym-address { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── DIET TIPS ── */
.tips-list { margin-top: 8px; }
.tip-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text);
}
.tip-item::before { content: '💡'; font-size: 13px; flex-shrink: 0; }

/* ── SVG CHART CONTAINER ── */
.chart-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 8px;
}
.chart-wrap svg { display: block; }

/* ── PREMIUM LOCK ── */
.premium-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  text-align: center;
  gap: 8px;
}
.premium-lock-icon { font-size: 36px; }
.premium-lock-title { font-size: 15px; font-weight: 700; }
.premium-lock-sub { font-size: 12px; color: var(--muted); }
.b-blue     { background: #EBF4FF; color: #2B6CB0; }
