/* XACTLOAD mobile/tablet presentation layer only. */

@media (max-width: 1024px) {
  .container-3d-visualization,
  [id^="container-3d-"],
  .container-3d,
  .three-container {
    width: 100% !important;
    max-width: 100% !important;
  }

  .container-3d-visualization canvas,
  [id^="container-3d-"] canvas,
  .container-3d canvas,
  .three-container canvas {
    max-width: 100% !important;
    height: auto;
    touch-action: none;
  }

  .table-responsive,
  .overflow-x-auto {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 768px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .table-responsive table,
  .overflow-x-auto table {
    min-width: max-content;
  }

  .table-responsive th,
  .table-responsive td,
  .overflow-x-auto th,
  .overflow-x-auto td {
    padding: 0.5rem 0.625rem !important;
    white-space: nowrap;
  }

  .table-responsive th:first-child,
  .table-responsive td:first-child,
  .overflow-x-auto th:first-child,
  .overflow-x-auto td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: inherit;
  }

  #cargo-table {
    min-width: 980px;
  }

  #cargo-table input,
  #cargo-table select,
  #cargo-table button,
  #cargo-table textarea {
    min-height: 44px;
    font-size: 16px !important;
  }

  #cargo-table th,
  #cargo-table td {
    white-space: nowrap;
  }

  h1 {
    font-size: clamp(1.25rem, 5vw, 1.75rem) !important;
  }

  h2 {
    font-size: clamp(1.125rem, 4.5vw, 1.5rem) !important;
  }

  .modal-dialog {
    max-width: calc(100vw - 1rem);
    margin: 0.5rem auto;
  }
}

@media (max-width: 640px) {
  .container-card .container-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding-right: 3.5rem;
  }

  .container-card .container-header > div:first-child {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 576px) {
  button,
  .btn,
  a.btn,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  .btn-group,
  .button-group,
  .action-buttons {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .btn-group > .btn,
  .button-group > *,
  .action-buttons > * {
    width: 100%;
  }

  .card,
  .summary-card,
  .kpi-card {
    width: 100%;
  }

  .navbar .container,
  .navbar.container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .navbar-brand img {
    max-width: 150px;
    height: auto;
  }

  .navbar-collapse.collapse:not(.show) {
    display: none !important;
  }

  .navbar-collapse.show {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem;
    padding-top: 0.75rem;
  }

  .dropdown-menu {
    max-width: calc(100vw - 1rem);
  }
}

@media (max-width: 480px) {
  .container,
  .container-fluid {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .table-responsive th,
  .table-responsive td,
  .overflow-x-auto th,
  .overflow-x-auto td {
    padding: 0.45rem 0.5rem !important;
  }
}
