/*
 * layout-fluid-modern.css
 * Camada global de layout fluido e responsivo.
 * Nao altera regras de negocio, somente apresentacao.
 */

:root {
  --cv-radius-sm: 0.55rem;
  --cv-radius-md: 0.85rem;
  --cv-radius-lg: 1.1rem;
  --cv-space-1: 0.25rem;
  --cv-space-2: 0.5rem;
  --cv-space-3: 0.75rem;
  --cv-space-4: 1rem;
  --cv-space-5: 1.25rem;
  --cv-space-6: 1.5rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

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

.layout-wrapper,
.layout-page,
.content-wrapper,
.container-fluid,
.container-xxl,
.container-xl,
.container-lg,
.container-md,
.container-sm {
  max-width: 100%;
}

.card,
.modal-content,
.offcanvas,
.dropdown-menu {
  border-radius: var(--cv-radius-lg);
}

.card-header,
.card-body,
.card-footer {
  min-width: 0;
}

.form-control,
.form-select,
.input-group-text,
.select2-container .select2-selection {
  border-radius: var(--cv-radius-sm) !important;
}

.btn {
  border-radius: var(--cv-radius-sm) !important;
  white-space: nowrap;
}

.btn-group,
.btn-toolbar {
  flex-wrap: wrap;
  gap: var(--cv-space-2);
}

.btn-group > .btn,
.btn-toolbar > .btn,
.input-group > .btn {
  margin: 0 !important;
}

.table-responsive,
.bootstrap-table,
.fixed-table-container,
.dataTables_wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  min-width: 100%;
}

.table th,
.table td {
  vertical-align: middle !important;
  line-height: 1.35;
}

.table td .btn,
.table td .badge,
.table td .dropdown,
.table td .dropdown-toggle {
  margin: var(--cv-space-1);
}

.table td:last-child,
.table th:last-child {
  min-width: 11rem;
}

.table td:last-child .btn,
.table td:last-child .btn-group,
.table td:last-child .dropdown {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cv-space-2);
}

.modal-dialog {
  margin: var(--cv-space-4) auto;
}

.modal-content {
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
}

.modal-header,
.modal-body,
.modal-footer {
  min-width: 0;
}

.modal-body {
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cv-space-2);
}

.modal-footer > * {
  margin: 0 !important;
}

.modal .form-control,
.modal .form-select,
.modal textarea,
.modal input:not([type="checkbox"]):not([type="radio"]) {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  caret-color: #fff !important;
}

.modal .form-control::placeholder,
.modal .form-select::placeholder,
.modal textarea::placeholder,
.modal input::placeholder {
  color: rgba(255, 255, 255, 0.72) !important;
}

.swal2-popup {
  width: min(34rem, calc(100vw - 1rem)) !important;
  border-radius: var(--cv-radius-lg) !important;
}

.swal2-html-container {
  overflow-wrap: anywhere;
}

.pagination {
  flex-wrap: wrap;
  gap: var(--cv-space-2);
}

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

/* Icon font hardening: evita conflito com overrides globais de tema */
.fa,
.fas,
.far,
.fab,
.fa-solid,
.fa-regular,
.fa-brands {
  font-style: normal !important;
  font-variant: normal !important;
  line-height: 1 !important;
  text-rendering: auto !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

.fa,
.fas,
.far,
.fa-solid,
.fa-regular {
  font-family: "Font Awesome 6 Free" !important;
}

.fab,
.fa-brands {
  font-family: "Font Awesome 6 Brands" !important;
}

.bx,
[class^="bx "],
[class*=" bx "] {
  font-family: boxicons !important;
  font-style: normal !important;
  font-variant: normal !important;
  line-height: 1 !important;
}

.ti,
[class^="ti "],
[class*=" ti "] {
  font-family: tabler-icons !important;
  font-style: normal !important;
  line-height: 1 !important;
}

@media (max-width: 1199.98px) {
  .layout-navbar .container-fluid,
  .layout-navbar .container-xxl,
  #layout-navbar .container-fluid,
  #layout-navbar .container-xxl {
    padding-inline: var(--cv-space-3);
  }

  .content-wrapper > .container-fluid,
  .content-wrapper > .container-xxl {
    padding-inline: var(--cv-space-3);
  }
}

@media (max-width: 991.98px) {
  .card-body {
    padding: var(--cv-space-4);
  }

  .btn {
    min-height: 2.55rem;
    white-space: normal;
    word-break: break-word;
  }

  .table,
  .bootstrap-table .table,
  .dataTables_wrapper table {
    white-space: nowrap;
  }

  .table td:last-child,
  .table th:last-child {
    min-width: 10rem;
  }

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

@media (max-width: 767.98px) {
  .layout-menu-toggle {
    margin-inline-end: var(--cv-space-2);
  }

  .content-wrapper > .container-fluid,
  .content-wrapper > .container-xxl {
    padding-inline: var(--cv-space-2);
  }

  .card {
    border-radius: var(--cv-radius-md);
  }

  .card-body,
  .card-header,
  .card-footer {
    padding: var(--cv-space-3);
  }

  .table {
    font-size: 0.88rem;
  }

  .table td,
  .table th {
    padding: 0.55rem 0.5rem;
  }

  .table td:last-child,
  .table th:last-child {
    min-width: 9.25rem;
  }

  .modal-dialog {
    margin: var(--cv-space-2);
  }

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

  .offcanvas.offcanvas-end,
  .offcanvas.offcanvas-start {
    max-width: 96vw;
  }
}

@media (max-width: 575.98px) {
  .navbar .form-control,
  .navbar .form-select {
    min-width: 0;
  }

  .btn-group > .btn,
  .btn-toolbar > .btn {
    flex: 1 1 auto;
  }

  .table td:last-child .btn,
  .table td:last-child .btn-group {
    width: 100%;
    justify-content: flex-start;
  }
}
