/* POINTMEDIA.POS — penyesuaian UI untuk APK WebView (HP & tablet Android) v4 */

html.pm-android-shell,
html.pm-android-shell body {
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
}

  html.pm-android-shell img,
  html.pm-android-shell video {
    max-width: 100%;
    height: auto;
  }

/* Logo sidebar — center di tablet/APK (bukan bottom nav mobile) */
html.pm-android-shell .sidebar-logo {
  justify-content: center !important;
  padding: 0 8px !important;
  margin-bottom: 16px !important;
}

html.pm-android-shell .sidebar-logo .logo-icon.pointmedia-logo {
  width: 40px !important;
  height: 40px !important;
  margin: 0 auto !important;
  box-shadow: none !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

html.pm-android-shell .sidebar-logo .logo-icon.pointmedia-logo img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

/* Tombol utama — jangan paksa tinggi 44px pada bottom nav (7 item) */
html.pm-android-shell .btn-process,
html.pm-android-shell .btn-pay,
html.pm-android-shell .ps-btn-primary,
html.pm-android-shell .agent-control {
  min-height: 44px;
}

html.pm-android-shell .modal,
html.pm-android-shell .modal-box,
html.pm-android-shell .sheet,
html.pm-android-shell .settings-modal,
html.pm-android-shell .order-detail-modal .modal-content {
  max-height: min(92dvh, calc(100dvh - 16px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Jangan ubah display:table global — merusak layout pesanan/laporan */
html.pm-android-shell .table-scroll-wrap,
html.pm-android-shell .orders-table-wrap,
html.pm-android-shell .report-table-wrap,
html.pm-android-shell .data-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

html.pm-android-shell .orders-table-wrap table,
html.pm-android-shell .report-table-wrap table,
html.pm-android-shell .table-scroll-wrap table {
  display: table;
  width: 100%;
  border-collapse: collapse;
}

@media (max-width: 768px) {
  html.pm-android-shell .sidebar .nav-item {
    min-height: 0;
    min-width: 0;
  }

  html.pm-android-shell body.cart-expanded main.pos-layout > .cart-panel {
    max-height: var(--kasir-mobile-cart-expanded-max, calc(100dvh - var(--kasir-mobile-nav-h, 52px) - env(safe-area-inset-bottom, 0px)));
  }

  html.pm-android-shell .page-wrap {
    padding-bottom: calc(var(--kasir-mobile-nav-h, 52px) + env(safe-area-inset-bottom, 0px) + 12px) !important;
  }

  html.pm-android-shell #settingsModal .side-modal {
    height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0px))) !important;
    max-height: 92dvh !important;
    display: flex !important;
    flex-direction: column !important;
  }

  html.pm-android-shell #settingsModal .side-modal-body.settings-body-v2 {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  html.pm-android-shell .settings-nav {
    padding: 8px 10px 6px !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
  }

  html.pm-android-shell .settings-nav-btn {
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 10px 12px !important;
    justify-content: center !important;
  }

  html.pm-android-shell .settings-nav-btn i {
    font-size: 16px !important;
  }

  html.pm-android-shell .settings-nav-btn span {
    display: none !important;
  }

  html.pm-android-shell .settings-panels {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  }

  html.pm-android-shell .settings-nav-title {
    font-size: 14px !important;
  }

  html.pm-android-shell .side-modal-header {
    padding: 12px 14px !important;
  }

  html.pm-android-shell .side-modal-title {
    font-size: 16px !important;
  }
}

@media (max-width: 768px) {
  html.pm-android-shell .main-layout,
  html.pm-android-shell .kasir-layout {
    min-width: 0;
  }

  html.pm-android-shell .checkout-panel,
  html.pm-android-shell .cart-panel {
    max-width: 100vw;
  }
}

html.pm-android-shell .pm-pay-modal {
  max-height: min(94dvh, calc(100dvh - env(safe-area-inset-top, 0px))) !important;
}

html.pm-android-shell .pm-pay-footer {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 8 !important;
  pointer-events: auto !important;
}

html.pm-android-shell .pm-pay-submit {
  min-height: 52px !important;
  touch-action: manipulation !important;
}

/* Landscape HP — sheet/modal memakai tinggi viewport penuh */
@media (orientation: landscape) and (max-height: 520px) {
  html.pm-android-shell .modal,
  html.pm-android-shell .sheet,
  html.pm-android-shell #settingsModal .side-modal {
    max-height: min(96dvh, calc(100dvh - 8px)) !important;
  }

  html.pm-android-shell body.cart-expanded main.pos-layout > .cart-panel {
    max-height: calc(100dvh - var(--kasir-mobile-nav-h, 48px) - env(safe-area-inset-bottom, 0px)) !important;
  }

  html.pm-android-shell .orders-page.page-wrap {
    padding-bottom: calc(var(--kasir-mobile-nav-h, 48px) + 8px) !important;
  }

  html.pm-android-shell .orders-filter-top,
  html.pm-android-shell .tab-filter {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

html.pm-android-shell img.product-photo.pm-img-defer {
  opacity: 0;
  transition: opacity 0.2s ease;
  background: var(--bg-elevated, #2a3045);
}

html.pm-android-shell img.product-photo.pm-img-loaded {
  opacity: 1;
}

html.pm-android-shell .product-img .pm-img-emoji-fallback {
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
