/* Shared responsive refinements for every screen size. Bootstrap handles the
 * grid; these rules cover application-specific surfaces and third-party charts. */

html {
  overflow-x: hidden;
}

body {
  min-width: 320px;
  overflow-x: clip;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

/* Plotly receives its final size from responsive-charts.js. Keep the enclosing
 * surface compact and prevent a desktop-width SVG from creating page overflow. */
.chart-container,
.responsive-chart {
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.responsive-chart {
  min-height: 300px;
  padding: clamp(0.35rem, 0.7vw, 0.75rem) !important;
}

.responsive-chart .plotly-graph-div,
.responsive-chart .plot-container {
  max-width: 100%;
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  max-width: 100%;
}

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

@media (max-width: 991.98px) {
  .app-navbar .navbar-collapse {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: 0.35rem;
    padding: 0.5rem 0 0.75rem;
  }

  .app-navbar .navbar-nav {
    align-items: stretch;
    gap: 0.15rem;
  }

  .app-navbar .nav-item,
  .app-navbar .nav-item.dropdown {
    padding-left: 0;
    padding-right: 0;
  }

  .app-navbar .nav-link,
  .app-navbar .nav-item > .btn {
    align-items: center;
    display: flex;
    min-height: 44px;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .app-navbar .nav-link.active {
    background: rgba(125, 211, 252, 0.1);
    border-bottom: 0;
    border-left: 3px solid #7dd3fc;
  }

  .app-navbar .dropdown-menu {
    margin: 0.15rem 0 0.35rem;
  }

  .responsive-chart {
    min-height: 340px;
  }
}

@media (max-width: 575.98px) {
  .container-smart {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .site-logo {
    height: 48px;
    width: 48px;
  }

  .app-navbar {
    min-height: 52px;
  }

  .app-navbar .navbar-toggler {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
  }

  .modal-dialog {
    margin: 0.5rem;
    max-width: none;
  }

  .modal-dialog-scrollable {
    height: calc(100dvh - 1rem);
  }

  .modal-dialog-scrollable .modal-content,
  .modal-content {
    max-height: calc(100dvh - 1rem);
  }

  .modal-header,
  .modal-footer {
    padding: 0.75rem 1rem;
  }

  .modal-footer {
    gap: 0.5rem;
  }

  .modal-footer .btn {
    flex: 1 1 auto;
  }

  .form-control,
  .form-select {
    font-size: 16px;
    min-height: 44px;
  }

  .table-responsive,
  table.table.table-responsive,
  table.table:not(.no-mobile-scroll) {
    -webkit-overflow-scrolling: touch;
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  .table-responsive > .table,
  table.table.table-responsive,
  table.table:not(.no-mobile-scroll) {
    font-size: 0.8125rem;
    min-width: 40rem;
  }

  .table-responsive > .table th,
  .table-responsive > .table td,
  table.table.table-responsive th,
  table.table.table-responsive td,
  table.table:not(.no-mobile-scroll) th,
  table.table:not(.no-mobile-scroll) td {
    white-space: nowrap;
  }

  .chart-container {
    min-height: 300px;
  }

  .responsive-chart {
    min-height: 320px;
  }

  .auth-page .vh-100 {
    height: auto !important;
    min-height: 100dvh;
  }

  .auth-page .mask {
    min-height: 100dvh;
    padding: 1rem 0;
  }

  .auth-page .card-body.p-5 {
    padding: 1.25rem !important;
  }
}
