/* ═══════════════════════════════════════════════════════════════════════
   COLEMAN & CO. — MEMBER DASHBOARD MOBILE POLISH
   Sprint D / conservative path: keep current single-scroll layout,
   tighten breakpoints, hit Apple HIG 44px touch-target minimums,
   improve readability at iPhone-portrait widths.
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── 44px MINIMUM TOUCH TARGETS (Apple HIG / WCAG 2.5.5) ────────── */
@media (max-width: 760px) {
  body button,
  body a.btn,
  body .inline-chat-send,
  body .chat-send,
  body #refillSendBtn,
  body #signOutBtn,
  body .sign-out-btn,
  body .action-tile-btn,
  body button[type="button"],
  body button[type="submit"] {
    min-height: 44px !important;
    min-width: 44px !important;
    padding-top: max(10px, var(--cc-space-3, 12px)) !important;
    padding-bottom: max(10px, var(--cc-space-3, 12px)) !important;
  }

  /* Inline chat send + textarea pair: stack on narrow widths */
  body .inline-chat-input-wrap {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  body .inline-chat-input-wrap > input,
  body .inline-chat-input-wrap > textarea {
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }
  body .inline-chat-send {
    flex: 1 1 100% !important;
    width: 100% !important;
  }
}

/* ─── TIGHTENED CARD PADDING ON IPHONE-PORTRAIT ──────────────────── */
@media (max-width: 480px) {
  body .sci-panel,
  body .msg-center,
  body .cc-orders-panel,
  body .feature-card,
  body .feature-cards .feature-card,
  body .blog-tile,
  body .features-grid > * {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Body type bumps slightly so it stays at iOS readable defaults */
  body { font-size: 16px !important; }

  /* Hero section: cap logo size, stack everything vertically */
  body .welcome-hero,
  body .member-hero {
    padding-top: 20px !important;
    padding-bottom: 24px !important;
    text-align: center !important;
  }
  body .welcome-hero img.logo,
  body .welcome-logo {
    max-width: 96px !important;
    margin: 0 auto 16px !important;
  }
}

/* ─── PROTOCOL STAT ROW: 2-COL ON MOBILE INSTEAD OF 4 ────────────── */
@media (max-width: 600px) {
  body .protocol-stat-row,
  body .stat-row,
  body [class*="stat-grid"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  body .stat-row .stat-item,
  body .protocol-stat-row > * {
    padding: 12px !important;
  }
}

/* ─── STICKY BOTTOM CTA BAND (just on member dashboard) ──────────── */
@media (max-width: 760px) {
  /* When the page-bottom sign out / footer scrolls into view,
     dampen the scroll with extra breathing room. */
  body main { padding-bottom: 32px !important; }
}

/* ─── ELIMINATE HORIZONTAL SCROLL ON OVERFLOWING ELEMENTS ────────── */
@media (max-width: 600px) {
  body, html { overflow-x: hidden; }
  /* Wide tables / grids that can't fit, scroll their own horizontal
     instead of pushing the body. */
  body table,
  body [class*="grid"],
  body .table-wrap {
    max-width: 100%;
  }
  body .horizontal-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ─── TYPOGRAPHIC RHYTHM ON MOBILE ────────────────────────────────── */
@media (max-width: 600px) {
  body h1, body .h1 { font-size: clamp(28px, 8vw, 38px) !important; line-height: 1.15 !important; }
  body h2, body .h2 { font-size: clamp(22px, 6vw, 30px) !important; line-height: 1.2 !important; }
  body h3, body .h3 { font-size: clamp(18px, 5vw, 22px) !important; line-height: 1.25 !important; }
  body .feature-card-title,
  body .blog-tile-title,
  body .pillar-title { font-size: 18px !important; line-height: 1.3 !important; }
}

/* ─── SAFE AREA INSETS (for iPhone notch / Dynamic Island) ───────── */
@supports (padding: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
  body .sticky-bottom-bar {
    padding-bottom: max(env(safe-area-inset-bottom), 12px);
  }
}

/* ─── INPUT ZOOM PREVENTION (iOS Safari) ─────────────────────────── */
@media (max-width: 760px) {
  body input[type="text"],
  body input[type="email"],
  body input[type="tel"],
  body input[type="number"],
  body input[type="search"],
  body input[type="password"],
  body select,
  body textarea {
    font-size: 16px !important; /* below 16 triggers iOS auto-zoom */
  }
}

/* ─── REFINED SPACING INSIDE THE INLINE-CHAT BUBBLE ──────────────── */
@media (max-width: 600px) {
  body .inline-chat-msg,
  body .chat-msg {
    padding: 10px 14px !important;
    margin: 0 0 8px !important;
    max-width: 88% !important;
  }
}

/* ─── VAULT EMPTY STATE SQUASH FIX ────────────────────────────────── */
@media (max-width: 480px) {
  body #vaultDynamicList:empty::after,
  body .vault-empty {
    padding: 20px 16px !important;
    font-size: 13px !important;
    line-height: 1.55 !important;
  }
}
