/* ============================================================
   VIEWER.CSS: VISTA DIVIDIDA, MINIATURAS Y VISOR PRINCIPAL
   SaaS Dark Design System (Zinc / Slate)
   ============================================================ */

.split-workspace {
  flex: 1;
  display: flex;
  width: 100%;
  height: calc(100vh - 52px);
  overflow: hidden;
  background-color: var(--bg-base);
}

/* ============================================================
   PANEL IZQUIERDO: MINIATURAS
   ============================================================ */
.sidebar-thumbnails {
  width: 260px;
  min-width: 220px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
}

.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sidebar-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-tip {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: 6px;
  line-height: 1.4;
}

.thumbnails-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thumbnails-scroll::-webkit-scrollbar {
  width: 5px;
}

.thumbnails-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.thumbnails-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.thumbnails-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.thumb-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.thumb-card:hover {
  background-color: var(--bg-overlay);
  border-color: var(--border-color-hover);
  transform: translateY(-1px);
}

.thumb-card.active {
  border-color: var(--primary);
  background-color: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 0 1px var(--primary), 0 4px 12px rgba(59, 130, 246, 0.2);
}

.thumb-canvas-box {
  width: 100%;
  aspect-ratio: 1 / 1.414; /* Proporción estándar A4 */
  background: #ffffff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.thumb-canvas-box canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.thumb-footer {
  margin-top: 8px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
}

.thumb-page-num {
  font-weight: 600;
  color: var(--text-main);
}

.thumb-action-hint {
  font-size: 0.68rem;
  color: var(--text-dim);
  transition: color var(--transition-fast);
}

.thumb-card:hover .thumb-action-hint,
.thumb-card.active .thumb-action-hint {
  color: var(--primary);
}

/* ============================================================
   PANEL DERECHO: VISTA PREVIA Y WORKSPACE
   ============================================================ */
.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-base);
  height: 100%;
  overflow: hidden;
}

.preview-toolbar {
  height: 48px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 10;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-current-tag {
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 500;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.zoom-text {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  min-width: 44px;
  text-align: center;
}

.btn-snipper {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  font-weight: 600;
}

.btn-snipper:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.preview-stage {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 36px 20px;
  position: relative;
  background-color: var(--bg-base);
}

.preview-stage::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.preview-stage::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

/* Lienzo Flotante Enterprise */
.canvas-wrapper {
  background: #ffffff;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  position: relative;
  transition: transform 0.15s ease-out;
  cursor: grab;
}

.canvas-wrapper:active {
  cursor: grabbing;
}

#preview-canvas {
  display: block;
}

.preview-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(9, 9, 11, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.85rem;
  border-radius: 4px;
  z-index: 20;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   ASISTENTE DE DATOS FALTANTES & SELECTOR DE PRESENCIA
   ============================================================ */

.missing-choice-row:hover {
  background: var(--bg-card-hover) !important;
  border-color: var(--primary-border) !important;
}

.missing-choice-row input[type="checkbox"]:checked + div > div:first-child {
  color: var(--primary) !important;
}

.missing-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.missing-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px 6px 0 0;
}

.missing-tab-btn.active {
  color: #ffffff;
  border-bottom-color: var(--primary);
}

.missing-field-panel {
  display: none;
  animation: fadeInPanel 0.2s ease-out;
}

.missing-field-panel.active {
  display: block;
}

@keyframes fadeInPanel {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

#dropzone-firma-upload.dragover {
  border-color: var(--primary) !important;
  background: rgba(59, 130, 246, 0.08) !important;
}
