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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header / Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.toolbar h1 {
  font-size: 16px;
  font-weight: 600;
  color: #e94560;
  margin-right: 8px;
  white-space: nowrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-left: 1px solid #0f3460;
}

button, select {
  background: #0f3460;
  color: #e0e0e0;
  border: 1px solid #533483;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

button:hover { background: #533483; }
button.active { background: #e94560; border-color: #e94560; }

select { padding: 4px 6px; }

.page-info {
  font-size: 13px;
  color: #aaa;
  min-width: 80px;
  text-align: center;
}

/* Upload overlay */
.upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.upload-overlay.hidden { display: none; }

.upload-box {
  border: 3px dashed #533483;
  border-radius: 16px;
  padding: 60px 80px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  background: #16213e;
  max-width: 500px;
}

.upload-box.dragover {
  border-color: #e94560;
  background: #1a1a3e;
}

.upload-box h2 {
  font-size: 22px;
  margin-bottom: 12px;
  color: #e94560;
}

.upload-box p {
  color: #aaa;
  margin-bottom: 20px;
}

.upload-box input[type="file"] { display: none; }

.upload-box label {
  display: inline-block;
  background: #e94560;
  color: white;
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.upload-box label:hover { background: #c73a52; }

.file-list {
  margin-top: 20px;
  max-height: 150px;
  overflow-y: auto;
}

.file-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #0f3460;
  border-radius: 4px;
  margin-top: 6px;
  font-size: 13px;
  cursor: pointer;
}

.file-list-item:hover { background: #533483; }

/* Main content: side-by-side */
.main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.panel + .panel { border-left: 2px solid #0f3460; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #16213e;
  font-size: 12px;
  color: #aaa;
  flex-shrink: 0;
  border-bottom: 1px solid #0f3460;
}

.panel-header span { font-weight: 600; color: #e94560; }

.panel-content {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  background: #111;
}

.panel-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

#pdfjs-container {
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#pdfjs-container canvas {
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
  background: white;
}

/* Debug panel */
.debug-panel {
  width: 290px;
  background: #16213e;
  border-left: 1px solid #0f3460;
  padding: 12px;
  overflow-y: auto;
  flex-shrink: 0;
  font-size: 12px;
}

.debug-panel h3 {
  color: #e94560;
  font-size: 13px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #0f3460;
}

.debug-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid #0f346033;
}

.debug-row .label { color: #888; }
.debug-row .value { color: #e0e0e0; font-family: monospace; }

.debug-section { margin-bottom: 16px; }

/* Rendering toggles */
.debug-hint {
  color: #666;
  font-size: 10px;
  margin-bottom: 10px;
  font-style: italic;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  margin: 2px 0;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
}

.toggle-row:hover { background: #0f3460; }

.toggle-row input[type="checkbox"] {
  accent-color: #e94560;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.toggle-label {
  font-size: 11px;
  color: #ccc;
  user-select: none;
}

.toggle-desc {
  font-size: 9px;
  color: #555;
  padding: 0 6px 2px 26px;
  line-height: 1.3;
}

/* Warning indicator when settings deviate from optimal */
.debug-panel .warn-badge {
  display: inline-block;
  background: #e94560;
  color: white;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
