/* Garde-fous responsive partagés par les pages publiques et l'administration. */

main,
.container,
.container-fluid,
.row > *,
.card,
.card-body,
.card-header,
.card-footer,
.modal-content,
.modal-header,
.modal-body,
.modal-footer,
.tab-content,
.tab-pane {
  min-width: 0;
}

.has-env-banner .modal {
  top: var(--os-env-banner-height, 0);
  height: calc(100% - var(--os-env-banner-height, 0px));
}

.modal-dialog-scrollable .modal-content > form {
  display: flex;
  min-height: 0;
  max-height: 100%;
  flex: 1 1 auto;
  flex-direction: column;
}

.modal-dialog-scrollable .modal-content > form > .modal-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}

.modal-dialog-scrollable .modal-content > form > .modal-header,
.modal-dialog-scrollable .modal-content > form > .modal-footer {
  flex: 0 0 auto;
}

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

pre {
  max-width: 100%;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.card-title,
.modal-title,
.alert,
dd,
td,
th {
  overflow-wrap: anywhere;
}

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

.pagination {
  max-width: 100%;
  flex-wrap: wrap;
  gap: 0.15rem;
}

.pagination .page-item,
.pagination .page-link {
  min-width: 0;
}

.btn,
.page-link,
.dropdown-item {
  overflow-wrap: anywhere;
}

input,
select,
textarea,
.input-group {
  max-width: 100%;
}

@media (max-width: 575.98px) {
  .modal-dialog:not(.modal-fullscreen-sm-down) {
    width: auto;
    max-width: none;
    margin: 0.5rem;
  }

  .modal-header {
    align-items: flex-start;
    gap: 0.5rem;
  }

  .modal-title {
    min-width: 0;
    font-size: 1rem;
    line-height: 1.3;
  }

  .modal-footer {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .modal-footer > *,
  .modal-footer > form,
  .modal-footer > form > .btn {
    width: 100%;
    min-width: 0;
    margin: 0 !important;
  }

  .card-header.d-flex,
  .card-footer.d-flex {
    flex-wrap: wrap;
  }
}
