/* ─────────────────────────────────────────────── */
/* RESET BÁSICO                                    */
/* ─────────────────────────────────────────────── */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  background: #0d0f13;
  color: #e6e7eb;
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ─────────────────────────────────────────────── */
/* SHELL GENERAL                                   */
/* ─────────────────────────────────────────────── */

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
}



/* ─────────────────────────────────────────────── */
/* MAIN LAYOUT                                      */
/* ─────────────────────────────────────────────── */

#workbench {
  width: 100%;
  padding: 40px 20px 80px;
}

.main-grid {
  max-width: 1400px;
  margin: 24px auto 40px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.5fr);
  gap: 28px;
  align-items: flex-start;   /* 👈 importante: columnas alineadas arriba */
}

/* ─────────────────────────────────────────────── */
/* PANEL RESUMEN DE FACTURA                         */
/* ─────────────────────────────────────────────── */

.invoice-summary-wrapper {
  max-width: 1400px;
  margin: 0 auto 35px;
}

.invoice-summary {
  background: #151921;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 26px 26px 32px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: all 0.2s ease;
}

.hidden {
  display: none !important;
}

.invoice-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.invoice-summary-title {
  font-size: 22px;
  font-weight: 700;
}

.invoice-summary-chip {
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  background: #2b3038;
  color: #bfc3cd;
}

.invoice-summary-chip.high {
  background: rgba(0, 219, 116, 0.18);
  color: #2fffa6;
}

.invoice-summary-chip.medium {
  background: rgba(255, 180, 0, 0.18);
  color: #ffc864;
}

.invoice-summary-chip.low {
  background: rgba(255, 70, 70, 0.18);
  color: #ff7373;
}

.invoice-summary-main {
  display: flex;
  align-items: baseline;
  gap: 22px;
}

.invoice-summary-amount {
  font-size: 32px;
  font-weight: 700;
  color: #4f8cff;
}

.invoice-summary-date {
  font-size: 15px;
  opacity: 0.7;
}

.invoice-summary-parties {
  display: flex;
  gap: 40px;
  margin-top: 4px;
}

.invoice-summary-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.invoice-summary-label {
  font-size: 13px;
  color: #8b8f99;
  margin-bottom: 2px;
}

.invoice-summary-name {
  font-size: 16px;
  font-weight: 600;
}

.invoice-summary-id {
  font-size: 14px;
  opacity: 0.6;
}

.invoice-summary-footer {
  margin-top: 10px;
  font-size: 14px;
  opacity: 0.65;
}

/* ─────────────────────────────────────────────── */
/* PANEL IZQUIERDO                                   */
/* ─────────────────────────────────────────────── */

.left-panel h2 {
  margin-bottom: 18px;
}

.dropzone {
  background: #151921;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  height: 220px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: border-color 0.2s ease;
  margin-bottom: 14px;
}

.dropzone:hover {
  border-color: #4f8cff;
}

.dropzone-inner {
  text-align: center;
}

.dropzone-icon {
  font-size: 38px;
  margin-bottom: 12px;
}

.dropzone-title {
  font-size: 18px;
  font-weight: 600;
}

.dropzone-sub {
  font-size: 14px;
  opacity: 0.6;
}

.file-info {
  margin: 6px 0 12px;
  font-size: 14px;
  opacity: 0.7;
}

.primary-btn {
  background: #4f8cff;
  padding: 14px 18px;
  color: white;
  border: none;
  border-radius: 12px;
  width: 100%;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 18px;
  transition: background 0.2s ease;
}

.primary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.status {
  min-height: 22px;
  font-size: 14px;
  margin-bottom: 18px;
}

.status.success {
  color: #2fffa6;
}

.status.error {
  color: #ff6b6b;
}

/* ─────────────────────────────────────────────── */
/* PANEL DERECHO                                     */
/* ─────────────────────────────────────────────── */

.right-panel h2 {
  margin-bottom: 6px;
}

.results-desc {
  font-size: 14px;
  opacity: 0.65;
  margin-bottom: 18px;
}

/* ─────────────────────────────────────────────── */
/* VISOR PDF                                       */
/* ─────────────────────────────────────────────── */

.pdf-viewer-container {
  background: #151921;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px 16px 12px;
  margin-bottom: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Mensaje inicial */
.pdf-viewer-placeholder {
  padding: 70px 20px;
  text-align: center;
  font-size: 14px;
  opacity: 0.6;
}

/* Contenedor del canvas */
.pdf-page-container {
  position: relative;
  width: 100%;
  background: #0b0d11;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Canvas del PDF */
#pdf-canvas {
  width: 100%;
  display: block;
}

/* Capa de texto (para futuros highlights) */
.pdf-text-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Barra inferior (info del PDF) */
.pdf-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px 0;
  font-size: 12px;
  opacity: 0.5;
}

/* Por si luego añadimos controles a la derecha en la toolbar */
.pdf-toolbar span:last-child {
  font-size: 11px;
  opacity: 0.7;
}

/* Responsive */
@media (max-width: 900px) {
  .pdf-viewer-container {
    padding: 12px 12px 10px;
  }

  .pdf-viewer-placeholder {
    padding: 50px 16px;
  }
}


.result-summary {
  background: #151921;
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  opacity: 0.95;
}

.result-summary.empty {
  opacity: 0.6;
  font-size: 14px;
  margin-bottom: 20px;
}

/* ─────────────────────────────────────────────── */
/* TABS + CONTENIDOS                                 */
/* ─────────────────────────────────────────────── */

.result-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.tab-btn {
  padding: 10px 18px;
  border-radius: 10px;
  background: #1b1f27;
  color: #b7bcc6;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.tab-btn-active {
  background: #4f8cff;
  color: white;
}

.tab-content {
  display: none;
}

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

.core-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px 22px;
  background: #151921;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.core-grid div {
  font-size: 13px;
  color: #d4d6dd;
}

.core-grid div strong {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b8f99;
  margin-bottom: 4px;
}

/* ─────────────────────────────────────────────── */
/* JSON OUTPUT                                       */
/* ─────────────────────────────────────────────── */

.json-output {
  background: #151921;
  padding: 20px;
  border-radius: 16px;
  white-space: pre-wrap;
  overflow-x: auto;
  font-size: 14px;
}

/* ─────────────────────────────────────────────── */
/* FOOTER                                           */
/* ─────────────────────────────────────────────── */

.footer {
  margin-top: auto;
  padding: 40px;
  text-align: center;
  opacity: 0.5;
  font-size: 14px;
}

/* ─────────────────────────────────────────────── */
/* QUICK FACTS · Chips profesionales               */
/* ─────────────────────────────────────────────── */

.quick-facts {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 12px 0 20px;
  flex-wrap: wrap;
}

/* Base del chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

/* Chips outline (Factura / Total) */
.chip-outline {
  border: 1px solid #4f8cff;
  color: #4f8cff;
  background: transparent;
}

/* Chips sólidos (Confianza) */
.chip-solid {
  color: #ffffff;
  border: none;
}

/* Verde alta confianza */
.chip-green {
  background: #00c56e;
}

/* Naranja media confianza */
.chip-orange {
  background: #ffa726;
}

/* Roja baja confianza */
.chip-red {
  background: #ef5350;
}

/* Tipografías internas */
.chip-label {
  opacity: 0.8;
  font-weight: 500;
  font-size: 12px;
}

.chip-value {
  font-weight: 700;
}

/* Mobile */
@media (max-width: 600px) {
  .chip {
    padding: 6px 12px;
    font-size: 12px;
  }
}


/* ─────────────────────────────────────────────── */
/* HERO · ALTERNATIVA 3: LOGO IZQUIERDA + TEXTO    */
/* ─────────────────────────────────────────────── */

/* ─────────────────────────────────────────────── */
/* HERO · LOGO IZQUIERDA + TEXTO                  */
/* ─────────────────────────────────────────────── */

.hero {
  width: 100%;
  padding: 0;
  background: linear-gradient(180deg, #12151c 0%, #0d0f13 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Dos columnas: logo + texto */
.hero-inner-two-col {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 48px;
  padding: 48px 20px 40px;
  align-items: center;
}

/* izquierda: logo centrado vertical/horizontal */
.hero-left {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Logo: protagonista pero contenido, sin romper layout */
.hero-left-logo {
  width: 100%;
  max-width: 320px;
  height: auto;
  object-fit: contain;
}

/* derecha: texto */
.hero-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero-title {
  font-size: 46px;
  font-weight: 700;
  line-height: 1.1;
}

.hero-desc {
  font-size: 18px;
  opacity: 0.75;
  max-width: 650px;
}

.hero-cta {
  display: inline-block;
  background: #4f8cff;
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 600;
  color: white;
  font-size: 17px;
  width: fit-content;
  transition: background 0.2s ease;
}

.hero-cta:hover {
  background: #6ba3ff;
}

.hero-meta {
  display: flex;
  gap: 20px;
  opacity: 0.6;
  font-size: 14px;
}

/* Responsive: apilado, pero manteniendo proporción y centro visual */
@media (max-width: 900px) {
  .hero-inner-two-col {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 32px 16px 32px;
    gap: 28px;
  }

  .hero-left {
    justify-content: center;
  }

  .hero-right {
    align-items: center;
  }

  .hero-left-logo {
    max-width: 220px;
  }

  .hero-title {
    font-size: 34px;
  }

  .hero-desc {
    font-size: 16px;
  }
}

/* Títulos de las dos columnas principales */
.left-panel h2,
.right-panel h2 {
  margin: 0 0 16px;   /* 👈 mismo margen superior (0) e inferior */
  padding: 0;
  font-size: 20px;
  font-weight: 600;
}

.left-panel,
.right-panel {
  padding-top: 0;
}

/* ─────────────────────────────────────────────── */
/* OVERLAY DE PROCESAMIENTO                       */
/* ─────────────────────────────────────────────── */

.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.48);   /* más suave */
  backdrop-filter: blur(1.5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: processing-fade-in 0.18s ease-out;
}

.processing-dialog {
  background: #151921;
  border-radius: 18px;
  padding: 22px 26px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
  min-width: 260px;
  max-width: 380px;
  animation: processing-scale-in 0.18s ease-out;
}

.processing-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: #4f8cff;
  animation: processing-spin 0.8s linear infinite;
}

.processing-text {
  font-size: 14px;
  font-weight: 600;
}

.processing-filename {
  font-size: 13px;
  max-width: 100%;
  text-align: center;
  opacity: 0.85;
  word-break: break-all;
}

.processing-sub {
  font-size: 12px;
  opacity: 0.65;
  text-align: center;
}

/* Barra de progreso estética (no real, pero da sensación de actividad) */
.processing-progress {
  margin-top: 8px;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.processing-progress-bar {
  width: 30%;
  height: 100%;
  background: #4f8cff;
  border-radius: 999px;
  animation: processing-progress-pulse 1.1s ease-in-out infinite;
}

/* Animaciones suaves */
@keyframes processing-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes processing-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes processing-scale-in {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes processing-progress-pulse {
  0% {
    transform: translateX(-40%);
  }
  50% {
    transform: translateX(40%);
  }
  100% {
    transform: translateX(120%);
  }
}

/* Para cuando ocultamos el overlay */
.hidden {
  display: none !important;
}

/* Bloquear dropzone durante el procesamiento */
.dropzone-disabled {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.2);
}

.helper-text {
  margin-top: 14px;
  font-size: 13px;
  opacity: 0.75;
  line-height: 1.45;
}

.helper-text strong {
  color: #ffffff;
  opacity: 0.9;
}