/* Mobile layout hardening shared by all admin pages. */
@media (max-width: 767.98px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  #wrapper,
  #content-wrapper,
  #content,
  #container-wrapper {
    min-width: 0;
    max-width: 100%;
  }

  #container-wrapper.container-fluid {
    width: auto;
    margin-right: 0;
    margin-left: 0;
    padding-right: 12px;
    padding-left: 12px;
  }

  #container-wrapper > .row {
    min-width: 0;
  }

  #container-wrapper .row > [class*="col-"] {
    min-width: 0;
  }

  #container-wrapper .card,
  #container-wrapper .card-body,
  #container-wrapper .input-group,
  #container-wrapper .form-control,
  #container-wrapper .custom-select,
  #container-wrapper .select2-container {
    max-width: 100%;
  }

  #container-wrapper .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  #container-wrapper .table-responsive > .table {
    margin-bottom: 0;
  }

  /* Legacy pages sometimes render a wide table directly inside a card. */
  #container-wrapper .card-body:has(table),
  #container-wrapper .posts_list:has(table) {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #eef2f7;
    -webkit-overflow-scrolling: touch;
  }

  #container-wrapper .card-body:has(table)::-webkit-scrollbar,
  #container-wrapper .posts_list:has(table)::-webkit-scrollbar,
  #container-wrapper .table-responsive::-webkit-scrollbar {
    height: 7px;
  }

  #container-wrapper .card-body:has(table)::-webkit-scrollbar-track,
  #container-wrapper .posts_list:has(table)::-webkit-scrollbar-track,
  #container-wrapper .table-responsive::-webkit-scrollbar-track {
    border-radius: 999px;
    background: #eef2f7;
  }

  #container-wrapper .card-body:has(table)::-webkit-scrollbar-thumb,
  #container-wrapper .posts_list:has(table)::-webkit-scrollbar-thumb,
  #container-wrapper .table-responsive::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #94a3b8;
  }

  #container-wrapper .modal-dialog {
    width: auto;
    max-width: calc(100vw - 24px);
    margin: 12px;
  }

  #container-wrapper .modal-header,
  #container-wrapper .modal-body,
  #container-wrapper .modal-footer {
    padding-right: 16px;
    padding-left: 16px;
  }

  #container-wrapper .dropdown-menu,
  #container-wrapper .bootstrap-select > .dropdown-menu {
    max-width: calc(100vw - 24px);
  }

  #container-wrapper .btn {
    line-height: 1.2;
  }

  #container-wrapper .btn i + span,
  #container-wrapper .btn .fa + span {
    margin-left: 5px;
  }

  #container-wrapper .custom-file-label {
    padding-right: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:not(.pos-mobile-app-shell) .ba-we-love-subscribers-wrap {
    right: 12px !important;
    bottom: calc(86px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body:not(.pos-mobile-app-shell) .scroll-to-bottom {
    right: 66px !important;
    bottom: calc(86px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body:not(.pos-mobile-app-shell) .scroll-to-top {
    right: 120px !important;
    bottom: calc(86px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (max-width: 359.98px) {
  #container-wrapper.container-fluid {
    padding-right: 10px;
    padding-left: 10px;
  }

  body:not(.pos-mobile-app-shell) .scroll-to-bottom {
    right: 61px !important;
  }

  body:not(.pos-mobile-app-shell) .scroll-to-top {
    right: 110px !important;
  }
}

@media print {
  .scroll-to-top,
  .scroll-to-bottom,
  .ba-we-love-subscribers-wrap {
    display: none !important;
  }
}
