/* === DriveHQ viewer theme overrides (ported from old viewer.htm) === */

/* Force light theme to match old DriveHQ viewer appearance */
:root {
  color-scheme: light;
  --body-bg-color: #f0f0f0;
  --toolbar-bg-color: #f5f5f5;
  --toolbar-border-color: #dcdcdc;
  --toolbar-box-shadow: 0 1px 0 var(--toolbar-border-color);
  --sidebar-bg-color: #ffffff;
  --doorhanger-bg-color: #ffffff;
  --doorhanger-border-color: rgba(0, 0, 0, 0.15);
  --doorhanger-hover-color: rgba(0, 0, 0, 0.9);
  --doorhanger-separator-color: #dcdcdc;
}

body,
.toolbar,
.toolbarButton,
.secondaryToolbarButton,
.overlayButton,
.editorParamsLabel,
.toolbarLabel {
  font-family: Verdana, Arial, sans-serif;
}

#viewerContainer {
  background-color: #f0f0f0;
}

#sidebarContainer {
  border-top: 1px solid #dcdcdc;
}

#toolbarSidebar {
  background-color: #f5f5f5;
  background-image: none;
}

html[dir="ltr"] #sidebarContent {
  box-shadow: inset -1px 0 0 #dcdcdc;
}

html[dir="rtl"] #sidebarContent {
  box-shadow: inset 1px 0 0 #dcdcdc;
}

#toolbarContainer,
.findbar,
.secondaryToolbar {
  background-color: #f5f5f5;
  background-image: none;
}

html[dir="ltr"] #toolbarContainer,
html[dir="rtl"] #toolbarContainer,
html[dir="ltr"] .findbar,
html[dir="rtl"] .findbar,
html[dir="ltr"] .secondaryToolbar,
html[dir="rtl"] .secondaryToolbar {
  box-shadow: inset 0 -1px 0 #dcdcdc, 0 1px 2px rgba(0, 0, 0, 0.06);
}

html[dir="ltr"] #toolbarSidebar {
  box-shadow: inset -1px 0 0 #dcdcdc, inset 0 -1px 0 #dcdcdc;
}

html[dir="rtl"] #toolbarSidebar {
  box-shadow: inset 1px 0 0 #dcdcdc, inset 0 -1px 0 #dcdcdc;
}

#loadingBar {
  background-color: #dcdcdc;
  border-bottom: 1px solid #dcdcdc;
}

.doorHanger,
.doorHangerRight {
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.doorHanger:after,
.doorHangerRight:after {
  border-bottom-color: #f5f5f5;
}

.doorHanger:before,
.doorHangerRight:before {
  border-bottom-color: rgba(0, 0, 0, 0.15);
}

.toolbarButton,
.dropdownToolbarButton,
.secondaryToolbarButton,
.overlayButton {
  color: rgba(0, 0, 0, 0.75);
}

.toolbarLabel {
  color: rgba(0, 0, 0, 0.6);
}

.toolbarField {
  background-color: #ffffff;
  background-image: none;
  border: 1px solid #c4c4c4;
  color: #333333;
  box-shadow: none;
}

.toolbarField:hover {
  background-color: #ffffff;
  border-color: #999999;
}

.toolbarField:focus {
  background-color: #ffffff;
  border-color: #229ef7;
}

.dropdownToolbarButton > select {
  color: #333333;
}

.dropdownToolbarButton > select > option {
  background: #ffffff;
  color: #333333;
}

.splitToolbarButtonSeparator {
  background-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.splitToolbarButton:hover > .toolbarButton,
.splitToolbarButton:focus > .toolbarButton,
.splitToolbarButton.toggled > .toolbarButton,
.toolbarButton.textButton {
  background-color: rgba(0, 0, 0, 0.06);
  background-image: none;
  border: 1px solid #c4c4c4;
  box-shadow: none;
}

.splitToolbarButton > .toolbarButton:hover,
.splitToolbarButton > .toolbarButton:focus,
.dropdownToolbarButton:hover,
.overlayButton:hover,
.overlayButton:focus,
.toolbarButton.textButton:hover,
.toolbarButton.textButton:focus {
  background-color: rgba(0, 0, 0, 0.1);
  box-shadow: none;
}

/* Page border styling */
.pdfViewer .page {
  border: 1px solid #d0d0d0;
  border-image: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  margin: 5px auto;
}

/* Hide download/save buttons (viewer may re-enable them via JS) */
#downloadButton,
#secondaryDownload {
  display: none !important;
}

/* Icons for DriveHQ toolbar buttons (reuse PDF.js mask-image vars) */
#drivehqHandTool::before {
  -webkit-mask-image: var(--secondaryToolbarButton-handTool-icon);
  mask-image: var(--secondaryToolbarButton-handTool-icon);
}

#drivehqRotateLeft::before {
  -webkit-mask-image: var(--secondaryToolbarButton-rotateCcw-icon);
  mask-image: var(--secondaryToolbarButton-rotateCcw-icon);
}

#drivehqRotateRight::before {
  -webkit-mask-image: var(--secondaryToolbarButton-rotateCw-icon);
  mask-image: var(--secondaryToolbarButton-rotateCw-icon);
}

/* === DriveHQ overlay styles === */

.drivehqLoading,
.drivehqError {
  position: fixed;
  left: 50%;
  z-index: 1000;
  width: min(360px, calc(100vw - 32px));
  transform: translateX(-50%);
  box-sizing: border-box;
}

.drivehqLoading {
  top: 96px;
  padding: 12px 16px;
  border: 1px solid #1f4f9a;
  border-radius: 6px;
  background: #26397e;
  color: #ffffff;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.drivehqLoading.is-hidden,
.drivehqError.is-hidden {
  display: none;
}

/* CSS spinner (replaces old Spinner-1.5s-48px.gif) */
.drivehqSpinner {
  width: 32px;
  height: 32px;
  margin: 0 auto 8px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: drivehq-spin 0.8s linear infinite;
}

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

.drivehqError {
  top: 100px;
  padding: 14px 16px 16px;
  border-radius: 6px;
  background: #26397e;
  color: #ffffff;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.drivehqError.is-office {
  background: #26397e;
}

.drivehqErrorTitle {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
}

.drivehqErrorMessage {
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.drivehqActionBar {
  margin-top: 12px;
}

.drivehqActionButton {
  display: inline-block;
  min-width: 72px;
  margin: 0 6px;
  padding: 6px 12px;
  border: 0;
  border-radius: 4px;
  background: #229ef7;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
  color: #ffffff;
  text-decoration: none;
  font-size: 12px;
  font-weight: bold;
  line-height: 1.4;
  cursor: pointer;
}

.drivehqActionButton:hover,
.drivehqActionButton:focus {
  background: #1089e2;
  color: #ffffff;
  text-decoration: none;
}

.drivehqActionButton:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/* === Secondary toolbar (right dropdown) refinements === */

#secondaryToolbar {
  width: 244px;
  border-radius: 6px;
  padding-block: 4px;
}

#secondaryToolbarButtonContainer {
  padding-block: 2px;
}

#secondaryToolbarButtonContainer .toolbarButton.labeled {
  font-family: "Segoe UI", Verdana, Geneva, Arial, sans-serif;
  font-size: 13px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.4;
  color: #333333;
  min-height: 30px;
  padding-inline-start: 14px;
  gap: 10px;
  border-radius: 3px;
  margin-inline: 4px;
  transition: background-color 0.12s ease, color 0.12s ease;
}

#secondaryToolbarButtonContainer .toolbarButton.labeled > span {
  letter-spacing: 0.1px;
}

#secondaryToolbarButtonContainer .toolbarButton.labeled::before {
  opacity: 0.85;
}

#secondaryToolbarButtonContainer .toolbarButton.labeled:is(:hover, :focus-visible) {
  background-color: #26397e;
  color: #ffffff;
}

#secondaryToolbarButtonContainer .toolbarButton.labeled:is(:hover, :focus-visible)::before {
  background-color: #ffffff;
  opacity: 1;
}

/* Selected radio option (cursor tool / scroll mode / spread mode) */
#secondaryToolbarButtonContainer .toolbarButton.labeled.toggled {
  background-color: #e8ebf5;
  color: #26397e;
  font-weight: 600;
}

#secondaryToolbarButtonContainer .toolbarButton.labeled.toggled::before {
  background-color: #26397e;
  opacity: 1;
}

#secondaryToolbarButtonContainer .toolbarButton.labeled.toggled:is(:hover, :focus-visible) {
  background-color: #26397e;
  color: #ffffff;
}

#secondaryToolbarButtonContainer .toolbarButton.labeled.toggled:is(:hover, :focus-visible)::before {
  background-color: #ffffff;
}

#secondaryToolbarButtonContainer .horizontalToolbarSeparator {
  margin: 5px 8px;
  border-top-color: #e3e3e3;
}
