/* Document studio — scan / PDF → editable layout → export */

.ds-page {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
  line-height: 1.5;
}

.ds-hero {
  background: linear-gradient(135deg, #1e3a5f 0%, #0f766e 45%, #134e4a 100%);
  color: #ecfeff;
  padding: 1.75rem 1.25rem 2rem;
}

.ds-hero__inner {
  max-width: 1100px;
  margin: 0 auto;
}

.ds-hero__crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
  font-size: 0.82rem;
}

.ds-hero__crumbs a {
  color: #a5f3fc;
  text-decoration: underline;
}

.ds-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.45rem, 2.2vw + 1rem, 2rem);
  font-weight: 800;
  line-height: 1.15;
}

.ds-hero p {
  margin: 0;
  max-width: 52rem;
  font-size: 0.92rem;
  opacity: 0.95;
}

/* Always-visible file control (avoids hidden-input + label issues and ad/global CSS). */
.ds-hero-upload {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 1.75rem;
}

.ds-hero-upload-card {
  max-width: 36rem;
  background: #fff;
  color: #0f172a;
  border-radius: 12px;
  padding: 1rem 1.25rem 1.15rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.ds-hero-upload-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}

.ds-hero-upload-hint {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.45;
}

/* Beat global style.css `input[type=file]{width:100%}` and any `display:none` from extensions. */
.ds-page input#ds-file-input.ds-file-input-hero,
.ds-page #ds-file-input.ds-file-input-hero {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 3rem !important;
  padding: 0.5rem 0.65rem !important;
  margin: 0 !important;
  font-size: 1rem !important;
  line-height: 1.4 !important;
  opacity: 1 !important;
  visibility: visible !important;
  position: relative !important;
  clip: auto !important;
  overflow: visible !important;
  white-space: normal !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
  border: 2px solid #0f766e !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
  color: #0f172a !important;
}

.ds-page input#ds-file-input.ds-file-input-hero::file-selector-button,
.ds-page #ds-file-input.ds-file-input-hero::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.45rem 0.95rem;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  border-radius: 6px;
  background: #0f766e;
  color: #fff;
  cursor: pointer;
}

.ds-page input#ds-file-input.ds-file-input-hero::file-selector-button:hover {
  background: #0d9488;
}

.ds-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.ds-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.ds-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.86rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  cursor: pointer;
}

.ds-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #94a3b8;
}

.ds-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ds-btn--primary {
  background: #7c3aed;
  border-color: #6d28d9;
  color: #fff;
}

.ds-btn--primary:hover:not(:disabled) {
  background: #6d28d9;
}

.ds-select-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #475569;
}

.ds-toolbar .ds-select-wrap > label {
  display: inline;
  margin-bottom: 0;
  font-weight: 600;
  color: inherit;
}

.ds-select-wrap select {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}

.ds-hint {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0 0 1rem;
  max-width: 52rem;
}

.ds-status {
  min-height: 1.5rem;
  font-size: 0.88rem;
  color: #475569;
  margin-bottom: 0.75rem;
}

.ds-status.ds-busy {
  color: #0f766e;
}

.ds-status.ds-err {
  color: #b91c1c;
}

.ds-workspace-wrap {
  overflow: auto;
  max-height: min(78vh, 900px);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #e2e8f0;
  padding: 1rem;
  outline: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.ds-workspace-wrap.ds-drop-hover {
  border-color: #0f766e;
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.35);
}

.ds-zoom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  color: #475569;
}

.ds-zoom-bar label {
  font-weight: 600;
}

.ds-zoom-bar input[type="range"] {
  width: min(220px, 50vw);
  vertical-align: middle;
}

.ds-zoom-pct {
  min-width: 2.75rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #0f172a;
}

.ds-btn--tiny {
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
}

.ds-zoom-inner {
  display: block;
  margin: 0 auto;
}

.ds-export-root {
  position: relative;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
  /* width/height set in JS to match page */
}

.ds-export-root canvas.ds-page-canvas {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  pointer-events: none;
}

.ds-text-layer {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  line-height: 1;
  opacity: 1;
}

.ds-text-layer .ds-text-el {
  position: absolute;
  transform-origin: 0 0;
  white-space: pre;
  color: #0f172a;
  cursor: text;
  outline: none;
  min-width: 0.25em;
  min-height: 0.5em;
}

.ds-text-layer .ds-text-el:focus {
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.45);
  border-radius: 2px;
}

.ds-text-layer.ds-ocr-mode .ds-text-el {
  /* Slightly transparent so misaligned OCR shows page underneath */
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.9);
}

.ds-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #64748b;
  font-size: 0.95rem;
}

.ds-empty__text {
  margin: 0 0 1rem;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.ds-empty__cta {
  margin: 0;
}

.ds-empty-upload {
  display: inline-block;
  cursor: pointer;
  padding: 0.5rem 1.1rem;
  background: #0f766e;
  color: #fff !important;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.95rem;
}

.ds-empty-upload:hover {
  background: #0d9488;
  color: #fff !important;
}

.ds-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  font-size: 0.84rem;
  color: #475569;
  margin-top: 0.5rem;
}

.ds-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

@media (max-width: 640px) {
  .ds-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .ds-toolbar .ds-select-wrap {
    justify-content: space-between;
  }
}

/* Print / Save as PDF — hide chrome, show document only */
@media print {
  body.ds-page {
    margin: 0 !important;
  }

  .ds-no-print {
    display: none !important;
  }

  .ds-page {
    background: #fff !important;
  }

  .ds-main {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
  }

  .ds-workspace-wrap.ds-print-area {
    display: block !important;
    overflow: visible !important;
    max-height: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: #fff !important;
  }

  .ds-zoom-inner {
    transform: none !important;
    width: auto !important;
    height: auto !important;
  }

  .ds-export-root {
    box-shadow: none !important;
    margin: 0 !important;
    page-break-inside: avoid;
  }
}
