/* 
 * Estilos específicos para el servicio Imagen a Excel
 * Parte de la arquitectura Clean + Vertical Slice
 */

/* === VARIABLES Y CONFIGURACIÓN GLOBAL === */
:root {
  --image-primary: rgb(0, 112, 192);
  --image-secondary: #2ecc71;
  --image-success: #27ae60;
  --image-warning: #f39c12;
  --image-danger: #e74c3c;
  --image-ai: #2ecc71;
  --image-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;
}

.image-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); }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

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

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

/* === PANTALLA 1 - SELECCIÓN === */
#pantalla-1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
  color: white;
  text-align: center;
}

#pantalla-1 h1 {
  font-size:  3.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: black;
}

#pantalla-1 p {
  font-size: 1.2rem;
  margin-bottom: 40px;
  opacity: 0.9;
  color: black;
}

/* === OCR INFO SECTION === */
.ocr-info {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 30px;
  margin-top: 40px;
  max-width: 600px;
  width: 100%;
}

.ocr-info h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  text-align: center;
}

.ocr-info p {
  margin-bottom: 20px;
  line-height: 1.6;
}

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

.feature {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 0.95rem;
}

.feature .icon {
  font-size: 1.2rem;
}

/* === PANTALLA 2 - LAYOUT === */
#pantalla-2 {
  display: grid;
  grid-template-columns: 1fr 350px;
  height: 100vh;
  overflow: hidden;
}

/* === ZONA DE IMAGEN === */
.zona-imagen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  background: #f8f9fa;
  scrollbar-color: var(--image-primary) #f0f8ff;
  scrollbar-width: thin;
}

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

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

.zona-imagen::-webkit-scrollbar-thumb {
  background: var(--image-primary);
  border-radius: 10px;
  border: 2px solid #f0f8ff;
}

.zona-imagen::-webkit-scrollbar-thumb:hover {
  background: #2c5aa0;
}

.imagen-container {
  max-height: 800px;
  padding: 20px;
  background: transparent;
  margin-top: -15px;
  height: 100%;
  box-sizing: border-box;
  position: relative;
}

.imagen-preview {
  width: 100%;
  min-height: 400px;
  background: white;
  border-radius: 12px;
  box-shadow: var(--image-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #ddd;
  position: relative;
  overflow: hidden;
}

.imagen-preview img {
  max-width: 100%;
  max-height: 400px !important;
  object-fit: contain;
  border-radius: 8px;
}

/* === BOTÓN CAMBIAR IMAGEN === */
.btn-cambiar-imagen {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--image-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  position: absolute;
  top: 15px;
  right: 15px;
  box-shadow: 0 2px 6px rgba(0, 112, 192, 0.3);
  transition: all 0.2s ease;
  z-index: 10;
}

.btn-cambiar-imagen:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 112, 192, 0.4);
}

/* === PANEL DE SERVICIO === */
.PANEL_SERVICIO {
  background: white;
  border-radius: 0;
  box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
  padding: 0 25px 25px 25px;
  height: 100vh;
  position: sticky;
  top: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.service-panel-content {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-top: 25px;
}

.service-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--image-primary);
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--image-primary);
}

.service-message {
  background: #f8fafc;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid var(--image-primary);
}

/* === OPCIONES DE MODO === */
.mode-options {
  background: #f8fafc;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.mode-options h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2d3748;
  margin: 0 0 15px 0;
}

.mode-selector {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  padding: 12px;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.mode-option:hover {
  background: rgba(0, 112, 192, 0.05);
  border-color: var(--image-primary);
}

.mode-option input[type="radio"] {
  margin: 4px 12px 0 0;
  transform: scale(1.2);
  accent-color: var(--image-primary);
}

.mode-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
}

.mode-icon {
  font-size: 1.5rem;
  margin-top: 2px;
}

.mode-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mode-text strong {
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
}

.mode-text small {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.3;
}

/* === ESTADÍSTICAS DEL SERVICIO === */
.service-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.95rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-label {
  font-weight: 500;
  color: #64748b;
}

.stat-value {
  font-weight: 600;
  color: var(--image-primary);
  text-align: right;
  word-break: break-all;
  max-width: 60%;
}

/* === BOTÓN DE SERVICIO === */
.service-actions {
  margin-top: 20px;
}

.service-button {
  width: 100%;
  background: linear-gradient(45deg, var(--image-primary), var(--image-ai));
  color: white;
  border: none;
  border-radius: 12px;
  padding: 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: var(--image-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;
}

/* === 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: 600px;
  width: 90%;
  transform: translateY(20px);
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  margin-top: -100px;
}

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

.loader-content h2 {
  color: var(--image-primary);
  font-size: 2.5rem;
  margin-bottom: 30px;
  font-weight: 700;
}

/* === BARRA DE PROGRESO === */
.progress-container {
  margin: 30px 0;
  background: #e2e8f0;
  border-radius: 25px;
  height: 12px;
  overflow: hidden;
  position: relative;
}

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

.progress-fill {
  height: 100%;
  background: linear-gradient(45deg, var(--image-primary), var(--image-ai));
  border-radius: 25px;
  width: 0%;
  transition: width 0.5s ease;
  position: relative;
  overflow: hidden;
}

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

.progress-fill.animating::before {
  left: 100%;
}

.progress-message {
  color: #64748b;
  font-size: 1rem;
  font-weight: 500;
  margin-top: 15px;
  transition: all 0.3s ease;
}

/* === PASOS DE PROCESAMIENTO === */
.processing-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 40px;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.step.active {
  border-color: var(--image-primary);
  background: rgba(0, 112, 192, 0.05);
}

.step.completed {
  border-color: var(--image-success);
  background: rgba(39, 174, 96, 0.05);
}

.step-icon {
  font-size: 1.5rem;
  transition: all 0.3s ease;
}

.step.active .step-icon {
  animation: pulse 1.5s infinite;
}

.step.completed .step-icon {
  animation: none;
}

.step-text {
  font-weight: 500;
  color: #2d3748;
}

/* === PANTALLA 3 - RESULTADOS === */
#pantalla-3 {
  padding: 40px 20px;
  background: linear-gradient(135deg, rgb(0, 112, 192) 0%, #2ecc71 100%);
  min-height: 100vh;
  color: white;
}

.results-container {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.results-container h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 40px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* === ESTADÍSTICAS DE PROCESAMIENTO === */
.processing-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 25px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #ffd700;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === PREVIEW DE DATOS === */
.data-preview {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.data-preview h3 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  text-align: center;
}

.data-preview-container {
  background: white;
  border-radius: 8px;
  padding: 20px;
  max-height: 400px;
  overflow: auto;
  color: #2d3748;
}

/* === TABLA EXTRAÍDA === */
.extracted-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.extracted-table th,
.extracted-table td {
  border: 1px solid #e2e8f0;
  padding: 8px 12px;
  text-align: left;
}

.extracted-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--image-primary);
}

.extracted-table tr:nth-child(even) {
  background: #f8fafc;
}

/* === TEXTO EXTRAÍDO === */
.extracted-text {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  color: #2d3748;
  background: #f8fafc;
  padding: 15px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

/* === ACCIONES DE RESULTADOS === */
.results-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.boton-servicio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 25px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  color: white;
  background: linear-gradient(45deg, var(--image-primary), var(--image-secondary));
  box-shadow: var(--image-shadow);
}

.boton-servicio:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

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

.boton-secundario:hover {
  background: linear-gradient(45deg, #7f8c8d, #6c7b7d) !important;
}

/* Botón circular 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;
  min-width: 50px !important;
  background: #0070C0 !important;
}

#btnVolverEmpezar .button-icon {
  margin: 0 !important;
}

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

/* === ÁREA DE ARRASTRE === */
.drop-area {
  border: 3px dashed rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  margin: 20px 0;
}

.drop-area:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.1);
}

.drop-area.drag-over {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
  transform: scale(1.02);
}

.boton-servicio {
  background: linear-gradient(45deg, #ffd700, #ffed4e);
  color: #2d3748;
  border: none;
  border-radius: 12px;
  padding: 15px 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.boton-servicio:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

/* === OVERLAY DE ARRASTRE === */
.drop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 112, 192, 0.9);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.drop-overlay.active {
  opacity: 1;
  visibility: visible;
}

.drop-overlay-content {
  text-align: center;
  color: white;
  animation: float 2s ease-in-out infinite;
}

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

.drop-overlay-content .message {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 10px 0;
}

.drop-overlay-content .submessage {
  font-size: 1.2rem;
  opacity: 0.9;
  margin: 0;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .loader-content h2 {
    font-size: 2rem;
  }
  
  .progress-container {
    margin: 20px 0;
  }
  
  .progress-message {
    font-size: 0.9rem;
  }
  
  .processing-steps {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  #pantalla-2 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    height: auto;
    min-height: 100vh;
  }
  
  .zona-imagen {
    height: 60vh;
    min-height: 400px;
  }
  
  .PANEL_SERVICIO {
    height: auto;
    min-height: 40vh;
    position: static;
  }
  
  .results-actions {
    flex-direction: column;
    gap: 15px;
  }
  
  .results-actions .boton-servicio {
    width: 100%;
    max-width: 300px;
  }
  
  #pantalla-1 h1 {
    font-size: 2rem;
  }
  
  #pantalla-1 p {
    font-size: 1rem;
  }
  
  .ocr-features {
    grid-template-columns: 1fr;
  }
  
  .processing-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .service-stats {
    font-size: 0.85rem;
  }
  
  .stat-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .stat-value {
    max-width: 100%;
  }
  
  .drop-overlay-content .message {
    font-size: 1.5rem;
  }
  
  .drop-overlay-content .submessage {
    font-size: 1rem;
  }
}