/* ============================================================================
 * BigPDF Visual Big-PDF Compressor — Workbench Specific Styles
 * Builds cleanly on /brand.css (--bp-* tokens & .bp-wb-* / .bp-loupe chrome)
 * ============================================================================ */

/* Ensure HTML [hidden] always wins over component display:flex / grid rules in brand.css */
[hidden] {
  display: none !important;
}

/* Fix specificity vs .bp-wb-btn so Open Full only renders in ?embed=1 */
html:not(.bp-embed) .bp-embed-only {
  display: none !important;
}

.vc-workbench-section {
  padding: 0 0 42px;
}

/* Keep compact header badge group strictly inside mobile viewport so chips wrap instead of clipping */
.bp-tool-head-badges {
  flex: 0 1 auto;
  max-width: 100%;
}

/* Searchable-Text P0 Caution Banner alignment & mobile wrapping */
.vc-caution-banner {
  width: 100%;
  max-width: 720px;
}

.vc-caution-banner .bp-btn {
  max-width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  padding: 8px 12px;
}

/* Workbench Grid Tweaks */
.vc-wb-body {
  grid-template-columns: minmax(0, 1fr) 338px;
  min-height: 580px;
}

/* Top Toolbar Helpers */
.vc-pager {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: var(--bp-radius-xs);
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--bp-line-dark);
}

.vc-icon-btn {
  min-height: 26px;
  min-width: 26px;
  padding: 0 6px;
  font-size: 15px;
  line-height: 1;
}

.vc-page-readout {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--bp-ink-on-dark);
  padding: 0 6px;
  white-space: nowrap;
}

.vc-sample-menu {
  position: relative;
}

.vc-sample-menu > summary {
  list-style: none;
}

.vc-sample-menu > summary::-webkit-details-marker {
  display: none;
}

.vc-sample-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 274px;
  padding: 6px;
  border-radius: var(--bp-radius-md);
  background: var(--bp-sheet);
  border: 1px solid var(--bp-line-strong);
  box-shadow: var(--bp-shadow-modal);
  color: var(--bp-ink);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vc-sample-opt {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--bp-radius-xs);
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: background-color 0.13s var(--bp-ease);
}

.vc-sample-opt:hover {
  background: var(--bp-sub);
}

.vc-sample-opt strong {
  font-family: var(--bp-font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--bp-ink);
}

.vc-sample-opt span {
  font-size: 12px;
  color: var(--bp-ink-muted);
}

/* Central Stage & Drop Overlay */
.vc-stage {
  padding: 18px 22px 20px;
  gap: 12px;
}

.vc-stage.has-doc {
  justify-content: flex-start;
}

/* Flow HUD naturally above the loupe so wrapped pills never overlap on mobile */
.vc-stage .bp-wb-hud {
  position: static;
  width: 100%;
  max-width: 720px;
  pointer-events: auto;
}

/* Compact Inspector Rail so Loupe & Telemetry sit cleanly above the fold */
.vc-inspector .bp-wb-panel {
  padding: 12px 15px;
  gap: 8px;
}

.vc-inspector .bp-wb-actions {
  padding: 12px 15px;
}

.vc-hud-teal {
  color: var(--bp-teal-on-dark);
}

.vc-drop-overlay {
  position: absolute;
  inset: 12px;
  z-index: 20;
  border-radius: var(--bp-radius-md);
  border: 2px dashed var(--bp-teal);
  background: rgba(234, 246, 245, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.vc-drop-overlay[hidden] {
  display: none;
}

.vc-drop-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 24px;
  border-radius: var(--bp-radius-md);
  background: var(--bp-sheet);
  border: 1px solid var(--bp-teal-border);
  box-shadow: var(--bp-shadow-md);
  font-family: var(--bp-font-display);
  font-size: 15px;
  color: var(--bp-ink);
}

.vc-drop-samples {
  width: 100%;
  padding-top: 12px;
  border-top: 1px solid var(--bp-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.vc-drop-samples-label {
  font-size: 11.5px;
  color: var(--bp-ink-muted);
}

/* Live Split-Screen Sharpness Loupe */
.vc-loupe-wrap {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vc-loupe-wrap[hidden] {
  display: none;
}

.vc-loupe {
  max-width: none;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #EAE5DC;
  cursor: ew-resize;
}

.vc-loupe canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
}

.bp-loupe-tag-right.is-larger {
  background: var(--bp-amber);
}

.vc-loupe-busy {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: var(--bp-radius-pill);
  background: rgba(23, 27, 33, 0.88);
  color: var(--bp-teal-on-dark);
  font-family: var(--bp-font-mono);
  font-size: 11px;
  font-weight: 600;
  z-index: 8;
  pointer-events: none;
}

.vc-loupe-busy[hidden] {
  display: none;
}

.vc-loupe-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: var(--bp-radius-sm);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--bp-line-strong);
}

.vc-loupe-hint {
  font-size: 11.5px;
  color: var(--bp-ink-secondary);
}

.vc-loupe-quick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.vc-mini-btn {
  border: 1px solid var(--bp-line-strong);
  background: var(--bp-paper);
  color: var(--bp-ink-strong);
  border-radius: 5px;
  padding: 3px 8px;
  font-family: var(--bp-font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s var(--bp-ease);
}

.vc-mini-btn:hover {
  background: var(--bp-sub);
  border-color: var(--bp-ink-muted);
}

.vc-mini-btn.is-active {
  background: var(--bp-teal-soft);
  border-color: var(--bp-teal);
  color: var(--bp-teal);
}

.vc-stage-error {
  width: 100%;
  max-width: 560px;
  margin: 0;
}

.vc-stage-error[hidden] {
  display: none;
}

/* Inspector Enhancements */
.vc-probe-badge {
  color: var(--bp-teal);
  font-size: 10.5px;
}

.vc-preset-note {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--bp-ink-muted);
}

.vc-range-ticks {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--bp-ink-muted);
}

.vc-color-group .bp-chip {
  flex: 1 1 auto;
  justify-content: center;
  padding: 0 8px;
  font-size: 11.5px;
}

/* Interactive Focal Point Mini-Map */
.vc-minimap-row {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.vc-minimap-box {
  position: relative;
  width: 98px;
  background: var(--bp-sub);
  border: 1px solid var(--bp-line-strong);
  border-radius: 4px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  box-shadow: var(--bp-shadow-sm);
  line-height: 0;
}

.vc-minimap-box canvas {
  display: block;
  width: 100%;
  height: auto;
}

.vc-minimap-rect {
  position: absolute;
  border: 2px solid var(--bp-teal);
  background: rgba(14, 110, 110, 0.16);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
  pointer-events: none;
  box-sizing: border-box;
}

.vc-minimap-cross {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
}

.vc-minimap-cross::before,
.vc-minimap-cross::after {
  content: "";
  position: absolute;
  background: var(--bp-accent);
}

.vc-minimap-cross::before {
  left: 0;
  right: 0;
  top: 3.5px;
  height: 1px;
}

.vc-minimap-cross::after {
  top: 0;
  bottom: 0;
  left: 3.5px;
  width: 1px;
}

.vc-minimap-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.vc-minimap-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.48;
  color: var(--bp-ink-secondary);
}

/* Byte Breakdown & Bloat Warning */
.vc-byte-breakdown {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--bp-ink-muted);
  padding: 8px 10px;
  border-radius: var(--bp-radius-xs);
  background: var(--bp-paper);
  border: 1px solid var(--bp-line);
}

.vc-bloat-warn {
  margin: 0;
  padding: 12px 13px;
  font-size: 12.5px;
  line-height: 1.5;
}

.vc-bloat-warn[hidden] {
  display: none;
}

.vc-bloat-warn .bp-callout-title {
  font-size: 13px;
}

.vc-bloat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Telemetry Color States */
.bp-wb-tel-val.is-emerald { color: var(--bp-emerald); }
.bp-wb-tel-val.is-teal { color: var(--bp-teal); }
.bp-wb-tel-val.is-amber { color: var(--bp-amber); }
.bp-wb-tel-val.is-rose { color: var(--bp-rose); }

/* Export Progress & Summary */
.vc-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--bp-radius-xs);
  background: var(--bp-sheet);
  border: 1px solid var(--bp-line-strong);
}

.vc-progress[hidden] {
  display: none;
}

.vc-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--bp-ink-strong);
}

.vc-progress-track {
  width: 100%;
  height: 7px;
  border-radius: var(--bp-radius-pill);
  background: var(--bp-control);
  overflow: hidden;
}

.vc-progress-fill {
  height: 100%;
  background: var(--bp-teal);
  border-radius: var(--bp-radius-pill);
  transition: width 0.16s var(--bp-ease);
}

.vc-export-result {
  padding: 11px 12px;
  border-radius: var(--bp-radius-sm);
  background: var(--bp-emerald-bg);
  border: 1px solid var(--bp-emerald-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vc-export-result.is-warn {
  background: var(--bp-amber-bg);
  border-color: var(--bp-amber-border);
}

.vc-export-result[hidden] {
  display: none;
}

.vc-export-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vc-export-delta {
  font-size: 12px;
  font-weight: 700;
  color: var(--bp-emerald);
}

.vc-export-result.is-warn .vc-export-delta {
  color: var(--bp-amber);
}

.vc-export-detail {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.48;
  color: var(--bp-ink-strong);
  overflow-wrap: anywhere;
}

.vc-export-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vc-export-btns .bp-btn {
  max-width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  padding: 8px 12px;
  min-height: 36px;
}

.vc-secondary-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

/* Thumbnail Filmstrip Customizations */
.bp-wb-thumbs[hidden] {
  display: none;
}

.bp-thumb-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Editorial Info Grid */
.vc-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

/* Embed Mode Refinements */
html.bp-embed .vc-workbench-section,
body.bp-embed .vc-workbench-section {
  padding: 0;
}

html.bp-embed .bp-proof-frame::before,
body.bp-embed .bp-proof-frame::before {
  display: none;
}

html.bp-embed .vc-wb-body,
body.bp-embed .vc-wb-body {
  min-height: 500px;
}

html.bp-embed .vc-stage,
body.bp-embed .vc-stage {
  padding: 14px 16px 16px;
  min-height: 440px;
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .vc-wb-body {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .vc-stage {
    padding: 14px 14px 16px;
    min-height: 340px;
  }

  .vc-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .vc-stage {
    padding: 12px 12px 14px;
  }

  .vc-caution-banner .bp-callout-caution-actions,
  .vc-caution-banner .bp-btn {
    width: 100%;
  }

  .bp-wb-hud {
    gap: 6px;
  }

  .bp-wb-hud-pill {
    font-size: 10.5px;
    padding: 4px 8px;
    max-width: 100%;
  }

  .vc-loupe {
    aspect-ratio: 4 / 3;
    min-height: 240px;
  }

  .bp-loupe-tag {
    top: 7px;
    padding: 3px 6px;
    font-size: 9.5px;
    white-space: nowrap;
  }

  .bp-loupe-tag-left {
    left: 7px;
  }

  .bp-loupe-tag-right {
    right: 7px;
  }

  .vc-loupe-bar {
    padding: 8px 10px;
  }

  .vc-sample-popover {
    left: auto;
    right: 0;
    width: min(274px, calc(100vw - 32px));
  }
}

@media (max-width: 420px) {
  .bp-wb-bar {
    gap: 8px;
  }

  .bp-wb-file {
    max-width: 148px;
    font-size: 11.5px;
  }

  .vc-page-readout {
    font-size: 11px;
    padding: 0 4px;
  }

  .bp-wb-btn {
    padding: 0 9px;
    font-size: 12px;
  }

  .bp-chip {
    font-size: 11.5px;
    padding: 0 9px;
  }

  .vc-minimap-row {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
  }

  .vc-minimap-box {
    width: 82px;
  }
}
