/* Estilos para el módulo de Reportes */

.reports-container {
  padding: 2rem;
}

.reports-header {
  margin-bottom: 2rem;
}

.reports-header h2 {
  color: #2c3e50;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.reports-header p {
  color: #7f8c8d;
  margin: 0;
}

/* Tabs de reportes */
.reports-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid #e9ecef;
  flex-wrap: wrap;
}

.report-tab {
  padding: 1rem 1.5rem;
  background: white;
  border: none;
  border-bottom: 3px solid transparent;
  color: #7f8c8d;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.report-tab:hover {
  color: #007bff;
  background: #f8f9fa;
}

.report-tab.active {
  color: #007bff;
  border-bottom-color: #007bff;
  background: #f8f9fa;
}

.report-tab i {
  font-size: 1.1rem;
}

/* Filtros */
.report-filters {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

.report-filters h5 {
  color: #2c3e50;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

.filter-group label {
  font-weight: 500;
  color: #495057;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.filter-group input {
  padding: 0.5rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.9rem;
}

.filter-group input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
}

.filter-actions .btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.date-range-display {
  background: #e7f3ff;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #0056b3;
}

.date-range-display i {
  color: #007bff;
}

/* Contenido de reportes */
.report-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.report-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.report-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden; /* Prevenir desbordamiento del contenedor */
}

.report-card .table-responsive {
  margin: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* Scroll suave en iOS */
}

.report-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e9ecef;
}

.report-card-header h4 {
  color: #2c3e50;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.report-info {
  display: flex;
  gap: 1.5rem;
  color: #7f8c8d;
  font-size: 0.9rem;
}

.report-info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.report-info-item i {
  color: #007bff;
}

/* DataTables personalizados */
.dataTables_wrapper {
  padding: 0;
  width: 100%;
  overflow: hidden; /* Prevenir desbordamiento */
}

.dataTables_wrapper .dataTables_scroll {
  overflow: auto;
}

.dataTables_wrapper .dataTables_scrollBody {
  overflow-x: auto !important;
  overflow-y: auto !important;
}

.dataTables_wrapper .dt-buttons {
  margin-bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dataTables_wrapper .dt-button {
  border-radius: 4px;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.dataTables_wrapper .dt-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dataTables_wrapper .dataTables_filter {
  margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter input {
  padding: 0.5rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  margin-left: 0.5rem;
}

.dataTables_wrapper table {
  width: 100% !important;
}

.dataTables_wrapper table.dataTable thead th {
  background: linear-gradient(135deg, #880d1eff, #dd2d4aff) !important;
  color: #ffffff;
  font-weight: 600;
  padding: 1rem;
  border-bottom: none !important;
  border: none !important;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

.dataTables_wrapper table.dataTable tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.dataTables_wrapper table.dataTable tbody tr:hover {
  background: #f8f9fa;
}

.dataTables_wrapper table.dataTable tfoot th {
  background: #e9ecef;
  font-weight: 600;
  padding: 1rem;
  border-top: 2px solid #dee2e6;
}

/* Estilos para scrollbar horizontal */
.table-responsive::-webkit-scrollbar {
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Asegurar que las tablas no colapsen */
.dataTables_wrapper table.dataTable {
  border-collapse: separate !important;
  border-spacing: 0;
}

/* Responsive */
@media (max-width: 991px) {
  .reports-container {
    padding: 1rem;
  }

  .reports-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .report-tab {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .report-card {
    padding: 1rem;
    overflow-x: hidden; /* Evitar scroll horizontal del card */
  }
  
  .report-card .table-responsive {
    margin: 0 -1rem; /* Compensar padding del card */
    padding: 0 1rem;
    width: calc(100% + 2rem); /* Extender al borde del card */
  }

  .report-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .report-info {
    flex-direction: column;
    gap: 0.5rem;
  }

  .dataTables_wrapper .dt-buttons {
    flex-direction: column;
  }

  .dataTables_wrapper .dt-button {
    width: 100%;
    justify-content: center;
  }
  
  /* Asegurar que las tablas no se desborden */
  .dataTables_wrapper table.dataTable {
    min-width: 100%;
  }
}

@media (max-width: 768px) {
  .reports-header h2 {
    font-size: 1.5rem;
  }

  .report-card-header h4 {
    font-size: 1.1rem;
  }
  
  .report-card .table-responsive {
    margin: 0 -0.75rem;
    padding: 0 0.75rem;
    width: calc(100% + 1.5rem);
  }

  .dataTables_wrapper table.dataTable thead th,
  .dataTables_wrapper table.dataTable tbody td {
    padding: 0.5rem;
    font-size: 0.85rem;
    white-space: nowrap; /* Prevenir wrap de texto en celdas */
  }
  
  .dataTables_wrapper table.dataTable tfoot th {
    padding: 0.5rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 576px) {
  .reports-container {
    padding: 0.5rem;
  }

  .report-filters {
    padding: 1rem;
  }
  
  .report-card {
    padding: 0.75rem;
  }
  
  .report-card .table-responsive {
    margin: 0 -0.75rem;
    padding: 0 0.75rem;
    width: calc(100% + 1.5rem);
  }

  .filter-actions {
    flex-direction: column;
  }

  .filter-actions .btn {
    width: 100%;
  }
  
  /* Ajustar tamaño de fuente en tablas para móviles */
  .dataTables_wrapper table.dataTable thead th,
  .dataTables_wrapper table.dataTable tbody td,
  .dataTables_wrapper table.dataTable tfoot th {
    padding: 0.4rem;
    font-size: 0.8rem;
  }
  
  /* Botones de DataTable más pequeños en móviles */
  .dataTables_wrapper .dt-button {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
}

/* Estilos para impresión */
@media print {
  .reports-tabs,
  .report-filters,
  .dataTables_wrapper .dt-buttons,
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    display: none !important;
  }

  .report-card {
    box-shadow: none;
    border: 1px solid #000;
  }

  .dataTables_wrapper table.dataTable {
    font-size: 10pt;
  }

  .dataTables_wrapper table.dataTable thead th {
    background: #f0f0f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
