/* 
 * Estilos específicos para el servicio Unir PDF
 * Parte de la arquitectura Clean + Vertical Slice
 */

/* === VARIABLES Y CONFIGURACIÓN GLOBAL === */
:root {
  --unir-primary: rgb(0, 112, 192);
  --unir-secondary: #2ecc71;
  --unir-success: #27ae60;
  --unir-warning: #f39c12;
  --unir-danger: #e74c3c;
  --unir-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* === LAYOUT BASE === */
html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

.main-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.pdf-service-section {
  width: 100vw;
  margin: 0;
  padding: 0;
  background-color: white;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === ANIMACIONES === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* === ESTADOS DE PANTALLA === */
.pantalla-activa {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

.pantalla-oculta {
  display: none;
}

/* === ZONA DE PDFs === */
.zona-pdfs {
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  background: #fafafa;
  scrollbar-color: #0070C0 #f0f8ff;
  scrollbar-width: thin;
}

.zona-pdfs::-webkit-scrollbar {
  width: 8px;
}

.zona-pdfs::-webkit-scrollbar-track {
  background: #f0f8ff;
  border-radius: 10px;
}

.zona-pdfs::-webkit-scrollbar-thumb {
  background: #0070C0;
  border-radius: 10px;
  border: 2px solid #f0f8ff;
}

.zona-pdfs::-webkit-scrollbar-thumb:hover {
  background: #005a9e;
}

/* === GRID Y CONTENEDOR DE ARCHIVOS === */
.files-container {
  max-height: 800px;
  overflow-y: auto;
  padding: 20px;
  background: transparent;
  margin-top: -15px;
  height: 100%;
  box-sizing: border-box;
  position: relative;
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
  padding: 15px;
  position: relative;
}

/* === TARJETAS PDF === */
.pdf-card {
  width: 198px;
  height: 244px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  transition: all 0.2s ease;
  user-select: none;
  cursor: grab;
}

/* === ESTILOS PARA SORTABLEJS === */
.sortable-chosen {
  opacity: 0.8;
  transform: scale(1.02);
}

.sortable-ghost {
  opacity: 0.4;
  background: #f0f0f0;
  border: 2px dashed #0070C0;
}

.sortable-drag {
  opacity: 0.7;
  transform: scale(1.05) rotate(2deg);
  z-index: 1000;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  cursor: grabbing;
}

.pdf-card.dragging {
  opacity: 0.7;
  transform: scale(1.05) rotate(2deg);
  z-index: 1000;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  cursor: grabbing;
}

.pdf-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.pdf-card canvas {
  width: 100%;
  height: 190px;
  object-fit: contain;
  display: block;
  background: #f9f9f9;
  transition: transform 0.3s ease;
}

.pdf-card .nombre-pdf {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 8px;
  font-size: 11px;
  color: #333;
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
  border-top: 1px solid #e0e0e0;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === BOTONES DE ACCIÓN === */
.pdf-action {
  position: absolute;
  top: 8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
}

.pdf-action.rotate {
  right: 44px;
  background: var(--unir-primary);
}

.pdf-action.delete {
  right: 8px;
  background: var(--unir-danger);
}

.pdf-action:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* === BOTÓN AGREGAR MÁS === */
#btnAgregarMas {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--unir-danger);
  border: none;
  color: white;
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 15px;
  right: 15px;
  box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3);
  transition: all 0.2s ease;
  z-index: 10;
}

#btnAgregarMas:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(231, 76, 60, 0.4);
}

#btnAgregarMas:active {
  transform: scale(0.95);
}

#btnAgregarMas::before {
  content: '+';
  line-height: 1;
}

/* === PANEL DE SERVICIO === */
.PANEL_SERVICIO {
  background: white;
  border-radius: 12px;
  box-shadow: var(--unir-shadow);
  padding: 0;
  height: fit-content;
  position: sticky;
  top: 0;
  width: 100%;
  margin-top: 0;
  box-sizing: border-box;
  overflow: hidden;
  min-height: 600px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.service-panel-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 0;
  padding: 15px 15px 0 15px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  
  /* Mismo estilo de scroll que zona-pdfs */
  scrollbar-color: #0070C0 #f0f8ff;
  scrollbar-width: thin;
}

/* Scrollbar personalizado para el panel de servicio */
.service-panel-content::-webkit-scrollbar {
  width: 8px;
}

.service-panel-content::-webkit-scrollbar-track {
  background: #f0f8ff;
  border-radius: 10px;
}

.service-panel-content::-webkit-scrollbar-thumb {
  background: #0070C0;
  border-radius: 10px;
  border: 2px solid #f0f8ff;
}

.service-panel-content::-webkit-scrollbar-thumb:hover {
  background: #005a9e;
}

.service-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--unir-primary);
  margin: 0;
}

.service-message {
  background: #f8fafc;
  padding: 15px;
  border-radius: 8px;
}

.service-stats {
  display: flex;
  flex-direction: row;
  gap: 30px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 8px;
  flex-wrap: wrap;
  font-size: 0.975rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: none;
}

.stat-label {
  font-weight: 500;
  color: #7f8c8d;
  white-space: nowrap;
}

.stat-value {
  font-weight: 700;
  color: var(--unir-primary);
  margin-left: 2px;
}

/* === CONTADOR DE PDFs === */
#total-files {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #e74c3c;
  color: white;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  padding: 0 6px;
  z-index: 10;
}

.service-actions {
  margin-top: 0;
  padding: 15px;
  background: white;
  border-top: 1px solid #f0f0f0;
  border-radius: 0 0 12px 12px;
  flex-shrink: 0;
}

.service-button {
  width: 100%;
  background: linear-gradient(45deg, var(--unir-primary), var(--unir-secondary));
  color: white;
  border: none;
  border-radius: 8px;
  padding: 15px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--unir-shadow);
}

.service-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

.service-button:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* === ESTADOS DE CARGA === */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--unir-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* === PANTALLA 3 - ACCIONES === */
.pantalla3-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  margin-top: 30px;
  flex-wrap: wrap;
}

.boton-secundario {
  background: linear-gradient(45deg, #95a5a6, #7f8c8d) !important;
  color: white !important;
}

.boton-secundario:hover {
  background: linear-gradient(45deg, #7f8c8d, #6c7b7d) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

/* Botón circular pequeño para volver a empezar */
#btnVolverEmpezar {
  width: 50px !important;
  height: 50px !important;
  border-radius: 50% !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 20px !important;
  min-width: 50px !important;
  background: #0070C0 !important;
}

#btnVolverEmpezar .button-icon {
  margin: 0 !important;
  font-size: 20px !important;
}

#btnVolverEmpezar img {
  filter: brightness(0) invert(1) !important;
}

.button-icon {
  font-size: 1.2em;
  margin-right: 8px;
}

.button-text {
  font-weight: 600;
}

/* === PANTALLA LOADER === */
#pantalla-loader {
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95);
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);

}

#pantalla-loader.pantalla-activa {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.loader-content {
  text-align: center;
  max-width: 500px;
  width: 90%;
  transform: translateY(20px);
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  margin-top: -250px;
}

#pantalla-loader.pantalla-activa .loader-content {
  transform: translateY(0);
}

.loader-content h2 {
  color: #156AAD;
  font-size: 3.5rem;
  margin-bottom: 40px;
  font-weight: 600;
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.2s forwards;
}

.progress-container {
  width: 100%;
  height: 64px;
  background: #ffffff;
  border-radius: 40px;
  overflow: hidden;
  border: 1px solid #d0d0d0;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
  opacity: 0;
  animation: fadeInUp 0.6s ease 0.4s forwards;
}

.progress-bar {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #156AAD, #1C8ED9);
  transition: width 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  transform-origin: left;
  border-radius: inherit;
  position: relative;
}

.progress-fill::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: translateX(-100%);
  transition: transform 0.8s ease;
}

.progress-fill.animating::before {
  transform: translateX(100%);
}

.progress-message {
  text-align: center;
  font-size: 18px;
  color: #666;
  font-weight: 500;
  min-height: 25px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  animation: fadeInUp 0.6s ease 0.6s forwards;
}

/* Animaciones de entrada */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive para móviles */
@media (max-width: 768px) {
  .loader-content h2 {
    font-size: 2rem;
    margin-bottom: 30px;
  }
  
  .progress-container {
    height: 56px;
    margin-bottom: 25px;
  }
  
  .progress-message {
    font-size: 16px;
  }
}

/* === MEDIA QUERIES === */
@media (max-width: 768px) {
  #pantalla-2 {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 10px;
  }

  .zona-pdfs {
    padding: 10px;
  }

  .PANEL_SERVICIO {
    position: relative;
    order: -1;
    min-height: auto;
    padding: 15px;
  }

  .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .pantalla3-actions {
    flex-direction: column;
    gap: 15px;
  }

  .pantalla3-actions .boton-servicio {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  .service-stats {
    flex-direction: column;
    gap: 8px;
  }
  
  .stat-item {
    justify-content: space-between;
    width: 100%;
  }
}

/* === REGLAS DE PANTALLA ORIGINALES (MANTENER HASTA VERIFICAR) === */
/* Pantallas del workflow */
.pantalla-activa {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

.pantalla-oculta {
  display: none;
}

/* Pantalla 1 - Inicio */
#pantalla-1 {
  width: 100vw;
  margin: 0;
  padding: 20px;
  padding-top: 0;
  box-sizing: border-box;
}

/* Pantalla 2 - Área de trabajo */
#pantalla-2 {
  display: grid;
  grid-template-columns: 70% 30%; 
  gap: 5px;
  min-height: 600px;
  background-color: white;
  width: 100vw;
  margin: 0;
  padding: 10px;
  padding-top: 0;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Pantalla 3 - Resultado */
#pantalla-3 {
  justify-content: start;
  align-items: center;
  text-align: center;
  padding: 60px 20px;
  padding-top: 0;
}

#pantalla-3 h2 { /*debe ser color azul*/
  color: var(--unir-primary);
  font-size: 3.5rem;
  margin-bottom: 15px;
  margin-top: 30px;
}

#descargarLink {
  font-size: 18px;
}

/* Área de drop */
.drop-area {
  border: none;
  border-radius: 12px;
  padding: 20px 20px;
  text-align: center;
  background: white;
  transition: all 0.3s ease;
  margin: 10px 0;
}

/* Hover del área de drag eliminado según solicitud */

.drop-area.drag-over {
  border-color: var(--unir-success);
  background: #d4edda;
  transform: scale(1.02);
}

.boton-servicio {
  background: linear-gradient(45deg, var(--unir-primary), var(--unir-secondary));
  color: white;
  padding: 20px 40px;
  border: none;
  border-radius: 8px;
  font-size: 24px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-block;
  text-decoration: none;
  box-shadow: var(--unir-shadow);
}

/* Hover eliminado según solicitud */

/* Eliminar padding y margin en pantalla 2 */
#pantalla-2 .pdf-service-section {
  padding: 0;
  margin: 0;
  max-width: none;
}

/* === OVERLAY DE ARRASTRE (COPIADO DESDE BACKUP) === */
.drop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  visibility: hidden;
}

.drop-overlay.active {
  opacity: 1;
  visibility: visible;
  /* Mantener pointer-events: none para no interferir con drag */
  pointer-events: none;
}

.drop-overlay-content {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  text-align: center;
  border: 3px dashed #0070C0;
}

.drop-overlay-content .icon {
  font-size: 64px;
  margin-bottom: 20px;
  display: block;
}

.drop-overlay-content .message {
  font-size: 24px;
  font-weight: bold;
  color: #0070C0;
  margin: 0;
}

.drop-overlay-content .submessage {
  font-size: 16px;
  color: #666;
  margin-top: 10px;
}

/* Responsive */
@media (max-width: 768px) {
  #pantalla-2 {
    flex-direction: column;
    height: auto;
    max-height: none;
  }

  .files-header {
    flex-direction: column;
    gap: 0.9375rem; /* 15px en rem */
    align-items: flex-start;
  }
  
  .files-grid {
    gap: 0.75rem; /* 12px en rem */
    max-width: none;
  }
  
  .files-grid .pdf-card {
    flex-basis: 8.75rem; /* 140px en rem */
    width: 8.75rem;
    max-width: 8.75rem;
  }
  
  .service-panel-content {
    padding: 1rem; /* 16px en rem */
  }
  
  .service-title {
    font-size: 1.125rem; /* 18px en rem */
  }
  
  .service-stats {
    padding: 1rem; /* 16px en rem */
    margin-bottom: 1.25rem; /* 20px en rem */
  }
  
  .stat-item {
    padding: 0.375rem 0; /* 6px en rem */
  }
  
  .stat-label {
    font-size: 0.75rem; /* 12px en rem */
  }
  
  .stat-value {
    font-size: 0.8125rem; /* 13px en rem */
    padding: 0.1875rem 0.375rem; /* 3px 6px en rem */
  }
  
  .service-button {
    padding: 0.75rem 1rem; /* 12px 16px en rem */
    font-size: 0.875rem; /* 14px en rem */
    min-height: 3rem; /* 48px en rem */
  }
  
  .drop-area {
    padding: 1.875rem 1.25rem; /* 30px 20px en rem */
    min-height: 15.625rem; /* 250px en rem */
  }
  
  .drop-overlay-content {
    padding: 1.875rem 1.25rem; /* 30px 20px en rem */
    margin: 0 1.25rem; /* 20px en rem */
  }
  
  .drop-overlay-content .message {
    font-size: 1.25rem; /* 20px en rem */
  }
}

/* === PANTALLA 2 - LAYOUT PRINCIPAL === */
#pantalla-2 {
  display: grid;
  flex-direction: row;
  height: 100%;
}

/* === ZONA DE PDFs (IZQUIERDA) - SCROLL EXCLUSIVO === */


/* === CONTENEDOR DE ARCHIVOS === */
.files-container {
  height: 100%;
  overflow: visible; /* El scroll lo maneja zona-pdfs */
}

/* === GRID DE ARCHIVOS === */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 1rem;
  padding: 1rem 0;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  #pantalla-2 {
    flex-direction: column;
    height: auto;
    max-height: none;
  }

  .zona-pdfs {
    width: 100%;
    max-height: 60vh;
    position: relative;
  }

}

/* === AJUSTES PARA EVITAR SCROLL VERTICAL DE TODA LA PÁGINA === */
.pdf-service-section {
  padding: 0;
  height: calc(100vh - 90px); /* Altura del viewport menos el header */
  max-height: calc(100vh - 90px);
  overflow: hidden; /* Evitar scroll vertical */
  display: flex;
  flex-direction: column;
}

.service-panel-content {
  padding-top: 0;
}

/* === OCULTAR FOOTER CUANDO PANTALLA 2 O 3 ESTÁN ACTIVAS === */
#pantalla-2.pantalla-activa ~ footer,
#pantalla-3.pantalla-activa ~ footer,
body:has(#pantalla-2.pantalla-activa) footer,
body:has(#pantalla-3.pantalla-activa) footer {
  display: none !important;
}

/* === AJUSTE DE ALTURA COMPLETA PARA PANTALLA 2 === */


#pantalla-2.pantalla-activa .PANEL_SERVICIO {
  top: 0px; /* Ajustar según altura real del header */
  height: calc(90vh);
}

/* === PANTALLAS DEL SERVICIO === */
#pantalla-1,
#pantalla-3 {
  flex: 1;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

/* === ZONA DE PDFs (IZQUIERDA) - SCROLL EXCLUSIVO === */
.zona-pdfs {
  width: 100%;
  height: 92%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  background: #fafafa;
  scrollbar-color: #0070C0 #f0f8ff;
  scrollbar-width: thin;
  margin-top: -10px; 
}

/* === PANEL DE SERVICIO (DERECHA) - COMPLETAMENTE FIJO === */


/* === RESPONSIVE === */
@media (max-width: 768px) {
  .pdf-service-section {
    height: auto;
    max-height: none;
  }

  #pantalla-2.pantalla-activa {
    flex-direction: column;
    height: auto;
  }

  .zona-pdfs {
    width: 100%;
    max-height: 60vh;
  }

  .PANEL_SERVICIO {
    position: static;
    width: 100%;
    height: auto;
    border-left: none;
    border-top: 2px solid #0070C0;
    margin-top: 1rem;
  }
}

/* === AJUSTES DEL CONTENEDOR PRINCIPAL === */
.main-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Cuando el footer está oculto (pantallas 2 y 3) */
.main-container:has(#pantalla-2.pantalla-activa),
.main-container:has(#pantalla-3.pantalla-activa) {
  height: 100vh;
  overflow: hidden;
}

/* === CONTENEDOR DEL SERVICIO === */
.pdf-service-section {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Cuando está en pantalla 2 o 3 */
#pantalla-2.pantalla-activa ~ footer,
#pantalla-3.pantalla-activa ~ footer {
  display: none;
}

#pantalla-2.pantalla-activa .pdf-service-section,
#pantalla-3.pantalla-activa .pdf-service-section {
  height: calc(100vh);
  overflow: hidden;
}

/* === PANTALLAS DEL SERVICIO === */
#pantalla-1,
#pantalla-3 {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* === AJUSTES ESPECÍFICOS PANTALLA 2 === */
#pantalla-2.pantalla-activa {
  display: grid;
  height: 100%;
  max-height: 100%;
}




/* === RESPONSIVE === */
@media (max-width: 768px) {
  .main-container:has(#pantalla-2.pantalla-activa),
  .main-container:has(#pantalla-3.pantalla-activa) {
    height: auto;
    overflow: visible;
  }

  .pdf-service-section {
    height: auto;
  }

  #pantalla-2.pantalla-activa {
    flex-direction: column;
    height: auto;
  }

  .zona-pdfs {
    width: 100%;
    max-height: 60vh;
  }

  .PANEL_SERVICIO {
    position: static;
    width: 100%;
    height: auto;
    border-left: none;
    border-top: 2px solid #0070C0;
    margin-top: 1rem;
  }
}

/* === AJUSTES GLOBALES === */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

/* === CONTENEDOR PRINCIPAL === */
.main-container {
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* === SECCIÓN DE SERVICIO PDF === */
.pdf-service-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* === PANTALLAS === */
.pantalla-activa {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.pantalla-oculta {
  display: none !important;
}

/* === PANTALLA 1 === */
#pantalla-1 {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  height: 100%;
  padding: 2rem;
}

/* === PANTALLA 3 === */
#pantalla-3 {
  justify-content: start;
  align-items: center;
  text-align: center;
}

/* === FOOTER CONTROL === */
footer {
  display: block;
}

#pantalla-2.pantalla-activa ~ footer,
#pantalla-3.pantalla-activa ~ footer {
  display: none;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .main-container {
    height: 100%;
    overflow-y: auto;
  }

  #pantalla-2 {
    flex-direction: column;
  }

  .zona-pdfs {
    width: 100%;
    max-height: 60vh;
  }

  .PANEL_SERVICIO {
    position: static;
    width: 100%;
    height: auto;
    border-left: none;
    border-top: 2px solid #0070C0;
    margin-top: 1rem;
  }
}

/* === Ajuste del título y descripción */
#pantalla-1 h1 {
  margin: 0;
  padding-top: 2rem;
}

#pantalla-1 p {
  margin: 1rem 0 0.5rem 0;
  color: #666;
}

/* ========================================
   ESTILOS ESPECÍFICOS PARA DIVIDIR PDF
   ======================================== */

/* === TABS === */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 10px;
}

.tab {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px 8px 0 0;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  border-bottom: 2px solid transparent;
}

.tab:hover {
  background: #e9ecef;
  border-color: #ced4da;
}

.tab.activo {
  background: white;
  border-color: var(--unir-primary);
  border-bottom-color: var(--unir-primary);
  color: var(--unir-primary);
  font-weight: 600;
}

.tab .icono {
  font-size: 16px;
}

.tab .pro-icon {
  font-size: 12px;
  margin-left: 5px;
}

/* === CONTENIDO DE TABS === */
.tab-content {
  display: none;
  padding: 0px 0;
}

.tab-content.activo {
  display: block;
}

/* === MODOS === */
.modo-rango-label,
.modo-paginas-label {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin-bottom: 10px;
}

.modos {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.modo {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.modo:hover {
  background: #e9ecef;
  border-color: #ced4da;
}

.modo.activo {
  background: var(--unir-primary);
  border-color: var(--unir-primary);
  color: white;
}

/* === CONTENEDORES DE MODOS === */
.rangos-container,
.rangos-fijos-container,
.paginas-container,
.paginas-rango-container,
.division-tamaño {
  margin-top: 15px;
}

.oculto {
  display: none !important;
}

/* === RANGOS PERSONALIZADOS === */
.rango {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rango.invalid {
  border-color: #dc3545;
  background: #fff5f5;
}

.rango-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--unir-primary);
  min-width: 60px;
}

.rango label {
  font-size: 13px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 5px;
}

.rango input[type="number"] {
  width: 60px;
  padding: 5px 8px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
}

.rango input[type="number"]:focus {
  outline: none;
  border-color: var(--unir-primary);
  box-shadow: 0 0 0 2px rgba(0, 112, 192, 0.2);
}

.eliminar-rango {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
  margin-left: auto;
}

.eliminar-rango:hover {
  background: #c82333;
  transform: scale(1.1);
}

.add-rango {
  background: var(--unir-primary);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 15px;
}

.add-rango:hover {
  background: #005a9e;
  transform: translateY(-1px);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #e3f2fd;
  border-radius: 6px;
  margin-top: 15px;
}

.checkbox-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--unir-primary);
}

.checkbox-line label {
  font-size: 13px;
  color: #333;
  margin: 0;
}

/* === RANGOS FIJOS === */
.rangos-fijos-container label {
  font-weight: 500;
  font-size: 14px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

#paginas-por-archivo {
  width: 80px;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

#paginas-por-archivo:focus {
  outline: none;
  border-color: var(--unir-primary);
  box-shadow: 0 0 0 2px rgba(0, 112, 192, 0.2);
}

/* === PÁGINAS === */
.paginas-container label,
.paginas-rango-container label {
  font-weight: 500;
  font-size: 14px;
  color: #333;
  display: block;
  margin-bottom: 8px;
}

#paginas-extraer-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 10px;
}

#paginas-extraer-input:focus {
  outline: none;
  border-color: var(--unir-primary);
  box-shadow: 0 0 0 2px rgba(0, 112, 192, 0.2);
}

.rango-simple {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.rango-simple label {
  font-size: 13px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 0;
}

.rango-simple input[type="number"] {
  width: 70px;
  padding: 8px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
}

.rango-simple input[type="number"]:focus {
  outline: none;
  border-color: var(--unir-primary);
  box-shadow: 0 0 0 2px rgba(0, 112, 192, 0.2);
}

/* === TAMAÑO === */
.tamaño-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

#tamaño-valor {
  width: 100px;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

#tamaño-valor:focus {
  outline: none;
  border-color: var(--unir-primary);
  box-shadow: 0 0 0 2px rgba(0, 112, 192, 0.2);
}

#tamaño-unidad {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

#tamaño-unidad:focus {
  outline: none;
  border-color: var(--unir-primary);
  box-shadow: 0 0 0 2px rgba(0, 112, 192, 0.2);
}

/* === TEXTO DE AYUDA === */
.help-text {
  font-size: 12px;
  color: #666;
  margin: 5px 0 0 0;
  font-style: italic;
}

/* === VISTA PREVIA PDF === */
.vista-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  min-height: 200px;
}

.vista-pdf canvas {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 15px;
}

.pdf-info {
  text-align: center;
}

.pdf-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 0 0 5px 0;
  word-break: break-word;
}

.pdf-info p {
  font-size: 12px;
  color: #666;
  margin: 0;
}

.error-preview {
  text-align: center;
  color: #dc3545;
  padding: 20px;
}

.error-preview p {
  margin: 5px 0;
  font-size: 14px;
}

/* === RESULTADOS === */
.resultados-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

/* Nuevo diseño para resumen de resultados */
.resultado-summary {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.resultado-info-main {
  margin-bottom: 15px;
}

.resultado-info-main h4 {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.resultado-info-main p {
  font-size: 14px;
  color: #666;
  margin: 5px 0;
}

/* Estilos para lista de archivos en ZIP */
.archivos-en-zip {
  border-top: 1px solid #e9ecef;
  padding-top: 15px;
  margin-top: 15px;
}

.archivos-en-zip h5 {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  margin: 0 0 10px 0;
}

.archivo-en-zip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  margin-bottom: 6px;
  transition: all 0.2s ease;
}

.archivo-en-zip:hover {
  background: #f1f3f4;
  border-color: #ced4da;
}

.archivo-nombre {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
}

.archivo-info {
  font-size: 12px;
  color: #6c757d;
  white-space: nowrap;
}

/* Mantener estilos legacy para compatibilidad */
.resultado-item {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.resultado-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 0 0 5px 0;
  word-break: break-word;
}

.resultado-info p {
  font-size: 12px;
  color: #666;
  margin: 2px 0;
}

.resultado-actions {
  flex-shrink: 0;
}

.boton-descargar {
  background: var(--unir-primary) !important;
  color: white !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 8px 16px !important;
  font-size: 13px !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  font-weight: 500 !important;
}

.boton-descargar:hover {
  background: #005a9e !important;
  transform: translateY(-1px) !important;
}

/* === RESPONSIVE PARA DIVIDIR PDF === */
@media (max-width: 768px) {
  .tabs {
    flex-wrap: wrap;
    gap: 5px;
  }
  
  .tab {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .modos {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .modo {
    padding: 8px 12px;
    font-size: 12px;
  }
  
  .rango {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .rango-simple {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .tamaño-selector {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .resultado-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .resultado-actions {
    width: 100%;
  }
  
  .boton-descargar {
    width: 100% !important;
  }
  
  /* Responsive para nueva UI de resultados */
  .archivo-en-zip {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .archivo-info {
    font-size: 11px;
  }
  
  .resultado-summary {
    padding: 15px;
  }
  
  .resultado-info-main h4 {
    font-size: 16px;
  }
  
  /* Ajustes responsive para el scroll del panel */
  .PANEL_SERVICIO {
    max-height: 50vh;
  }
  
  .service-panel-content {
    max-height: calc(50vh - 80px);
  }
}