/* ============================================================
   HOUSE OF ALPHA FITNESS — Mobile-First / App Experience
   Loaded after style.css + pages.css to override for phones.
   Designed to feel like a native app on iOS/Android.
   ============================================================ */

/* ===== Safe area + viewport ===== */
:root {
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h:    72px;
}

html, body {
  /* Disable iOS rubber-band scroll where annoying */
  overscroll-behavior-y: none;
}

/* Better tap feedback */
* { -webkit-tap-highlight-color: rgba(212, 255, 0, 0.15); }
button, a { touch-action: manipulation; }

/* Prevent zoom on input focus on iOS — input must be ≥16px */
input, select, textarea { font-size: 16px !important; }

/* ============================================================
   BOTTOM TAB BAR — visible on mobile only
   ============================================================ */
.tab-bar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-top: 1px solid var(--line);
  padding: 10px 8px calc(10px + var(--safe-bottom));
}
.tab-bar-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 640px;
  margin: 0 auto;
}
.tab-bar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  color: var(--text-muted);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 12px;
  position: relative;
  transition: color .2s;
}
.tab-bar a i {
  font-size: 20px;
  transition: transform .2s;
}
.tab-bar a.active {
  color: var(--accent);
}
.tab-bar a.active i {
  transform: translateY(-2px);
}
.tab-bar a.active::before {
  content: '';
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px;
  background: var(--accent); border-radius: 0 0 4px 4px;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* CTA-style middle tab (Train) */
.tab-bar .tab-cta {
  position: relative;
}
.tab-bar .tab-cta i {
  width: 48px; height: 48px;
  background: var(--grad-accent); color: #0a0a0f;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 18px;
  box-shadow: 0 8px 24px var(--accent-glow);
  margin-bottom: 2px;
  transform: translateY(-12px);
}
.tab-bar .tab-cta {
  font-size: 9px;
}
.tab-bar .tab-cta::before { display: none !important; }

/* ============================================================
   Mobile breakpoint — phones (< 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* Show bottom tab bar */
  .tab-bar { display: block; }

  /* Push body content above tab bar */
  body { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom)); }

  /* Hide top-right CTA buttons (they live in tab bar now) */
  .nav-cta { display: none !important; }

  /* Compact navbar */
  .navbar {
    padding-top: var(--safe-top);
  }
  .nav-container { height: 56px; padding: 0 16px; }
  .brand { font-size: 18px; }
  .brand-mark { width: 32px; height: 32px; font-size: 12px; }

  /* Replace hamburger with simpler icon */
  .nav-toggle {
    width: 40px; height: 40px;
    padding: 0;
    align-items: center; justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
  }

  /* Drawer styled like iOS sheet */
  .nav-links.open {
    top: 56px;
    background: rgba(5, 5, 7, 0.98);
    backdrop-filter: blur(20px);
    padding: 24px 20px 40px;
    gap: 4px;
    font-size: 18px;
    border-radius: 0;
  }
  .nav-links.open a {
    padding: 16px 18px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
  }
  .nav-links.open a:hover { background: rgba(212,255,0,0.06); }

  /* Announcement bar — smaller (or hide on tiny screens) */
  .announcement-bar { height: 30px; font-size: 10px; }
  .announcement-track { gap: 32px; padding-left: 32px; }

  /* ============ HERO ============ */
  .hero {
    min-height: auto;
    padding: 32px 20px 60px !important;
  }
  .hero-badge {
    margin-bottom: 18px;
    font-size: 11px;
    padding: 6px 12px;
  }
  .hero-title {
    font-size: clamp(48px, 14vw, 72px) !important;
    margin-bottom: 18px;
  }
  .hero-sub {
    font-size: 15px;
    margin-bottom: 24px;
  }
  .hero-cta {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 40px;
    width: 100%;
  }
  .hero-cta .btn {
    width: 100%;
    padding: 16px 24px;
    justify-content: center;
  }
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding-top: 24px;
  }
  .stat-num { font-size: 32px !important; }
  .stat-label { font-size: 10px; letter-spacing: 0.1em; }

  /* ============ Generic sections ============ */
  .features, .categories, .how, .ai-demo,
  .coaches, .pricing, .testimonials, .faq, .final-cta {
    padding: 60px 0 !important;
  }
  .container { padding: 0 16px; }

  .section-head {
    margin-bottom: 32px;
    text-align: left;
  }
  .section-head .eyebrow { justify-content: flex-start; }
  .section-title { font-size: clamp(34px, 9vw, 48px) !important; }
  .section-sub { font-size: 14px; margin: 0; }

  /* ============ FEATURES ============ */
  .features-grid { gap: 16px; }
  .feature-card {
    border-radius: 16px;
  }
  .feature-media { height: 200px; }
  .feature-body { padding: 24px 20px 28px; }
  .feature-body h3 { font-size: 24px; line-height: 1.05; }
  .feature-body > p { font-size: 14px; }
  .feature-list li { font-size: 13px; padding: 6px 0; }
  .play-btn { width: 60px; height: 60px; font-size: 18px; }

  /* AI mock chat — smaller */
  .ai-mock-body { padding: 14px; gap: 8px; }
  .ai-msg { font-size: 12px; padding: 10px 12px; }

  /* ============ CATEGORIES — 2 cols ============ */
  .cat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }
  .cat-card { aspect-ratio: 3/4; border-radius: 14px; }
  .cat-info { left: 14px; right: 14px; bottom: 14px; }
  .cat-info h3 { font-size: 24px !important; }
  .cat-count { font-size: 9px; }
  .cat-arrow {
    width: 32px; height: 32px;
    top: 12px; right: 12px;
    font-size: 11px;
  }

  /* ============ HOW IT WORKS ============ */
  .steps {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .step { padding: 24px 20px; }
  .step h3 { font-size: 20px; }
  .step p { font-size: 13px; }

  /* ============ AI DEMO ============ */
  .ai-demo-grid { gap: 32px; }
  .ai-demo .section-title { font-size: clamp(30px, 8vw, 44px) !important; }
  .ai-features li { font-size: 13px; gap: 12px; }
  .ai-feat-icon { width: 36px; height: 36px; font-size: 14px; }
  .ai-card { padding: 20px; border-radius: 16px; }
  .ai-form .row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ai-form input, .ai-form select { padding: 12px; }
  .macros { gap: 6px; }
  .macro { padding: 12px 6px; }
  .macro span { font-size: 18px; }
  .macro small { font-size: 9px; }

  /* ============ COACHES ============ */
  .coaches-grid { gap: 14px; }
  .coach { border-radius: 16px; }
  .coach-img { height: 280px; }
  .coach-info { padding: 20px 22px 22px; }
  .coach-info h3 { font-size: 20px; }
  .coach-info p { font-size: 13px; }

  /* ============ PRICING ============ */
  .pricing-grid { gap: 14px; }
  .plan { padding: 28px 22px; border-radius: 16px; }
  .plan-popular { transform: none; }
  .plan-popular:hover { transform: translateY(-4px); }
  .plan h3 { font-size: 24px; }
  .price .amount { font-size: 48px; }
  .plan-feats li { font-size: 13px; }
  .billing-toggle { font-size: 13px; }

  /* ============ TESTIMONIALS — horizontal scroll ============ */
  .testi-grid {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 4px 16px 16px;
    scrollbar-width: none;
  }
  .testi-grid::-webkit-scrollbar { display: none; }
  .testi {
    flex: 0 0 80%;
    min-width: 280px;
    scroll-snap-align: start;
    padding: 24px;
    border-radius: 16px;
  }
  .testi p { font-size: 14px; }

  /* ============ FAQ ============ */
  .faq-item summary {
    padding: 18px 20px;
    font-size: 14px;
  }
  .faq-body { padding: 0 20px 20px; font-size: 14px; }

  /* ============ FINAL CTA ============ */
  .final-cta { padding: 40px 0 60px !important; }
  .cta-card { padding: 40px 24px; border-radius: 20px; }
  .cta-card h2 { font-size: 32px; }
  .cta-card p { font-size: 14px; margin-bottom: 24px; }
  .cta-buttons { flex-direction: column; gap: 10px; }
  .cta-buttons .btn { width: 100%; justify-content: center; }

  /* ============ FOOTER ============ */
  .footer { padding: 60px 0 0; }
  .footer-grid { gap: 32px; margin-bottom: 32px; }
  .footer-brand p { font-size: 13px; }
  .footer h4 { font-size: 11px; margin-bottom: 12px; }
  .footer ul li a { font-size: 13px; }
  .footer-bottom-row { flex-direction: column; align-items: flex-start; font-size: 11px; gap: 8px; }


  /* ============================================================
     PAGES — Workouts
     ============================================================ */
  .page-hero { padding: 32px 0 24px !important; }
  .page-title { font-size: clamp(40px, 12vw, 56px) !important; margin: 10px 0 12px; }
  .page-sub { font-size: 14px; }

  /* Sticky filters — mobile */
  .filters-section {
    top: 56px !important;
    padding: 14px 0 !important;
  }
  .filters { gap: 12px; }
  .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .filter-group label { font-size: 10px; min-width: 0; }
  .search-input { max-width: 100%; }

  /* Horizontal-scrolling chip rows */
  .chips {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 4px 16px;
    scrollbar-width: none;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip {
    flex-shrink: 0;
    padding: 9px 16px;
    font-size: 12px;
    scroll-snap-align: start;
  }

  /* Workouts grid — single column on phone */
  .workouts-section { padding: 24px 0 60px; }
  .workouts-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .workout-card { border-radius: 16px; }
  .workout-thumb { aspect-ratio: 16/9; }
  .workout-body { padding: 16px 18px 20px; }
  .workout-body h3 { font-size: 20px; }
  .workout-play { opacity: 1; transform: translate(-50%,-50%) scale(1); }

  .results-bar { margin-bottom: 18px; font-size: 12px; }

  /* Modal — full-screen sheet style */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    animation: sheetUp .35s cubic-bezier(0.2,0.8,0.2,1);
  }
  @keyframes sheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .modal-card::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--line-strong);
    border-radius: 2px;
    margin: 10px auto 0;
    position: relative; z-index: 3;
  }
  .modal-info { padding: 20px 22px 28px; }
  .modal-info h3 { font-size: 22px; }
  .modal-actions .btn { width: 100%; justify-content: center; }


  /* ============================================================
     PAGES — AI Nutritionist
     ============================================================ */
  .ai-workspace { padding: 16px 0 40px; }
  .ai-workspace-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .ai-side { position: static; gap: 14px; }
  .ai-side-card { padding: 22px; border-radius: 16px; }

  /* AI main — make it feel like a chat app */
  .ai-main {
    border-radius: 16px;
    min-height: auto;
  }

  /* Tabs become full-width sticky pill row */
  .ai-tabs {
    position: sticky;
    top: 56px;
    z-index: 10;
    background: var(--bg-3);
  }
  .ai-tabs .tab {
    padding: 14px 6px;
    font-size: 11px;
    letter-spacing: 0.04em;
  }
  .ai-tabs .tab i {
    display: inline-block !important;
    margin-right: 4px;
    font-size: 13px;
  }

  /* Chat — full screen height feel */
  .chat-shell { min-height: 70vh; }
  .chat-header { padding: 14px 18px; }
  .chat-bot strong { font-size: 14px; }
  .chat-bot span { font-size: 11px; }
  .bot-avatar { width: 38px; height: 38px; font-size: 16px; }
  .btn-sm { padding: 6px 10px; font-size: 11px; }

  .chat-messages {
    padding: 16px;
    gap: 10px;
  }
  .chat-messages .ai-msg { max-width: 88%; font-size: 14px; padding: 11px 14px; }
  .suggestions { gap: 6px; }
  .suggest { padding: 7px 12px; font-size: 11px; }

  .chat-input {
    padding: 12px;
    gap: 8px;
    /* Stick to bottom of viewport when keyboard absent */
    position: sticky;
    bottom: 0;
  }
  .chat-input input { padding: 11px 14px; }
  .chat-input button { width: 42px; height: 42px; }

  /* Plan tab */
  .plan-summary { padding: 16px 18px; }
  .plan-summary h3 { font-size: 18px; }
  .plan-summary small { font-size: 9px; }
  .day summary {
    grid-template-columns: 60px 1fr auto;
    padding: 14px 18px;
    gap: 10px;
  }
  .day summary i:last-child { font-size: 12px; }
  .day-name { font-size: 13px; }
  .day-cal { font-size: 12px; }

  .meal {
    grid-template-columns: 1fr auto;
    padding: 12px 18px;
    gap: 10px;
  }
  .meal-time { font-size: 11px; color: var(--accent); font-weight: 600; }
  .meal-info h5 { font-size: 13px; }
  .meal-info p { font-size: 11px; }
  .meal-macro { font-size: 16px; }

  /* Recipes — single column scroll */
  .recipes-grid {
    padding: 18px;
    gap: 14px;
    grid-template-columns: 1fr;
  }
  .recipe-img { height: 160px; }
  .recipe-info { padding: 14px 16px 16px; }
  .recipe-info h4 { font-size: 18px; }
  .recipe-info p { font-size: 12px; }
  .recipe-macros { font-size: 10px; gap: 8px 12px; }


  /* ============================================================
     Misc small phone tweaks
     ============================================================ */
  .btn { padding: 13px 22px; font-size: 13px; }
  .btn-lg { padding: 15px 26px; font-size: 14px; }

  /* Bigger tap targets for nav links in drawer */
  .nav-links a { min-height: 44px; }

  /* Toast positioning above tab bar */
  #hoa-toast {
    bottom: calc(var(--tabbar-h) + 16px + var(--safe-bottom)) !important;
  }
}


/* ============================================================
   Small phone (≤ 380px) — extra tightening
   ============================================================ */
@media (max-width: 380px) {
  .hero-title { font-size: clamp(40px, 13vw, 56px) !important; }
  .section-title { font-size: 28px !important; }
  .cat-info h3 { font-size: 20px !important; }
  .ai-form .row { grid-template-columns: 1fr; }
  .macro span { font-size: 16px; }
  .tab-bar a { font-size: 9px; }
  .tab-bar a i { font-size: 18px; }
  .tab-bar .tab-cta i { width: 44px; height: 44px; font-size: 16px; }
}


/* ============================================================
   Tablets (768-1024) — 2-col grids, no tab bar
   ============================================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  .features-grid { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .coaches-grid { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: 1fr; max-width: 480px; margin: 0 auto; }
  .testi-grid { grid-template-columns: repeat(2, 1fr); }
}


/* ============================================================
   Reduce motion — accessibility
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
