/* ==========================================================================
   ApexCoach - Ultra Mobile Native Design System (Invitation Codes Engine)
   ========================================================================== */

:root {
  --bg-dark: #0A0E17;
  --bg-card: #141B2D;
  --bg-card-hover: #1E283D;
  --bg-header: rgba(14, 20, 32, 0.96);
  
  --primary: #10B981;
  --primary-glow: rgba(16, 185, 129, 0.25);
  --primary-hover: #059669;
  
  --accent: #06B6D4;
  --coach-purple: #8B5CF6;
  --coach-glow: rgba(139, 92, 246, 0.25);
  
  --color-protein: #3B82F6;
  --color-carbs: #F59E0B;
  --color-fats: #EC4899;

  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);

  --danger: #EF4444;
  --warning: #F59E0B;
  --success: #10B981;

  --font-heading: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;

  --header-height: 50px;
  --nav-height: 58px;
  --max-width: 480px;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  background-color: #030712;
  color: var(--text-main);
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

button, .card, .food-search-item, .exercise-card, .portal-card, .subtab-btn, .nav-item, .more-menu-item, .sub-plan-card {
  transition: transform 0.1s ease, background-color 0.15s ease, border-color 0.15s ease;
}

button:active, .portal-card:active, .more-menu-item:active {
  transform: scale(0.96) !important;
}

/* Mobile Frame Wrapper */
.app-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  background-color: var(--bg-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  padding-bottom: calc(var(--nav-height) + 10px);
  overflow-x: hidden;
}

/* Form controls */
.form-group { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
.form-control {
  background-color: var(--bg-dark); border: 1px solid var(--border-color); border-radius: 10px;
  padding: 8px 10px; color: var(--text-main); font-size: 0.8rem; outline: none; width: 100%;
}
.form-control:focus { border-color: var(--primary); }

/* INVITATION CODE CARD STYLES */
.invite-code-card {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(16, 185, 129, 0.12));
  border: 1px dashed var(--coach-purple); border-radius: 14px; padding: 14px; text-align: center;
}
.invite-code-card .lbl { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 4px; }
.code-val-box {
  font-family: var(--font-heading); font-size: 1.4rem; font-weight: 800; color: var(--primary);
  letter-spacing: 2px; padding: 6px; border-radius: 8px; background-color: rgba(0,0,0,0.4); margin: 6px 0;
}

/* Login Portal */
.login-portal {
  padding: 30px 16px;
  display: flex; flex-direction: column; justify-content: center; min-height: 100vh; text-align: center;
  background: radial-gradient(circle at top, rgba(16, 185, 129, 0.12), transparent 70%);
}
.login-brand { margin-bottom: 24px; }
.login-logo {
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: inline-flex; align-items: center; justify-content: center; color: #000; box-shadow: 0 8px 20px var(--primary-glow); margin-bottom: 10px;
}
.logo-icon-lg { width: 28px; height: 28px; }
.login-brand h1 { font-family: var(--font-heading); font-size: 1.9rem; font-weight: 800; }
.login-brand h1 span { color: var(--primary); }
.login-brand p { color: var(--text-muted); font-size: 0.8rem; margin-top: 3px; }

.portal-instruction { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

.portal-cards { display: flex; flex-direction: column; gap: 10px; }
.portal-card {
  background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px;
  padding: 12px; display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.portal-avatar { position: relative; flex-shrink: 0; }
.portal-avatar img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
.portal-coach .portal-avatar img { border-color: var(--coach-purple); }

.portal-badge {
  position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
  background-color: var(--coach-purple); color: #FFF; font-size: 0.55rem; font-weight: 800;
  padding: 1px 5px; border-radius: 6px; text-transform: uppercase; white-space: nowrap;
}
.portal-badge.client { background-color: var(--primary); color: #000; }

.portal-info { flex: 1; min-width: 0; }
.portal-info h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 2px; }
.portal-info p { font-size: 0.7rem; color: var(--text-muted); line-height: 1.2; }
.portal-arrow { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }

/* SINGLE-LINE COMPACT TOP HEADER (50px HIGH) */
.app-header {
  position: sticky; top: 0; z-index: 100; background-color: var(--bg-header);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color); padding: 0 10px;
  height: var(--header-height); display: flex; align-items: center; justify-content: space-between;
  width: 100%; overflow: hidden; gap: 6px;
}

.brand-mini { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.logo-badge-mini {
  width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center; color: #000; box-shadow: 0 2px 8px var(--primary-glow);
}
.logo-icon-sm { width: 15px; height: 15px; }
.brand-title-sm { font-family: var(--font-heading); font-size: 0.95rem; font-weight: 800; letter-spacing: -0.4px; }
.brand-title-sm span { color: var(--primary); }

/* Coach Client Selector Pill & Quota Badge */
.client-picker-pill {
  display: flex; align-items: center; gap: 4px; background-color: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--coach-purple); border-radius: 12px; padding: 2px 6px;
  flex: 1; max-width: 170px; min-width: 0;
}

.client-picker-pill .badge { cursor: pointer; font-size: 0.6rem; padding: 1px 4px; flex-shrink: 0; }

.client-dropdown-mini {
  background: transparent; color: var(--text-main); border: none; font-size: 0.72rem;
  font-weight: 700; outline: none; width: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; cursor: pointer;
}
.client-dropdown-mini option { background-color: var(--bg-card); color: var(--text-main); }

.header-right-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.btn-icon-head {
  width: 30px; height: 30px; border-radius: 8px; background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color); color: var(--text-main); display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: 0.8rem;
}

.btn-profile-logout-sm { background: transparent; border: none; cursor: pointer; display: flex; align-items: center; gap: 4px; padding: 0; }
.btn-profile-logout-sm img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1px solid var(--primary); }

/* Main Views */
.app-content { flex: 1; padding: 10px; display: flex; flex-direction: column; width: 100%; overflow-x: hidden; }
.app-view { display: none; animation: fadeIn 0.2s ease-out; width: 100%; }
.app-view.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

.view-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 6px; }
.view-header h2 { font-family: var(--font-heading); font-size: 1.15rem; font-weight: 700; }

.card { background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 14px; padding: 12px; margin-bottom: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); width: 100%; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 6px; }
.card-header h3 { font-size: 0.88rem; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.card-header h3 svg { width: 15px; height: 15px; color: var(--primary); }

.view-hero { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.hero-text h2 { font-size: 1.15rem; font-weight: 800; }
.hero-text p { font-size: 0.72rem; color: var(--text-muted); }

.btn-icon-circle {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none; color: #000; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 12px var(--primary-glow); flex-shrink: 0;
}

.coach-banner {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(6, 182, 212, 0.15));
  border: 1px solid var(--coach-purple); border-radius: 12px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.coach-avatar img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--coach-purple); flex-shrink: 0; }
.coach-banner-info { flex: 1; min-width: 0; }
.coach-name { font-size: 0.65rem; font-weight: 700; color: var(--coach-purple); text-transform: uppercase; }
.coach-msg { font-size: 0.72rem; font-style: italic; color: var(--text-main); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* SUBSCRIPTION TIERS CARDS MODAL */
.sub-plans-grid { display: flex; flex-direction: column; gap: 10px; }
.sub-plan-card {
  background-color: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color); border-radius: 14px;
  padding: 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
}

.sub-plan-card.active-plan {
  border-color: var(--primary); background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(20, 27, 45, 1));
  box-shadow: 0 4px 16px var(--primary-glow);
}

.plan-header { display: flex; justify-content: space-between; align-items: center; }
.plan-header h4 { font-size: 0.95rem; font-weight: 800; }
.plan-price { font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.plan-price span { font-size: 0.68rem; font-weight: 400; color: var(--text-muted); }

.plan-features { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.plan-features li { font-size: 0.75rem; color: var(--text-main); display: flex; align-items: center; gap: 6px; }
.plan-features li svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Calorie Ring */
.macro-dashboard-grid { display: flex; align-items: center; gap: 12px; }
.calorie-ring-container { position: relative; width: 75px; height: 75px; flex-shrink: 0; }
.calorie-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 10; }
.ring-progress { fill: none; stroke: var(--primary); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }

.calorie-ring-content { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.calorie-val { font-family: var(--font-heading); font-size: 0.9rem; font-weight: 800; line-height: 1; color: var(--text-main); }
.calorie-lbl { font-size: 0.52rem; color: var(--text-muted); margin-top: 2px; }

.macro-bars-stack { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.macro-lbl-row { display: flex; justify-content: space-between; font-size: 0.65rem; margin-bottom: 1px; }
.macro-name { font-weight: 600; display: flex; align-items: center; gap: 4px; }

.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-protein { background-color: var(--color-protein); }
.dot-carbs { background-color: var(--color-carbs); }
.dot-fats { background-color: var(--color-fats); }

.bg-protein { background-color: var(--color-protein); }
.bg-carbs { background-color: var(--color-carbs); }
.bg-fats { background-color: var(--color-fats); }

.progress-bar-bg { height: 4px; background-color: rgba(255, 255, 255, 0.08); border-radius: 10px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 10px; transition: width 0.4s ease; }

.workout-preview-list { display: flex; flex-direction: column; gap: 6px; }
.exercise-preview-item {
  background-color: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color); border-radius: 10px;
  padding: 6px 8px; display: flex; align-items: center; gap: 8px;
}
.ex-num { width: 22px; height: 22px; border-radius: 50%; background-color: rgba(255, 255, 255, 0.08); font-size: 0.68rem; font-weight: 700; display: flex; align-items: center; justify-content: center; color: var(--text-muted); flex-shrink: 0; }
.ex-details { flex: 1; min-width: 0; }
.ex-title { font-size: 0.78rem; font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-meta { font-size: 0.65rem; color: var(--text-muted); }

/* Running Module Styles */
.running-dash-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.run-dash-stat { background-color: rgba(255, 255, 255, 0.03); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; }
.run-dash-stat .lbl { font-size: 0.65rem; color: var(--text-muted); }
.run-dash-stat .val { font-size: 0.95rem; font-weight: 800; margin: 1px 0; }
.run-dash-stat .sub { font-size: 0.65rem; color: var(--text-muted); }

.running-vma-card { padding: 12px; }
.vma-input-row { display: flex; flex-direction: column; gap: 8px; }
.vma-pace-table { background-color: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color); border-radius: 10px; padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; }
.pace-row { display: flex; justify-content: space-between; font-size: 0.72rem; }
.pace-row strong { color: var(--accent); }

.runs-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.run-card { padding: 10px; margin-bottom: 0; }
.run-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.run-dist { font-size: 1.1rem; font-weight: 800; color: var(--accent); }
.run-dist small { font-size: 0.65rem; font-weight: 500; color: var(--text-muted); }

.run-metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background-color: rgba(255, 255, 255, 0.03); border-radius: 8px; padding: 4px; text-align: center; }
.run-metric { display: flex; flex-direction: column; align-items: center; font-size: 0.65rem; }
.run-metric svg { width: 12px; height: 12px; color: var(--accent); margin-bottom: 1px; }

/* Exercise Library Styles */
.category-chips-scroll { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: none; }
.category-chips-scroll::-webkit-scrollbar { display: none; }

.chip-filter {
  background-color: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-muted); padding: 5px 10px;
  border-radius: 10px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; cursor: pointer; flex-shrink: 0;
}
.chip-filter.active { background-color: var(--primary); border-color: var(--primary); color: #000; box-shadow: 0 2px 6px var(--primary-glow); }

.exercise-library-grid { display: flex; flex-direction: column; gap: 8px; }
.exercise-lib-card { padding: 0; overflow: hidden; display: flex; cursor: pointer; height: 90px; }
.lib-card-img { width: 85px; height: 100%; position: relative; flex-shrink: 0; }
.lib-card-img img { width: 100%; height: 100%; object-fit: cover; }
.lib-tag { position: absolute; bottom: 3px; left: 3px; background-color: rgba(0, 0, 0, 0.85); font-size: 0.55rem; font-weight: 700; padding: 1px 4px; border-radius: 4px; white-space: nowrap; }

.lib-card-content { flex: 1; padding: 8px; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.lib-card-content h4 { font-size: 0.8rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muscles-lbl { font-size: 0.65rem; color: var(--text-muted); display: flex; align-items: center; gap: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muscles-lbl svg { width: 10px; height: 10px; color: var(--primary); flex-shrink: 0; }

.lib-card-footer { display: flex; justify-content: space-between; align-items: center; }
.difficulty-pill { font-size: 0.58rem; background-color: rgba(255, 255, 255, 0.08); padding: 1px 5px; border-radius: 4px; color: var(--text-muted); }

/* Detail Tutorial Modal Elements */
.detail-ex-media { width: 100%; border-radius: 10px; overflow: hidden; margin-bottom: 10px; max-height: 160px; background-color: #000; }
.detail-img { width: 100%; height: 100%; object-fit: cover; }
.detail-ex-section { background-color: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color); border-radius: 10px; padding: 8px; margin-bottom: 8px; }
.detail-ex-section h4 { font-size: 0.78rem; font-weight: 700; margin-bottom: 5px; display: flex; align-items: center; gap: 4px; }
.detail-ex-section h4 svg { width: 14px; height: 14px; color: var(--primary); }

.instructions-steps-list { display: flex; flex-direction: column; gap: 5px; }
.step-item { display: flex; gap: 6px; font-size: 0.72rem; line-height: 1.25; }
.step-num { width: 18px; height: 18px; border-radius: 50%; background-color: var(--primary-glow); color: var(--primary); font-weight: 700; font-size: 0.62rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tips-list { font-size: 0.72rem; line-height: 1.3; color: var(--text-main); display: flex; flex-direction: column; gap: 4px; }

.exercise-bank-picker-list { display: flex; flex-direction: column; gap: 6px; }
.exercise-bank-item { background-color: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color); border-radius: 10px; padding: 6px 8px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.exercise-bank-item img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.bank-item-info { flex: 1; min-width: 0; }
.bank-item-info h4 { font-size: 0.78rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-item-cat { font-size: 0.65rem; color: var(--text-muted); }

/* Coach Specialties Checkbox Cards */
.specs-checkbox-grid { display: flex; flex-direction: column; gap: 6px; }
.spec-checkbox-card {
  background-color: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color); border-radius: 10px;
  padding: 8px; display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.spec-checkbox-card input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--coach-purple); flex-shrink: 0; }
.spec-info strong { font-size: 0.78rem; font-weight: 700; }
.spec-info span { font-size: 0.65rem; color: var(--text-muted); }

/* Client Modules Toggle Form */
.modules-toggle-form { display: flex; flex-direction: column; gap: 8px; }
.toggle-row {
  background-color: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color); border-radius: 10px;
  padding: 8px; display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
.toggle-row strong { font-size: 0.78rem; display: block; }
.toggle-row p { font-size: 0.65rem; color: var(--text-muted); }
.switch-toggle { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }

/* Nutrition & Search View */
.date-selector { display: flex; align-items: center; gap: 5px; font-size: 0.78rem; font-weight: 600; }
.search-bar-container { position: relative; margin-bottom: 8px; }
.search-input-wrapper { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--text-muted); }

.search-input-wrapper input {
  width: 100%; background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px;
  padding: 8px 36px 8px 32px; color: var(--text-main); font-size: 0.78rem; outline: none;
}
.search-input-wrapper input:focus { border-color: var(--primary); }

.barcode-scan-btn {
  position: absolute; right: 4px; background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none; color: #000; width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}

.quick-barcode-demos { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; font-size: 0.65rem; color: var(--text-muted); }
.badge-demo { background-color: rgba(255, 255, 255, 0.08); border: 1px solid var(--border-color); color: var(--text-main); padding: 2px 6px; border-radius: 8px; cursor: pointer; white-space: nowrap; flex-shrink: 0; }

.search-results-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; background-color: var(--bg-card); border: 1px solid var(--primary);
  border-radius: 12px; margin-top: 4px; max-height: 220px; overflow-y: auto; z-index: 90; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.food-search-item { padding: 8px 10px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.food-item-info h4 { font-size: 0.78rem; font-weight: 600; }
.food-item-info p { font-size: 0.65rem; color: var(--text-muted); }
.food-item-macros { text-align: right; }
.food-item-macros .cal { font-size: 0.78rem; font-weight: 700; color: var(--primary); display: block; }
.food-item-macros .macros { font-size: 0.6rem; color: var(--text-muted); }

.meal-card { padding: 10px; margin-bottom: 8px; }
.meal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.meal-title-group { display: flex; align-items: center; gap: 6px; }
.meal-icon { width: 16px; height: 16px; }
.meal-title-group h4 { font-size: 0.8rem; font-weight: 700; }
.meal-calories { font-size: 0.68rem; color: var(--text-muted); }
.meal-food-list { display: flex; flex-direction: column; gap: 4px; }

.logged-food-row { background-color: rgba(255, 255, 255, 0.02); border: 1px solid var(--border-color); border-radius: 6px; padding: 5px 6px; display: flex; justify-content: space-between; align-items: center; font-size: 0.74rem; }
.logged-food-name { font-weight: 500; }
.logged-food-weight { color: var(--text-muted); font-size: 0.62rem; }
.logged-food-right { display: flex; align-items: center; gap: 5px; }
.logged-food-kcal { font-weight: 700; }
.btn-remove-food { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 0.85rem; padding: 0 2px; }

/* Workout View */
.workout-days-scroll { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: none; }
.workout-days-scroll::-webkit-scrollbar { display: none; }

.day-tab { background-color: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-muted); padding: 5px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; cursor: pointer; display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.day-tab span { font-size: 0.58rem; font-weight: 400; margin-top: 1px; }
.day-tab.active { background-color: var(--primary); border-color: var(--primary); color: #000; box-shadow: 0 2px 6px var(--primary-glow); }

.workout-session-header { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(20, 27, 45, 1)); border-color: rgba(16, 185, 129, 0.3); padding: 10px; }
.session-meta h3 { font-size: 0.92rem; margin-top: 2px; }
.session-desc { font-size: 0.68rem; color: var(--text-muted); margin-top: 1px; }

.exercise-card { background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 10px; margin-bottom: 8px; width: 100%; overflow: hidden; }
.exercise-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 4px; }
.exercise-title-area h4 { font-size: 0.82rem; font-weight: 700; }
.exercise-notes { font-size: 0.68rem; color: var(--text-muted); }

.sets-table { width: 100%; border-collapse: collapse; margin-bottom: 6px; table-layout: fixed; }
.sets-table th { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; text-align: center; padding: 3px 1px; }
.sets-table td { padding: 2px 1px; text-align: center; }

.set-input { width: 42px; background-color: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color); border-radius: 5px; color: var(--text-main); padding: 3px 2px; font-size: 0.75rem; font-weight: 700; text-align: center; outline: none; }
.set-check { width: 24px; height: 24px; border-radius: 5px; border: 1.5px solid var(--border-color); background: transparent; color: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.set-check.checked { background-color: var(--primary); border-color: var(--primary); color: #000; }

.exercise-actions-bar { display: flex; justify-content: flex-end; gap: 4px; padding-top: 4px; border-top: 1px dashed var(--border-color); }

/* Progress Charts */
.progress-tabs-sub { display: flex; background-color: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-color); border-radius: 10px; padding: 2px; margin-bottom: 10px; }
.subtab-btn { flex: 1; border: none; background: transparent; color: var(--text-muted); font-size: 0.7rem; font-weight: 600; padding: 5px 3px; border-radius: 7px; cursor: pointer; }
.subtab-btn.active { background-color: var(--bg-card); color: var(--primary); }

.chart-wrapper { position: relative; height: 180px; width: 100%; }

/* CHAT VIEW - FULL VERTICAL SPACE MAXIMIZED */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - var(--header-height) - var(--nav-height) - 15px); }
.chat-header { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border-color); margin-bottom: 6px; flex-shrink: 0; }
.chat-avatar-wrapper { position: relative; flex-shrink: 0; }
.chat-avatar-wrapper img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }

.online-indicator { position: absolute; bottom: 1px; right: 1px; width: 8px; height: 8px; border-radius: 50%; background-color: var(--success); border: 1.5px solid var(--bg-dark); }
.chat-header-info h3 { font-size: 0.82rem; font-weight: 700; }
.status-text { font-size: 0.62rem; color: var(--text-muted); }

.coach-quick-replies { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 4px; flex-shrink: 0; }
.chip { background-color: rgba(139, 92, 246, 0.15); border: 1px solid var(--coach-purple); color: var(--text-main); padding: 3px 7px; border-radius: 10px; font-size: 0.65rem; white-space: nowrap; cursor: pointer; flex-shrink: 0; }

.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 2px; margin-bottom: 8px; }
.msg-bubble { max-width: 82%; padding: 8px 10px; border-radius: 12px; font-size: 0.78rem; line-height: 1.3; position: relative; }
.msg-incoming { align-self: flex-start; background-color: var(--bg-card); border: 1px solid var(--border-color); border-bottom-left-radius: 2px; }
.msg-outgoing { align-self: flex-end; background: linear-gradient(135deg, var(--primary), #059669); color: #000; font-weight: 500; border-bottom-right-radius: 2px; }
.msg-time { font-size: 0.58rem; margin-top: 2px; display: block; opacity: 0.7; text-align: right; }

.chat-input-bar { display: flex; align-items: center; gap: 4px; background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 16px; padding: 4px 6px; flex-shrink: 0; }
.btn-chat-attach { background: none; border: none; color: var(--text-muted); padding: 4px; cursor: pointer; flex-shrink: 0; }
.chat-input-bar input { flex: 1; background: transparent; border: none; color: var(--text-main); font-size: 0.78rem; outline: none; min-width: 0; }
.btn-chat-send { background-color: var(--primary); border: none; color: #000; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }

/* FIXED 5-TAB BOTTOM NAVIGATION BAR (ZERO SCROLL) */
.app-bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--max-width); height: var(--nav-height);
  background-color: rgba(14, 20, 32, 0.98); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color); display: flex; justify-content: space-around; align-items: center;
  z-index: 100; padding: 0; overflow: hidden; flex-wrap: nowrap;
}

.nav-item {
  background: transparent; border: none; color: var(--text-muted); display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: 0.6rem; font-weight: 600; cursor: pointer; padding: 4px 0; border-radius: 8px; flex: 1; text-align: center;
}

.nav-item svg { width: 16px; height: 16px; }
.nav-item.active { color: var(--primary); }

.nav-icon-badge { position: relative; }
.badge-dot { position: absolute; top: -2px; right: -2px; width: 7px; height: 7px; background-color: var(--danger); border-radius: 50%; display: none; }
.badge-dot.active { display: block; }

/* MORE MENU BOTTOM SHEET DRAWER */
.more-menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 4px 0; }
.more-menu-item {
  background-color: rgba(255, 255, 255, 0.04); border: 1px solid var(--border-color); border-radius: 12px;
  padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center;
  cursor: pointer; color: var(--text-main); font-size: 0.78rem; font-weight: 600;
}
.more-menu-item svg { width: 22px; height: 22px; color: var(--primary); }
.more-menu-item.accent svg { color: var(--accent); }
.more-menu-item.purple svg { color: var(--coach-purple); }

/* Buttons & UI */
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-hover)); color: #000; font-weight: 700; border: none; border-radius: 8px; padding: 7px 12px; font-size: 0.78rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.btn-outline { background: transparent; border: 1px solid var(--border-light); color: var(--text-main); font-weight: 600; border-radius: 8px; padding: 5px 10px; font-size: 0.72rem; cursor: pointer; }
.btn-ghost { background: rgba(255, 255, 255, 0.08); border: none; color: var(--text-main); font-size: 0.7rem; font-weight: 600; padding: 4px 7px; border-radius: 6px; cursor: pointer; }

.btn-sm { padding: 4px 8px; font-size: 0.7rem; }
.btn-lg { padding: 10px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }

.btn-text { background: none; border: none; color: var(--primary); font-size: 0.72rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 2px; }

.badge { font-size: 0.62rem; font-weight: 700; padding: 2px 5px; border-radius: 8px; }
.badge-warning { background-color: rgba(245, 158, 11, 0.2); color: var(--warning); border: 1px solid var(--warning); }
.badge-accent { background-color: rgba(6, 182, 212, 0.2); color: var(--accent); border: 1px solid var(--accent); }
.badge-outline { border: 1px solid var(--border-light); color: var(--text-muted); }

.tag { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; padding: 2px 4px; border-radius: 4px; }
.tag-primary { background-color: var(--primary-glow); color: var(--primary); }

.hidden { display: none !important; }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-yellow { color: var(--warning); }
.text-orange { color: #F97316; }
.text-blue { color: var(--color-protein); }
.text-red { color: var(--danger); }
.text-muted { color: var(--text-muted); }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px); z-index: 200; display: flex; align-items: flex-end; justify-content: center; }
.modal-content { width: 100%; max-width: var(--max-width); background-color: var(--bg-card); border-top-left-radius: 18px; border-top-right-radius: 18px; border: 1px solid var(--border-color); padding: 14px; max-height: 85vh; overflow-y: auto; animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-header h3 { font-size: 0.95rem; font-weight: 700; display: flex; align-items: center; gap: 5px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.4rem; cursor: pointer; }

.toast-container { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 300; width: 88%; max-width: 360px; display: flex; flex-direction: column; gap: 5px; pointer-events: none; }
.toast { background-color: var(--bg-card); border: 1px solid var(--primary); border-radius: 10px; padding: 8px 12px; font-size: 0.78rem; font-weight: 600; color: var(--text-main); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); animation: toastIn 0.2s ease; }

@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Food Modal Selected Food Badge & Macro Pills */
.selected-food-preview {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.selected-food-preview h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.selected-food-preview p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.macro-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

.pill {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.pill-cal {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pill-prot {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.pill-carbs {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.pill-fats {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

