/* ==========================================================================
   DocuHub Static — Custom Stylesheet (assets/styles.css)
   ========================================================================== */

/* 1. Smooth Scroll & Custom Scrollbars */
html {
  scroll-behavior: smooth;
}

.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.dark .custom-scrollbar {
  scrollbar-color: rgba(71, 85, 105, 0.55) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.45);
  border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 116, 139, 0.7);
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(71, 85, 105, 0.6);
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 116, 139, 0.85);
}

/* 2. Desktop Sidebar & Right Panel Collapse States */
@media (min-width: 1024px) {
  aside#left-sidebar.sidebar-collapsed {
    margin-left: -280px;
  }
}

aside#right-panel.panel-open-mobile {
  display: flex !important;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  box-shadow: -8px 0 24px -4px rgba(15, 23, 42, 0.18);
}

/* 3. Markdown Typography & Code Block Copy Button */
#markdown-container pre {
  position: relative;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background-color: #f8fafc !important;
  overflow: hidden;
}

.dark #markdown-container pre {
  border-color: #1e293b;
  background-color: #0f172a !important;
}

#markdown-container pre code.hljs {
  display: block;
  overflow-x: auto;
  padding: 2.5rem 1.15rem 1rem 1.15rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.65;
  background: transparent !important;
}

.code-block-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.75rem;
  background-color: rgba(226, 232, 240, 0.55);
  border-bottom: 1px solid rgba(203, 213, 225, 0.6);
  font-family: 'Inter', sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dark .code-block-header {
  background-color: rgba(30, 41, 59, 0.75);
  border-bottom-color: rgba(51, 65, 85, 0.65);
  color: #94a3b8;
}

.copy-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: #475569;
  background-color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(203, 213, 225, 0.8);
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-code-btn:hover {
  background-color: #ffffff;
  color: #2563eb;
  border-color: #93c5fd;
}

.dark .copy-code-btn {
  color: #cbd5e1;
  background-color: rgba(15, 23, 42, 0.7);
  border-color: rgba(71, 85, 105, 0.8);
}

.dark .copy-code-btn:hover {
  background-color: #1e293b;
  color: #60a5fa;
  border-color: #3b82f6;
}

/* Inline code pills */
#markdown-container :not(pre) > code {
  padding: 0.15rem 0.375rem;
  border-radius: 0.375rem;
  background-color: #f1f5f9;
  color: #0f172a;
  font-weight: 500;
  font-size: 0.85em;
}

.dark #markdown-container :not(pre) > code {
  background-color: #1e293b;
  color: #e2e8f0;
}

#markdown-container :not(pre) > code::before,
#markdown-container :not(pre) > code::after {
  content: none !important;
}

/* Markdown Tables */
#markdown-container table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

/* 4. PDF Canvas & Thumbnail Styling */
.pdf-page-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s ease;
}

.pdf-canvas {
  display: block;
  background-color: #ffffff;
  border-radius: 4px;
  box-shadow:
    0 10px 25px -5px rgba(15, 23, 42, 0.18),
    0 8px 10px -6px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(15, 23, 42, 0.06);
  max-width: 100%;
  height: auto;
}

.dark .pdf-canvas {
  box-shadow:
    0 12px 30px -5px rgba(0, 0, 0, 0.55),
    0 8px 12px -6px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.pdf-thumbnail-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  border-radius: 0.625rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pdf-thumbnail-item:hover {
  background-color: rgba(148, 163, 184, 0.14);
}

.pdf-thumbnail-item.active {
  background-color: rgba(37, 99, 235, 0.08);
  border-color: #3b82f6;
}

.dark .pdf-thumbnail-item.active {
  background-color: rgba(59, 130, 246, 0.15);
  border-color: #60a5fa;
}

.pdf-thumbnail-canvas {
  background-color: #ffffff;
  border-radius: 0.25rem;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
  max-width: 140px;
  height: auto;
}

/* 5. Remove Spin Buttons from Page Input */
#pdf-page-input::-webkit-outer-spin-button,
#pdf-page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#pdf-page-input {
  -moz-appearance: textfield;
}

/* 6. Toast Animation */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-enter {
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
