/**
 * =====================================================
 * ESTILOS PARA BOTONES DE EXPORTACIÓN
 * =====================================================
 * 
 * Versión: 1.0.0
 * Fecha: 2025-12-10
 * 
 * Estilos personalizados para los botones de exportación
 * de DataTables (Excel, CSV, Copy, Print)
 */

/* =====================================================
   CONTENEDOR DE BOTONES DE EXPORTACIÓN
   ===================================================== */

.export-buttons-container {
  display: inline-block;
  margin-bottom: 10px;
}

.export-buttons-container .dt-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

/* Ajuste para posición en box-header */
.box-header .export-buttons-container {
  float: right;
  margin-left: 10px;
}

/* =====================================================
   ESTILOS DE BOTONES INDIVIDUALES
   ===================================================== */

.export-btn {
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 3px;
  transition: all 0.3s ease;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 400;
  text-align: center;
  vertical-align: middle;
}

.export-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.export-btn:active {
  transform: translateY(0);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.export-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Iconos dentro de botones */
.export-btn i {
  margin-right: 5px;
}

/* =====================================================
   COLORES ESPECÍFICOS POR TIPO DE EXPORTACIÓN
   ===================================================== */

/* Botón Excel - Verde */
.export-btn.btn-success {
  background-color: #00a65a;
  border-color: #008d4c;
  color: #fff;
}

.export-btn.btn-success:hover {
  background-color: #008d4c;
  border-color: #007a3d;
}

/* Botón CSV - Azul Claro */
.export-btn.btn-info {
  background-color: #00c0ef;
  border-color: #00acd6;
  color: #fff;
}

.export-btn.btn-info:hover {
  background-color: #00acd6;
  border-color: #0097bc;
}

/* Botón Copiar - Gris */
.export-btn.btn-default {
  background-color: #f4f4f4;
  border-color: #ddd;
  color: #444;
}

.export-btn.btn-default:hover {
  background-color: #e7e7e7;
  border-color: #adadad;
}

/* Botón Imprimir - Azul */
.export-btn.btn-primary {
  background-color: #3c8dbc;
  border-color: #367fa9;
  color: #fff;
}

.export-btn.btn-primary:hover {
  background-color: #367fa9;
  border-color: #2e6c93;
}

/* =====================================================
   RESPONSIVE - MÓVILES Y TABLETS
   ===================================================== */

@media (max-width: 768px) {
  /* En móviles, poner botones en columna completa */
  .box-header .export-buttons-container {
    float: none;
    display: block;
    width: 100%;
    margin-left: 0;
    margin-top: 10px;
  }

  .export-buttons-container .dt-buttons {
    justify-content: center;
    width: 100%;
  }

  .export-btn {
    flex: 1 1 45%;
    min-width: 100px;
    max-width: 150px;
    font-size: 12px;
    padding: 5px 10px;
  }
}

@media (max-width: 480px) {
  /* En pantallas muy pequeñas, botones full width */
  .export-btn {
    flex: 1 1 100%;
    max-width: none;
    margin-bottom: 5px;
  }

  .export-buttons-container .dt-buttons {
    flex-direction: column;
    gap: 5px;
  }
}

/* =====================================================
   INTEGRACIÓN CON DATATABLES WRAPPER
   ===================================================== */

/* Cuando los botones están dentro del wrapper de DataTables */
.dataTables_wrapper .dt-buttons {
  float: left;
  margin-bottom: 10px;
}

.dataTables_wrapper .dt-buttons .export-btn {
  margin-right: 5px;
}

/* =====================================================
   ESTADOS DE CARGA Y DESHABILITADO
   ===================================================== */

.export-btn:disabled,
.export-btn.disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

/* Indicador de carga */
.export-btn.loading {
  position: relative;
  color: transparent;
}

.export-btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* =====================================================
   TOOLTIPS Y AYUDA
   ===================================================== */

.export-btn[title] {
  position: relative;
}

/* Tooltip personalizado (opcional) */
.export-btn:hover::before {
  /* Implementar si se necesita tooltip personalizado */
}

/* =====================================================
   IMPRESIÓN - OCULTAR BOTONES AL IMPRIMIR
   ===================================================== */

@media print {
  .export-buttons-container,
  .dt-buttons {
    display: none !important;
  }
}

/* =====================================================
   TEMA OSCURO (OPCIONAL)
   ===================================================== */

.skin-black .export-btn.btn-default,
.skin-blue .export-btn.btn-default {
  background-color: #3c3c3c;
  border-color: #2c2c2c;
  color: #fff;
}

.skin-black .export-btn.btn-default:hover,
.skin-blue .export-btn.btn-default:hover {
  background-color: #2c2c2c;
  border-color: #1c1c1c;
}

/* =====================================================
   AGRUPACIÓN DE BOTONES
   ===================================================== */

/* Si se usan dentro de btn-group */
.btn-group .export-btn:not(:last-child) {
  border-right: none;
}

.btn-group .export-btn:not(:first-child) {
  border-left: none;
}

.btn-group .export-btn:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.btn-group .export-btn:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.btn-group .export-btn:not(:first-child):not(:last-child) {
  border-radius: 0;
}

/* =====================================================
   ANIMACIONES ADICIONALES
   ===================================================== */

/* Animación de éxito al exportar */
@keyframes successPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.export-btn.success {
  animation: successPulse 0.5s ease-in-out;
}

/* =====================================================
   COMPATIBILIDAD CON COLUMN-TOGGLE
   ===================================================== */

/* Ajustar espacio cuando hay column-toggle y export buttons */
.column-toggle-container + .export-buttons-container {
  margin-left: 10px;
}

/* =====================================================
   AJUSTES FINALES
   ===================================================== */

/* Prevenir selección de texto en botones */
.export-btn {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Asegurar que los iconos no se deformen */
.export-btn i.fa {
  display: inline-block;
  width: 14px;
  text-align: center;
}
