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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: white;
  overflow-y: scroll;
  overflow-x: hidden;
  min-height: 100vh;
}

#loading {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  color: #666;
}

#pdf-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  background: white;
}

/* PDF Page Container */
.pdf-page {
  position: relative;
  margin: 0 auto;
}

.pdf-page canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* Text Layer */
.textLayer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 1;
  line-height: 1;
  text-align: initial;
  pointer-events: none;
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  transform-origin: 0 0;
  caret-color: black;
}

.textLayer span {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  padding: 8px 0;
  margin: -8px 0;
  pointer-events: auto;
}

.textLayer br {
  pointer-events: none;
}

/* Text Selection */
.textLayer ::selection {
  background: rgba(0, 100, 255, 0.3);
}

.textLayer br::selection {
  background: transparent;
}

/* Annotation Layer */
.annotationLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.annotationLayer section {
  position: absolute;
  text-align: initial;
  pointer-events: auto;
  box-sizing: border-box;
  transform-origin: 0 0;
}

.annotationLayer .linkAnnotation {
  outline: none;
}

.annotationLayer .linkAnnotation > a {
  position: absolute;
  font-size: 1em;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
}

.annotationLayer .linkAnnotation > a:hover {
  opacity: 0.2;
  background: rgba(255, 255, 0, 1);
}

/* Link Layer */
.linkLayer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.linkLayer a {
  position: absolute;
  pointer-events: auto;
  background: transparent;
  text-decoration: none;
}

.linkLayer a:hover {
  background: rgba(0, 100, 255, 0.1);
  outline: 1px solid rgba(0, 100, 255, 0.3);
}

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: margin 0.3s ease;
}

/* Sidebars */
.sidebar-left,
.sidebar-right {
  position: fixed;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: #f8f9fa;
  z-index: 100;
  display: none;
}

.sidebar-left {
  left: 0;
  width: 250px;
  border-right: 1px solid #e0e0e0;
}

.sidebar-right {
  right: 0;
  width: 200px;
  border-left: 1px solid #e0e0e0;
}

.layout[data-has-sidebar="true"] .sidebar-left {
  display: block;
}

.layout[data-has-toc="true"] .sidebar-right {
  display: block;
}

.layout[data-has-sidebar="true"] .content {
  margin-left: 250px;
}

.layout[data-has-toc="true"] .content {
  margin-right: 200px;
}

@media (max-width: 768px) {
  .sidebar-left,
  .sidebar-right {
    display: none !important;
  }

  .layout[data-has-sidebar="true"] .content,
  .layout[data-has-toc="true"] .content {
    margin-left: 0;
    margin-right: 0;
  }
}
