:root {
  color-scheme: light;
  --bg: #f2f2f2;
  --toolbar: #ffffff;
  --border: rgba(0, 0, 0, 0.12);
  --text: #1f1f1f;
  --muted: rgba(0, 0, 0, 0.55);
  --accent: #1b67e6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app {
  position: relative;
  height: 100vh;
}

#toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--toolbar);
  border-bottom: 1px solid var(--border);
}

#toolbar::-webkit-scrollbar {
  display: none;
}

.toolbar-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar-group.right {
  margin-left: auto;
}


.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  border-color: rgba(0, 0, 0, 0.25);
}

.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading i {
  opacity: 0;
}

.btn.loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: var(--accent);
  position: absolute;
  inset: 0;
  margin: auto;
  animation: spin 0.8s linear infinite;
}

.page-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  padding: 6px 8px;
  width: 36px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn i {
  font-size: 16px;
}

.zoom-btn {
  padding: 6px 8px;
  width: 36px;
  height: 32px;
}

.zoom-icon {
  font-size: 18px;
  line-height: 1;
  display: inline-block;
  transform: translateY(-1px);
}


#pageNumber {
  width: 64px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 14px;
  text-align: center;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}

#viewerContainer {
  position: absolute;
  top: 58px;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: auto;
  padding: 16px 12px 32px;
}

#printContainer {
  display: none;
}

.print-page {
  break-after: page;
  page-break-after: always;
}

@media print {
  body {
    background: #fff;
  }

  #toolbar,
  #viewerContainer {
    display: none !important;
  }

  #printContainer {
    display: block;
    padding: 0;
  }

  #printContainer canvas {
    width: 100%;
    height: auto;
    display: block;
  }
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.compact-ui #toolbar {
  gap: 6px;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px;
}

.compact-ui #toolbar::-webkit-scrollbar {
  display: none;
}

.compact-ui .toolbar-group {
  flex: 0 0 auto !important;
}

.compact-ui .toolbar-group.right {
  display: none;
}

.compact-ui #viewerContainer {
  padding: 12px 8px 24px;
}

.compact-ui .btn {
  padding: 6px 10px;
}

.compact-ui #pageNumber {
  width: 52px;
}

.compact-ui .icon-btn,
.compact-ui .zoom-btn {
  width: 34px;
  height: 30px;
}

.compact-ui .zoom-icon {
  font-size: 19px;
}

.compact-ui #zoomLabel {
  display: none !important;
}

@media (max-width: 900px) {
  #toolbar {
    gap: 6px;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 8px 10px;
  }

  #toolbar::-webkit-scrollbar {
    display: none;
  }

  .toolbar-group {
    flex: 0 0 auto !important;
  }

  .toolbar-group.right {
    display: none;
  }

  #viewerContainer {
    padding: 12px 8px 24px;
  }

  .btn {
    padding: 6px 10px;
  }

  #pageNumber {
    width: 52px;
  }

  .icon-btn,
  .zoom-btn {
    width: 34px;
    height: 30px;
  }

  .zoom-icon {
    font-size: 19px;
  }

  #zoomLabel {
    display: none !important;
  }
}

@media (min-width: 901px) {
  #toolbar {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  #zoomLabel {
    display: inline;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.toolbar-group {
  flex: 0 0 auto;
}
