/* ========================================
 * pdf-view-main.css
 * Styles for the PDF viewer component
 * Refactored to use central CSS for styling
 * Styling delegated to: /static/css/common.css, /static/css/components/*.css
 * ======================================== */

/* ========================================
 * PDF Viewer Controls
 * ======================================== */

.pdf-viewer-controls {
  /* background: var(--scitex-light); */ /* Styling from central CSS */
  /* border-bottom: 1px solid #dee2e6; */ /* Styling from central CSS */
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ========================================
 * PDF Canvas
 * ======================================== */

.pdf-viewer-canvas {
  /* background: var(--scitex-light); */ /* Styling from central CSS */
  overflow-y: auto;
  padding: 0; /* Remove padding for full-screen PDF display */
  margin: 0;
  width: 100%;
  height: 100%;
}

/* Ensure PDF canvas takes full height when in preview mode */
.preview-panel .pdf-viewer-canvas {
  padding: 0 !important;
  margin: 0 !important;
}

/* ========================================
 * PDF Sidebar Outline
 * ======================================== */

.pdf-sidebar-outline {
  position: fixed;
  left: -300px;
  top: 0;
  width: 300px;
  height: 100vh;
  /* background: var(--scitex-white); */ /* Styling from central CSS */
  /* border-right: 1px solid #dee2e6; */ /* Styling from central CSS */
  /* transition: left 0.3s ease; */ /* Styling from central CSS */
  z-index: 100; /* Lowered to stay below Monaco widgets */
  overflow-y: auto;
}

.pdf-sidebar-outline.open {
  left: 0;
}

.pdf-outline-header {
  padding: 1rem;
  /* border-bottom: 1px solid #dee2e6; */ /* Styling from central CSS */
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  /* background: var(--scitex-white); */ /* Styling from central CSS */
  z-index: 10;
}

.pdf-outline-items {
  padding: 0.5rem;
}

/* ========================================
 * PDF Outline Items (Generic)
 * ======================================== */

.pdf-outline-item-wrapper {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  /* border-radius: 4px; */ /* Styling from central CSS */
  /* transition: background 0.2s; */ /* Styling from central CSS */
  /* color: var(--scitex-primary); */ /* Styling from central CSS */
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pdf-outline-item-wrapper:hover {
  /* background: var(--scitex-light); */ /* Styling from central CSS */
}

.pdf-outline-item-wrapper.level-1 {
  padding-left: 0.75rem;
}

.pdf-outline-item-wrapper.level-2 {
  padding-left: 2rem;
}

.pdf-outline-item-wrapper.level-3 {
  padding-left: 3rem;
}

.pdf-outline-toggle-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* font-size: 0.75rem; */ /* Styling from central CSS */
  /* transition: transform 0.2s; */ /* Styling from central CSS */
  flex-shrink: 0;
}

.pdf-outline-toggle-icon.collapsed {
  /* transform: rotate(-90deg); */ /* Styling from central CSS */
}

.pdf-outline-children {
  overflow: hidden;
  /* transition: max-height 0.3s ease; */ /* Styling from central CSS */
}

.pdf-outline-children.collapsed {
  max-height: 0 !important;
}

.pdf-outline-title {
  flex: 1;
  user-select: none;
}

/* ========================================
 * PDF Outline Items (Writer-specific)
 * ======================================== */

.pdf-outline-item-writer {
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  /* border-radius: 4px; */ /* Styling from central CSS */
  /* transition: background 0.2s; */ /* Styling from central CSS */
  /* font-size: 0.8rem; */ /* Styling from central CSS */
  /* color: var(--text-primary); */ /* Styling from central CSS */
}

.pdf-outline-item-writer:hover {
  /* background: var(--workspace-bg-secondary); */ /* Styling from central CSS */
}

.pdf-outline-child-writer {
  padding-left: 1.5rem;
  /* font-size: 0.75rem; */ /* Styling from central CSS */
  /* color: var(--text-muted); */ /* Styling from central CSS */
}

/* ========================================
 * PDF Overlay
 * ======================================== */

.pdf-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* background: rgba(0, 0, 0, 0.5); */ /* Styling from central CSS */
  display: none;
  z-index: 99; /* Lowered to stay below Monaco widgets */
}

.pdf-overlay.open {
  display: block;
}

/* ========================================
 * PDF Preview Embed Styling
 * Ensure no spacing around embedded PDFs
 * ======================================== */

.pdf-preview-container embed,
.pdf-viewer-canvas embed {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  border: none;
}

/* Full-screen PDF display */
.pdf-preview-viewer {
  padding: 0 !important;
  margin: 0 !important;
}

.pdf-preview-viewer embed {
  margin: 0 !important;
  padding: 0 !important;
}

/* ========================================
 * PDF Context Menu (right-click)
 * ======================================== */

.pdf-context-menu {
  display: none;
  position: fixed;
  z-index: 10000;
  min-width: 180px;
  background: var(--workspace-bg-secondary, #1e1e1e);
  border: 1px solid var(--workspace-border-default, #3a3a3a);
  border-radius: 6px;
  padding: 4px 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.pdf-context-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 14px;
  border: none;
  background: none;
  color: var(--text-primary, #e0e0e0);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.pdf-context-menu button:hover {
  background: var(--workspace-bg-tertiary, #2d2d2d);
}

.pdf-context-menu button i {
  width: 14px;
  text-align: center;
  color: var(--text-muted, #888);
  font-size: 11px;
}

[data-theme="light"] .pdf-context-menu {
  background: var(--workspace-bg-secondary);
  border-color: var(--workspace-border-default);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}
