/* Ajustes globales responsive para VETPRO */
:root {
  --vet-sidebar-collapsed: 78px;
  --vet-sidebar-expanded: 260px;
  --vet-bg-page: #ebf7ff;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  max-width: 100%;
  overflow-x: hidden;
  background: var(--vet-bg-page);
}

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

.home-section {
  left: var(--vet-sidebar-collapsed) !important;
  width: calc(100% - var(--vet-sidebar-collapsed)) !important;
  min-width: 0;
  overflow-x: hidden;
}

.sidebar:not(.close) ~ .home-section {
  left: var(--vet-sidebar-expanded) !important;
  width: calc(100% - var(--vet-sidebar-expanded)) !important;
}

.home-content {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px clamp(14px, 2.5vw, 30px);
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(235, 247, 255, 0.96);
  border-bottom: 1px solid rgba(17, 16, 29, 0.08);
  backdrop-filter: blur(8px);
}

.home-content .text {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.home-section > .container,
.home-section > .container-fluid,
.home-section .container,
.home-section .container-fluid {
  max-width: 100%;
}

.card {
  max-width: 100%;
}

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

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

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

.table th,
.table td {
  vertical-align: middle;
}

.form-control,
.form-select,
.select2-container,
.select2-container .select2-selection {
  max-width: 100%;
}

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

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

textarea {
  resize: vertical;
}

.modal-dialog {
  max-width: min(96vw, 760px);
  margin-left: auto;
  margin-right: auto;
}

.offcanvas.offcanvas-end,
.offcanvas-laboratorio {
  max-width: 100vw !important;
}

.d-flex.responsive-actions,
.card-footer .d-flex,
.modal-footer,
.form-actions {
  flex-wrap: wrap;
}

.btn {
  white-space: normal;
}

.dataTables_wrapper {
  width: 100%;
  overflow: hidden;
}

.dataTables_wrapper .row {
  row-gap: .75rem;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  max-width: 100%;
}

.dataTables_wrapper .dataTables_filter input {
  max-width: min(100%, 260px);
  margin-left: .4rem;
}

.sidebar-overlay {
  display: none;
}

@media (max-width: 991.98px) {
  .sidebar {
    width: min(86vw, 290px) !important;
    transform: translateX(-105%);
    transition: transform .28s ease;
    box-shadow: 8px 0 26px rgba(0,0,0,.18);
  }

  .sidebar.close {
    width: min(86vw, 290px) !important;
    transform: translateX(-105%);
  }

  .sidebar.mobile-open,
  .sidebar.close.mobile-open {
    transform: translateX(0);
  }

  .sidebar .logo-details .logo_name,
  .sidebar.close .logo-details .logo_name,
  .sidebar .nav-links li a .link_name,
  .sidebar.close .nav-links li a .link_name {
    opacity: 1;
    pointer-events: auto;
    display: inline;
  }

  .sidebar.close .nav-links {
    overflow: auto;
  }

  .sidebar.close .nav-links li .iocn-link {
    display: flex;
  }

  .sidebar.close .nav-links i.arrow {
    display: block;
  }

  .sidebar.close .nav-links li .sub-menu {
    position: static;
    left: auto;
    top: auto;
    opacity: 1;
    pointer-events: auto;
    display: none;
    margin-top: -10px;
    padding: 6px 6px 14px 80px;
    border-radius: 0;
  }

  .sidebar.close .nav-links li.showMenu .sub-menu,
  .sidebar .nav-links li.showMenu .sub-menu {
    display: block;
  }

  .sidebar.close .nav-links li .sub-menu.blank {
    display: none !important;
  }

  .sidebar .profile-details,
  .sidebar.close .profile-details {
    width: min(86vw, 290px) !important;
    background: #1d1b31;
  }

  .sidebar.close .profile-details i,
  .sidebar.close .profile-details .profile_name,
  .sidebar.close .profile-details .job {
    display: block;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(17,16,29,.48);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
  }

  .sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
  }

  body.menu-open {
    overflow: hidden;
  }

  .home-section,
  .sidebar.close ~ .home-section,
  .sidebar:not(.close) ~ .home-section,
  .sidebar-right ~ .home-section,
  .sidebar-right.open ~ .home-section {
    left: 0 !important;
    width: 100% !important;
  }

  .home-content {
    min-height: 62px;
    padding: 10px 14px;
  }

  .home-section .home-content .bx-menu {
    font-size: 30px;
    flex: 0 0 auto;
  }

  .home-section .home-content .text {
    font-size: clamp(1.05rem, 4vw, 1.45rem);
  }

  .container,
  .container-fluid {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .card-body {
    padding: 1rem;
  }

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

  .d-flex.justify-content-between,
  .d-flex.align-items-center.justify-content-between {
    gap: .75rem;
    flex-wrap: wrap;
  }

  .modal-dialog {
    width: auto;
    margin: .75rem;
  }

  .offcanvas-laboratorio {
    width: 100vw !important;
  }
}

@media (max-width: 767.98px) {
  .home-section {
    min-height: 100dvh;
  }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.1rem; }

  .card,
  .container.card {
    border-radius: 14px;
  }

  .table {
    font-size: .86rem;
  }

  .table th,
  .table td {
    padding: .55rem .5rem;
    white-space: nowrap;
  }

  .table td .btn,
  .table th .btn {
    font-size: .78rem;
    padding: .35rem .55rem;
  }

  .btn-group,
  .btn-toolbar {
    flex-wrap: wrap;
  }

  .form-control-lg,
  .form-select-lg {
    font-size: 1rem;
  }

  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    text-align: left !important;
    float: none !important;
  }

  .dataTables_wrapper .dataTables_filter label,
  .dataTables_wrapper .dataTables_length label {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    max-width: none;
    margin-left: 0;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 3px;
  }

  .modal-footer > * {
    flex: 1 1 auto;
  }
}

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

  .home-content {
    padding-left: 10px;
    padding-right: 10px;
  }

  .card-body {
    padding: .85rem;
  }

  .btn.w-100-mobile,
  .form-actions .btn,
  .modal-footer .btn {
    width: 100%;
  }

  .alert {
    padding: .75rem;
  }

  .tarjeta-animal {
    max-width: 100% !important;
  }
}


/* Botón hamburguesa global: visible incluso en pantallas que no tienen .home-content */
.mobile-menu-toggle {
  display: none;
}

@media (max-width: 991.98px) {
  .mobile-menu-toggle {
    display: inline-flex !important;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1205;
    width: 46px;
    height: 46px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    background: #11101d;
    color: #fff;
    box-shadow: 0 5px 18px rgba(0,0,0,.24);
    font-size: 22px;
    cursor: pointer;
  }

  .mobile-menu-toggle:focus-visible {
    outline: 3px solid rgba(25,135,84,.35);
    outline-offset: 2px;
  }

  .sidebar,
  .sidebar.close {
    z-index: 1200 !important;
  }

  .sidebar-overlay {
    z-index: 1190 !important;
  }

  /* Deja espacio para el botón en páginas que no tienen encabezado propio */
  .home-section {
    padding-top: 66px;
  }

  .home-section .home-content {
    margin-top: -66px;
    padding-left: 70px !important;
  }

  /* Evita mostrar dos hamburguesas al mismo tiempo */
  .home-section .home-content .bx-menu {
    display: none !important;
  }
}

/* ============================================================
   TABLAS COMPACTAS EN CELULAR
   Conserva la primera columna útil y la columna Acciones.
   En escritorio no altera la tabla original.
   ============================================================ */
@media (max-width: 767.98px) {
  table.vet-mobile-compact {
    width: 100% !important;
    table-layout: fixed !important;
  }

  table.vet-mobile-compact th,
  table.vet-mobile-compact td {
    display: none !important;
  }

  table.vet-mobile-compact th.vet-mobile-primary,
  table.vet-mobile-compact td.vet-mobile-primary,
  table.vet-mobile-compact th.vet-mobile-actions,
  table.vet-mobile-compact td.vet-mobile-actions {
    display: table-cell !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
    vertical-align: middle !important;
  }

  table.vet-mobile-compact th.vet-mobile-primary,
  table.vet-mobile-compact td.vet-mobile-primary {
    width: 64% !important;
    max-width: 64% !important;
  }

  table.vet-mobile-compact th.vet-mobile-actions,
  table.vet-mobile-compact td.vet-mobile-actions {
    width: 36% !important;
    max-width: 36% !important;
    text-align: center !important;
  }

  table.vet-mobile-compact td.vet-mobile-primary h1,
  table.vet-mobile-compact td.vet-mobile-primary h2,
  table.vet-mobile-compact td.vet-mobile-primary h3,
  table.vet-mobile-compact td.vet-mobile-primary h4,
  table.vet-mobile-compact td.vet-mobile-primary h5,
  table.vet-mobile-compact td.vet-mobile-primary h6,
  table.vet-mobile-compact td.vet-mobile-primary p {
    margin: 0 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  table.vet-mobile-compact td.vet-mobile-actions {
    padding: .45rem .3rem !important;
  }

  table.vet-mobile-compact td.vet-mobile-actions a,
  table.vet-mobile-compact td.vet-mobile-actions button,
  table.vet-mobile-compact td.vet-mobile-actions .btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    margin: 2px !important;
    border-radius: 9px !important;
    vertical-align: middle;
  }

  table.vet-mobile-compact td.vet-mobile-actions i,
  table.vet-mobile-compact td.vet-mobile-actions .fa,
  table.vet-mobile-compact td.vet-mobile-actions .fas,
  table.vet-mobile-compact td.vet-mobile-actions .far,
  table.vet-mobile-compact td.vet-mobile-actions .fa-solid {
    font-size: 1rem !important;
    line-height: 1 !important;
  }

  table.vet-mobile-compact td.vet-mobile-actions form {
    display: inline !important;
    margin: 0 !important;
  }

  /* DataTables: buscador y paginación más cómodos */
  .dataTables_wrapper .dataTables_filter {
    width: 100%;
    margin-bottom: .75rem;
  }

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

  .dataTables_wrapper .dataTables_filter input {
    display: block;
    width: 100% !important;
    margin-top: .35rem !important;
  }

  .dataTables_wrapper .dataTables_paginate {
    overflow-x: auto;
    padding-bottom: .25rem;
  }

  /* Título visible y separado del botón hamburguesa */
  .home-content {
    justify-content: center;
    padding-left: 68px !important;
    padding-right: 14px !important;
  }

  .home-content .text {
    width: 100%;
    text-align: center;
    padding-right: 44px;
  }
}

@media (max-width: 420px) {
  table.vet-mobile-compact th.vet-mobile-primary,
  table.vet-mobile-compact td.vet-mobile-primary {
    width: 60% !important;
    max-width: 60% !important;
  }

  table.vet-mobile-compact th.vet-mobile-actions,
  table.vet-mobile-compact td.vet-mobile-actions {
    width: 40% !important;
    max-width: 40% !important;
  }
}
