/* ===================================================================
   CSS COMPLETO “Desktop + Móvil Compacto” para tablas .filtrable
   =================================================================== */

/* ------------------------------------------------------------
   1) MÓVIL COMPACTO (pantallas ≤ 768px)
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  /* 1.1) Convertir toda la tabla en bloques: cada <tr> es un “registro” vertical */
  .filtrable,
  .filtrable thead,
  .filtrable tbody,
  .filtrable th,
  .filtrable td,
  .filtrable tr {
    display: block !important;
    width: 100% !important;
  }

  /* 1.2) Ocultar la fila de encabezados (<thead>) */
  .filtrable thead tr {
    display: none !important;
  }

  /* 1.3) Cada <tr> actúa como una “tarjeta” muy compacta:
         - Solo tiene un border-bottom para separar de la siguiente.
         - Sin margin extra entre tarjetas.
         - Padding interno mínimo. */
  .filtrable tr {
    margin-bottom: 0;                    /* nada de espacio extra vertical */
    border-bottom: 1px solid #ddd;       /* línea que separa registros */
    padding: 0;                          /* padding mínimo (se maneja en <td>) */
    box-sizing: border-box;
  }

  /* 1.4) Dentro de cada registro (<tr>), cada <td> (nombre o DNI):
         - Sin bordes internos.
         - Padding muy ligero.
         - Text-wrap permitido.
         - Primera línea = nombre. Segunda línea = DNI. */
  .filtrable td {
    border: none !important;             /* quitar bordes internos */
    padding: 0.25em 0.5em;               /* separa un poco el texto, pero muy compacto */
    white-space: normal;                 /* permite wrap si es muy largo */
    text-align: left;
    box-sizing: border-box;
    word-wrap: break-word;
  }

  /* 1.5) Ajustar el buscador “Buscar:” para que sea un bloque completo
         y no se extienda sin control */
  .dataTables_wrapper .dataTables_filter {
    display: block !important;
    text-align: left !important;
    margin: 0 0 0.5em 0;
    width: 100%;
  }
  .dataTables_wrapper .dataTables_filter label {
    display: block !important;
    white-space: nowrap;
    margin: 0 0 0.25em 0;
    font-weight: 500;
  }
  /* Limitar ancho del input de búsqueda */
  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;   /* ocupa todo el ancho del contenedor (hasta max-width) */
    max-width: 200px;         /* no crecerá más allá de 300px */
    box-sizing: border-box;
    padding: 0.5em;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
  }

  /* 1.6) Ajustar “Mostrar _MENU_ filas” para que sea bloque y no se rompa */
  .dataTables_wrapper .dataTables_length {
    display: block !important;
    white-space: nowrap;
 text-align: left !important;
    margin: 0 0 0.8em 0;
  }
  .dataTables_wrapper .dataTables_length label {
    display: inline-flex !important;
    align-items: cener; 
    gap: 0.3em;
  }
}
  /* 1.7) Asegurar que el <select> "Mostrar 10 filas" no sea demasiado estrecho */
  .dataTables_wrapper .dataTables_length select {
    min-width: 60px;       /* nunca más estrecho que 60px */
    padding-right: 1.2em;  /* algo de espacio para la flechita */
    box-sizing: border-box;
  }

/* ------------------------------------------------------------
   2) ESCRITORIO (pantallas > 768px)
   ------------------------------------------------------------ */
.filtrable {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5em;
}

.filtrable thead th {
  background-color: #f7f7f7;
  color: #333;
  font-weight: 600;
  padding: 0.75em;
  border: 1px solid #ddd;
  text-align: left;
}

.filtrable tbody td {
  padding: 0.75em;
  border: 1px solid #ddd;
  color: #555;
}

.filtrable tbody tr:hover td {
  background-color: #fcfcfc;
}

/* ------------------------------------------------------------
   3) Ajustes generales de DataTables en ESCRITORIO
   ------------------------------------------------------------ */
/* 3.1) “Mostrar _MENU_ filas” sin salto de línea */
.dataTables_wrapper .dataTables_length {
  white-space: nowrap;
}
.dataTables_wrapper .dataTables_length label {
  display: inline-flex !important;
  align-items: center;
  gap: 0.3em;
}
/* 3.3) Forzar mínimo ancho en el <select> de “Mostrar _MENU_ filas” */
.dataTables_wrapper .dataTables_length select {
  min-width: 60px;       /* al menos 60px de ancho */
  padding-right: 1.2em;  /* espacio para la flechita */
  box-sizing: border-box;
}


/* 3.2) Cuadro de búsqueda alineado a la derecha */
.dataTables_wrapper .dataTables_filter {
  text-align: right;
  margin-bottom: 1em;
}
.dataTables_wrapper .dataTables_filter label {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.dataTables_wrapper .dataTables_filter input {
  width: 200px;
  max-width: 80%;
  box-sizing: border-box;
  padding: 0.3em 0.6em;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* ------------------------------------------------------------
   4) Eliminar cualquier scroll horizontal innecesario
   ------------------------------------------------------------ */
.dataTables_wrapper {
  width: 100% !important;
  overflow-x: hidden !important;
}

table.filtrable {
  table-layout: fixed;
  width: 100%;
}

table.filtrable th,
table.filtrable td {
  min-width: 80px;
  word-wrap: break-word;
}