/* preview-excel-document.component.css */

.preview-excel-container {
  max-width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fafafa;
  overflow: hidden;
  position: relative; /* Agregado para contener elementos posicionados */
}

.excel-table {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e0e0e0;
}

.excel-table thead th {
  background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}

.excel-table tbody tr:hover {
  background: #e3f2fd !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.excel-table tbody tr:last-child {
  border-bottom: none;
}

.excel-table tbody tr:last-child td:first-child {
  border-radius: 0 0 0 8px;
}

.excel-table tbody tr:last-child td:last-child {
  border-radius: 0 0 8px 0;
}

.data-cell {
  transition: all 0.2s ease;
  position: relative;
}

.data-cell:hover {
  background: #f5f5f5 !important;
}

.cell-input {
  transition: all 0.2s ease;
  outline: none;
}

.cell-input:focus {
  border-color: #1976d2 !important;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.row-number {
  background: #f8f9fa !important;
  font-weight: 500;
  color: #6c757d;
  border-right: 2px solid #dee2e6 !important;
}

.column-header {
  background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
  border-bottom: 2px solid #dee2e6;
}

.table-container {
  flex: 1;
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin: 0 16px;
  overflow: auto;
  margin-bottom: 0; /* Removido el margen inferior */
  min-height: 0; /* Permite que el flex funcione correctamente */
}

.table-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.preview-header {
  background: linear-gradient(to bottom, #ffffff, #f8f9fa);
  border-bottom: 1px solid #e0e0e0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  flex-shrink: 0; /* Evita que el header se encoja */
}

.table-summary {
  padding: 16px;
  background: linear-gradient(to bottom, #f8f9fa, #ffffff);
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #6c757d;
  min-height: 48px;
  /* Removido position: fixed y propiedades relacionadas */
  flex-shrink: 0; /* Evita que se encoja */
  box-sizing: border-box;
}

.dialog-actions {
  background: linear-gradient(to bottom, #ffffff, #f8f9fa);
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
  /* Removido position: fixed y propiedades relacionadas */
  flex-shrink: 0; /* Evita que se encoja */
  box-sizing: border-box;
}

.changes-indicator {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

.no-data-message {
  background: white;
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  margin: 32px;
  padding: 48px;
  text-align: center;
  color: #6c757d;
}

/* Responsive */
@media (max-width: 768px) {
  .excel-table {
    font-size: 12px;
  }
  
  .column-header,
  .data-cell {
    min-width: 100px;
    padding: 8px 12px;
  }
  
  .row-number {
    width: 40px;
    padding: 8px 4px;
  }
  
  .header-controls {
    flex-direction: column;
    gap: 12px;
  }
  
  .edit-controls {
    justify-content: center;
  }
}

/* Mejoras de accesibilidad */
.excel-table:focus-within {
  outline: 2px solid #1976d2;
  outline-offset: 2px;
}

button:focus {
  outline: 2px solid #1976d2;
  outline-offset: 2px;
}

/* Estados de carga */
.loading-state {
  opacity: 0.6;
  pointer-events: none;
}

.loading-state::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #1976d2;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

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



/* Estilos adicionales para mejorar la experiencia de edición */
.cell-input:focus {
  border-color: #007bff !important;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25) !important;
}

.cell-input {
  transition: all 0.2s ease;
}

.data-cell {
  position: relative;
}

.data-cell:hover {
  background-color: rgba(0, 123, 255, 0.05);
}

.row-number:hover .mat-icon-button {
  opacity: 1;
}

.column-header:hover .mat-icon-button {
  opacity: 1;
}

/* Animaciones suaves */
.preview-excel-container {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .header-controls {
    flex-direction: column;
    gap: 12px;
  }
  
  .edit-controls {
    flex-wrap: wrap;
  }
  
  .table-container {
    overflow-x: scroll;
  }
}
