/*
 * Responsive profesional global.
 * Capa conservadora para pantallas heredadas con Bootstrap 3/4, mapas, tablas,
 * modales, formularios y streaming. No reemplaza los estilos existentes.
 */

:root {
  --jw-rsp-page-pad: clamp(10px, 3vw, 18px);
  --jw-rsp-touch: 44px;
  --jw-rsp-radius: 8px;
}

html {
  min-width: 0;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 0;
  max-width: 100%;
}

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

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

img,
video,
canvas {
  height: auto;
}

iframe {
  border: 0;
}

input,
select,
textarea,
button,
.btn,
.form-control,
.select2-container {
  max-width: 100%;
}

textarea {
  resize: vertical;
}

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

.jw-responsive-scroll,
.table-responsive,
.dataTables_wrapper,
.estadisticas-table-wrap,
.territorio-table-wrap,
.tel-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.jw-responsive-scroll > table,
.table-responsive > table,
.estadisticas-table-wrap > table,
.territorio-table-wrap > table,
.tel-table-wrap > table {
  margin-bottom: 0;
}

table,
.table,
.dataTable {
  max-width: 100%;
}

#map,
#mymap,
#map-canvas,
#map_salida,
#map-wrap,
.map-canvas,
.territorio-map-wrap,
.google-map {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.modal,
.modal-dialog,
.modal-content,
.modal-body {
  max-width: 100%;
}

.swal2-popup {
  max-width: calc(100vw - 24px) !important;
}

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

@media (max-width: 991.98px) {
  .container,
  .container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: var(--jw-rsp-page-pad) !important;
    padding-right: var(--jw-rsp-page-pad) !important;
  }

  .row {
    margin-left: calc(var(--jw-rsp-page-pad) * -0.5) !important;
    margin-right: calc(var(--jw-rsp-page-pad) * -0.5) !important;
  }

  [class*="col-"] {
    padding-left: calc(var(--jw-rsp-page-pad) * 0.5) !important;
    padding-right: calc(var(--jw-rsp-page-pad) * 0.5) !important;
  }

  .modal-dialog {
    width: min(720px, calc(100vw - 24px)) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .modal-dialog[style] {
    max-width: calc(100vw - 24px) !important;
  }
}

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

  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  li,
  label,
  legend,
  .modal-title,
  .panel-title,
  .brand,
  .navbar-brand {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.28rem; }
  h4 { font-size: 1.12rem; }

  .btn,
  button,
  input[type="button"],
  input[type="submit"],
  input[type="reset"] {
    min-height: var(--jw-rsp-touch);
    white-space: normal;
    line-height: 1.2;
  }

  .btn-group,
  .btn-toolbar,
  .modal-footer,
  .form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .btn-group > .btn,
  .btn-toolbar > .btn,
  .modal-footer > .btn,
  .form-actions > .btn {
    float: none !important;
    margin: 0 !important;
  }

  .modal-footer > .btn,
  .form-actions > .btn {
    flex: 1 1 140px;
  }

  .form-inline,
  .form-horizontal .form-group {
    width: 100%;
  }

  .form-inline .form-group,
  .form-inline .form-control,
  .form-horizontal .control-label,
  .form-horizontal .controls,
  .form-horizontal .form-control {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .form-horizontal .control-label {
    padding-top: 0;
    margin-bottom: 6px;
    text-align: left !important;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea,
  .form-control {
    min-height: var(--jw-rsp-touch);
    font-size: 16px !important;
  }

  .select2-container {
    width: 100% !important;
  }

  .select2-container .select2-selection--single,
  .select2-container .select2-selection--multiple {
    min-height: var(--jw-rsp-touch);
  }

  .modal {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .modal-dialog {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    margin: 10px auto !important;
  }

  .modal-content {
    max-height: calc(100vh - 20px);
    overflow: hidden;
    border-radius: var(--jw-rsp-radius);
  }

  .modal-header,
  .modal-footer {
    padding: 12px !important;
  }

  .modal-body {
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px !important;
  }

  .modal-body [style*="grid-template-columns:1fr 1fr"],
  .modal-body [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  table.table,
  table.dataTable,
  .tabla-estadistica,
  .tel-table {
    width: 100% !important;
  }

  table th,
  table td,
  .table th,
  .table td,
  .dataTable th,
  .dataTable td {
    vertical-align: middle !important;
    overflow-wrap: anywhere;
  }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 10px !important;
    text-align: left !important;
  }

  .dataTables_wrapper .dataTables_filter label,
  .dataTables_wrapper .dataTables_length label {
    width: 100%;
  }

  .dataTables_wrapper .dataTables_filter input,
  .dataTables_wrapper .dataTables_length select {
    width: 100% !important;
    max-width: 100% !important;
    margin: 6px 0 0 !important;
  }

  .dataTables_wrapper .dataTables_paginate {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .dataTables_wrapper .dataTables_paginate .paginate_button {
    margin: 0 !important;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
  }

  #map,
  #mymap,
  #map-canvas,
  #map_salida,
  .map-canvas,
  .territorio-map-wrap {
    min-height: min(68vh, 520px);
  }

  iframe[src*="youtube"],
  iframe[src*="youtu.be"],
  iframe[src*="maps"],
  iframe[src*="google"],
  video {
    width: 100% !important;
  }

  .panel,
  .well,
  .card,
  .box,
  .jumbotron {
    max-width: 100%;
  }

  .navbar-fixed-top,
  .navbar-fixed-bottom {
    max-width: 100vw;
  }
}

@media (max-width: 520px) {
  :root {
    --jw-rsp-page-pad: 10px;
  }

  .hidden-xs-force,
  .desktop-only {
    display: none !important;
  }

  .btn-block-xs,
  .modal-footer > .btn,
  .form-actions > .btn {
    width: 100% !important;
    flex-basis: 100%;
  }

  .swal2-actions {
    width: 100%;
    gap: 8px;
  }

  .swal2-actions .swal2-styled {
    flex: 1 1 120px;
    min-height: var(--jw-rsp-touch);
  }
}

@media (max-width: 380px) {
  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.35rem; }

  .modal-dialog {
    width: calc(100vw - 12px) !important;
    max-width: calc(100vw - 12px) !important;
    margin-top: 6px !important;
    margin-bottom: 6px !important;
  }

  .modal-body {
    padding: 10px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
