/* =================================================================
   CONSOLIDAPP - REDISEÑO "NEBULA"
   ================================================================= */

:root {
  --primary-color: #8e44ad;
  --secondary-color: #9b59b6;
  --accent-color: #e67e22;
  --light-color: #f4f6f9;
  --dark-color: #3d3b51;
  --white-color: #ffffff;
  --success-color: #2ecc71;
  --danger-color: #e74c3c;
  --border-color: #ddd;
  
  --gradient-bg: linear-gradient(135deg, #4c42c4 0%, #7942c4 100%);
  --nav-bg: #2c2a3e;
  
  --floating-nav-width: 90px;
  --border-radius: 12px;
  --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease-in-out;
  
  --font-family-headings: 'Montserrat', sans-serif;
  --font-family-body: 'Roboto', sans-serif;
}

/* --- Reseteo Global y Tipografía --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font-family-body);
  background-color: var(--light-color);
  color: var(--dark-color);
  font-size: 16px;
  line-height: 1.6;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--font-family-headings); font-weight: 600; }
i { transition: var(--transition); }

/* --- Contenedor Principal de la App --- */
.app-container { display: flex; }

/* --- Nueva Navegación Flotante --- */
.floating-nav {
  width: var(--floating-nav-width);
  background-color: var(--nav-bg);
  height: 100vh;
  position: fixed;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 0;
  box-shadow: 5px 0 25px rgba(0,0,0,0.1);
}

.nav-logo {
  margin-bottom: 2.5rem;
}
.nav-logo i {
  font-size: 2.5rem;
  color: var(--primary-color);
}

.nav-menu {
  list-style: none;
  width: 100%;
}
.nav-item {
  margin: 0.5rem 0;
}
.nav-link {
  color: #a5a3b6;
  text-decoration: none;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 60px;
  position: relative;
  transition: var(--transition);
}

.nav-link::before { /* Indicador de estado activo */
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 0;
  background-color: var(--primary-color);
  border-radius: 0 5px 5px 0;
  transition: var(--transition);
}

.nav-link.active::before, .nav-link:hover::before {
  height: 100%;
}

.nav-link .nav-icon {
  font-size: 1.5rem;
  transition: var(--transition);
}

.nav-link:hover .nav-icon, .nav-link.active .nav-icon {
  color: var(--white-color);
  transform: scale(1.1);
}

.nav-link::after { /* Tooltip */
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--floating-nav-width) + 15px);
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--dark-color);
  color: var(--white-color);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1100;
}

.nav-link:hover::after {
  opacity: 1;
  visibility: visible;
}


/* --- Contenido Principal --- */
.main-content {
  flex: 1;
  margin-left: var(--floating-nav-width);
  padding: 2rem 3rem;
  transition: margin-left var(--transition);
}
.header {
  margin-bottom: 2rem; padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}
.header h2 { font-size: 1.8rem; color: var(--dark-color); }

/* --- Tarjetas (Cards) --- */
.card {
  background-color: var(--white-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 2rem;
  overflow: hidden;
  border: 1px solid #eef;
}
.card-header, .card-body, .card-footer { padding: 1.5rem 2rem; }
.card-header {
  border-bottom: 1px solid #eee;
  background-color: #f9f9fd;
}
.card-header h3 { font-size: 1.3rem; color: var(--primary-color); }
.card-footer {
  background-color: #f9f9fd;
  text-align: center;
}

/* --- Estilos de Pasos --- */
.step-content { display: none; }
.step-content.active { display: block; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.grid-setup { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.step1-section { display: flex; flex-direction: column; }
.step1-title {
  display: flex; align-items: center; margin-bottom: 1.5rem;
  font-family: var(--font-family-headings); color: var(--dark-color);
}
.step-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient-bg); color: var(--white-color);
  font-size: 1.1rem; margin-right: 1rem;
}

/* --- Sección de Carga de Archivos --- */
.upload-section {
  border: 2px dashed #c4c1e0;
  padding: 2rem; text-align: center; border-radius: var(--border-radius);
  transition: var(--transition); flex-grow: 1;
  display: flex; flex-direction: column; justify-content: center;
  background-color: #fdfdff;
}
.upload-section.drag-over {
  border-color: var(--primary-color);
  background-color: #f4f2ff;
}
.upload-icon .far { font-size: 4rem; color: var(--primary-color); margin-bottom: 1rem; }
.file-input { display: none; }
.file-list { margin-top: 1rem; }
.file-list-item {
  background-color: #f8f9fa; padding: 0.8rem 1rem;
  border-radius: 4px; margin-bottom: 0.5rem;
  font-size: 0.9rem; border-left: 4px solid var(--success-color);
  display: flex; justify-content: space-between; align-items: center;
}

/* --- Selección de Método --- */
.method-selection { display: flex; flex-direction: column; gap: 1rem; }
.method-option input[type="radio"] { display: none; }
.method-option .method-content {
  display: flex; align-items: center; padding: 1.2rem;
  border: 2px solid #eee; border-radius: var(--border-radius);
  cursor: pointer; transition: var(--transition);
}
.method-option .method-content:hover { border-color: var(--secondary-color); }
.method-option input:checked + .method-content {
  border-color: var(--primary-color);
  background-color: #f8f6ff;
  box-shadow: 0 0 15px rgba(142, 68, 173, 0.2);
}
.method-content i {
  font-size: 1.8rem; color: var(--primary-color);
  margin-right: 1.2rem; width: 40px; text-align: center;
}
.method-text { display: flex; flex-direction: column; }
.method-text strong { color: var(--dark-color); font-size: 1.1rem; }
.method-text span { font-size: 0.9rem; color: #7f8c8d; }

/* --- Botones --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.8rem 1.8rem; border: none; border-radius: var(--border-radius);
  font-family: var(--font-family-headings); font-weight: 600;
  cursor: pointer; text-transform: uppercase; letter-spacing: 0.5px;
  font-size: 0.9rem; transition: var(--transition);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
}
.btn:hover { 
  transform: translateY(-3px); 
  box-shadow: 0 8px 25px rgba(0,0,0,0.15); 
}
.btn-primary { 
  background: var(--gradient-bg);
  color: var(--white-color); 
}
.btn-secondary { background-color: var(--dark-color); color: var(--white-color); }
.btn-success { background-color: var(--success-color); color: var(--white-color); }
.btn-danger { background-color: var(--danger-color); color: var(--white-color); }
.btn-accent { background-color: var(--accent-color); color: var(--white-color); }
.btn-large { padding: 1rem 2.5rem; font-size: 1.1rem; }
.info-text { margin-bottom: 1.5rem; }

.animate-pulse {
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(142, 68, 173, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(142, 68, 173, 0); }
  100% { box-shadow: 0 0 0 0 rgba(142, 68, 173, 0); }
}


/* --- Controles de Navegación --- */
.nav-controls {
  display: flex; justify-content: space-between;
  margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #eee;
}

/* --- Formularios --- */
.form-select, input[type="text"], textarea {
  width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border-color);
  border-radius: var(--border-radius); font-size: 1rem; transition: var(--transition);
  background-color: var(--white-color);
}
.form-select:focus, input[type="text"]:focus, textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 8px rgba(142, 68, 173, 0.2);
  outline: none;
}
textarea { resize: vertical; min-height: 120px; }
.form-label { display: block; margin-bottom: 0.5rem; font-weight: 500; }

/* --- Contenedores de Proyecto y Tablas --- */
.projects-container { display: flex; flex-direction: column; gap: 1.5rem; }
.project-card {
  background-color: var(--white-color);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
}
.project-header {
  background: var(--gradient-bg);
  color: var(--white-color); padding: 1rem 1.5rem;
  cursor: pointer; display: flex; justify-content: space-between; align-items: center;
}
.project-body { padding: 1.5rem; }
.table-responsive { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.95em;
}
.data-table th, .data-table td {
  padding: 0.9rem; border-bottom: 1px solid #eee;
  text-align: left; vertical-align: middle;
}
.data-table th { background-color: #f8f9fa; font-weight: 600; }
.highlight-red { color: var(--danger-color); font-weight: bold; }
.reassign-controls { display: flex; gap: 1rem; margin-bottom: 1rem; }

/* --- Consolidación de Sacos --- */
.bag-consolidation { border: 1px solid #eee; border-radius: var(--border-radius); margin-bottom: 1rem; }
.bag-consolidation-header {
  background-color: #f8f9fa; padding: 0.8rem 1.2rem;
  border-bottom: 1px solid #eee; font-weight: bold;
}
.bag-list-container {
  padding: 1rem; background-color: #fdfdff; min-height: 60px;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}
.bag-item {
  display: inline-flex; align-items: center; gap: 8px; margin: 0.5rem;
  padding: 0.6rem 1.2rem; background-color: var(--white-color);
  border: 1px solid var(--border-color); border-radius: 20px; cursor: grab;
}
.bag-op-icon { cursor: pointer; color: #7f8c8d; }

/* --- Overlays y Modales --- */
.hidden { display: none !important; }
.loading-overlay {
  display: flex; position: fixed; top: 0; left: 0;
  width: 100%; height: 100%; background: rgba(255, 255, 255, 0.9);
  z-index: 9999; flex-direction: column; justify-content: center; align-items: center;
}
.loading-spinner {
  border: 5px solid #f3f3f3; border-top: 5px solid var(--primary-color);
  border-radius: 50%; width: 60px; height: 60px;
  animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

.modal {
  display: none; position: fixed; z-index: 1051; left: 0; top: 0;
  width: 100%; height: 100%; background-color: rgba(0,0,0,0.6);
  justify-content: center; align-items: center;
}
.modal-content {
  background-color: var(--white-color); padding: 0;
  width: 90%; max-width: 500px; border-radius: var(--border-radius);
  overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.modal-content.large { max-width: 800px; }
.modal-header {
  padding: 1.2rem 1.5rem; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #ddd; background-color: #f8f9fa;
}
.modal-header h3 { font-size: 1.4rem; color: var(--primary-color);}
.modal-body { padding: 1.5rem; max-height: 70vh; overflow-y: auto; }
.modal-footer {
  padding: 1rem 1.5rem; text-align: right;
  border-top: 1px solid #ddd; background-color: #f8f9fa;
}
.close-modal {
  color: #aaa; font-size: 1.8rem; cursor: pointer;
  border: none; background: none; line-height: 1;
}

/* --- Secciones de Asignar y Descargar --- */
.assign-section {
  margin-bottom: 2rem; padding: 1.5rem; border: 1px solid #ddd;
  border-radius: var(--border-radius); background: #fafafa;
}
.move-option-list { display: flex; flex-direction: column; gap: 0.8rem; }
.move-option-item {
  padding: 1rem; border: 1px solid var(--border-color);
  border-radius: var(--border-radius); cursor: pointer; transition: var(--transition);
  display: flex; justify-content: space-between; align-items: center;
}
.move-option-item:hover { border-color: var(--secondary-color); background-color: #f8f8f8; }
.move-option-info { display: flex; flex-direction: column; }
.move-option-validation { font-weight: bold; }
.move-option-item.fits { background-color: #e8f5e9; }
.move-option-item.no-fit { background-color: #fbe9e7; opacity: 0.7; cursor: not-allowed; }

.download-summary { list-style: none; padding: 0; margin: 0; }
.summary-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.2rem; border-bottom: 1px solid #eee;
}
.summary-item:last-child { border-bottom: none; }
.summary-label { font-weight: bold; color: var(--primary-color); }
.summary-value { font-size: 1.1rem; }

.download-actions { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #eee; }
.download-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem; background-color: #f8f9fa;
  border-radius: var(--border-radius); margin-bottom: 0.8rem;
}

/* --- Clases Utilitarias --- */
.text-muted { color: #7f8c8d; }
.text-center { text-align: center; }