/* Work mobile/tablet UX overlay — additive, NEVER edit Flutter source.
 * Loaded via nginx sub_filter into Flutter index.html on each request.
 * Created 2026-05-06 — work.it-enterprise.pro
 */

/* iOS-friendly viewport: prevents auto-zoom on input focus when font >=16px */
:root {
  --ite-virtkb-h: 56px;
  --ite-virtkb-bg: #1a1f2c;
  --ite-virtkb-fg: #e6edf3;
  --ite-virtkb-key-bg: #2c3344;
  --ite-virtkb-key-active: #3d8bff;
}

@media (max-width: 900px), (pointer: coarse) {
  /* xterm.js terminal in Flutter wrapper — bump font to defeat iOS auto-zoom */
  .xterm,
  .xterm .xterm-screen,
  .xterm .xterm-rows,
  .xterm .xterm-helper-textarea {
    font-size: 16px !important;
    line-height: 1.25 !important;
  }
  .xterm-viewport {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* Body — never let touch generate page-zoom. Apps drive their own zoom. */
  html, body {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
  }

  /* Reserve space at the bottom so virtual keyboard doesn't cover terminal */
  body.ite-virtkb-on {
    padding-bottom: var(--ite-virtkb-h) !important;
  }
  flutter-view, flt-glass-pane {
    min-height: calc(100dvh - var(--ite-virtkb-h)) !important;
  }
}

/* Virtual key toolbar — only visible on touch / narrow viewports */
#ite-virtkb {
  display: none;
}
@media (max-width: 900px), (pointer: coarse) {
  #ite-virtkb {
    display: flex !important;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: var(--ite-virtkb-h);
    background: var(--ite-virtkb-bg);
    color: var(--ite-virtkb-fg);
    z-index: 2147483000;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -2px 6px rgba(0,0,0,.35);
    padding: 6px 4px env(safe-area-inset-bottom, 6px) 4px;
    gap: 4px;
    align-items: stretch;
    user-select: none;
    -webkit-user-select: none;
  }
  #ite-virtkb button {
    flex: 0 0 auto;
    min-width: 44px;
    padding: 0 10px;
    margin: 0;
    border: 1px solid #3a4256;
    border-radius: 6px;
    background: var(--ite-virtkb-key-bg);
    color: var(--ite-virtkb-fg);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(61,139,255,.35);
  }
  #ite-virtkb button:active,
  #ite-virtkb button.held {
    background: var(--ite-virtkb-key-active);
    color: #fff;
  }
  #ite-virtkb .grow { flex-grow: 1; min-width: 80px; }
  #ite-virtkb .pin {
    position: sticky;
    right: 0;
    background: var(--ite-virtkb-bg);
    box-shadow: -8px 0 8px -6px rgba(0,0,0,.5);
    padding-left: 4px;
  }
}

/* PWA install hint banner (mobile only) */
#ite-pwa-hint {
  display: none;
  position: fixed;
  left: 8px; right: 8px; top: 8px;
  background: #1f2937;
  color: #e6edf3;
  border: 1px solid #3a4256;
  border-radius: 8px;
  padding: 10px 12px;
  font: 14px/1.4 -apple-system, system-ui, sans-serif;
  z-index: 2147483001;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
#ite-pwa-hint button {
  margin-left: 8px;
  padding: 4px 10px;
  border: 1px solid #3a4256;
  border-radius: 4px;
  background: #2c3344;
  color: #e6edf3;
}
@media (display-mode: standalone) {
  #ite-pwa-hint { display: none !important; }
}
