/* Dark theme overrides for react-pdf-viewer */
.rpv-core__viewer {
  background-color: #334155 !important;
  color: #e2e8f0 !important;
  height: 100% !important;
  overflow: auto !important;
}

.rpv-core__viewer-container {
  height: 100% !important;
  overflow: hidden !important;
}

.rpv-core__inner-container {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

.rpv-core__inner-pages {
  flex: 1 !important;
  overflow: auto !important;
  padding: 16px !important;
}

.rpv-core__page {
  background-color: #fff !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
  margin-bottom: 16px !important;
  max-width: 100% !important;
}

.rpv-core__page-layer {
  background-color: #fff !important;
}

/* Toolbar styling */
.rpv-core__toolbar {
  background-color: #1e293b !important;
  border-bottom: 1px solid #475569 !important;
  flex-shrink: 0 !important;
}

.rpv-core__toolbar-item {
  color: #e2e8f0 !important;
}

.rpv-core__toolbar-item:hover {
  background-color: #475569 !important;
}

.rpv-core__textbox {
  background-color: #475569 !important;
  border: 1px solid #64748b !important;
  color: #e2e8f0 !important;
}

.rpv-core__textbox:focus {
  border-color: #0d9488 !important;
  outline: none !important;
  box-shadow: 0 0 0 1px #0d9488 !important;
}

.rpv-core__button {
  background-color: #475569 !important;
  border: 1px solid #64748b !important;
  color: #e2e8f0 !important;
}

.rpv-core__button:hover {
  background-color: #64748b !important;
}

.rpv-core__button--primary {
  background-color: #0d9488 !important;
  border-color: #0d9488 !important;
}

.rpv-core__button--primary:hover {
  background-color: #0f766e !important;
}

/* Text selection */
.rpv-core__text-layer-selection {
  background-color: rgba(59, 130, 246, 0.3) !important;
}

/* Scrollbar styles for better visibility in dark theme */
.rpv-core__viewer::-webkit-scrollbar,
.rpv-core__inner-pages::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.rpv-core__viewer::-webkit-scrollbar-track,
.rpv-core__inner-pages::-webkit-scrollbar-track {
  background: #1e293b;
}

.rpv-core__viewer::-webkit-scrollbar-thumb,
.rpv-core__inner-pages::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}

.rpv-core__viewer::-webkit-scrollbar-thumb:hover,
.rpv-core__inner-pages::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Loading screen styles */
.rpv-core__loader {
  background-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* Search popup styles */
.rpv-search__popover {
  background-color: #1e293b !important;
  border: 1px solid #475569 !important;
  color: #e2e8f0 !important;
}

.rpv-search__input {
  background-color: #475569 !important;
  border: 1px solid #64748b !important;
  color: #e2e8f0 !important;
}

.rpv-search__input:focus {
  border-color: #0d9488 !important;
  outline: none !important;
  box-shadow: 0 0 0 1px #0d9488 !important;
}

/* Zoom control styles */
.rpv-zoom__popover {
  background-color: #1e293b !important;
  border: 1px solid #475569 !important;
  color: #e2e8f0 !important;
}

.rpv-zoom__popover-item {
  color: #e2e8f0 !important;
}

.rpv-zoom__popover-item:hover {
  background-color: #475569 !important;
}

/* Hide download button specifically */
.rpv-get-file__download-button,
.rpv-toolbar__item[title*="Download"],
.rpv-toolbar__item[aria-label*="Download"],
.rpv-core__toolbar-item[title*="Download"],
.rpv-core__toolbar-item[aria-label*="Download"],
.rpv-default-layout__toolbar-item[title*="Download"],
.rpv-default-layout__toolbar-item[aria-label*="Download"] {
  display: none !important;
}

/* Ensure PDF pages are properly contained */
.rpv-core__page-container {
  max-width: 100% !important;
  margin: 0 auto 16px auto !important;
}

/* Fix any overflow issues */
.rpv-core__doc {
  overflow: visible !important;
}

/* Custom styling for our container */
.pdf-viewer-container {
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.pdf-viewer-container .rpv-core__viewer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .rpv-core__toolbar {
    flex-wrap: wrap;
    gap: 2px;
  }
  
  .rpv-core__toolbar-item {
    font-size: 12px;
    padding: 4px 6px;
  }
  
  .rpv-core__textbox {
    width: 40px;
  }
  
  .rpv-core__inner-pages {
    padding: 8px !important;
  }
  
  .rpv-core__page {
    margin-bottom: 8px !important;
  }
}

/* Ensure text selection works properly */
.rpv-core__text-layer {
  pointer-events: auto !important;
  user-select: text !important;
}