/* Estilos generales */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f5f5;
  color: #333;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: white;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.sidebar nav ul {
  list-style: none;
  padding: 20px 0;
  flex-grow: 1;
}

.sidebar nav ul li {
  margin: 5px 0;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: #ecf0f1;
  text-decoration: none;
  transition: all 0.3s ease;
  gap: 10px;
}

.nav-link:hover, .nav-link.active {
  background-color: rgba(255,255,255,0.1);
  border-left: 4px solid #3498db;
}

.nav-link span {
  flex-grow: 1;
}

.sidebar-footer {
  padding: 15px;
  text-align: center;
  font-size: 0.8rem;
  color: #bdc3c7;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Contenido principal */
.content {
  flex-grow: 1;
  padding: 20px;
  background-color: #f8f9fa;
}

.mobile-header {
  display: none;
  padding: 15px;
  background: white;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  align-items: center;
  gap: 15px;
}

.menu-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #2c3e50;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.card-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.card-header h2 {
  color: #2c3e50;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header p {
  color: #7f8c8d;
  font-size: 0.9rem;
}

/* Secciones */
.seccion {
  display: none;
}

.seccion.activa {
  display: block;
}

/* Inicio */
.intro-card {
  text-align: center;
  padding: 40px;
  margin-bottom: 30px;
}

.intro-icon {
  font-size: 4rem;
  color: #3498db;
  margin-bottom: 20px;
}

.intro-actions {
  margin-top: 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 15px;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.total { background: #e3f2fd; color: #1976d2; }
.stat-icon.pending { background: #fff3e0; color: #f57c00; }
.stat-icon.returned { background: #e8f5e8; color: #388e3c; }
.stat-icon.canceled { background: #ffebee; color: #d32f2f; }

.stat-info h3 {
  font-size: 1.8rem;
  margin-bottom: 5px;
}

.stat-info p {
  color: #7f8c8d;
  font-size: 0.9rem;
}

/* Formulario */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  padding: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  margin-bottom: 8px;
  font-weight: 500;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.radio-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  margin: 0;
}

.form-actions {
  padding: 20px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 15px;
  justify-content: flex-end;
}

/* Botones */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: #2c3e50;
  color: white;
}

.btn-secondary:hover {
  background: #1a252f;
}

.btn-outline {
  background: transparent;
  border: 1px solid #ddd;
  color: #7f8c8d;
}

.btn-outline:hover {
  background: #f8f9fa;
}

/* Alertas */
.alert {
  padding: 15px;
  border-radius: 6px;
  margin: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Tabla */
.table-controls {
  padding: 20px;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
  border-bottom: 1px solid #eee;
}

.search-box {
  position: relative;
  flex-grow: 1;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #7f8c8d;
}

.search-box input {
  padding: 10px 10px 10px 40px;
  border: 1px solid #ddd;
  border-radius: 6px;
  width: 100%;
  max-width: 300px;
}

.table-controls select {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background: #f8f9fa;
  font-weight: 600;
  color: #2c3e50;
}

tr:hover {
  background: #f8f9fa;
}

/* Estados */
.status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status.pendiente {
  background: #fff3e0;
  color: #f57c00;
}

.status.devuelto {
  background: #e8f5e8;
  color: #388e3c;
}

.status.cancelado {
  background: #ffebee;
  color: #d32f2f;
}

/* Botones de acción */
.action-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  margin: 2px;
}

.action-btn.primary {
  background: #3498db;
  color: white;
}

.action-btn.primary:hover {
  background: #2980b9;
}

.action-btn.danger {
  background: #dc3545;
  color: white;
}

.action-btn.danger:hover {
  background: #c82333;
}

.action-btn.warning {
  background: #ffc107;
  color: #212529;
}

.action-btn.warning:hover {
  background: #e0a800;
}

/* Paginación */
.table-footer {
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #eee;
}

.table-info {
  color: #7f8c8d;
  font-size: 0.9rem;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-btn {
  padding: 8px 12px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-numbers {
  font-size: 0.9rem;
  color: #7f8c8d;
}

/* Respaldo */
.backup-content {
  padding: 20px;
}

.backup-info {
  background: #e3f2fd;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #1976d2;
}

.backup-actions {
  margin-bottom: 30px;
}

.backup-history h3 {
  margin-bottom: 15px;
  color: #2c3e50;
}

.backup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-bottom: 10px;
  background: #f8f9fa;
}

.backup-details {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.backup-name {
  font-weight: 500;
  color: #2c3e50;
}

.backup-date {
  font-size: 0.8rem;
  color: #7f8c8d;
}

.backup-actions {
  display: flex;
  gap: 10px;
}

.no-backups {
  text-align: center;
  color: #7f8c8d;
  font-style: italic;
  padding: 20px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #7f8c8d;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 15px;
  justify-content: flex-end;
}

/* Responsive */
@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    left: -250px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .mobile-header {
    display: flex;
  }
  
  .content {
    padding: 15px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .table-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-box input {
    max-width: none;
  }
  
  .table-footer {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
}

@media (max-width: 576px) {
  .intro-actions {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .modal-content {
    width: 95%;
    margin: 20px;
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .backup-item {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .backup-actions {
    justify-content: center;
  }
}

.center {
  text-align: center;
}

/* Ajustar el ancho de las columnas para la nueva tabla */
#tablaSalidas {
  table-layout: auto;
}

#tablaSalidas th:nth-child(6),
#tablaSalidas td:nth-child(6) {
  width: 120px; /* Fecha Real Entrega */
}

#tablaSalidas th:nth-child(7),
#tablaSalidas td:nth-child(7) {
  width: 150px; /* Recibió */
}

/* Asegurar que la tabla sea responsive */
@media (max-width: 1200px) {
  .table-container {
    overflow-x: auto;
  }
}

/* Mejora el diseño del historial de respaldos */
.backup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 10px;
  background: white;
  transition: all 0.3s ease;
}

.backup-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.backup-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.backup-name {
  font-weight: 600;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 8px;
}

.backup-info {
  font-size: 0.85rem;
  color: #7f8c8d;
}

.backup-actions {
  display: flex;
  gap: 10px;
}

.no-backups {
  text-align: center;
  color: #7f8c8d;
  font-style: italic;
  padding: 30px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #dee2e6;
}
/* Estilos para botones de acción en respaldos */
.backup-actions {
  display: flex;
  gap: 8px;
}

.action-btn.danger {
  background: #dc3545;
  color: white;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.3s ease;
}

.action-btn.danger:hover {
  background: #c82333;
}

/* Loading spinner */
.fa-spinner {
  margin-right: 8px;
}

/* Estilos para botones de acción en respaldos */
.backup-actions {
  display: flex;
  gap: 8px;
}

.action-btn.danger {
  background: #dc3545;
  color: white;
  padding: 8px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.3s ease;
}

.action-btn.danger:hover {
  background: #c82333;
}

/* Loading spinner */
.fa-spinner {
  margin-right: 8px;
}