/* =================================================================
   SISTEMA DE BOTONES ROBUSTO - ANTI-DUPLICACION v4.0
   ================================================================= */

/* RESET: Limpiar estilos conflictivos */
.table-actions {
  display: flex !important;
  gap: 0.3rem !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
  width: auto !important;
  min-width: fit-content !important;
  max-width: 180px !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Botones chip base */
.table-action-btn.btn-chip {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.25rem !important;
  padding: 0.2rem 0.4rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  border-radius: 0.4rem !important;
  border: 1px solid transparent !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
  min-width: 0 !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

/* Iconos en botones */
.table-action-btn.btn-chip .bi {
  font-size: 0.85rem !important;
  line-height: 1 !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

/* Labels de texto */
.table-action-btn.btn-chip .btn-label {
  font-size: inherit !important;
  line-height: 1 !important;
  margin: 0 !important;
  padding: 0 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  color: inherit !important;
}

/* COLORES PRINCIPALES */
.btn-chip.btn-fill-primary {
  background-color: #EA580C !important;
  color: #ffffff !important;
  border-color: #EA580C !important;
}

.btn-chip.btn-fill-secondary {
  background-color: #16A34A !important;
  color: #ffffff !important;
  border-color: #16A34A !important;
}

.btn-chip.btn-fill-danger {
  background-color: #DC2626 !important;
  color: #ffffff !important;
  border-color: #DC2626 !important;
}

/* Efectos hover */
.btn-chip.btn-fill-primary:hover {
  background-color: #C2410C !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 8px rgba(234, 88, 12, 0.3) !important;
}

.btn-chip.btn-fill-secondary:hover {
  background-color: #15803D !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 8px rgba(22, 163, 74, 0.3) !important;
}

.btn-chip.btn-fill-danger:hover {
  background-color: #B91C1C !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.3) !important;
}

/* Estados focus y active */
.btn-chip:focus {
  outline: 0 !important;
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.3) !important;
}

.btn-chip:active {
  transform: translateY(0) !important;
}

/* RESPONSIVE: Ocultar texto en pantallas pequeñas */
@media (max-width: 768px) {
  .table-action-btn .btn-label {
    display: none !important;
  }
  
  .table-action-btn.btn-chip {
    padding: 0.25rem !important;
    width: 26px !important;
    height: 26px !important;
    justify-content: center !important;
    gap: 0 !important;
  }
  
  .table-actions {
    gap: 0.2rem !important;
    max-width: 100px !important;
  }
}

@media (max-width: 576px) {
  .table-action-btn.btn-chip {
    padding: 0.2rem !important;
    width: 24px !important;
    height: 24px !important;
  }
  
  .table-action-btn.btn-chip .bi {
    font-size: 0.75rem !important;
  }
  
  .table-actions {
    gap: 0.15rem !important;
    max-width: 80px !important;
  }
}

/* PREVENIR CONFLICTOS */
.table-actions * {
  box-sizing: border-box !important;
}

.table-actions .btn-chip:not(.table-action-btn) {
  display: none !important;
}

/* Asegurar que las celdas no se estiren */
.table td.table-actions,
.table th.table-actions {
  width: auto !important;
  min-width: fit-content !important;
  vertical-align: middle !important;
  text-align: center !important;
  padding: 0.5rem 0.25rem !important;
}

/* CORRECCION DE TABLAS RESPONSIVE */
.table-responsive {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* Prevenir scroll horizontal innecesario */
.table {
  table-layout: auto !important;
}

.table td:last-child,
.table th:last-child {
  position: sticky !important;
  right: 0 !important;
  background: inherit !important;
  z-index: 1 !important;
}

/* TOOLTIPS SEGUROS */
.table-action-btn[data-bs-toggle="tooltip"] {
  position: relative !important;
}

/* LIMPIEZA FINAL */
.table-actions .btn:not(.btn-chip) {
  display: none !important;
}

.table-actions a:not(.btn-chip),
.table-actions button:not(.btn-chip) {
  display: none !important;
}