/* ==========================================================================
   MGT2E DATAPAD — Parts of a form the browser would otherwise draw (code/forms.js)
   The message on a field that fails its check, and on touch screens the open list of a <select>.
   ========================================================================== */

@layer components {

  /* ---------- Field message: laid over the field, hiding what's in it for a moment (forms.js sets the box) ---------- */
  .field-error {
    position: fixed;
    z-index: 970;               /* over the on-screen keyboard (960); under the portrait lock (1000) */
    display: flex;
    align-items: center;
    padding: 0 8px;
    overflow: hidden;
    white-space: nowrap;
    background: var(--surface-solid);
    border: 1px solid var(--c-red);
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: var(--tracking);
    text-transform: uppercase;
    color: var(--c-red);
    text-shadow: 0 0 8px rgba(255, 69, 69, 0.5);
  }

  .input.is-invalid,
  .input.is-invalid:focus {
    border-color: var(--c-red);
  }

  /* ---------- Open list (touch screens) ---------- */
  .picker {
    position: fixed;
    z-index: 955;               /* over sign-in (900) and tips (950); under the on-screen keyboard (960) */
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    background: var(--surface-solid);
    border: 1px solid var(--glass-border-hi);
    box-shadow: var(--shadow-drop), inset 2px 0 0 var(--c-orange);
  }

  .picker__opt {
    display: block;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    font: inherit;
    font-size: var(--fs-sm);
    letter-spacing: 0.04em;
    text-align: left;
    color: var(--c-text);
    background: none;
    border: none;
    border-left: 2px solid transparent;
    border-bottom: 1px solid var(--line-faint);
    -webkit-tap-highlight-color: transparent;
  }

  .picker__opt:active {
    color: var(--c-ice-bright);
    background: var(--wash-hover-hi);
  }

  .picker__opt.is-active {
    color: var(--c-ice-bright);
    background: linear-gradient(90deg, var(--wash-active), transparent);
    border-left-color: var(--c-orange);
  }

  /* The closed select: its own arrow, and touches go to its label, which opens the list above (forms.js) */
  @media (pointer: coarse) {
    select.input {
      -webkit-appearance: none;
      appearance: none;
      padding-right: 26px;
      pointer-events: none;
      background-image:
        linear-gradient(45deg, transparent 50%, var(--c-ice) 50%),
        linear-gradient(-45deg, transparent 50%, var(--c-ice) 50%);
      background-position: right 14px center, right 8px center;
      background-size: 6px 6px;
      background-repeat: no-repeat;
    }
  }
}
