:root {
  --bg-dark: #020403;
  --bg-sidebar: rgba(10, 14, 12, 0.7);
  --card-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.1);
  --emerald: #00ff88; 
  --emerald-dim: #10b981;
  --emerald-glow: rgba(0, 255, 136, 0.2);
  --text-main: #ffffff;
  --text-dim: #94a3b8;
  --error: #ff3333;
  --font-family: 'Outfit', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 80% 20%, var(--emerald-glow) 0%, transparent 40%),
    radial-gradient(circle at 20% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 40%);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Glass Header */
.glass-header {
  height: 80px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.emerald { color: var(--emerald); }

.brand-badge {
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 24px;
  border-radius: 14px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  border: 1px solid var(--glass-border);
  color: #fff;
}

/* Layout */
.container {
  display: grid;
  grid-template-columns: 320px 1fr; /* Reduced from 380px */
  flex: 1;
  height: calc(100vh - 80px); /* Fill remaining space exactly */
  overflow: hidden;
  background: transparent;
}

/* Sidebar with depth */
.sidebar {
  background: rgba(10, 15, 13, 0.4);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-right: 1px solid var(--glass-border);
  padding: 20px; /* Reduced from 30px */
  display: flex;
  flex-direction: column;
  gap: 16px; /* Reduced from 24px */
  z-index: 10;
  /* Altura total y scroll si la pantalla es muy pequeña en vertical */
  height: 100%; /* Adapt to container */
  overflow: hidden; 
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 18px; /* Reduced from 24px */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px; /* Reduced from 20px */
  color: #fff;
}

/* Drop Zone Modern */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 15px; /* Reduced from 30px */
  text-align: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.drop-zone:hover {
  border-color: var(--emerald);
  background: rgba(0, 255, 136, 0.05);
  transform: translateY(-2px);
}

.drop-zone i {
  color: var(--emerald);
  margin-bottom: 12px;
}

.drop-zone p {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Inputs Premium */
.input-group label {
  display: block;
  font-size: 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px; /* Reduced from 10px */
}

select {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  color: white;
  padding: 14px 20px;
  border-radius: 16px;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: 0.3s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 18px;
}

select:focus {
  border-color: var(--emerald);
  box-shadow: 0 0 0 2px var(--emerald-glow);
}

/* Buttons High Contrast */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--emerald) 0%, #00cc6a 100%);
  color: #000;
  border: none;
  padding: 12px; /* Reduced from 16px */
  border-radius: 16px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(0, 255, 136, 0.2);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 255, 136, 0.4);
}

.btn-validate {
  margin-top: auto;
  width: 100%;
  background: #ffffff;
  color: #000;
  border: none;
  padding: 12px; /* Reduced from 20px */
  border-radius: 18px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-validate:hover {
  transform: translateY(-4px) scale(1.02);
  background: #f0f0f0;
}

/* File List with Elegance */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px; /* Reduced from 10px */
  overflow-y: auto;
  max-height: 100%; /* Ocupa el espacio disponible en el flex container padre */
  padding-right: 5px; /* Espacio para scrollbar */
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px; /* Reduced from 14px */
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  font-size: 0.85rem;
  transition: all 0.3s;
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.file-item i { color: var(--emerald); }

.file-item .file-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  font-weight: 500;
}

.file-item .file-type {
  font-size: 0.65rem;
  font-weight: 800;
  background: rgba(0, 255, 136, 0.15);
  color: var(--emerald);
  padding: 4px 10px;
  border-radius: 8px;
  flex-shrink: 0;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--text-dim);
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: rgba(255, 51, 51, 0.2);
  color: var(--error);
}

/* Main Display Area */
.main-content {
  padding: 50px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  background: transparent;
  z-index: 5;
  /* Habilitar Scroll */
  overflow-y: auto;
  height: 100%;
  max-height: calc(100vh - 80px); /* Restar altura del header */
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.report-header h2 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -1.5px;
  background: linear-gradient(to bottom, #fff 40%, var(--text-dim) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* The "Documento" Sheet Effect */
.report-viewer {
  flex: 1;
  background: rgba(5, 8, 7, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  padding: 60px;
  overflow-y: auto;
  box-shadow: inset 0 0 100px rgba(0,0,0,0.8);
}

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 30px;
}

.empty-state i {
  color: var(--emerald);
  filter: drop-shadow(0 0 30px var(--emerald-glow));
  opacity: 0.8;
}

.empty-state h3 {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  opacity: 0.9;
}

/* Report Blocks Packaging */
.audit-block {
  margin-bottom: 40px;
  padding: 45px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  line-height: 1.9;
  position: relative;
  animation: blockFadeIn 0.8s ease-out;
}

@keyframes blockFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.audit-block.hallazgo {
  border-left: 8px solid var(--error);
  background: linear-gradient(90deg, rgba(255, 51, 51, 0.05) 0%, transparent 100%);
}

.audit-block.cumplimiento {
  border-left: 8px solid var(--emerald);
  background: linear-gradient(90deg, rgba(0, 255, 136, 0.05) 0%, transparent 100%);
}

.field-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 15px;
  padding: 8px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.hallazgo .field-label { color: var(--error); }
.cumplimiento .field-label { color: var(--emerald); }

.audit-block p {
  margin-bottom: 20px;
  font-size: 1.15rem;
  color: #f1f5f9;
}

/* Toast with High Visibility */
.toast {
  position: fixed;
  bottom: 50px;
  right: 50px;
  background: #ffffff;
  color: #000;
  padding: 20px 40px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 40px 80px rgba(0,0,0,0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 15px;
}

.btn-text-only {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 12px 28px;
  border-radius: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s;
}

.btn-text-only:hover {
  background: #fff;
  color: #000;
}

/* Scrollbar Style */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--emerald); }


/* ... existing code ... */

.hidden { display: none !important; }

/* Utilities needed for layout */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; min-height: 0; }
.overflow-hidden { overflow: hidden; }
.mb-2 { margin-bottom: 0.5rem; }
.mt-4 { margin-top: 1rem; }

/* Main Content: Fix Scrolling to be internal only */
.main-content {
  padding: 50px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  background: transparent;
  z-index: 5;
  /* Disable outer scroll, let report-viewer handle it */
  overflow: hidden; 
  height: 100%;
  max-height: calc(100vh - 80px);
}


/* Nuevo Encabezado Visual del Reporte (Estilo GradeSight) */
.report-visual-header {
  display: none; /* OCULTO EN PANTALLA, SOLO VISIBLE EN IMPRESIÓN */
  background: #f0f2f5;
  color: #000;
  padding: 30px;
  border-radius: 20px;
  margin-bottom: 40px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.5s ease;
  border: 1px solid rgba(255,255,255,0.1);
}

/* ESTILOS DE IMPRESIÓN (PDF REAL) */
@media print {
  /* Ocultar todo lo que no sea el reporte */
  .sidebar, .glass-header, .report-header, .toast, .glow-bg {
    display: none !important;
  }

  html, body {
    background: #fff !important;
    overflow: visible !important;
    height: auto !important;
    min-height: auto !important;
    color: #000 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .container {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .main-content {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    border: none !important;
  }

  .report-viewer {
    background: #fff !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  /* Forzar el header a blanco puro en impresión */
  /* Forzar el header a blanco puro en impresión */
  .report-visual-header {
    display: block !important; /* FORZAR VISIBILIDAD EN IMPRESIÓN */
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid #000 !important;
    box-shadow: none !important;
    margin-bottom: 20px !important;
    padding: 0 !important;
    gap: 10px !important;
  }

  .header-grid {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    gap: 10px !important;
  }
  
  .header-row {
    margin-bottom: 4px !important;
  }

  .audit-block {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin-bottom: 15px !important;
    padding: 10px 0 10px 15px !important; /* Left padding for the border accent */
    /* page-break-inside: avoid;  <-- REMOVED to prevent huge gaps */
  }

  .audit-block p {
    color: #000 !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
    margin-bottom: 8px !important;
  }
  
  h3 {
    font-size: 12pt !important;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
  }

  /* Ajustar colores de bordes para tinta */
  .audit-block.hallazgo {
    border-left: 4px solid #d32f2f !important; /* Rojo impresión más delgado */
  }
  
  .audit-block.cumplimiento {
    border-left: 4px solid #388e3c !important; /* Verde impresión más delgado */
  }

  .field-label {
    color: #000 !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    font-size: 9pt !important;
    padding: 0 !important;
    background: transparent !important;
  }
  
  /* Utilities overrides for print */
  .mb-2 { margin-bottom: 2px !important; }
  .mt-4 { margin-top: 2px !important; } /* reduced to minimum visual separation */


}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #000;
  padding-bottom: 10px;
}

.header-brand h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: #004d40;
  margin: 0;
  letter-spacing: -0.5px;
}

.header-brand p {
  font-size: 0.9rem;
  color: #555;
  margin-top: 5px;
  font-style: italic;
}

.header-meta {
  text-align: right;
  font-size: 0.85rem;
  color: #444;
  font-weight: 600;
}

.header-title-box {
  text-align: center;
  margin: 10px 0;
}

.header-title-box h2 {
  font-size: 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  color: #000;
  letter-spacing: 1px;
}

.header-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px;
}

.header-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.header-label {
  font-weight: 800;
  color: #000;
  min-width: 100px;
}

.header-value {
  color: #333;
}

/* Ajustes a los bloques de auditoría para que resalten más */
.audit-block {
    margin-bottom: 30px;
    padding: 30px;
    background: transparent; /* Cleaner look without glass background */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Subtle separator */
    border-radius: 0; /* More document-like, less card-like */
    line-height: 1.8;
    position: relative;
    animation: blockFadeIn 0.8s ease-out;
    text-align: justify; /* Formal text alignment */
}

