/* ============================================================
   PDFLokal - Style Guide
   ============================================================
   Design Philosophy: Handling papers on a desk
   - Clean, minimal, functional
   - Paper-like textures and shadows
   - Fast, no unnecessary animations
   ============================================================ */

/* CSS Variables */
:root {
  /* Colors */
  --bg-primary: #fafaf9;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f5f5f4;
  --bg-hover: #e7e5e4;
  
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-tertiary: #a8a29e;
  --text-inverse: #ffffff;
  
  --accent-primary: #dc2626;
  --accent-secondary: #b91c1c;
  --accent-light: #fef2f2;
  
  --border-light: #e7e5e4;
  --border-medium: #d6d3d1;
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --shadow-paper: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  
  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { color: var(--text-secondary); }

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-secondary);
}

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-md) 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 0.875rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background: var(--accent-secondary);
  color: var(--text-inverse);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: var(--space-3xl) 0 var(--space-2xl);
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

/* Drop Zone */
.dropzone-container {
  max-width: 700px;
  margin: var(--space-xl) auto var(--space-3xl);
}

.dropzone {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-xl);
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: var(--bg-secondary);
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent-primary);
  background: var(--accent-light);
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-lg);
  color: var(--text-tertiary);
}

.dropzone h3 {
  font-size: 1.125rem;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.dropzone p {
  font-size: 0.9375rem;
  color: var(--text-tertiary);
}

.dropzone input[type="file"] {
  display: none;
}

/* Tools Grid */
.tools-section {
  padding-bottom: var(--space-3xl);
}

.tools-category {
  margin-bottom: var(--space-2xl);
}

.tools-category h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-md);
}

.tool-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tool-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tool-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tool-card.disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-light);
}

.tool-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto var(--space-sm);
  color: var(--accent-primary);
}

.tool-card.disabled .tool-icon {
  color: var(--text-tertiary);
}

.tool-card h3 {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
}

.tool-card p {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

/* Privacy Badge */
.privacy-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
}

.privacy-badge svg {
  width: 20px;
  height: 20px;
  color: var(--accent-primary);
}

.privacy-badge p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

/* Footer */
.footer {
  text-align: center;
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--border-light);
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.footer a {
  color: var(--text-secondary);
}

.footer a:hover {
  color: var(--accent-primary);
}

/* ============================================================
   Workspace Styles (Tool-specific views)
   ============================================================ */

.workspace {
  display: none;
  padding: var(--space-xl) 0;
}

.workspace.active {
  display: block;
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.workspace-header h2 {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.back-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* File List / Thumbnails */
.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  min-height: 150px;
  padding: var(--space-lg);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
}

.file-item {
  position: relative;
  width: 120px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-paper);
  overflow: hidden;
  cursor: grab;
  transition: all var(--transition-fast);
}

.file-item:hover {
  box-shadow: var(--shadow-md);
}

.file-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.file-item-preview {
  width: 100%;
  height: 150px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.file-item-preview img,
.file-item-preview canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.file-item-info {
  padding: var(--space-sm);
  border-top: 1px solid var(--border-light);
}

.file-item-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-size {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.file-item-remove {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  width: 24px;
  height: 24px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.file-item:hover .file-item-remove {
  opacity: 1;
}

.file-item-remove:hover {
  background: var(--accent-primary);
}

/* Page Thumbnails for PDF */
.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
}

.page-item {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-paper);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-item:hover {
  box-shadow: var(--shadow-md);
}

.page-item.selected {
  outline: 3px solid var(--accent-primary);
  outline-offset: 2px;
}

.page-item canvas {
  width: 100%;
  display: block;
}

.page-item-number {
  position: absolute;
  bottom: var(--space-xs);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 0.6875rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.page-item-checkbox {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-medium);
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-item.selected .page-item-checkbox {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* Add File Button */
.add-file-btn {
  width: 120px;
  height: 150px;
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.add-file-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-light);
}

.add-file-btn svg {
  width: 32px;
  height: 32px;
}

.add-file-btn span {
  font-size: 0.75rem;
  font-weight: 500;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  margin-bottom: var(--space-xl);
}

.control-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.control-group label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.control-group input[type="number"],
.control-group input[type="text"],
.control-group select {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.9375rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.control-group input:focus,
.control-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Range Slider */
.range-slider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  max-width: 400px;
}

.range-slider input[type="range"] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  background: var(--border-medium);
  border-radius: 3px;
  cursor: pointer;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
}

.range-slider .range-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 50px;
  text-align: right;
}

/* Preview Area */
.preview-area {
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-xl);
  align-items: center;
  width: 100%;
  max-width: 800px;
}

.preview-box {
  text-align: center;
}

.preview-box img,
.preview-box canvas {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-paper);
}

.preview-box p {
  margin-top: var(--space-sm);
  font-size: 0.875rem;
}

.preview-arrow {
  font-size: 1.5rem;
  color: var(--text-tertiary);
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
}

/* PDF Editor Canvas */
.editor-container {
  position: relative;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.editor-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.editor-tool-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.editor-tool-btn.active {
  background: var(--accent-light);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.editor-canvas-wrapper {
  display: flex;
  justify-content: center;
  background: #e5e5e5;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow: auto;
  max-height: 600px;
}

.editor-canvas {
  background: white;
  box-shadow: var(--shadow-lg);
  cursor: crosshair;
}

.editor-page-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.editor-page-nav button {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.editor-page-nav button:hover:not(:disabled) {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.editor-page-nav button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.editor-page-nav span {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

/* Signature Pad */
.signature-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.signature-modal.active {
  display: flex;
}

.signature-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 500px;
  width: 90%;
}

.signature-box h3 {
  margin-bottom: var(--space-lg);
}

.signature-canvas {
  width: 100%;
  height: 200px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: white;
  cursor: crosshair;
}

.signature-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

/* Progress Bar */
.progress-container {
  margin-bottom: var(--space-xl);
}

.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
  text-align: center;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: var(--space-md) var(--space-lg);
  background: var(--text-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: slideIn 0.3s ease;
}

.toast.error {
  background: var(--accent-primary);
}

.toast.success {
  background: #16a34a;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================================
   Donation Page Styles
   ============================================================ */

.donate-page {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-3xl) var(--space-lg);
  text-align: center;
}

.donate-page h1 {
  margin-bottom: var(--space-lg);
}

.donate-intro {
  font-size: 1.0625rem;
  line-height: 1.7;
  margin-bottom: var(--space-2xl);
}

.qris-container {
  background: var(--bg-secondary);
  padding: var(--space-xl);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-2xl);
}

.qris-container img {
  max-width: 280px;
  width: 100%;
  border-radius: var(--radius-md);
}

.qris-container p {
  margin-top: var(--space-md);
  font-size: 0.9375rem;
}

.other-ways {
  text-align: left;
  margin-bottom: var(--space-2xl);
}

.other-ways h2 {
  font-size: 1.125rem;
  margin-bottom: var(--space-md);
}

.other-ways ul {
  list-style: none;
}

.other-ways li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-light);
}

.other-ways li:last-child {
  border-bottom: none;
}

.other-ways li span:first-child {
  font-size: 1.25rem;
}

.faq-section {
  text-align: left;
  margin-bottom: var(--space-2xl);
}

.faq-section h2 {
  font-size: 1.125rem;
  margin-bottom: var(--space-lg);
}

.faq-item {
  margin-bottom: var(--space-lg);
}

.faq-item h3 {
  font-size: 1rem;
  margin-bottom: var(--space-sm);
}

.faq-item p {
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ============================================================
   Responsive Design
   ============================================================ */

@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.75rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .dropzone {
    padding: var(--space-2xl) var(--space-lg);
  }
  
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-sm);
  }
  
  .tool-card {
    padding: var(--space-md);
  }
  
  .tool-icon {
    width: 32px;
    height: 32px;
  }
  
  .tool-card h3 {
    font-size: 0.8125rem;
  }
  
  .workspace-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
  
  .preview-comparison {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  
  .preview-arrow {
    transform: rotate(90deg);
  }
  
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .action-bar {
    flex-direction: column;
  }
  
  .action-bar .btn {
    width: 100%;
  }
  
  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
    bottom: var(--space-md);
  }
}

@media (max-width: 480px) {
  .header-inner {
    flex-direction: column;
    gap: var(--space-md);
  }
  
  .page-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
  
  .file-item {
    width: 100px;
  }
  
  .file-item-preview {
    height: 120px;
  }
}

/* Page Manager Toolbar */
.page-manager-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
  align-items: center;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border-medium);
  margin: 0 var(--space-sm);
}

.pm-status {
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: var(--space-sm) 0;
  text-align: center;
}

.page-item .page-source {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-xs);
  font-size: 0.625rem;
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-item .page-rotation-badge {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  font-size: 0.625rem;
  background: var(--accent-primary);
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.page-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

/* Drop indicator for drag and drop */
.drop-indicator {
  width: 4px;
  height: 140px;
  background: var(--accent-primary);
  border-radius: 2px;
  margin: 0 -2px;
  box-shadow: 0 0 8px var(--accent-primary);
  animation: pulse-indicator 0.8s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-indicator {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.page-item .delete-btn {
  position: absolute;
  bottom: 24px;
  right: var(--space-xs);
  width: 20px;
  height: 20px;
  background: rgba(220, 38, 38, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.page-item:hover .delete-btn {
  opacity: 1;
}

@media (max-width: 768px) {
  .page-manager-toolbar {
    justify-content: center;
  }

  .toolbar-divider {
    display: none;
  }
}

/* Enhanced PDF Editor Styles */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.editor-tool-group {
  display: flex;
  gap: var(--space-xs);
}

.editor-tool-divider {
  width: 1px;
  height: 32px;
  background: var(--border-light);
}

.editor-action-group {
  display: flex;
  gap: var(--space-xs);
}

.editor-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.editor-action-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-light);
}

.editor-action-btn.danger:hover {
  border-color: #dc2626;
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

.editor-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.editor-status .status-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Text Input Modal */
.edit-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.edit-modal.active {
  display: flex;
}

.edit-modal-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-xl);
}

.edit-modal-box h3 {
  margin-bottom: var(--space-lg);
  font-size: 1.125rem;
}

.edit-modal-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.edit-text-input {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition-fast);
}

.edit-text-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.edit-text-options {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.edit-option-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.edit-option-group label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.edit-option-group select,
.edit-option-group input[type="color"] {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  font-size: 0.875rem;
  cursor: pointer;
}

.edit-option-group input[type="color"] {
  width: 50px;
  height: 36px;
  padding: 2px;
}

.edit-text-preview {
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

#text-preview-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: var(--space-xs);
}

.text-preview-box {
  min-height: 40px;
  padding: var(--space-sm);
  background: white;
  border-radius: var(--radius-sm);
  word-wrap: break-word;
  white-space: pre-wrap;
}

.edit-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

/* Annotation Selection Handles */
.annotation-selected {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Canvas Cursors */
.editor-canvas.tool-select { cursor: default; }
.editor-canvas.tool-whiteout { cursor: crosshair; }
.editor-canvas.tool-text { cursor: text; }
.editor-canvas.tool-signature { cursor: copy; }
.editor-canvas.dragging { cursor: grabbing; }
.editor-canvas.resizing { cursor: nwse-resize; }

/* Annotation Resize Handles (rendered via CSS overlay) */
.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--accent-primary);
  border: 2px solid white;
  border-radius: 2px;
  cursor: nwse-resize;
}

.resize-handle.nw { top: -5px; left: -5px; cursor: nwse-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: nesw-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: nwse-resize; }

/* Mobile Responsive for Editor */
@media (max-width: 768px) {
  .editor-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  .editor-tool-group {
    justify-content: center;
  }

  .editor-tool-divider {
    display: none;
  }

  .editor-action-group {
    justify-content: center;
  }

  .editor-status {
    justify-content: center;
    margin-left: 0;
    margin-top: var(--space-sm);
  }

  .editor-tool-btn {
    padding: var(--space-sm);
    font-size: 0.75rem;
  }

  .editor-tool-btn svg {
    width: 14px;
    height: 14px;
  }

  .edit-modal-box {
    padding: var(--space-lg);
  }

  .edit-text-options {
    flex-direction: column;
    gap: var(--space-md);
  }
}

/* Drop Hint Component - For file upload areas */
.drop-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  text-align: center;
  min-height: 150px;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.drop-hint:hover,
.drop-hint.drag-over {
  border-color: var(--accent-primary);
  background: var(--accent-light);
  color: var(--accent-primary);
}

.drop-hint-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-md);
  color: inherit;
}

.drop-hint-text {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.drop-hint-subtext {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.drop-hint input[type="file"] {
  display: none;
}

/* Empty state for page-grid and file-list */
.page-grid.empty,
.file-list.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.page-grid.empty .drop-hint,
.file-list.empty .drop-hint {
  width: 100%;
  max-width: 400px;
  min-height: 200px;
  border: none;
  background: transparent;
}

.preview-area .drop-hint {
  width: 100%;
  max-width: 500px;
}

@media (max-width: 768px) {
  .drop-hint {
    padding: var(--space-lg);
    min-height: 120px;
  }

  .drop-hint-icon {
    width: 40px;
    height: 40px;
  }

  .drop-hint-text {
    font-size: 0.875rem;
  }
}

/* Utility Classes */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
