/* ==========================================================================
   FITEXPERT STUDIO - 100% DEDICATED MOBILE APP SYSTEM (NATIVE IPHONE UI)
   ========================================================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-card: rgba(23, 32, 54, 0.92);

  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-emerald: #10b981;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-highlight: rgba(0, 242, 254, 0.35);

  --font-heading: 'Outfit', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;

  --glass-blur: blur(16px);
  --shadow-lg: 0 8px 24px 0 rgba(0, 0, 0, 0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s ease;
}

*, *::before, *::after {
  box-sizing: border-box !important;
  margin: 0;
  padding: 0;
  max-width: 100% !important;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  background-color: var(--bg-primary);
  height: 100%;
}

body {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  min-height: 100vh;
  position: relative;
  overscroll-behavior-y: none;
  -webkit-user-select: none;
  user-select: none;
}

img, svg, canvas, input, select, textarea, button {
  max-width: 100% !important;
}

input, select, textarea {
  -webkit-user-select: text;
  user-select: text;
}

.desktop-only-nav,
.desktop-text {
  display: none !important;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.2;
}
.glow-1 { width: 220px; height: 220px; background: radial-gradient(circle, var(--accent-cyan), transparent); top: -30px; left: -30px; }
.glow-2 { width: 220px; height: 220px; background: radial-gradient(circle, var(--accent-purple), transparent); bottom: -30px; right: -30px; }

/* Native App Top Header Bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.95);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  padding-top: max(10px, env(safe-area-inset-top));
  padding-bottom: 8px;
  padding-left: 10px;
  padding-right: 10px;
  width: 100% !important;
}

.header-container {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.brand { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.brand-icon {
  width: 32px; height: 32px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #0b0f19; display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.brand-text h1 { font-family: var(--font-heading); font-size: 15px; font-weight: 800; line-height: 1; }
.accent-text { background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.btn-purple { background: linear-gradient(135deg, var(--accent-purple), #6d28d9); color: #fff; }
.btn-reload-glow { background: linear-gradient(135deg, var(--accent-emerald), #047857); color: #fff; }

/* Native Bottom Mobile Tab Bar */
.mobile-bottom-nav {
  display: flex !important;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1001 !important;
  pointer-events: auto !important;
  background: rgba(11, 15, 25, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  padding-top: 6px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  padding-left: 2px; padding-right: 2px;
  justify-content: space-around;
  user-select: none;
  width: 100% !important;
}

.mobile-nav-btn {
  background: transparent; border: none; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-family: var(--font-heading); font-size: 10px; font-weight: 600;
  cursor: pointer; flex: 1; padding: 6px 0; transition: var(--transition);
  pointer-events: auto !important;
  z-index: 1002 !important;
}
.mobile-nav-btn i, .mobile-nav-btn span { pointer-events: none; }
.mobile-nav-btn i { font-size: 16px; }
.mobile-nav-btn.active { color: var(--accent-cyan); font-weight: 700; }

/* Full-Width Fluid Mobile App Container */
.main-container {
  width: 100% !important;
  max-width: 100% !important;
  margin: 6px auto calc(70px + env(safe-area-inset-bottom)) auto !important;
  padding: 0 8px !important;
}

.tab-content { display: none; width: 100% !important; }
.tab-content.active { display: block; }

.section-header { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 10px; width: 100% !important; }
.section-header h2 { font-family: var(--font-heading); font-size: 16px; font-weight: 700; line-height: 1.2; }
.section-header p { color: var(--text-muted); font-size: 11px; }

.grid, .grid-2, .grid-3-1, .grid-2-sm, .grid-3-sm {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 10px;
  width: 100% !important;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px; font-family: var(--font-heading); font-weight: 700; font-size: 13px;
  border-radius: var(--radius-md); border: none; cursor: pointer; min-height: 40px; transition: var(--transition);
}
.btn-primary { background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue)); color: #0b0f19; }
.btn-emerald { background: linear-gradient(135deg, var(--accent-emerald), #059669); color: #fff; }
.btn-outline { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color); color: var(--text-main); }
.btn-sm { padding: 5px 8px; min-height: 32px; font-size: 11px; border-radius: var(--radius-sm); }
.btn-block { width: 100% !important; }

.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px !important;
  box-shadow: var(--shadow-lg);
  width: 100% !important;
  overflow: hidden !important;
}

.card-title { font-family: var(--font-heading); font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: var(--radius-full); font-size: 10px; font-weight: 600; font-family: var(--font-heading); white-space: nowrap; }
.badge-cyan { background: rgba(0, 242, 254, 0.15); color: var(--accent-cyan); border: 1px solid rgba(0, 242, 254, 0.3); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }

.form-group { margin-bottom: 8px; width: 100% !important; }
.form-group label { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 3px; }
.form-control { width: 100% !important; background: rgba(11, 15, 25, 0.7); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 8px 10px; color: var(--text-main); font-size: 14px; outline: none; min-height: 40px; }

.metrics-grid { display: grid; grid-template-columns: 1fr !important; gap: 6px; margin-bottom: 10px; width: 100% !important; }
.metric-box { background: rgba(11, 15, 25, 0.6); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px !important; text-align: center; overflow: hidden !important; }
.metric-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; display: block; }
.metric-value { font-family: var(--font-heading); font-size: 18px !important; font-weight: 800; margin: 2px 0; word-break: break-all; }
.metric-unit { font-size: 9px; color: var(--text-dim); display: block; }

.chart-wrapper { width: 100% !important; position: relative; margin: 8px 0; max-height: 160px; }

.macro-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; width: 100% !important; }
.macro-card { background: rgba(11, 15, 25, 0.4); border-radius: var(--radius-md); padding: 8px; border-left: 3px solid var(--accent-blue); width: 100% !important; }
.macro-prot { border-left-color: var(--accent-cyan); }
.macro-carbs { border-left-color: var(--accent-emerald); }
.macro-fat { border-left-color: var(--accent-amber); }
.macro-header { display: flex; justify-content: space-between; font-weight: 600; font-size: 11px; margin-bottom: 2px; }
.macro-bar { height: 5px; background: rgba(255, 255, 255, 0.1); border-radius: var(--radius-full); overflow: hidden; width: 100% !important; }
.macro-fill { height: 100%; border-radius: var(--radius-full); }
.macro-prot .macro-fill { background: var(--accent-cyan); }
.macro-carbs .macro-fill { background: var(--accent-emerald); }
.macro-fat .macro-fill { background: var(--accent-amber); }
.macro-sub { font-size: 9px; color: var(--text-muted); }

.day-tabs { display: flex; gap: 4px; margin-bottom: 10px; overflow-x: auto; padding-bottom: 4px; width: 100% !important; -webkit-overflow-scrolling: touch; }
.day-tab-btn { background: rgba(11, 15, 25, 0.6); border: 1px solid var(--border-color); color: var(--text-muted); padding: 5px 10px; border-radius: var(--radius-md); font-family: var(--font-heading); font-weight: 600; font-size: 11px; white-space: nowrap; flex-shrink: 0; }
.day-tab-btn.active { background: var(--accent-purple); color: #fff; border-color: var(--accent-purple); }

.exercise-list { display: flex; flex-direction: column; gap: 8px; width: 100% !important; }
.exercise-card { background: rgba(11, 15, 25, 0.6); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 100% !important; }
.ex-info h4 { font-family: var(--font-heading); font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.ex-meta { display: flex; flex-wrap: wrap; gap: 4px; font-size: 10px; color: var(--text-muted); }

.week-days-bar { display: flex; gap: 4px; margin-bottom: 10px; overflow-x: auto; padding-bottom: 4px; width: 100% !important; }
.day-nav-btn { flex: 1; min-width: 38px; background: rgba(19, 27, 46, 0.7); border: 1px solid var(--border-color); color: var(--text-muted); padding: 6px 2px; border-radius: var(--radius-md); font-family: var(--font-heading); font-weight: 700; text-align: center; font-size: 11px; }
.day-nav-btn.active { background: linear-gradient(135deg, var(--accent-emerald), #059669); color: #fff; border-color: var(--accent-emerald); }

.meal-item-card { background: rgba(11, 15, 25, 0.6); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px; width: 100% !important; }
.meal-cat { font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--accent-emerald); margin-bottom: 2px; }
.meal-name { font-family: var(--font-heading); font-size: 13px; font-weight: 700; margin-bottom: 4px; }

.chat-modal-card { width: 94vw !important; max-width: 480px !important; height: 80vh !important; display: flex; flex-direction: column; padding: 12px !important; }
.ai-chat-header { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color); margin-bottom: 6px; }
.ai-avatar-badge { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-purple), #6d28d9); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.chat-chips-bar { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 4px; }
.chat-chip { background: rgba(139, 92, 246, 0.15); border: 1px solid rgba(139, 92, 246, 0.3); color: #ddd6fe; padding: 4px 8px; border-radius: var(--radius-full); font-size: 10px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.chat-messages-container { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px; }
.chat-msg { display: flex; gap: 6px; max-width: 92%; }
.chat-msg.ai { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-purple); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.chat-bubble { background: rgba(19, 27, 46, 0.95); border: 1px solid var(--border-color); padding: 8px 10px; border-radius: var(--radius-md); font-size: 12px; line-height: 1.35; color: var(--text-main); }
.chat-msg.user .chat-bubble { background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue)); color: #0b0f19; font-weight: 600; border: none; }
.chat-input-form { display: flex; gap: 6px; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border-color); }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(11, 15, 25, 0.9); backdrop-filter: blur(6px); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 8px !important; }
.modal-overlay.active { display: flex !important; }
.modal-card { background: var(--bg-secondary); border: 1px solid var(--border-highlight); border-radius: var(--radius-lg); width: 94vw !important; max-width: 480px !important; max-height: 80vh !important; overflow-y: auto; padding: 14px !important; position: relative; }
.modal-close { position: absolute; top: 8px; right: 8px; background: transparent; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }

@media print {
  .app-header,
  .mobile-bottom-nav,
  .bg-glow,
  .header-buttons,
  .chat-chips-bar,
  .chat-input-form,
  .btn,
  .modal-overlay {
    display: none !important;
  }

  body, html {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt !important;
  }

  .tab-content {
    display: block !important;
    page-break-after: always;
  }

  .card {
    background: #ffffff !important;
    border: 1px solid #000000 !important;
    box-shadow: none !important;
    color: #000000 !important;
    margin-bottom: 20px !important;
    padding: 15px !important;
  }

  .card-title, h2, h3, h4 {
    color: #000000 !important;
  }

  .exercise-card, .meal-item-card, .metric-box {
    background: #f8fafc !important;
    border: 1px solid #cccccc !important;
    color: #000000 !important;
  }

  .metric-value, .badge, span, p, label {
    color: #000000 !important;
  }
}
