/* rutas.css ===== ESTILOS GENERALES Y CONTENEDOR PRINCIPAL ===== */

.rutas-container {
  width: 100%;
  max-width: 100%;
  margin: 1.6rem auto;
  padding: 0 0.8rem;
  box-sizing: border-box;
}

/* ===== PANEL DE ACCIONES PRINCIPALES ===== */
.acciones {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.6rem;
  padding: 1.2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid #f0f0f0;
  transition: all 0.3s ease;
}

.acciones h2 {
  color: #1a202c;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  transition: font-size 0.3s ease;
}

.acciones > div {
  display: flex;
  gap: 0.8rem;
  transition: gap 0.3s ease;
}

/* ===== SISTEMA DE BOTONES PRINCIPALES (tamaño mediano) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  min-height: 40px;
  /* ELIMINAR min-width fijo y usar padding para controlar tamaño */
  min-width: auto;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  /* Permitir que se ajuste al contenido */
  width: auto;
  white-space: nowrap;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* ===== BOTONES DE TABLA - TAMAÑO Y ESPACIADO OPTIMIZADO ===== */
.btn-edit,
.btn-delete,
.btn-guardar,
.btn-cancelar,
.btn-guardar-nueva,
.btn-cancelar-nueva {
  background: linear-gradient(135deg, #0d6efd 0%, #3d8bfd 100%);
  color: #fff;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  min-height: 34px;
  max-width: 50px;
  min-width: 45px; /* Ancho suficiente para texto + ícono */
  justify-content: center;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(13, 110, 253, 0.2);
  flex: 1 1 auto; /* Permite que crezcan y se ajusten */
}

.btn-edit:hover {
  background: linear-gradient(135deg, #094bb3 0%, #0d6efd 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.btn-delete {
  background: linear-gradient(135deg, #dc3545 0%, #e35d6a 100%);
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.2);
}

.btn-delete:hover {
  background: linear-gradient(135deg, #c82333 0%, #dc3545 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Botones de Guardar/Cancelar en tabla (mismo tamaño que editar/eliminar) */
.btn-guardar,
.btn-guardar-nueva {
  background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(40, 167, 69, 0.2);
}

.btn-guardar:hover,
.btn-guardar-nueva:hover {
  background: linear-gradient(135deg, #218838 0%, #28a745 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-cancelar,
.btn-cancelar-nueva {
  background: linear-gradient(135deg, #6c757d 0%, #868e96 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(108, 117, 125, 0.2);
}

.btn-cancelar:hover,
.btn-cancelar-nueva:hover {
  background: linear-gradient(135deg, #5a6268 0%, #6c757d 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Estilos para los íconos dentro de los botones */
.btn i {
  font-size: 0.9rem;
  width: 16px;
  text-align: center;
}

/* ===== COLORES PARA BOTONES PRINCIPALES ===== */

/* Principal - Verde */
.btn-primary,
.btn-success {
  background: linear-gradient(135deg, #008c3a 0%, #00b050 100%);
  color: #fff;
  box-shadow: 0 3px 8px rgba(0, 140, 58, 0.25);
}

.btn-primary:hover,
.btn-success:hover {
  background: linear-gradient(135deg, #006e2e 0%, #008c3a 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 140, 58, 0.35);
}

/* Outline - Verde borde */
.btn-outline {
  background: transparent;
  border: 2px solid #008c3a;
  color: #008c3a;
  box-shadow: 0 2px 6px rgba(0, 140, 58, 0.1);
}

.btn-outline:hover {
  background: #008c3a;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 140, 58, 0.25);
}

/* Mantenimiento - Gris */
.btn-mantenimiento {
  background: linear-gradient(135deg, #5b5b5b 0%, #7a7a7a 100%);
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(91, 91, 91, 0.25);
}

.btn-mantenimiento:hover {
  background: linear-gradient(135deg, #4a4a4a 0%, #666666 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(91, 91, 91, 0.35);
}

/* Cancelar - Gris oscuro */
.btn-cancelar {
  background: linear-gradient(135deg, #6c757d 0%, #8a939b 100%);
  color: white;
  box-shadow: 0 3px 8px rgba(108, 117, 125, 0.25);
}

.btn-cancelar:hover {
  background: linear-gradient(135deg, #5a6268 0%, #727b84 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(108, 117, 125, 0.35);
}

/* Agregar Fila - Verde agua */
#btnAgregarFila {
  background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
  color: #fff;
  box-shadow: 0 3px 8px rgba(23, 162, 184, 0.25);
}

#btnAgregarFila:hover {
  background: linear-gradient(135deg, #138496 0%, #17a2b8 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(23, 162, 184, 0.35);
}

/* ===== BOTONES DESHABILITADOS ===== */
.btn:disabled,
.btn[disabled],
.btn-edit:disabled,
.btn-delete:disabled {
  background: #e5e7eb !important;
  border-color: #d1d5db !important;
  color: #9ca3af !important;
  cursor: not-allowed;
  opacity: 0.6;
  transform: none !important;
  box-shadow: none !important;
}

/* ===== MEJORAS PARA LA COLUMNA DE ACCIONES ===== */

/* Contenedor principal de la columna de acciones */
.tabla td:last-child {
  padding: 0.5rem !important;
  width: auto !important;
  min-width: 120px !important; /* Ancho mínimo suficiente para 2-3 botones */
  max-width: 150px !important; /* Ancho máximo controlado */
  text-align: center;
  vertical-align: middle;
}

/* Contenedor de botones dentro de la tabla */
.acciones-tabla {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  min-width: 100px;
  max-width: 140px;
  margin: 0 auto;
}

/* ===== BOTÓN CANCELAR DEL FORMULARIO (especial - más grande) ===== */
.acciones-formulario .btn-cancelar {
  padding: 0.6rem 1rem !important;
  font-size: 0.85rem !important;
  min-width: 110px;
  min-height: 40px;
}

/* ===== FILTRO ÚNICO ===== */
.filtros-container {
  background: #fff;
  padding: 1.2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  margin-bottom: 1.2rem;
  border: 1px solid #f0f0f0;
}

.filtros-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid #e8e8e8;
  padding-bottom: 0.7rem;
}

.filtros-header h3 {
  color: #1a202c;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

/* Estilos para el filtro único */
.filtro-unico-simple {
  margin-top: 1rem;
}

.search-container {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 0.8rem;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  background: white;
  box-sizing: border-box;
  max-width: 280px;
  min-height: 48px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.search-input:focus {
  outline: none;
  border-color: #7ba5ff;
  box-shadow: 0 0 0 3px rgba(123, 165, 255, 0.2);
  transform: translateY(-1px);
}

.search-input::placeholder {
  color: #9ca3af;
  font-style: italic;
}

/* ===== SISTEMA DE TABLA ===== */
.tabla-contenedor {
  background: #fff;
  padding: 1.2rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  overflow-x: auto;
  margin-bottom: 1.2rem;
  width: 100%;
  border: 1px solid #f0f0f0;
  -webkit-overflow-scrolling: touch;
}

.tabla {
  width: 100%;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
}

/* Cabeceras de tabla */
.tabla th {
  background:#7ba5ff;
  color: #fff;
  padding: 0.7rem;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 0.75rem;
  border-bottom: 2px solid #5f76dc;
}

/* Celdas de tabla */
.tabla td {
  padding: 0.7rem;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.8rem;
  text-align: left;
  color: #374151;
  vertical-align: middle;
  transition: background-color 0.2s;
}

.tabla tr:last-child td {
  border-bottom: none;
}

.tabla tr:hover {
  background: #f8fafc;
}

/* ===== INDICADORES DE ESTADO ===== */
.estado {
  padding: 0.35rem 0.7rem;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
  text-align: center;
  min-width: 80px;
  border: 1.5px solid;
  white-space: nowrap;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.estado-devolucion {
  background: linear-gradient(135deg, #ffcfcf 0%, #ffabb3 100%);
  color: #721c24;
  border-color: #dc3545;
}

.estado-pendiente,
.estado-reprogramado {
  background: linear-gradient(135deg, #fff3cd 0%, #ffe695 100%);
  color: #856404;
  border-color: #ffd351;
}

.estado-entregado-parcial,
.estado-en-proceso {
  background: linear-gradient(135deg, #d1ecf1 0%, #abdae2 100%);
  color: #0c5460;
  border-color: #6edff6;
}

.estado-recogido,
.estado-completado {
  background: linear-gradient(135deg, #d4edda 0%, #96e8a9 100%);
  color: #155724;
  border-color: #28a745;
}


/* Clase para indicador de solo lectura */
.indicador-solo-lectura {
  color: #6c757d !important;
  font-style: italic;
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
}

/* ===== ESTILOS PARA CAMPOS DE SOLO LECTURA ===== */
input[readonly],
select[disabled],
input.campo-bloqueado {
  background: #f8f9fa !important;
  border-color: #e9ecef !important;
  color: #6c757d !important;
  cursor: not-allowed !important;
  opacity: 0.8 !important;
}

input[readonly]:focus,
select[disabled]:focus {
  border-color: #e9ecef !important;
  box-shadow: none !important;
  transform: none !important;
}

/* ===== ESTILOS PARA FILAS EN EDICIÓN ===== */
.fila-editando {
  background: linear-gradient(135deg, #f0f9ff 0%, #e6f7ff 100%) !important;
  border-left: 3px solid #7ba5ff;
}

.fila-editando td {
  padding: 0.8rem !important;
}

/* Inputs dentro de la tabla en modo edición */
.input-edicion {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 2px solid #7ba5ff;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  background: white;
  box-sizing: border-box;
  min-height: 36px;
  box-shadow: 0 2px 6px rgba(123, 165, 255, 0.1);
}

.input-edicion:focus {
  outline: none;
  border-color: #5f76dc;
  box-shadow: 0 0 0 3px rgba(123, 165, 255, 0.2);
}

/* Select dentro de la tabla en modo edición */
.select-edicion {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 2px solid #7ba5ff;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  background: white;
  box-sizing: border-box;
  min-height: 36px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(123, 165, 255, 0.1);
}

.select-edicion:focus {
  outline: none;
  border-color: #5f76dc;
  box-shadow: 0 0 0 3px rgba(123, 165, 255, 0.2);
}

/* ===== SISTEMA DE PAGINACIÓN ===== */
.paginacion {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  margin-top: 1.6rem;
  padding: 1.2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #f0f0f0;
}

.btn-pag {
  background: linear-gradient(135deg, #008c3a 0%, #00b050 100%);
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  transition: all 0.25s;
  min-height: 40px;
  max-width: 40px;
  box-sizing: border-box;
  box-shadow: 0 3px 8px rgba(0, 140, 58, 0.25);
}

.btn-pag:hover:not(:disabled) {
  background: linear-gradient(135deg, #006e2e 0%, #008c3a 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 140, 58, 0.35);
}

.btn-pag:disabled {
  background: #e5e7eb;
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.info-pagina {
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
}

/* ===== AREA DE IMPORTACIÓN ===== */
.area-importar-datos {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 1.6rem;
  border-radius: 12px;
  border: 2px dashed #adb5bd;
  margin-bottom: 1.6rem;
}

.importar-instructions {
  background: white;
  padding: 1.2rem;
  border-radius: 10px;
  margin-bottom: 1.2rem;
  border: 1px solid #e0e0e0;
}

.importar-instructions h3 {
  color: #495057;
  font-size: 1rem;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.importar-instructions p {
  color: #6c757d;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.textarea-excel {
  width: 100%;
  padding: 1rem;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.85rem;
  background: white;
  box-sizing: border-box;
  min-height: 150px;
  resize: vertical;
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.textarea-excel:focus {
  outline: none;
  border-color: #7ba5ff;
  box-shadow: 0 0 0 3px rgba(123, 165, 255, 0.2);
}

.importar-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
}

.rutas-container .formulario-ruta {
  display: flex;
}

/* ===== MEDIA QUERIES MEJORADAS - RESPONSIVIDAD OPTIMIZADA ===== */

/* TABLET - 768px */
@media (max-width: 768px) {
  .rutas-container {
    padding: 0 0.8rem;
    margin: 1.2rem auto;
  }
  
  .acciones {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .acciones h2 {
    font-size: 1.2rem;
  }
  
  .acciones > div {
    gap: 0.5rem;
  }
  
  /* Botones principales - más compactos */
  .btn {
    padding: 0.5rem 0.8rem;
    min-height: 36px;
    font-size: 0.8rem;
  }
  
  /* Ajustar específicamente los botones con íconos */
  .btn i {
    font-size: 0.9em; /* Reducir tamaño de íconos */
  }
  
  /* ===== MEJORAS PARA COLUMNA DE ACCIONES EN TABLET ===== */
  .tabla td:last-child {
    padding: 0.4rem !important;
    min-width: 100px !important;
    max-width: 130px !important;
  }
  
  .acciones-tabla {
    min-width: 90px;
    max-width: 120px;
    gap: 0.3rem;
  }
  
  /* Botones de tabla en tablet */
  .btn-edit,
  .btn-delete,
  .btn-guardar,
  .btn-cancelar,
  .btn-guardar-nueva,
  .btn-cancelar-nueva {
    padding: 0.35rem 0.6rem;
    min-height: 32px;
    max-width: 50px;
    min-width: 45px;
    font-size: 0.7rem;
    gap: 0.3rem;
  }
  
  .btn i {
    font-size: 0.85rem;
    width: 14px;
  }
  
  /* Eliminar contenido innecesario */
  .btn-mantenimiento,
  .btn-primary,
  .btn-success {
    content: '';
  }
  
  .filtros-container,
  .tabla-contenedor {
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  .estado {
    min-width: 75px;
    font-size: 0.6rem;
    padding: 0.3rem 0.6rem;
  }
  
  .input-edicion,
  .select-edicion {
    min-height: 34px;
    font-size: 0.75rem;
  }
  
  .paginacion {
    padding: 1rem;
    gap: 1rem;
  }
  
  .btn-pag {
    padding: 0.55rem 0.9rem;
    min-height: 38px;
  }
  
  .tabla th {
    padding: 0.6rem 0.5rem;
    font-size: 0.7rem;
  }
  
  .tabla td {
    padding: 0.6rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* ===== CELULAR - 526px ===== */
@media (max-width: 526px) {
  .rutas-container {
    padding: 0 0.6rem;
    margin: 1rem auto;
  }
  
  .acciones {
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .acciones h2 {
    font-size: 1.1rem;
    text-align: center;
    width: 100%;
  }
  
  .acciones > div {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }
  
  /* Botones principales - ocupar ancho completo pero sin exceso */
  .btn {
    padding: 0.45rem 0.7rem;
    min-height: 34px;
    justify-content: center;
    font-size: 0.75rem;
  }
  
  /* Si los botones están en línea (no en columna) */
  .acciones > div:not(.acciones-formulario) {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .acciones > div:not(.acciones-formulario) .btn {
    width: calc(50% - 0.25rem); /* Dos botones por fila */
  }
  
  /* ===== MEJORAS PARA COLUMNA DE ACCIONES EN MÓVIL ===== */
  .tabla td:last-child {
    padding: 0.3rem !important;
    min-width: 80px !important; /* REDUCIDO PERO SUFICIENTE */
    max-width: 100px !important;
  }
  
  .acciones-tabla {
    flex-direction: column; /* Cambia a vertical en móvil */
    gap: 0.25rem;
    min-width: 60px;
    max-width: 80px;
    align-items: stretch; /* Hace que los botones ocupen todo el ancho */
  }
  
  /* BOTONES APILADOS VERTICALMENTE EN MÓVIL */
  .btn-edit,
  .btn-delete,
  .btn-guardar,
  .btn-cancelar,
  .btn-guardar-nueva,
  .btn-cancelar-nueva {
    width: 100% !important; /* Ocupa el 100% del contenedor */
    max-width: 50px;
    min-width: 45px;
    padding: 0.3rem 0.4rem;
    min-height: 30px;
    font-size: 0.65rem;
    margin: 0; /* Elimina márgenes */
    justify-content: center;
  }
  
  /* Solo mostrar íconos en móvil, ocultar texto */
  .btn-edit span,
  .btn-delete span,
  .btn-guardar span,
  .btn-cancelar span,
  .btn-guardar-nueva span,
  .btn-cancelar-nueva span {
    display: none; /* Oculta el texto en móvil */
  }
  
  .btn i {
    font-size: 0.8rem;
    width: 14px;
  }
  
  .filtros-container,
  .tabla-contenedor {
    padding: 0.8rem;
    margin-bottom: 0.8rem;
  }
  
  .estado {
    min-width: 70px;
    font-size: 0.58rem;
    padding: 0.25rem 0.5rem;
  }
  
  .input-edicion,
  .select-edicion {
    min-height: 32px;
    font-size: 0.7rem;
  }
  
  .paginacion {
    flex-direction: row;
    gap: 0.8rem;
    padding: 0.8rem;
  }
  
  .btn-pag {
    width: 100%;
  }
  
  .tabla th {
    padding: 0.5rem 0.4rem;
    font-size: 0.65rem;
  }
  
  .tabla td {
    padding: 0.5rem 0.4rem;
    font-size: 0.7rem;
  }
  
  .search-input {
    max-width: 100%;
  }
  
  /* ===== OCULTAR COLUMNAS SOLO PARA TABLA DE PUNTOS DE ENTREGA ===== */
  /* Para la tabla específica de puntos de entrega (con ID o clase específica) */
  
  /* Opción A: Si la tabla tiene el ID #tablaPuntosEntrega */
  #tablaPuntosEntrega th:nth-child(1),
  #tablaPuntosEntrega td:nth-child(1),
  #tablaPuntosEntrega th:nth-child(5),
  #tablaPuntosEntrega td:nth-child(5) {
    display: none !important;
  }
  
  /* Opción B: Si no funciona, usar una clase específica */
  /* Agrega class="tabla-puntos-entrega" a tu tabla de puntos */
  .tabla-puntos-entrega th:nth-child(1),
  .tabla-puntos-entrega td:nth-child(1),
  .tabla-puntos-entrega th:nth-child(5),
  .tabla-puntos-entrega td:nth-child(5) {
    display: none !important;
  }
  
  /* Opción C: Si ninguna funciona, usa este selector más amplio */
  /* Solo aplica a tablas dentro de secciones específicas */
  section:has(#tablaPuntosEntrega) .tabla th:nth-child(1),
  section:has(#tablaPuntosEntrega) .tabla td:nth-child(1),
  section:has(#tablaPuntosEntrega) .tabla th:nth-child(5),
  section:has(#tablaPuntosEntrega) .tabla td:nth-child(5) {
    display: none !important;
  }
  
  /* Mantener el border-radius en la nueva primera columna visible */
  #tablaPuntosEntrega tr:first-child th:nth-child(2),
  .tabla-puntos-entrega tr:first-child th:nth-child(2),
  section:has(#tablaPuntosEntrega) .tabla tr:first-child th:nth-child(2) {
    border-top-left-radius: 8px !important;
  }
  
  /* Ocultar formulario de ruta en móvil */
  .rutas-container .formulario-ruta {
    display: none !important;
  }
}

/* MÓVIL PEQUEÑO - 360px */
@media (max-width: 360px) {
  .rutas-container {
    padding: 0 0.4rem;
    margin: 0.8rem auto;
  }
  
  .acciones {
    padding: 0.7rem;
  }
  
  .acciones h2 {
    font-size: 1rem;
  }
  
  .acciones > div:not(.acciones-formulario) .btn {
    width: 100%; /* Un botón por fila en pantallas muy pequeñas */
  }
  
  /* Botones principales - tamaño mínimo legible */
  .btn {
    padding: 0.4rem 0.6rem;
    min-height: 32px;
    font-size: 0.7rem;
  }
  
  /* ===== MEJORAS PARA COLUMNA DE ACCIONES EN MÓVIL PEQUEÑO ===== */
  .tabla td:last-child {
    padding: 0.25rem !important;
    min-width: 70px !important;
    max-width: 90px !important;
  }
  
  .acciones-tabla {
    min-width: 55px;
    max-width: 70px;
    gap: 0.2rem;
  }
  
  /* BOTONES DE TABLA - MÁS COMPACTOS EN MÓVIL PEQUEÑO */
  .btn-edit,
  .btn-delete,
  .btn-guardar,
  .btn-cancelar,
  .btn-guardar-nueva,
  .btn-cancelar-nueva {
    padding: 0.25rem 0.35rem;
    min-height: 28px;
    max-width: 50px;
    min-width: 45px;
    font-size: 0.6rem;
  }
  
  .btn i {
    font-size: 0.75rem;
    width: 12px;
  }
  
  .estado {
    min-width: 65px;
    font-size: 0.55rem;
    padding: 0.2rem 0.4rem;
  }
  
  .tabla th {
    padding: 0.4rem 0.3rem;
    font-size: 0.6rem;
  }
  
  .tabla td {
    padding: 0.4rem 0.3rem;
    font-size: 0.65rem;
  }
  
  .btn-pag {
    min-height: 36px;
    font-size: 0.8rem;
  }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn-edit,
  .btn-delete,
  .btn-pag,
  .btn-guardar,
  .btn-cancelar {
    transition: none;
    transform: none;
  }
  
  .btn::before {
    display: none;
  }
}

/* Efectos de brillo */
.btn:active {
  transform: translateY(0);
  transition: transform 0.1s;
}