/* ==========================================================================
   PDF Monster - Redact PDF Tool CSS
   Client-Side PDF.js Viewer + Redaction Overlays
   ========================================================================== */

/* PDF Viewer Container (scrollbar, alle Seiten) */
.redact-pdf-viewer {
  max-height: 70vh;
  overflow-y: scroll;
  overflow-x: hidden;
  background: var(--bg-tertiary, #f0f0f0);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-4, 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4, 16px);
}

/* Einzelne Seite */
.redact-pdf-page {
  position: relative;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  width: fit-content;
  max-width: 100%;
  flex-shrink: 0;
}

.redact-pdf-page canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Seiten-Label */
.redact-page-label {
  text-align: center;
  font-size: var(--fs-xs, 12px);
  color: var(--text-tertiary, #999);
  padding: var(--space-1, 4px) 0;
  background: rgba(255, 255, 255, 0.8);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: none;
}

/* PDF.js TextLayer */
.redact-text-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  opacity: 0.25;
  line-height: 1.0;
  pointer-events: none;
}

.redact-text-layer span {
  color: transparent;
  position: absolute;
  white-space: pre;
  transform-origin: 0% 0%;
  pointer-events: all;
  cursor: text;
}

.redact-text-layer ::selection {
  background: rgba(0, 100, 255, 0.3);
}

/* Redaction Overlays (pro Seite) */
.redact-pdf-page .redaction-overlays {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}

.redact-pdf-page .redaction-overlays.active {
  pointer-events: auto;
  cursor: crosshair;
}

/* Selection (Zieh-Auswahl, halbtransparent) */
.redaction-selection {
  position: absolute;
  background: rgba(0, 0, 0, 0.3);
  border: 2px dashed rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 11;
}

/* Platzierte Schwärzung */
.redaction-box {
  position: absolute;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.9);
  cursor: pointer;
  pointer-events: auto;
  z-index: 10;
  transition: background 0.15s ease;
}

.redaction-box:hover {
  background: rgba(0, 0, 0, 0.95);
}

.redaction-box.white {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(200, 200, 200, 0.9);
}

.redaction-box.white:hover {
  background: rgba(255, 255, 255, 0.98);
}

/* Delete-Button auf Redaction-Box */
.redaction-box .redact-delete-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: var(--danger, #dc3545);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  display: none;
  z-index: 12;
  padding: 0;
}

.redaction-box:hover .redact-delete-btn {
  display: block;
}

/* Search Highlight (gelbe Markierung fuer Suchergebnisse) */
.redact-search-highlight {
  position: absolute;
  background: rgba(255, 220, 0, 0.4);
  border: 1px solid rgba(255, 180, 0, 0.6);
  pointer-events: none;
  z-index: 9;
  border-radius: 2px;
}

/* Redaction Item in Sidebar */
.redaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2, 8px);
  background: var(--bg-secondary, #f5f5f5);
  border-radius: var(--radius-md, 8px);
  margin-bottom: var(--space-1, 4px);
  font-size: var(--fs-sm, 14px);
}

.redaction-item .redact-item-delete {
  background: none;
  border: none;
  color: var(--danger, #dc3545);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm, 4px);
  font-size: var(--fs-xs, 12px);
}

.redaction-item .redact-item-delete:hover {
  background: rgba(220, 53, 69, 0.1);
}

/* Lazy Loading Placeholder */
.redact-pdf-page.loading {
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary, #f5f5f5);
}

.redact-pdf-page.loading::after {
  content: "Seite wird geladen...";
  color: var(--text-tertiary, #999);
  font-size: var(--fs-sm, 14px);
}

/* Privacy Badge */
.redact-privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1, 4px);
  padding: var(--space-1, 4px) var(--space-2, 8px);
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-radius: var(--radius-md, 8px);
  font-size: var(--fs-xs, 12px);
  font-weight: 500;
  margin-bottom: var(--space-2, 8px);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .redact-pdf-viewer {
    max-height: 50vh;
    padding: var(--space-2, 8px);
    gap: var(--space-2, 8px);
  }

  .redact-pdf-page canvas {
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .redact-pdf-viewer {
    max-height: 45vh;
    padding: var(--space-1, 4px);
  }
}
