/* ========================================
   PanConverter v1.7.1 - Modern UI
   Glassmorphism, Gradients & Animations
   ======================================== */

/* Modern Color Palette */
:root {
  /* Primary Brand Colors - Purple-Blue Gradient */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --primary-light: #8b9aff;
  --primary-dark: #5661b3;

  /* Accent Colors */
  --accent-green: #10b981;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;

  /* Semantic Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* Neutral Colors */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Semantic UI Colors (Light Theme Default) */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --border-color: #e5e7eb;
  --border-color-strong: #d1d5db;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);

  /* Effects */
  --blur-amount: 10px;
  --transition-speed: 0.3s;
  --transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base styles - Reset is in styles.css */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
  height: 100vh;
  /* Background controlled by themes - do not set here */
  color: var(--gray-900);
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 4px 8px;
  gap: 2px;
}

/* Glass Container for main content */
.main-content-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-amount));
  -webkit-backdrop-filter: blur(var(--blur-amount));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Tab Bar - Modern Glassmorphism */
.tab-bar {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 4px 8px;
  min-height: 36px;
  gap: 4px;
  border-radius: 8px;
}

.tab {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  margin-right: 4px;
  cursor: pointer;
  user-select: none;
  max-width: 200px;
  min-width: 120px;
  transition: all var(--transition-speed) var(--transition-ease);
  transform: translateY(0);
}

.tab:hover {
  background: rgba(0, 0, 0, 0.05);
}

.tab.active {
  background: #ffffff;
  color: #24292e;
  border-bottom: 2px solid #0366d6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tab-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}

.tab-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  padding: 4px;
  margin-left: 8px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: currentColor;
  transition: all var(--transition-speed) var(--transition-ease);
}

.tab-close:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: rotate(90deg);
}

.new-tab-button {
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  transition: all var(--transition-speed) var(--transition-ease);
  display: flex;
  align-items: center;
  gap: 6px;
}

.new-tab-button:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Toolbar - Modern Gradient Buttons */
.toolbar {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  gap: 2px;
  border-radius: 8px;
}

.toolbar button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: #586069;
}

.toolbar button:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #24292e;
}

.toolbar button:active {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(0.95);
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  margin: 0 8px;
}

/* Tab Content */
.tab-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.tab-content:not(.active) {
  display: none;
}

/* Editor Container */
.editor-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  border-radius: 0 0 20px 20px;
}

.pane {
  flex: 1;
  overflow: auto;
  min-width: 0;
}

.pane:first-child {
  border-right: 1px solid rgba(255, 255, 255, 0.3);
}

/* Custom Scrollbar */
.pane::-webkit-scrollbar,
.editor-textarea::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.pane::-webkit-scrollbar-track,
.editor-textarea::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.pane::-webkit-scrollbar-thumb,
.editor-textarea::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.pane::-webkit-scrollbar-thumb:hover,
.editor-textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.4);
}

.editor-textarea {
  width: 100%;
  height: 100%;
  padding: 24px;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 15px;
  line-height: 1.7;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  /* Color controlled by theme */
}

/* CodeMirror container */
.codemirror-container {
  height: 100%;
  overflow: auto;
}
.codemirror-container .cm-editor {
  height: 100%;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 14px;
}
.codemirror-container .cm-scroller {
  overflow: auto;
}

.pane:last-child {
  padding: 0;
  /* Background controlled by theme */
}

.preview-content {
  max-width: none;
  margin: 0;
  padding: 24px 32px;
  line-height: 1.8;
  font-size: 15px;
  /* Color controlled by theme */
}

/* Status Bar */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 12px;
  /* Background and color controlled by theme */
  font-size: 12px;
  font-weight: 500;
  min-height: 24px;
  flex-shrink: 0;
}

/* Preview Styles - Modern Typography */
.preview-content h1, .preview-content h2, .preview-content h3 {
  /* Color controlled by theme */
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 16px;
  line-height: 1.3;
}

.preview-content h1 {
  font-size: 2.5em;
  border-bottom: 3px solid #e1e4e8;
  padding-bottom: 12px;
}

.preview-content h2 {
  font-size: 2em;
  border-bottom: 2px solid #e1e4e8;
  padding-bottom: 10px;
}

.preview-content p {
  margin-bottom: 18px;
  line-height: 1.8;
}

.preview-content code {
  padding: 3px 8px;
  margin: 0 2px;
  font-size: 90%;
  background: rgba(175, 184, 193, 0.2);
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-weight: 500;
}

.preview-content pre {
  padding: 20px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
  background: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.preview-content pre code {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

.preview-content blockquote {
  padding: 16px 20px;
  color: var(--gray-700);
  border-left: 4px solid #e1e4e8;
  margin-bottom: 20px;
  background: #f6f8fa;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}

.preview-content a {
  color: #0366d6;
  text-decoration: none;
  font-weight: 600;
  position: relative;
  transition: color var(--transition-speed);
}

.preview-content a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: #0366d6;
  transition: width var(--transition-speed) var(--transition-ease);
}

.preview-content a:hover {
  color: #0366d6;
}

.preview-content a:hover::after {
  width: 100%;
}

.preview-content table {
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 20px;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.preview-content table th,
.preview-content table td {
  padding: 12px 16px;
  border: 1px solid #e1e4e8;
}

.preview-content table th {
  font-weight: 600;
  background: #f0f0f0;
  color: #333333;
}

.preview-content table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.5);
}

/* Modern Dialogs */
.export-dialog,
.batch-dialog,
.find-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s var(--transition-ease);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.export-dialog.hidden,
.batch-dialog.hidden {
  display: none;
}

.export-dialog-content,
.batch-dialog-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUpFade 0.4s var(--transition-ease);
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.export-dialog-header,
.batch-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e1e4e8;
  background: #24292e;
  border-radius: 20px 20px 0 0;
}

.export-dialog-header h3,
.batch-dialog-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.export-dialog-body,
.batch-dialog-body {
  padding: 24px;
}

.export-section,
.batch-section {
  margin-bottom: 20px;
}

.export-section label,
.batch-section label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--gray-700);
  font-size: 14px;
}

.export-section select,
.export-section input,
.batch-section select,
.batch-section input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e1e4e8;
  border-radius: 10px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(5px);
  transition: all var(--transition-speed) var(--transition-ease);
}

.export-section select:focus,
.export-section input:focus,
.batch-section select:focus,
.batch-section input:focus {
  outline: none;
  border-color: #0366d6;
  box-shadow: 0 0 0 4px rgba(3, 102, 214, 0.1);
  background: white;
}

/* Modern Buttons */
.export-dialog-footer,
.batch-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #e1e4e8;
  background: #f6f8fa;
  border-radius: 0 0 20px 20px;
}

.export-dialog-footer button,
.batch-dialog-footer button,
.folder-input-group button {
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-speed) var(--transition-ease);
  position: relative;
  overflow: hidden;
}

.export-dialog-footer button.primary,
.batch-dialog-footer button.primary {
  background: #2ea44f;
  color: white;
  box-shadow: 0 4px 12px rgba(46, 164, 79, 0.3);
}

.export-dialog-footer button.primary:hover,
.batch-dialog-footer button.primary:hover {
  transform: translateY(-2px);
  background: #22863a;
  box-shadow: 0 6px 20px rgba(34, 134, 58, 0.4);
}

.export-dialog-footer button:not(.primary),
.batch-dialog-footer button:not(.primary),
.folder-input-group button {
  background: #fafbfc;
  color: var(--gray-700);
  border: 1px solid #e1e4e8;
}

.export-dialog-footer button:not(.primary):hover,
.batch-dialog-footer button:not(.primary):hover,
.folder-input-group button:hover {
  background: #f3f4f6;
  border-color: #d0d7de;
  transform: translateY(-2px);
}

/* Find Dialog - Floating Modern */
.find-dialog {
  position: absolute;
  top: 70px;
  right: 24px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  min-width: 420px;
  padding: 16px;
  animation: slideInRight 0.3s var(--transition-ease);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.find-dialog.hidden {
  display: none;
}

/* Progress Bars - Modern Gradient */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e1e4e8;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: #2ea44f;
  transition: width 0.4s var(--transition-ease);
  width: 0%;
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Auto-save Indicator - Modern */
.auto-save-indicator {
  position: fixed;
  top: 24px;
  right: 24px;
  background: #2ea44f;
  color: white;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 10000;
  box-shadow: 0 4px 20px rgba(46, 164, 79, 0.3);
  animation: slideInRight 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auto-save-indicator::before {
  content: '✓';
  display: inline-block;
  width: 18px;
  height: 18px;
  background: white;
  color: #2ea44f;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Enhanced Statistics - Modern */
.enhanced-stats {
  font-size: 11px;
  color: var(--gray-600);
  padding: 2px 0;
  margin-left: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

/* Line Numbers - Modern */
.line-numbers {
  min-width: 50px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  border-right: 1px solid #e1e4e8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--gray-500);
  text-align: right;
  user-select: none;
  overflow: hidden;
}

.line-numbers.hidden {
  display: none;
}

/* Animations & Transitions */
.toolbar button,
.tab,
.new-tab-button,
.export-dialog-footer button,
.batch-dialog-footer button {
  position: relative;
  overflow: hidden;
}

.toolbar button::before,
.tab::before,
.new-tab-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.toolbar button:hover::before,
.tab:hover::before,
.new-tab-button:hover::before {
  width: 200px;
  height: 200px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 8px;
    gap: 8px;
  }

  .export-dialog-content,
  .batch-dialog-content {
    max-width: 95%;
  }

  .find-dialog {
    right: 12px;
    min-width: 320px;
  }
}

/* Hide default elements */
.pane.hidden {
  display: none;
}

.pane.full-width {
  border-right: none;
}

/* ========================================
   Dynamic Pane Resizer
   Draggable splitter between editor/preview
   ======================================== */

.pane-resizer {
  width: 6px;
  background: linear-gradient(to right, #e1e4e8, #d0d7de, #e1e4e8);
  cursor: col-resize;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s ease;
  border-radius: 3px;
}

.pane-resizer:hover {
  background: linear-gradient(to right, #0366d6, #0366d6, #0366d6);
}

.pane-resizer:active {
  background: #0366d6;
}

.pane-resizer::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 30px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 1px;
}

.pane-resizer:hover::before {
  background: rgba(255, 255, 255, 0.8);
}

/* Dark theme resizer */
body.theme-dark .pane-resizer,
body.theme-one-dark .pane-resizer,
body.theme-dracula .pane-resizer,
body.theme-nord .pane-resizer,
body.theme-tokyo-night .pane-resizer,
body.theme-palenight .pane-resizer,
body.theme-ayu-dark .pane-resizer,
body.theme-ayu-mirage .pane-resizer,
body.theme-oceanic-next .pane-resizer,
body.theme-gruvbox-dark .pane-resizer,
body.theme-cobalt2 .pane-resizer {
  background: linear-gradient(to right, #333, #444, #333);
}

body.theme-dark .pane-resizer:hover,
body.theme-one-dark .pane-resizer:hover,
body.theme-dracula .pane-resizer:hover {
  background: #61afef;
}

/* ========================================
   PDF Viewer Styles
   Full-featured PDF reader
   ======================================== */

.pdf-viewer-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #525659;
}

.pdf-viewer-container.hidden {
  display: none;
}

.pdf-viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #323639;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.pdf-viewer-toolbar button {
  background: #474a4d;
  border: 1px solid #5a5d60;
  border-radius: 4px;
  color: #fff;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s ease;
}

.pdf-viewer-toolbar button:hover {
  background: #5a5d60;
}

.pdf-viewer-toolbar button:active {
  background: #0366d6;
}

.pdf-toolbar-separator {
  width: 1px;
  height: 24px;
  background: #5a5d60;
  margin: 0 4px;
}

#pdf-page-info {
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
}

#pdf-page-input {
  width: 50px;
  padding: 4px 6px;
  border: 1px solid #5a5d60;
  border-radius: 4px;
  background: #474a4d;
  color: #fff;
  text-align: center;
  font-size: 13px;
}

#pdf-zoom-level {
  color: #fff;
  font-size: 13px;
  min-width: 50px;
  text-align: center;
}

.pdf-filename {
  color: #aaa;
  font-size: 12px;
  flex: 1;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 8px;
}

#pdf-close {
  background: #c0392b !important;
  border-color: #e74c3c !important;
}

#pdf-close:hover {
  background: #e74c3c !important;
}

/* PDF Editor Toolbar Buttons */
.pdf-editor-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #3498db, #2980b9) !important;
  border: 1px solid #2980b9 !important;
  color: #fff !important;
  padding: 5px 8px !important;
  font-size: 11px !important;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pdf-editor-btn:hover {
  background: linear-gradient(135deg, #2980b9, #1a5276) !important;
  transform: translateY(-1px);
}

.pdf-editor-btn:active {
  transform: translateY(0);
}

.pdf-editor-btn svg {
  flex-shrink: 0;
}

.pdf-editor-btn span {
  white-space: nowrap;
}

/* PDF toolbar wrapping for smaller screens */
.pdf-toolbar-main {
  flex-wrap: wrap;
  min-height: auto;
  padding: 6px 10px !important;
}

/* Light theme PDF toolbar - refined styling */
body.theme-light .pdf-viewer-toolbar,
body.theme-atomonelight .pdf-viewer-toolbar,
body.theme-github .pdf-viewer-toolbar,
body.theme-solarized .pdf-viewer-toolbar,
body.theme-gruvbox-light .pdf-viewer-toolbar,
body.theme-ayu-light .pdf-viewer-toolbar,
body.theme-sepia .pdf-viewer-toolbar,
body.theme-paper .pdf-viewer-toolbar,
body.theme-rosepine-dawn .pdf-viewer-toolbar {
  background: linear-gradient(180deg, #fafafa 0%, #f0f0f0 100%) !important;
  border-bottom: 1px solid #d0d0d0 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body.theme-light .pdf-viewer-toolbar button,
body.theme-atomonelight .pdf-viewer-toolbar button,
body.theme-github .pdf-viewer-toolbar button,
body.theme-solarized .pdf-viewer-toolbar button,
body.theme-gruvbox-light .pdf-viewer-toolbar button,
body.theme-ayu-light .pdf-viewer-toolbar button,
body.theme-sepia .pdf-viewer-toolbar button,
body.theme-paper .pdf-viewer-toolbar button,
body.theme-rosepine-dawn .pdf-viewer-toolbar button {
  background: #fff !important;
  border: 1px solid #ccc !important;
  color: #333 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

body.theme-light .pdf-viewer-toolbar button:hover,
body.theme-atomonelight .pdf-viewer-toolbar button:hover,
body.theme-github .pdf-viewer-toolbar button:hover,
body.theme-solarized .pdf-viewer-toolbar button:hover,
body.theme-gruvbox-light .pdf-viewer-toolbar button:hover,
body.theme-ayu-light .pdf-viewer-toolbar button:hover,
body.theme-sepia .pdf-viewer-toolbar button:hover,
body.theme-paper .pdf-viewer-toolbar button:hover,
body.theme-rosepine-dawn .pdf-viewer-toolbar button:hover {
  background: #e8e8e8 !important;
  border-color: #bbb !important;
}

/* Light theme PDF editor buttons */
body.theme-light .pdf-editor-btn,
body.theme-atomonelight .pdf-editor-btn,
body.theme-github .pdf-editor-btn,
body.theme-solarized .pdf-editor-btn,
body.theme-gruvbox-light .pdf-editor-btn,
body.theme-ayu-light .pdf-editor-btn,
body.theme-sepia .pdf-editor-btn,
body.theme-paper .pdf-editor-btn,
body.theme-rosepine-dawn .pdf-editor-btn {
  background: linear-gradient(135deg, #4a90d9, #357abd) !important;
  border: 1px solid #357abd !important;
}

body.theme-light .pdf-editor-btn:hover,
body.theme-atomonelight .pdf-editor-btn:hover,
body.theme-github .pdf-editor-btn:hover,
body.theme-solarized .pdf-editor-btn:hover,
body.theme-gruvbox-light .pdf-editor-btn:hover,
body.theme-ayu-light .pdf-editor-btn:hover,
body.theme-sepia .pdf-editor-btn:hover,
body.theme-paper .pdf-editor-btn:hover,
body.theme-rosepine-dawn .pdf-editor-btn:hover {
  background: linear-gradient(135deg, #357abd, #2868a0) !important;
}

/* Light theme page info */
body.theme-light #pdf-page-info,
body.theme-atomonelight #pdf-page-info,
body.theme-github #pdf-page-info,
body.theme-solarized #pdf-page-info,
body.theme-gruvbox-light #pdf-page-info,
body.theme-ayu-light #pdf-page-info,
body.theme-sepia #pdf-page-info,
body.theme-paper #pdf-page-info,
body.theme-rosepine-dawn #pdf-page-info,
body.theme-light #pdf-zoom-level,
body.theme-atomonelight #pdf-zoom-level,
body.theme-github #pdf-zoom-level,
body.theme-solarized #pdf-zoom-level,
body.theme-gruvbox-light #pdf-zoom-level,
body.theme-ayu-light #pdf-zoom-level,
body.theme-sepia #pdf-zoom-level,
body.theme-paper #pdf-zoom-level,
body.theme-rosepine-dawn #pdf-zoom-level {
  color: #444 !important;
  font-weight: 500;
}

body.theme-light #pdf-page-input,
body.theme-atomonelight #pdf-page-input,
body.theme-github #pdf-page-input,
body.theme-solarized #pdf-page-input,
body.theme-gruvbox-light #pdf-page-input,
body.theme-ayu-light #pdf-page-input,
body.theme-sepia #pdf-page-input,
body.theme-paper #pdf-page-input,
body.theme-rosepine-dawn #pdf-page-input {
  background: #fff !important;
  border: 1px solid #ccc !important;
  color: #333 !important;
}

body.theme-light .pdf-toolbar-separator,
body.theme-atomonelight .pdf-toolbar-separator,
body.theme-github .pdf-toolbar-separator,
body.theme-solarized .pdf-toolbar-separator,
body.theme-gruvbox-light .pdf-toolbar-separator,
body.theme-ayu-light .pdf-toolbar-separator,
body.theme-sepia .pdf-toolbar-separator,
body.theme-paper .pdf-toolbar-separator,
body.theme-rosepine-dawn .pdf-toolbar-separator {
  background: #d0d0d0 !important;
}

body.theme-light .pdf-filename,
body.theme-atomonelight .pdf-filename,
body.theme-github .pdf-filename,
body.theme-solarized .pdf-filename,
body.theme-gruvbox-light .pdf-filename,
body.theme-ayu-light .pdf-filename,
body.theme-sepia .pdf-filename,
body.theme-paper .pdf-filename,
body.theme-rosepine-dawn .pdf-filename {
  color: #555 !important;
}

/* Sepia theme specific */
body.theme-sepia .pdf-viewer-toolbar {
  background: linear-gradient(180deg, #f4f0e8 0%, #e8e4dc 100%) !important;
  border-bottom-color: #cdc8c0 !important;
}

body.theme-sepia .pdf-viewer {
  background: #d8d4cc !important;
}

/* Rose Pine Dawn specific */
body.theme-rosepine-dawn .pdf-viewer-toolbar {
  background: linear-gradient(180deg, #faf4ed 0%, #f2e9e1 100%) !important;
  border-bottom-color: #ddd8d1 !important;
}

body.theme-rosepine-dawn .pdf-viewer {
  background: #e6e0d8 !important;
}

/* Dark theme PDF toolbar refinement */
body.theme-dark .pdf-viewer-toolbar,
body.theme-onedark .pdf-viewer-toolbar,
body.theme-one-dark .pdf-viewer-toolbar,
body.theme-dracula .pdf-viewer-toolbar,
body.theme-nord .pdf-viewer-toolbar,
body.theme-tokyo-night .pdf-viewer-toolbar,
body.theme-tokyonight .pdf-viewer-toolbar,
body.theme-palenight .pdf-viewer-toolbar,
body.theme-monokai .pdf-viewer-toolbar,
body.theme-material .pdf-viewer-toolbar,
body.theme-gruvbox-dark .pdf-viewer-toolbar,
body.theme-ayu-dark .pdf-viewer-toolbar,
body.theme-ayu-mirage .pdf-viewer-toolbar,
body.theme-oceanic-next .pdf-viewer-toolbar,
body.theme-cobalt2 .pdf-viewer-toolbar,
body.theme-concrete-dark .pdf-viewer-toolbar,
body.theme-concrete-warm .pdf-viewer-toolbar {
  background: linear-gradient(180deg, #2d2d2d 0%, #252525 100%) !important;
  border-bottom: 1px solid #1a1a1a !important;
}

body.theme-dark .pdf-viewer-toolbar button,
body.theme-onedark .pdf-viewer-toolbar button,
body.theme-one-dark .pdf-viewer-toolbar button,
body.theme-dracula .pdf-viewer-toolbar button,
body.theme-nord .pdf-viewer-toolbar button,
body.theme-tokyo-night .pdf-viewer-toolbar button,
body.theme-tokyonight .pdf-viewer-toolbar button,
body.theme-palenight .pdf-viewer-toolbar button,
body.theme-monokai .pdf-viewer-toolbar button,
body.theme-material .pdf-viewer-toolbar button,
body.theme-gruvbox-dark .pdf-viewer-toolbar button,
body.theme-ayu-dark .pdf-viewer-toolbar button,
body.theme-ayu-mirage .pdf-viewer-toolbar button,
body.theme-oceanic-next .pdf-viewer-toolbar button,
body.theme-cobalt2 .pdf-viewer-toolbar button,
body.theme-concrete-dark .pdf-viewer-toolbar button,
body.theme-concrete-warm .pdf-viewer-toolbar button {
  background: #3d3d3d !important;
  border: 1px solid #4d4d4d !important;
  color: #e0e0e0 !important;
}

body.theme-dark .pdf-viewer-toolbar button:hover,
body.theme-onedark .pdf-viewer-toolbar button:hover,
body.theme-one-dark .pdf-viewer-toolbar button:hover,
body.theme-dracula .pdf-viewer-toolbar button:hover,
body.theme-nord .pdf-viewer-toolbar button:hover,
body.theme-tokyo-night .pdf-viewer-toolbar button:hover,
body.theme-tokyonight .pdf-viewer-toolbar button:hover,
body.theme-palenight .pdf-viewer-toolbar button:hover,
body.theme-monokai .pdf-viewer-toolbar button:hover,
body.theme-material .pdf-viewer-toolbar button:hover,
body.theme-gruvbox-dark .pdf-viewer-toolbar button:hover,
body.theme-ayu-dark .pdf-viewer-toolbar button:hover,
body.theme-ayu-mirage .pdf-viewer-toolbar button:hover,
body.theme-oceanic-next .pdf-viewer-toolbar button:hover,
body.theme-cobalt2 .pdf-viewer-toolbar button:hover,
body.theme-concrete-dark .pdf-viewer-toolbar button:hover,
body.theme-concrete-warm .pdf-viewer-toolbar button:hover {
  background: #4d4d4d !important;
  border-color: #5d5d5d !important;
}

body.theme-dark .pdf-viewer,
body.theme-onedark .pdf-viewer,
body.theme-one-dark .pdf-viewer,
body.theme-dracula .pdf-viewer,
body.theme-nord .pdf-viewer,
body.theme-tokyo-night .pdf-viewer,
body.theme-tokyonight .pdf-viewer,
body.theme-palenight .pdf-viewer,
body.theme-monokai .pdf-viewer,
body.theme-material .pdf-viewer,
body.theme-gruvbox-dark .pdf-viewer,
body.theme-ayu-dark .pdf-viewer,
body.theme-ayu-mirage .pdf-viewer,
body.theme-oceanic-next .pdf-viewer,
body.theme-cobalt2 .pdf-viewer,
body.theme-concrete-dark .pdf-viewer,
body.theme-concrete-warm .pdf-viewer {
  background: #1a1a1a !important;
}

body.theme-dark .pdf-viewer-container,
body.theme-onedark .pdf-viewer-container,
body.theme-one-dark .pdf-viewer-container,
body.theme-dracula .pdf-viewer-container,
body.theme-nord .pdf-viewer-container,
body.theme-tokyo-night .pdf-viewer-container,
body.theme-tokyonight .pdf-viewer-container,
body.theme-palenight .pdf-viewer-container,
body.theme-monokai .pdf-viewer-container,
body.theme-material .pdf-viewer-container,
body.theme-gruvbox-dark .pdf-viewer-container,
body.theme-ayu-dark .pdf-viewer-container,
body.theme-ayu-mirage .pdf-viewer-container,
body.theme-oceanic-next .pdf-viewer-container,
body.theme-cobalt2 .pdf-viewer-container,
body.theme-concrete-dark .pdf-viewer-container,
body.theme-concrete-warm .pdf-viewer-container {
  background: #1a1a1a !important;
}

body.theme-dark #pdf-page-input,
body.theme-onedark #pdf-page-input,
body.theme-one-dark #pdf-page-input,
body.theme-dracula #pdf-page-input,
body.theme-nord #pdf-page-input,
body.theme-tokyo-night #pdf-page-input,
body.theme-tokyonight #pdf-page-input,
body.theme-palenight #pdf-page-input,
body.theme-monokai #pdf-page-input,
body.theme-material #pdf-page-input,
body.theme-gruvbox-dark #pdf-page-input,
body.theme-ayu-dark #pdf-page-input,
body.theme-ayu-mirage #pdf-page-input,
body.theme-oceanic-next #pdf-page-input,
body.theme-cobalt2 #pdf-page-input,
body.theme-concrete-dark #pdf-page-input,
body.theme-concrete-warm #pdf-page-input {
  background: #3d3d3d !important;
  border: 1px solid #4d4d4d !important;
  color: #e0e0e0 !important;
}

body.theme-dark .pdf-toolbar-separator,
body.theme-onedark .pdf-toolbar-separator,
body.theme-one-dark .pdf-toolbar-separator,
body.theme-dracula .pdf-toolbar-separator,
body.theme-nord .pdf-toolbar-separator,
body.theme-tokyo-night .pdf-toolbar-separator,
body.theme-tokyonight .pdf-toolbar-separator,
body.theme-palenight .pdf-toolbar-separator,
body.theme-monokai .pdf-toolbar-separator,
body.theme-material .pdf-toolbar-separator,
body.theme-gruvbox-dark .pdf-toolbar-separator,
body.theme-ayu-dark .pdf-toolbar-separator,
body.theme-ayu-mirage .pdf-toolbar-separator,
body.theme-oceanic-next .pdf-toolbar-separator,
body.theme-cobalt2 .pdf-toolbar-separator,
body.theme-concrete-dark .pdf-toolbar-separator,
body.theme-concrete-warm .pdf-toolbar-separator {
  background: #3d3d3d !important;
}

.pdf-viewer {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  background: #525659;
}

#pdf-canvas {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  background: white;
}

/* Light theme PDF viewer */
body.theme-light .pdf-viewer-container,
body.theme-atomonelight .pdf-viewer-container,
body.theme-github .pdf-viewer-container,
body.theme-solarized .pdf-viewer-container,
body.theme-gruvbox-light .pdf-viewer-container,
body.theme-ayu-light .pdf-viewer-container,
body.theme-sepia .pdf-viewer-container,
body.theme-paper .pdf-viewer-container,
body.theme-rosepine-dawn .pdf-viewer-container {
  background: #e8e8e8;
}

body.theme-light .pdf-viewer-toolbar,
body.theme-atomonelight .pdf-viewer-toolbar,
body.theme-github .pdf-viewer-toolbar,
body.theme-solarized .pdf-viewer-toolbar,
body.theme-gruvbox-light .pdf-viewer-toolbar,
body.theme-ayu-light .pdf-viewer-toolbar,
body.theme-sepia .pdf-viewer-toolbar,
body.theme-paper .pdf-viewer-toolbar,
body.theme-rosepine-dawn .pdf-viewer-toolbar {
  background: #f5f5f5;
  border-bottom-color: #ddd;
}

body.theme-light .pdf-viewer-toolbar button,
body.theme-atomonelight .pdf-viewer-toolbar button,
body.theme-github .pdf-viewer-toolbar button {
  background: #fff;
  border-color: #ddd;
  color: #333;
}

body.theme-light .pdf-viewer-toolbar button:hover,
body.theme-atomonelight .pdf-viewer-toolbar button:hover,
body.theme-github .pdf-viewer-toolbar button:hover {
  background: #e8e8e8;
}

body.theme-light #pdf-page-info,
body.theme-atomonelight #pdf-page-info,
body.theme-github #pdf-page-info,
body.theme-light #pdf-zoom-level,
body.theme-atomonelight #pdf-zoom-level,
body.theme-github #pdf-zoom-level {
  color: #333;
}

body.theme-light #pdf-page-input,
body.theme-atomonelight #pdf-page-input,
body.theme-github #pdf-page-input {
  background: #fff;
  border-color: #ddd;
  color: #333;
}

body.theme-light .pdf-filename,
body.theme-atomonelight .pdf-filename,
body.theme-github .pdf-filename {
  color: #666;
}

body.theme-light .pdf-viewer,
body.theme-atomonelight .pdf-viewer,
body.theme-github .pdf-viewer,
body.theme-solarized .pdf-viewer,
body.theme-gruvbox-light .pdf-viewer,
body.theme-ayu-light .pdf-viewer,
body.theme-sepia .pdf-viewer,
body.theme-paper .pdf-viewer,
body.theme-rosepine-dawn .pdf-viewer {
  background: #d0d0d0;
}

/* ========================================
   Print Styles for styles-modern.css
   Ensures proper print output
   ======================================== */

@media print {
  /* Reset container for print */
  .container {
    padding: 0;
    gap: 0;
    display: block !important;
  }

  /* Hide all UI elements */
  .tab-bar,
  .toolbar,
  .status-bar,
  .pane-resizer,
  .preview-header,
  .find-dialog,
  .export-dialog,
  .batch-dialog,
  .editor-pane,
  [id^="editor-pane-"],
  .new-tab-button,
  .tab-close {
    display: none !important;
  }

  /* Show preview content */
  .preview-pane,
  [id^="preview-pane-"],
  .preview-content,
  [id^="preview-"] {
    display: block !important;
    width: 100% !important;
    padding: 20px !important;
    position: static !important;
    overflow: visible !important;
  }

  /* Reset main content glass */
  .main-content-glass {
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* Reset editor container */
  .editor-container {
    display: block !important;
  }

  /* Reset tab content */
  .tab-content {
    display: block !important;
  }

  /* Reset pane */
  .pane {
    display: block !important;
    width: 100% !important;
  }

  /* NO STYLES MODE - Black text on white (ink-saving) */
  body.printing-no-styles .container,
  body.printing-no-styles .main-content-glass,
  body.printing-no-styles .tab-content,
  body.printing-no-styles .pane,
  body.printing-no-styles .preview-pane,
  body.printing-no-styles [id^="preview-pane-"],
  body.printing-no-styles .preview-content,
  body.printing-no-styles [id^="preview-"] {
    background: white !important;
    color: #000 !important;
  }

  body.printing-no-styles .preview-content h1,
  body.printing-no-styles .preview-content h2,
  body.printing-no-styles .preview-content h3,
  body.printing-no-styles .preview-content h4,
  body.printing-no-styles .preview-content h5,
  body.printing-no-styles .preview-content h6,
  body.printing-no-styles .preview-content p,
  body.printing-no-styles .preview-content li,
  body.printing-no-styles .preview-content td,
  body.printing-no-styles .preview-content th {
    color: #000 !important;
  }

  body.printing-no-styles .preview-content code,
  body.printing-no-styles .preview-content pre {
    background: #f5f5f5 !important;
    color: #000 !important;
    border-color: #ddd !important;
  }

  body.printing-no-styles .preview-content a {
    color: #000 !important;
  }

  body.printing-no-styles .preview-content blockquote {
    background: #f9f9f9 !important;
    color: #333 !important;
    border-left-color: #ccc !important;
  }

  /* WITH STYLES MODE - Preserve theme colors */
  /* The theme colors are inherited from the body class */
}

/* ========================================
   Dark Theme Overrides for styles-modern.css
   These ensure dark themes work properly
   ======================================== */

/* Common dark theme styles for preview content */
body.theme-dark .preview-content,
body.theme-dark [id^="preview-"],
body.theme-one-dark .preview-content,
body.theme-one-dark [id^="preview-"],
body.theme-dracula .preview-content,
body.theme-dracula [id^="preview-"],
body.theme-nord .preview-content,
body.theme-nord [id^="preview-"],
body.theme-tokyo-night .preview-content,
body.theme-tokyo-night [id^="preview-"],
body.theme-palenight .preview-content,
body.theme-palenight [id^="preview-"],
body.theme-ayu-dark .preview-content,
body.theme-ayu-dark [id^="preview-"],
body.theme-ayu-mirage .preview-content,
body.theme-ayu-mirage [id^="preview-"],
body.theme-oceanic-next .preview-content,
body.theme-oceanic-next [id^="preview-"],
body.theme-gruvbox-dark .preview-content,
body.theme-gruvbox-dark [id^="preview-"],
body.theme-cobalt2 .preview-content,
body.theme-cobalt2 [id^="preview-"] {
  color: #e6e6e6;
  background: transparent;
}

/* Dark theme headings */
body.theme-dark .preview-content h1,
body.theme-dark .preview-content h2,
body.theme-dark .preview-content h3,
body.theme-dark .preview-content h4,
body.theme-dark .preview-content h5,
body.theme-dark .preview-content h6,
body.theme-one-dark .preview-content h1,
body.theme-one-dark .preview-content h2,
body.theme-one-dark .preview-content h3,
body.theme-one-dark .preview-content h4,
body.theme-one-dark .preview-content h5,
body.theme-one-dark .preview-content h6,
body.theme-dracula .preview-content h1,
body.theme-dracula .preview-content h2,
body.theme-dracula .preview-content h3,
body.theme-dracula .preview-content h4,
body.theme-dracula .preview-content h5,
body.theme-dracula .preview-content h6,
body.theme-nord .preview-content h1,
body.theme-nord .preview-content h2,
body.theme-nord .preview-content h3,
body.theme-nord .preview-content h4,
body.theme-nord .preview-content h5,
body.theme-nord .preview-content h6,
body.theme-tokyo-night .preview-content h1,
body.theme-tokyo-night .preview-content h2,
body.theme-tokyo-night .preview-content h3,
body.theme-tokyo-night .preview-content h4,
body.theme-tokyo-night .preview-content h5,
body.theme-tokyo-night .preview-content h6,
body.theme-palenight .preview-content h1,
body.theme-palenight .preview-content h2,
body.theme-palenight .preview-content h3,
body.theme-palenight .preview-content h4,
body.theme-palenight .preview-content h5,
body.theme-palenight .preview-content h6,
body.theme-ayu-dark .preview-content h1,
body.theme-ayu-dark .preview-content h2,
body.theme-ayu-dark .preview-content h3,
body.theme-ayu-dark .preview-content h4,
body.theme-ayu-dark .preview-content h5,
body.theme-ayu-dark .preview-content h6,
body.theme-ayu-mirage .preview-content h1,
body.theme-ayu-mirage .preview-content h2,
body.theme-ayu-mirage .preview-content h3,
body.theme-ayu-mirage .preview-content h4,
body.theme-ayu-mirage .preview-content h5,
body.theme-ayu-mirage .preview-content h6,
body.theme-oceanic-next .preview-content h1,
body.theme-oceanic-next .preview-content h2,
body.theme-oceanic-next .preview-content h3,
body.theme-oceanic-next .preview-content h4,
body.theme-oceanic-next .preview-content h5,
body.theme-oceanic-next .preview-content h6,
body.theme-gruvbox-dark .preview-content h1,
body.theme-gruvbox-dark .preview-content h2,
body.theme-gruvbox-dark .preview-content h3,
body.theme-gruvbox-dark .preview-content h4,
body.theme-gruvbox-dark .preview-content h5,
body.theme-gruvbox-dark .preview-content h6,
body.theme-cobalt2 .preview-content h1,
body.theme-cobalt2 .preview-content h2,
body.theme-cobalt2 .preview-content h3,
body.theme-cobalt2 .preview-content h4,
body.theme-cobalt2 .preview-content h5,
body.theme-cobalt2 .preview-content h6 {
  color: #f0f0f0;
  border-bottom-color: #444;
}

/* Dark theme paragraphs and text */
body.theme-dark .preview-content p,
body.theme-dark .preview-content li,
body.theme-dark .preview-content td,
body.theme-one-dark .preview-content p,
body.theme-one-dark .preview-content li,
body.theme-one-dark .preview-content td,
body.theme-dracula .preview-content p,
body.theme-dracula .preview-content li,
body.theme-dracula .preview-content td,
body.theme-nord .preview-content p,
body.theme-nord .preview-content li,
body.theme-nord .preview-content td,
body.theme-tokyo-night .preview-content p,
body.theme-tokyo-night .preview-content li,
body.theme-tokyo-night .preview-content td,
body.theme-palenight .preview-content p,
body.theme-palenight .preview-content li,
body.theme-palenight .preview-content td,
body.theme-ayu-dark .preview-content p,
body.theme-ayu-dark .preview-content li,
body.theme-ayu-dark .preview-content td,
body.theme-ayu-mirage .preview-content p,
body.theme-ayu-mirage .preview-content li,
body.theme-ayu-mirage .preview-content td,
body.theme-oceanic-next .preview-content p,
body.theme-oceanic-next .preview-content li,
body.theme-oceanic-next .preview-content td,
body.theme-gruvbox-dark .preview-content p,
body.theme-gruvbox-dark .preview-content li,
body.theme-gruvbox-dark .preview-content td,
body.theme-cobalt2 .preview-content p,
body.theme-cobalt2 .preview-content li,
body.theme-cobalt2 .preview-content td {
  color: #d4d4d4;
}

/* Dark theme code blocks */
body.theme-dark .preview-content pre,
body.theme-one-dark .preview-content pre,
body.theme-dracula .preview-content pre,
body.theme-nord .preview-content pre,
body.theme-tokyo-night .preview-content pre,
body.theme-palenight .preview-content pre,
body.theme-ayu-dark .preview-content pre,
body.theme-ayu-mirage .preview-content pre,
body.theme-oceanic-next .preview-content pre,
body.theme-gruvbox-dark .preview-content pre,
body.theme-cobalt2 .preview-content pre {
  background: #1e1e1e;
  border-color: #333;
  color: #d4d4d4;
}

/* Dark theme inline code */
body.theme-dark .preview-content code,
body.theme-one-dark .preview-content code,
body.theme-dracula .preview-content code,
body.theme-nord .preview-content code,
body.theme-tokyo-night .preview-content code,
body.theme-palenight .preview-content code,
body.theme-ayu-dark .preview-content code,
body.theme-ayu-mirage .preview-content code,
body.theme-oceanic-next .preview-content code,
body.theme-gruvbox-dark .preview-content code,
body.theme-cobalt2 .preview-content code {
  background: rgba(255, 255, 255, 0.1);
  border-color: #444;
  color: #e06c75;
}

/* Dark theme blockquotes */
body.theme-dark .preview-content blockquote,
body.theme-one-dark .preview-content blockquote,
body.theme-dracula .preview-content blockquote,
body.theme-nord .preview-content blockquote,
body.theme-tokyo-night .preview-content blockquote,
body.theme-palenight .preview-content blockquote,
body.theme-ayu-dark .preview-content blockquote,
body.theme-ayu-mirage .preview-content blockquote,
body.theme-oceanic-next .preview-content blockquote,
body.theme-gruvbox-dark .preview-content blockquote,
body.theme-cobalt2 .preview-content blockquote {
  background: rgba(255, 255, 255, 0.05);
  border-left-color: #555;
  color: #aaa;
}

/* Dark theme links */
body.theme-dark .preview-content a,
body.theme-one-dark .preview-content a,
body.theme-dracula .preview-content a,
body.theme-nord .preview-content a,
body.theme-tokyo-night .preview-content a,
body.theme-palenight .preview-content a,
body.theme-ayu-dark .preview-content a,
body.theme-ayu-mirage .preview-content a,
body.theme-oceanic-next .preview-content a,
body.theme-gruvbox-dark .preview-content a,
body.theme-cobalt2 .preview-content a {
  color: #61afef;
}

/* Dark theme tables */
body.theme-dark .preview-content table,
body.theme-one-dark .preview-content table,
body.theme-dracula .preview-content table,
body.theme-nord .preview-content table,
body.theme-tokyo-night .preview-content table,
body.theme-palenight .preview-content table,
body.theme-ayu-dark .preview-content table,
body.theme-ayu-mirage .preview-content table,
body.theme-oceanic-next .preview-content table,
body.theme-gruvbox-dark .preview-content table,
body.theme-cobalt2 .preview-content table {
  border-color: #444;
}

body.theme-dark .preview-content table th,
body.theme-one-dark .preview-content table th,
body.theme-dracula .preview-content table th,
body.theme-nord .preview-content table th,
body.theme-tokyo-night .preview-content table th,
body.theme-palenight .preview-content table th,
body.theme-ayu-dark .preview-content table th,
body.theme-ayu-mirage .preview-content table th,
body.theme-oceanic-next .preview-content table th,
body.theme-gruvbox-dark .preview-content table th,
body.theme-cobalt2 .preview-content table th {
  background: #2d2d2d;
  color: #e6e6e6;
  border-color: #444;
}

body.theme-dark .preview-content table td,
body.theme-one-dark .preview-content table td,
body.theme-dracula .preview-content table td,
body.theme-nord .preview-content table td,
body.theme-tokyo-night .preview-content table td,
body.theme-palenight .preview-content table td,
body.theme-ayu-dark .preview-content table td,
body.theme-ayu-mirage .preview-content table td,
body.theme-oceanic-next .preview-content table td,
body.theme-gruvbox-dark .preview-content table td,
body.theme-cobalt2 .preview-content table td {
  border-color: #444;
}

body.theme-dark .preview-content table tr:nth-child(even),
body.theme-one-dark .preview-content table tr:nth-child(even),
body.theme-dracula .preview-content table tr:nth-child(even),
body.theme-nord .preview-content table tr:nth-child(even),
body.theme-tokyo-night .preview-content table tr:nth-child(even),
body.theme-palenight .preview-content table tr:nth-child(even),
body.theme-ayu-dark .preview-content table tr:nth-child(even),
body.theme-ayu-mirage .preview-content table tr:nth-child(even),
body.theme-oceanic-next .preview-content table tr:nth-child(even),
body.theme-gruvbox-dark .preview-content table tr:nth-child(even),
body.theme-cobalt2 .preview-content table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

/* Dark theme horizontal rules */
body.theme-dark .preview-content hr,
body.theme-one-dark .preview-content hr,
body.theme-dracula .preview-content hr,
body.theme-nord .preview-content hr,
body.theme-tokyo-night .preview-content hr,
body.theme-palenight .preview-content hr,
body.theme-ayu-dark .preview-content hr,
body.theme-ayu-mirage .preview-content hr,
body.theme-oceanic-next .preview-content hr,
body.theme-gruvbox-dark .preview-content hr,
body.theme-cobalt2 .preview-content hr {
  border-color: #444;
  background: #444;
}

/* ========================================
   Modal/Dialog Theming
   Dialogs inherit app theme colors
   ======================================== */

/* Dark theme modals */
body.theme-dark .export-dialog-content,
body.theme-dark .batch-dialog-content,
body.theme-dark .pdf-editor-content,
body.theme-one-dark .export-dialog-content,
body.theme-one-dark .batch-dialog-content,
body.theme-one-dark .pdf-editor-content,
body.theme-onedark .export-dialog-content,
body.theme-onedark .batch-dialog-content,
body.theme-onedark .pdf-editor-content,
body.theme-dracula .export-dialog-content,
body.theme-dracula .batch-dialog-content,
body.theme-dracula .pdf-editor-content,
body.theme-nord .export-dialog-content,
body.theme-nord .batch-dialog-content,
body.theme-nord .pdf-editor-content,
body.theme-tokyo-night .export-dialog-content,
body.theme-tokyo-night .batch-dialog-content,
body.theme-tokyo-night .pdf-editor-content,
body.theme-tokyonight .export-dialog-content,
body.theme-tokyonight .batch-dialog-content,
body.theme-tokyonight .pdf-editor-content,
body.theme-palenight .export-dialog-content,
body.theme-palenight .batch-dialog-content,
body.theme-palenight .pdf-editor-content,
body.theme-ayu-dark .export-dialog-content,
body.theme-ayu-dark .batch-dialog-content,
body.theme-ayu-dark .pdf-editor-content,
body.theme-ayu-mirage .export-dialog-content,
body.theme-ayu-mirage .batch-dialog-content,
body.theme-ayu-mirage .pdf-editor-content,
body.theme-oceanic-next .export-dialog-content,
body.theme-oceanic-next .batch-dialog-content,
body.theme-oceanic-next .pdf-editor-content,
body.theme-gruvbox-dark .export-dialog-content,
body.theme-gruvbox-dark .batch-dialog-content,
body.theme-gruvbox-dark .pdf-editor-content,
body.theme-cobalt2 .export-dialog-content,
body.theme-cobalt2 .batch-dialog-content,
body.theme-cobalt2 .pdf-editor-content,
body.theme-monokai .export-dialog-content,
body.theme-monokai .batch-dialog-content,
body.theme-monokai .pdf-editor-content,
body.theme-material .export-dialog-content,
body.theme-material .batch-dialog-content,
body.theme-material .pdf-editor-content,
body.theme-concrete-dark .export-dialog-content,
body.theme-concrete-dark .batch-dialog-content,
body.theme-concrete-dark .pdf-editor-content,
body.theme-concrete-warm .export-dialog-content,
body.theme-concrete-warm .batch-dialog-content,
body.theme-concrete-warm .pdf-editor-content {
  background: #2d2d2d !important;
  border-color: #444 !important;
  color: #e6e6e6 !important;
}

/* Dark theme dialog headers */
body.theme-dark .export-dialog-header,
body.theme-dark .batch-dialog-header,
body.theme-one-dark .export-dialog-header,
body.theme-one-dark .batch-dialog-header,
body.theme-onedark .export-dialog-header,
body.theme-onedark .batch-dialog-header,
body.theme-dracula .export-dialog-header,
body.theme-dracula .batch-dialog-header,
body.theme-nord .export-dialog-header,
body.theme-nord .batch-dialog-header,
body.theme-tokyo-night .export-dialog-header,
body.theme-tokyo-night .batch-dialog-header,
body.theme-tokyonight .export-dialog-header,
body.theme-tokyonight .batch-dialog-header,
body.theme-palenight .export-dialog-header,
body.theme-palenight .batch-dialog-header,
body.theme-ayu-dark .export-dialog-header,
body.theme-ayu-dark .batch-dialog-header,
body.theme-ayu-mirage .export-dialog-header,
body.theme-ayu-mirage .batch-dialog-header,
body.theme-oceanic-next .export-dialog-header,
body.theme-oceanic-next .batch-dialog-header,
body.theme-gruvbox-dark .export-dialog-header,
body.theme-gruvbox-dark .batch-dialog-header,
body.theme-cobalt2 .export-dialog-header,
body.theme-cobalt2 .batch-dialog-header,
body.theme-monokai .export-dialog-header,
body.theme-monokai .batch-dialog-header,
body.theme-material .export-dialog-header,
body.theme-material .batch-dialog-header,
body.theme-concrete-dark .export-dialog-header,
body.theme-concrete-dark .batch-dialog-header,
body.theme-concrete-warm .export-dialog-header,
body.theme-concrete-warm .batch-dialog-header {
  background: #1a1a1a !important;
  border-bottom-color: #333 !important;
}

/* Dark theme dialog header text */
body.theme-dark .export-dialog-header h3,
body.theme-dark .batch-dialog-header h3,
body.theme-onedark .export-dialog-header h3,
body.theme-onedark .batch-dialog-header h3,
body.theme-dracula .export-dialog-header h3,
body.theme-dracula .batch-dialog-header h3,
body.theme-nord .export-dialog-header h3,
body.theme-nord .batch-dialog-header h3,
body.theme-tokyonight .export-dialog-header h3,
body.theme-tokyonight .batch-dialog-header h3,
body.theme-monokai .export-dialog-header h3,
body.theme-monokai .batch-dialog-header h3,
body.theme-material .export-dialog-header h3,
body.theme-material .batch-dialog-header h3 {
  color: #fff !important;
}

/* Dark theme dialog body */
body.theme-dark .export-dialog-body,
body.theme-dark .batch-dialog-body,
body.theme-one-dark .export-dialog-body,
body.theme-one-dark .batch-dialog-body,
body.theme-dracula .export-dialog-body,
body.theme-dracula .batch-dialog-body,
body.theme-nord .export-dialog-body,
body.theme-nord .batch-dialog-body,
body.theme-tokyo-night .export-dialog-body,
body.theme-tokyo-night .batch-dialog-body,
body.theme-palenight .export-dialog-body,
body.theme-palenight .batch-dialog-body,
body.theme-ayu-dark .export-dialog-body,
body.theme-ayu-dark .batch-dialog-body,
body.theme-ayu-mirage .export-dialog-body,
body.theme-ayu-mirage .batch-dialog-body,
body.theme-oceanic-next .export-dialog-body,
body.theme-oceanic-next .batch-dialog-body,
body.theme-gruvbox-dark .export-dialog-body,
body.theme-gruvbox-dark .batch-dialog-body,
body.theme-cobalt2 .export-dialog-body,
body.theme-cobalt2 .batch-dialog-body {
  background: transparent;
}

/* Dark theme dialog labels */
body.theme-dark .export-section label,
body.theme-dark .batch-section label,
body.theme-one-dark .export-section label,
body.theme-one-dark .batch-section label,
body.theme-dracula .export-section label,
body.theme-dracula .batch-section label,
body.theme-nord .export-section label,
body.theme-nord .batch-section label,
body.theme-tokyo-night .export-section label,
body.theme-tokyo-night .batch-section label,
body.theme-palenight .export-section label,
body.theme-palenight .batch-section label,
body.theme-ayu-dark .export-section label,
body.theme-ayu-dark .batch-section label,
body.theme-ayu-mirage .export-section label,
body.theme-ayu-mirage .batch-section label,
body.theme-oceanic-next .export-section label,
body.theme-oceanic-next .batch-section label,
body.theme-gruvbox-dark .export-section label,
body.theme-gruvbox-dark .batch-section label,
body.theme-cobalt2 .export-section label,
body.theme-cobalt2 .batch-section label {
  color: #ccc;
}

/* Dark theme dialog inputs and selects */
body.theme-dark .export-section select,
body.theme-dark .export-section input,
body.theme-dark .batch-section select,
body.theme-dark .batch-section input,
body.theme-one-dark .export-section select,
body.theme-one-dark .export-section input,
body.theme-one-dark .batch-section select,
body.theme-one-dark .batch-section input,
body.theme-dracula .export-section select,
body.theme-dracula .export-section input,
body.theme-dracula .batch-section select,
body.theme-dracula .batch-section input,
body.theme-nord .export-section select,
body.theme-nord .export-section input,
body.theme-nord .batch-section select,
body.theme-nord .batch-section input,
body.theme-tokyo-night .export-section select,
body.theme-tokyo-night .export-section input,
body.theme-tokyo-night .batch-section select,
body.theme-tokyo-night .batch-section input,
body.theme-palenight .export-section select,
body.theme-palenight .export-section input,
body.theme-palenight .batch-section select,
body.theme-palenight .batch-section input,
body.theme-ayu-dark .export-section select,
body.theme-ayu-dark .export-section input,
body.theme-ayu-dark .batch-section select,
body.theme-ayu-dark .batch-section input,
body.theme-ayu-mirage .export-section select,
body.theme-ayu-mirage .export-section input,
body.theme-ayu-mirage .batch-section select,
body.theme-ayu-mirage .batch-section input,
body.theme-oceanic-next .export-section select,
body.theme-oceanic-next .export-section input,
body.theme-oceanic-next .batch-section select,
body.theme-oceanic-next .batch-section input,
body.theme-gruvbox-dark .export-section select,
body.theme-gruvbox-dark .export-section input,
body.theme-gruvbox-dark .batch-section select,
body.theme-gruvbox-dark .batch-section input,
body.theme-cobalt2 .export-section select,
body.theme-cobalt2 .export-section input,
body.theme-cobalt2 .batch-section select,
body.theme-cobalt2 .batch-section input {
  background: #2d2d2d;
  border-color: #444;
  color: #e6e6e6;
}

/* Dark theme dialog footer */
body.theme-dark .export-dialog-footer,
body.theme-dark .batch-dialog-footer,
body.theme-one-dark .export-dialog-footer,
body.theme-one-dark .batch-dialog-footer,
body.theme-dracula .export-dialog-footer,
body.theme-dracula .batch-dialog-footer,
body.theme-nord .export-dialog-footer,
body.theme-nord .batch-dialog-footer,
body.theme-tokyo-night .export-dialog-footer,
body.theme-tokyo-night .batch-dialog-footer,
body.theme-palenight .export-dialog-footer,
body.theme-palenight .batch-dialog-footer,
body.theme-ayu-dark .export-dialog-footer,
body.theme-ayu-dark .batch-dialog-footer,
body.theme-ayu-mirage .export-dialog-footer,
body.theme-ayu-mirage .batch-dialog-footer,
body.theme-oceanic-next .export-dialog-footer,
body.theme-oceanic-next .batch-dialog-footer,
body.theme-gruvbox-dark .export-dialog-footer,
body.theme-gruvbox-dark .batch-dialog-footer,
body.theme-cobalt2 .export-dialog-footer,
body.theme-cobalt2 .batch-dialog-footer {
  background: #1a1a1a;
  border-top-color: #333;
}

/* Sepia theme modals */
body.theme-sepia .export-dialog-content,
body.theme-sepia .batch-dialog-content,
body.theme-sepia .pdf-editor-content {
  background: rgba(244, 236, 216, 0.98);
  border-color: #d4c4a8;
  color: #5b4636;
}

body.theme-sepia .export-dialog-header,
body.theme-sepia .batch-dialog-header {
  background: #e8dcc8;
  border-bottom-color: #d4c4a8;
}

body.theme-sepia .export-dialog-header h3,
body.theme-sepia .batch-dialog-header h3 {
  color: #3d2914;
}

body.theme-sepia .export-section label,
body.theme-sepia .batch-section label {
  color: #5b4636;
}

body.theme-sepia .export-section select,
body.theme-sepia .export-section input,
body.theme-sepia .batch-section select,
body.theme-sepia .batch-section input {
  background: #f4ecd8;
  border-color: #d4c4a8;
  color: #5b4636;
}

body.theme-sepia .export-dialog-footer,
body.theme-sepia .batch-dialog-footer {
  background: #e8dcc8;
  border-top-color: #d4c4a8;
}

/* Rose Pine Dawn theme modals */
body.theme-rosepine-dawn .export-dialog-content,
body.theme-rosepine-dawn .batch-dialog-content,
body.theme-rosepine-dawn .pdf-editor-content {
  background: rgba(250, 244, 237, 0.98);
  border-color: #dfdad9;
  color: #575279;
}

body.theme-rosepine-dawn .export-dialog-header,
body.theme-rosepine-dawn .batch-dialog-header {
  background: #f2e9e1;
  border-bottom-color: #dfdad9;
}

body.theme-rosepine-dawn .export-dialog-header h3,
body.theme-rosepine-dawn .batch-dialog-header h3 {
  color: #286983;
}

body.theme-rosepine-dawn .export-section label,
body.theme-rosepine-dawn .batch-section label {
  color: #575279;
}

body.theme-rosepine-dawn .export-section select,
body.theme-rosepine-dawn .export-section input,
body.theme-rosepine-dawn .batch-section select,
body.theme-rosepine-dawn .batch-section input {
  background: #faf4ed;
  border-color: #dfdad9;
  color: #575279;
}

body.theme-rosepine-dawn .export-dialog-footer,
body.theme-rosepine-dawn .batch-dialog-footer {
  background: #f2e9e1;
  border-top-color: #dfdad9;
}

/* ========================================
   Command Palette (Ctrl+Shift+P)
   ======================================== */
.command-palette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    justify-content: center;
    padding-top: 80px;
}
.command-palette-overlay.hidden {
    display: none;
}
.command-palette {
    width: 560px;
    max-height: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.command-palette-input {
    width: 100%;
    padding: 14px 18px;
    border: none;
    outline: none;
    font-size: 15px;
    border-bottom: 1px solid #e5e7eb;
    font-family: inherit;
}
.command-palette-results {
    overflow-y: auto;
    max-height: 340px;
}
.command-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 14px;
}
.command-item:hover,
.command-item.selected {
    background: #f3f4f6;
}
.command-label strong {
    color: #5661b3;
}
.command-shortcut {
    font-size: 12px;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
}

/* Dark theme command palette */
body[class*="dark"] .command-palette {
    background: #1e1e1e;
    border: 1px solid #333;
}
body[class*="dark"] .command-palette-input {
    background: #1e1e1e;
    color: #eee;
    border-color: #333;
}
body[class*="dark"] .command-item:hover,
body[class*="dark"] .command-item.selected {
    background: #2d2d2d;
}
body[class*="dark"] .command-shortcut {
    background: #333;
    color: #888;
}

/* ========================================
   Breadcrumb Bar
   ======================================== */
.breadcrumb-bar {
    padding: 4px 12px;
    font-size: 12px;
    color: var(--gray-500, #6b7280);
    border-bottom: 1px solid var(--gray-200, #e5e7eb);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    background: var(--gray-50, #f9fafb);
    font-family: 'JetBrains Mono', monospace;
}
body[class*="dark"] .breadcrumb-bar {
    background: #1a1a1a;
    color: #888;
    border-color: #333;
}

/* Print Preview Dialog */
.print-preview-dialog {
    width: 90vw;
    max-width: 1200px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}
.print-preview-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.print-preview-sidebar {
    width: 260px;
    padding: 16px;
    border-right: 1px solid var(--gray-200, #e5e7eb);
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.print-preview-content {
    flex: 1;
    padding: 16px;
    background: #e5e7eb;
    display: flex;
    justify-content: center;
    overflow: auto;
}
.print-preview-content iframe {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border-radius: 4px;
}
.print-option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.print-option-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600, #4b5563);
}
.print-option-group select,
.print-option-group input[type="text"] {
    padding: 8px 10px;
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 8px;
    font-size: 13px;
    background: white;
}
.scale-control {
    display: flex;
    align-items: center;
    gap: 8px;
}
.scale-control input[type="range"] {
    flex: 1;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.print-range-input {
    margin-top: 6px;
}
.print-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
}
.btn-primary {
    flex: 1;
    padding: 10px;
    background: var(--primary-dark, #5661b3);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.btn-primary:hover {
    opacity: 0.9;
}
.btn-secondary {
    flex: 1;
    padding: 10px;
    background: var(--gray-100, #f3f4f6);
    color: var(--gray-700, #374151);
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

/* Writing Analytics Modal */
.analytics-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.5); backdrop-filter:blur(4px); display:flex; align-items:center; justify-content:center; z-index:10000; animation:analyticsFadeIn 0.2s ease; }
.analytics-modal { background:var(--bg-primary,#fff); border-radius:12px; width:520px; max-height:80vh; overflow-y:auto; box-shadow:0 20px 60px rgba(0,0,0,0.3); animation:analyticsSlideUp 0.3s ease; }
.analytics-header { display:flex; justify-content:space-between; align-items:center; padding:20px 24px; border-bottom:1px solid var(--border-color,#e5e7eb); }
.analytics-header h2 { margin:0; font-size:18px; font-weight:600; color:var(--text-primary); }
.analytics-close { background:none; border:none; font-size:24px; cursor:pointer; color:var(--text-muted); padding:4px 8px; border-radius:4px; }
.analytics-close:hover { background:var(--bg-tertiary); color:var(--text-primary); }
.analytics-body { padding:16px 24px 24px; }
.analytics-section { margin-bottom:20px; }
.analytics-section h3 { font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-muted,#9ca3af); margin:0 0 10px; }
.analytics-row { display:flex; justify-content:space-between; align-items:baseline; padding:6px 0; font-size:14px; }
.analytics-label { color:var(--text-secondary,#6b7280); }
.analytics-value { font-weight:500; color:var(--text-primary); }
.analytics-value small { color:var(--text-muted); font-weight:400; margin-left:6px; }
.readability-meter { height:4px; background:var(--bg-tertiary,#f3f4f6); border-radius:2px; margin-top:8px; overflow:hidden; }
.readability-fill { height:100%; background:linear-gradient(90deg,#ef4444,#f59e0b,#10b981); border-radius:2px; transition:width 0.5s ease; }
.word-cloud { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.word-tag { background:var(--bg-tertiary,#f3f4f6); padding:4px 10px; border-radius:12px; font-size:13px; color:var(--text-secondary); }
.word-tag small { opacity:0.5; font-size:10px; margin-left:2px; }
.analytics-longest { flex-direction:column; gap:4px; }
.analytics-sentence-preview { font-style:italic; font-size:13px; color:var(--text-secondary); font-weight:400; }
@keyframes analyticsFadeIn { from{opacity:0} to{opacity:1} }
@keyframes analyticsSlideUp { from{transform:translateY(16px);opacity:0} to{transform:translateY(0);opacity:1} }
body[class*="dark"] .analytics-modal { background:var(--gray-800,#1f2937); }
body[class*="dark"] .word-tag { background:var(--gray-700,#374151); }

/* ========================================
   Interactive PDF Thumbnail Sidebar Styles
   ======================================== */
.pdf-editor-body.side-by-side {
  display: flex;
  flex-direction: row;
  gap: 16px;
  height: 550px;
  overflow: hidden;
}

.pdf-editor-left-panel {
  flex: 1.2;
  overflow-y: auto;
  padding-right: 8px;
  height: 100%;
}

.pdf-editor-right-panel {
  flex: 0.8;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-color, #e5e7eb);
  padding-left: 16px;
  height: 100%;
  overflow: hidden;
}

.pdf-editor-right-panel h4 {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.pdf-editor-right-panel .sidebar-help {
  margin: 0 0 12px 0;
  font-size: 11px;
  color: var(--text-secondary, #6b7280);
  line-height: 1.4;
}

.pdf-thumbnail-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  overflow-y: auto;
  padding: 4px;
}

.pdf-thumbnail-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  background: var(--bg-primary, #ffffff);
  box-shadow: var(--shadow-sm);
  padding: 8px;
  transition: all var(--transition-speed, 0.3s) var(--transition-ease);
  position: relative;
  overflow: hidden;
}

.pdf-thumbnail-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light, #8b9aff);
}

.pdf-thumbnail-card.marked-delete {
  border-color: var(--error, #ef4444);
  background: rgba(239, 68, 68, 0.05);
}

.pdf-thumbnail-card.marked-delete::after {
  content: "DELETE";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.pdf-thumbnail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.pdf-thumbnail-header .badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-tertiary, #f3f4f6);
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono, monospace);
}

.canvas-container {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-secondary, #f9fafb);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 6px;
  padding: 6px;
  height: 120px;
  overflow: hidden;
}

.pdf-thumbnail-canvas {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease;
}

/* CSS Rotations */
.rot90 {
  transform: rotate(90deg);
}
.rot180 {
  transform: rotate(180deg);
}
.rot270 {
  transform: rotate(270deg);
}

.pdf-thumbnail-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.pdf-thumbnail-controls button,
.pdf-thumbnail-controls label {
  font-size: 11px;
}

.btn-rotate-thumbnail {
  background: var(--bg-tertiary, #f3f4f6);
  border: 1px solid var(--border-color, #e5e7eb);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 3px 6px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-rotate-thumbnail:hover {
  background: var(--primary-light, #8b9aff);
  color: #fff;
  border-color: var(--primary-dark);
}

.delete-thumbnail-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  color: var(--text-secondary);
}

.delete-thumbnail-checkbox input {
  margin: 0;
  cursor: pointer;
}

.pdf-thumbnail-reorder {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.btn-reorder-left,
.btn-reorder-right {
  flex: 1;
  background: var(--bg-tertiary, #f3f4f6);
  border: 1px solid var(--border-color, #e5e7eb);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reorder-left:hover:not(:disabled),
.btn-reorder-right:hover:not(:disabled) {
  background: var(--bg-secondary);
  border-color: var(--text-muted);
}

.btn-reorder-left:disabled,
.btn-reorder-right:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.loading-thumbnails,
.thumbnail-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.thumbnail-error {
  color: var(--error, #ef4444);
}

/* Dark mode adjustments */
body[class*="dark"] .pdf-thumbnail-card {
  background: var(--gray-800, #1f2937);
  border-color: var(--gray-700, #374151);
}
body[class*="dark"] .pdf-thumbnail-header .badge {
  background: var(--gray-700, #374151);
  color: var(--gray-200);
}
body[class*="dark"] .canvas-container {
  background: var(--gray-900, #111827);
  border-color: var(--gray-700);
}
body[class*="dark"] .btn-rotate-thumbnail,
body[class*="dark"] .btn-reorder-left,
body[class*="dark"] .btn-reorder-right {
  background: var(--gray-700, #374151);
  border-color: var(--gray-600);
  color: var(--gray-200);
}
