/* © 2026 Finfident PTY LTD — iOS stability fixes for Finfident Hub (Capacitor / WKWebView)
   31 Oct 2026: the parts that only matter on touch screens (16px fields, native date/select look, chip ring) are kept to
   phones and tablets, so the desktop staff portal's dense tables and forms keep their size.
   Load AFTER the app's main stylesheet. Fixes the "screen flicks when I tap" problem:
   1) grey tap-highlight flash   2) auto-zoom when focusing inputs < 16px
   3) 'transition: all' re-animating layout   4) date/time inputs overflowing their box
   5) layout jump when chips change border width */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* 1. No grey flash on tap */
* { -webkit-tap-highlight-color: transparent; }

/* No 300ms delay / double-tap zoom on controls */
a, button, input, select, textarea, label, summary, [role="button"], [data-action] {
  touch-action: manipulation;
}
button, [role="button"], .chip, .pill, .seg button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* 2. iOS zooms the whole page when a field with font-size < 16px is focused — this is the
      big "screen jumps" moment on New task / Remind me / Refer forms. */
@media (hover: none) and (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
}

/* 4. Native date/time pickers: stop them overflowing and centring oddly */
input[type="date"], input[type="time"], input[type="datetime-local"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  display: block;
  text-align: left;
  background-clip: padding-box;
}
input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value { text-align: left; margin: 0; }

/* 3 + 5. Tap feedback without layout change: animate ONLY transform/colour, never 'all' */
button, .chip, .pill, .card[data-action], a.card {
  transition-property: transform, background-color, color, box-shadow, opacity !important;
  transition-duration: 120ms !important;
  transition-timing-function: ease-out !important;
}
button:active, .chip:active, .pill:active, a.card:active, .card[data-action]:active {
  transform: scale(0.97);
}
/* Selected chips/avatars: use box-shadow ring instead of a thicker border (no reflow) */
.chip, .pill, .avatar-pick { border-width: 1px; }
@media (hover: none) and (pointer: coarse) {
  .chip[aria-pressed="true"], .avatar-pick[aria-pressed="true"],
  .chip.is-selected, .pill.is-selected, .avatar-pick.is-selected {
    box-shadow: 0 0 0 2px #ff5558 inset;
  }
}

/* Fixed headers / tab bars: own layer so they never repaint with the content */
.app-header, .tab-bar, nav.bottom-nav, [data-fixed] {
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Scroll areas: momentum scrolling, no rubber-band of the whole webview behind them */
html, body { overscroll-behavior-y: none; }
.scroll, main, [data-scroll] { -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }

/* Images never shift layout while loading */
img { max-width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* 1 Nov 2026: no "press" flash at all. Mahesh: whatever you tap (button, card, chip, list row) flashed.
   Every tapped item used to shrink (scale .95–.97), dim (brightness) or get a coloured highlight. Taps now leave the
   item exactly as it is; the screen it opens or the selected state is the feedback. Applies to app, web and desktop. */
*, *::before, *::after { -webkit-tap-highlight-color: transparent !important; }
button:active, a:active, [role="button"]:active, .btn:active, .card:active, .pill:active, .chip:active,
.qa a:active, .qa button:active, #tabbar button:active, .ic-btn:active, .avatar:active, a.card:active, .card[data-action]:active,
#hero .hero-stats button:active, .sm-qa button:active, .sm-qb button:active, .sm-acts a:active, .sm-acts button:active, .nt:active {
  transform: none !important; filter: none !important;
}
body.sm .sm-li:active, .sm-more:active { background: none !important; }
