/* ============================================================
   Nexozs Admin — mobile layer                  v2 · 2026-11-23

   v1 turned each table row into a tall stacked card. One product
   took ~420px, so 16 products meant ~6700px of scrolling. Replaced.

   v2 keeps the desktop table shape — columns side by side, swipe
   left/right — and makes the rows compact so many fit on screen.

   Every rule is inside a max-width query: desktop is untouched.
   ============================================================ */

@media (max-width: 760px) {

  /* 1 ── the horizontal scroller ------------------------------ */

  /* mobile.js tags the real scroll container with .nx-hscroll — the
     panel uses six different wrapper class names, so finding it at
     runtime is safer than listing them here. */
  .nx-hscroll {
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;   /* momentum swipe on iOS */
    overscroll-behavior-x: contain;      /* don't drag the page sideways */
    scrollbar-width: thin;
  }

  /* a visible scrollbar is the clearest "there is more to the right" hint */
  .nx-hscroll::-webkit-scrollbar { height: 6px; }

  .nx-hscroll::-webkit-scrollbar-thumb {
    background: #c3cbd9;
    border-radius: 3px;
  }

  /* 2 ── compact rows: fit more on a small screen ------------- */

  /* the panel already sets border-collapse:separate !important,
     which is what the sticky first column below needs */
  table.atc-table { font-size: 12px; }

  table.atc-table > thead > tr > th {
    padding: 9px 10px;
    font-size: 11px;
    white-space: nowrap;
  }

  table.atc-table > tbody > tr > td {
    padding: 9px 10px;
    vertical-align: middle;
  }

  /* long product names were forcing rows 3–4 lines tall */
  table.atc-table > tbody > tr > td b,
  table.atc-table > tbody > tr > td strong {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
  }
  table.atc-table > tbody > tr > td small { font-size: 10px; }

  table.atc-table > tbody > tr > td img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
  }

  table.atc-table button,
  table.atc-table .btn,
  table.atc-table a.btn {
    padding: 7px 10px;
    font-size: 11px;
    min-height: 32px;
    white-space: nowrap;
  }

  /* 3 ── first column stays put while you swipe --------------- */
  /*    Without this you lose track of which row you are reading.
        Delete this block to let the whole row scroll away.      */

  table.atc-table > thead > tr > th:first-child,
  table.atc-table > tbody > tr > td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    box-shadow: 1px 0 0 #eceff4;
  }
  table.atc-table > thead > tr > th:first-child {
    z-index: 3;
    background: #f6f8fc;
  }

  /* 4 ── Incomplete Orders ------------------------------------ */
  /*    This section is a 7-column CSS grid, not a table. Its
        columns are fractions, so on a phone each got ~45px and
        every entry grew to ~330px tall. Fixed pixel columns plus
        the shared scroller (added by mobile.js) restore the row. */

  /* the panel hides this header below 1100px and collapses each entry
     to one column below 650px — that stacked view is what made every
     entry ~330px tall. Bring the header back and restore the row.    */
  #tab-incompleteorders .nx-v20-cols { display: grid !important; }

  #tab-incompleteorders .nx-v20-cols,
  #tab-incompleteorders .nx-live-session-card {
    grid-template-columns: 96px 170px 140px 150px 100px 140px 110px !important;
    min-width: 906px;
    gap: 8px !important;
  }
  #tab-incompleteorders .nx-live-session-card { padding: 11px 12px; font-size: 11.5px; }
  #tab-incompleteorders .nx-v20-cols { padding: 11px 12px; }
  #tab-incompleteorders .nx-live-session-card small { margin-top: 3px; }
  #tab-incompleteorders .nx-avatar { width: 28px; height: 28px; flex-basis: 28px; }
  #tab-incompleteorders .nx-live-product img { width: 30px; height: 30px; }
  #tab-incompleteorders .nx-live-actions { flex-wrap: nowrap; }

  /* The order-items grid (.nx-items-head / .nx-item-row) is left alone:
     the panel already gives it min-width:610px inside .nx-items-card,
     which overflows horizontally — the behaviour we want.             */

  /* 6 ── filter bars: stack instead of squeezing -------------- */
  #tab-incompleteorders .nx-v20-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  #tab-incompleteorders .nx-v20-filters input { grid-column: 1 / -1; }
  #tab-incompleteorders .nx-v20-filters input,
  #tab-incompleteorders .nx-v20-filters select {
    width: 100%;
    font-size: 16px;      /* stops iOS zooming on focus */
    box-sizing: border-box;
  }

  /* 7 ── install-as-app button -------------------------------- */
  #nxInstallApp {
    position: fixed;
    left: 14px; bottom: 14px;
    z-index: 9999;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border: 0;
    border-radius: 999px;
    background: #e11d2e;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(225, 29, 46, .35);
  }
  #nxInstallApp.nx-show { display: inline-flex; }
}

@media (display-mode: standalone) {
  #nxInstallApp { display: none !important; }
}
