
/* ================= Workspace ================= */
.workspace{
  width: 100%;
  max-width: none;
  margin: 9px 0 11px;

  padding: 0 18px;

  display: grid;
  grid-template-columns: 240px minmax(640px, 1fr) 440px;
  gap: 18px;

  /* This makes all columns match tallest (PDF) */
  align-items: stretch;
}



/* NEW: Thumbnails panel */
/* Thumbnails panel */
.thumbspane{
  background: linear-gradient(180deg, rgba(25,33,50,0.85), rgba(20,26,36,0.85));
  border: 1px solid var(--stroke);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow2);
  overflow: hidden;

  display: flex;
  flex-direction: column;

  /* Fixed height relative to screen */
  max-height: calc(100vh - 140px);
}

/* Only list scrolls */
.thumbs-list{
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;

  overflow-y: auto;
  overflow-x: hidden;

  flex: 1;
}

/* Header stays fixed, list scrolls */
.thumbs-header{
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}

.thumbs-title{ font-weight: 900; }

.thumbs-sub{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Scrollable list area */



.thumb-item{
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 8px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 140ms ease, background 140ms ease;
}

.thumb-item:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.20);
}

.thumb-item.active{
  border-color: rgba(96,165,250,0.65);
  box-shadow: 0 0 0 4px rgba(59,130,246,0.18);
}

/* Clamp thumbnail size so list isn't huge */
.thumb-img{
  width: 100%;
  height: 140px;          /* <-- change this for bigger/smaller previews */
  object-fit: contain;    /* show full page; use 'cover' if you want cropped */
  display: block;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.25);
}

.thumb-meta{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chip-mini{
  padding: 7px 10px;
  font-size: 12px;
}

/* Existing panes keep working */
.docpane, .notespane{
  background: linear-gradient(180deg, rgba(25,33,50,0.85), rgba(20,26,36,0.85));
  border: 1px solid var(--stroke);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow2);
  overflow: hidden;

  /* allow their internals to scroll if needed later */
  min-height: 0;
}

/* ================= Responsive ================= */
@media (max-width: 1200px){
  .workspace{
    grid-template-columns: 1fr;
    height: auto; /* stack mode */
  }

  .thumbspane{
    min-height: unset;
  }

  /* thumbs becomes a horizontal strip */
  .thumbs-list{
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .thumb-item{
    min-width: 180px;
  }

  #notesArea{ height: 520px; }
  .brand{ min-width: 200px; }
}



.docpane, .notespane{
  background: linear-gradient(180deg, rgba(25,33,50,0.85), rgba(20,26,36,0.85));
  border: 1px solid var(--stroke);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow2);
  overflow: hidden;
}

.doc-header{
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.doc-title{
  font-weight: 900;
  letter-spacing: -0.01em;
}

.doc-hint{
  font-size: 12px;
  color: var(--muted);
}

.doc-surface{
  padding: 16px;
  display:flex;
  justify-content:center;
}

#pdfCanvas{
  display: block;

  /* Let PDF.js control the real size */
  width: auto;
  height: auto;

  max-width: none;
  max-height: none;

  border-radius: var(--r-xl);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  box-shadow: var(--shadow);
}

/* ================= PDF Stage + Text Layer (Traditional Mode) ================= */

#pdfStage, .pdf-stage{
  overflow: auto;
  display: grid;
  place-items: center;
}

#pdfWrap, .pdf-wrap{
  position: relative;
  display: inline-block; /* shrink-wrap to canvas size */
}


/* PDF.js text layer sits on top of the canvas */
.textLayer{
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: auto;
  user-select: text;
  cursor: text;

  /* keep text invisible but selectable */
  color: transparent;

  /* helps match PDF.js layer behavior */
  transform-origin: 0 0;
}

/* When OCR box mode is active, disable text selection so it doesn't fight the canvas */
.textLayer.off{
  pointer-events: none;
  user-select: none;
}

/* PDF.js renders many absolutely-positioned spans */
.textLayer span{
  position: absolute;
  white-space: pre;
  transform-origin: 0 0;
  line-height: 1;
}

/* Make normal browser text selection highlight show up nicely */
.textLayer ::selection{
  background: rgba(59,130,246,0.35);
}

.textLayer ::-moz-selection{
  background: rgba(59,130,246,0.35);
}


/* Notes */
.notes-header{
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}

.notes-title{
  font-weight: 900;
}

.notes-sub{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.notes-actions{
  display:flex;
  gap: 10px;
}

.chip{
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease;
}

.chip:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.22);
}

.chip-danger{
  border-color: rgba(239,68,68,0.30);
}

.chip-danger:hover{
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.42);
}

#notesArea{
  width: 100%;
  height: 680px;
  resize: vertical;
  padding: 14px 16px;
  border: 0;
  outline: none;
  color: var(--text);
  background: rgba(0,0,0,0.28);
  font-size: 14px;
  line-height: 1.55;
}

#notesArea::placeholder{
  color: rgba(255,255,255,0.45);
}

/* ================= Responsive ================= */
@media (max-width: 1200px){
  .workspace{
    grid-template-columns: 1fr;
  }
  input[type="range"]{ width: 180px; }
  #notesArea{ height: 520px; }
  .brand{ min-width: 200px; }
}

@media (max-width: 700px){
  .topbar-inner{
    flex-direction: column;
    align-items: stretch;
  }
  .brand{
    width: 100%;
    justify-content: flex-start;
  }
  .divider{ display:none; }
  input[type="range"]{ width: 100%; }
}

/* ================= Toast Notification ================= */

#toast{
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;

  background: rgba(20,26,36,0.95);
  color: white;

  padding: 12px 16px;
  border-radius: 12px;

  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;

  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);

  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;

  transition:
    opacity 200ms ease,
    transform 200ms ease;
}

/* Visible state */
#toast.show{
  opacity: 1;
  transform: translateY(0);
}

/* Success style */
#toast.success{
  border-color: rgba(34,197,94,0.5);
}

/* Danger style */
#toast.danger{
  border-color: rgba(239,68,68,0.5);
}

.checkrow{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight: 800;
  color: rgba(255,255,255,0.9);
  user-select:none;
}

.checkrow input{
  transform: translateY(1px);
}

.toolinput{
  width: 120px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  outline: none;
}

.toolinput:disabled{
  opacity: 0.45;
}

/* ================= Unify the 3 panes into ONE workspace ================= */

/* 1) Make the whole workspace the “card” */
.workspace{
  padding: 16px;
  gap: 0; /* key: no gap = no “three cards” spacing */

  background: linear-gradient(180deg, rgba(18,20,24,0.78), rgba(18,20,24,0.60));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-xl);
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  position: relative;
  overflow: hidden;
}

/* optional: soft top glow to feel more “native” */
.workspace::before{
  content:"";
  position:absolute;
  inset: 0;
  pointer-events:none;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(255,255,255,0.06), transparent 60%),
    radial-gradient(900px 600px at 10% 30%, rgba(59,130,246,0.05), transparent 55%);
  opacity: 0.9;
}

/* 2) Remove “card” styling from individual panes */
.thumbspane, .docpane, .notespane{
  background: transparent;            /* key */
  border: 0;                          /* key */
  box-shadow: none;                   /* key */
  border-radius: 0;                   /* key */

  min-height: 0;
  position: relative;
  z-index: 1; /* above the workspace glow */
}

/* Give the left & right panes a tiny inset tint so they’re readable,
   without feeling like separate containers */
.thumbspane, .notespane{
  background: rgba(255,255,255,0.02);
}

/* 3) Add “dividers” between columns (not borders around panes) */
.thumbspane{ border-right: 1px solid rgba(255,255,255,0.06); }
.docpane{ border-right: 1px solid rgba(255,255,255,0.06); }

/* 4) Headers should look like part of the same surface */
.thumbs-header, .doc-header, .notes-header{
  background: rgba(255,255,255,0.015);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* 5) Bring back rounding only at the OUTER corners */
.thumbspane{ border-top-left-radius: var(--r-xl); border-bottom-left-radius: var(--r-xl); }
.notespane{ border-top-right-radius: var(--r-xl); border-bottom-right-radius: var(--r-xl); }

/* 6) Restore spacing inside panes (since gap is 0 now) */
.thumbs-list{ padding: 12px; }
.doc-surface{ padding: 18px; }
#notesArea{ padding: 14px 16px; }

/* 7) Make canvas feel like “paper on desk”, not another card */
#pdfCanvas{
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  box-shadow: 0 22px 70px rgba(0,0,0,0.55);
}

/* ===== Shared workspace header (the strip you want) ===== */

.workspace{
  /* keep your grid, but add a header row */
  grid-template-rows: 54px 1fr;
}

/* header spans all columns */
.workbar{
  grid-column: 1 / -1;
  grid-row: 1;

  display: grid;
  grid-template-columns: 240px 1fr 440px;
  align-items: center;

  padding: 10px 12px;

  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-xl) var(--r-xl) 0 0;

  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.workbar-left,
.workbar-right{
  display:flex;
  align-items:center;
  gap: 10px;
}

.workbar-mid{
  display:flex;
  justify-content:flex-start;
  padding: 0 10px;
  color: rgba(255,255,255,0.78);
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* Left pill: "Pages ▾" */
.wb-pill{
  display:flex;
  align-items:center;
  gap: 10px;

  padding: 10px 12px;
  border-radius: 999px;

  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

.wb-icon{
  width: 22px;
  height: 22px;
  display:grid;
  place-items:center;
  border-radius: 7px;
  background: rgba(59,130,246,0.16);
  border: 1px solid rgba(96,165,250,0.20);
  color: rgba(255,255,255,0.9);
  font-size: 11px;
  font-weight: 800;
}

.wb-title{
  font-size: 13px;
  font-weight: 750;
  color: rgba(255,255,255,0.92);
}

.wb-caret{
  opacity: 0.65;
  font-size: 12px;
}

/* Icon buttons on right */
.wb-iconbtn{
  width: 34px;
  height: 34px;
  border-radius: 999px;

  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.80);

  display:grid;
  place-items:center;

  cursor:pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.wb-iconbtn:hover{
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.10);
}

.wb-circle{
  background: rgba(255,255,255,0.035);
}

/* Move the actual panes to row 2 */
.thumbspane{ grid-row: 2; }
.docpane{ grid-row: 2; }
.notespane{ grid-row: 2; }

/* Optional: hide individual pane headers (because the strip replaces them) */
.thumbs-header,
.doc-header,
.notes-header{
  display:none;
}

/* ===== doc title when used in unified header ===== */

.workbar .doc-title{
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;

  color: rgba(255,255,255,0.82);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  padding: 0;
  border: 0;
  background: none;
}

/* Optional: slightly mute the “Document:” prefix */
.workbar .doc-title::first-line{
  color: rgba(255,255,255,0.70);
}

/* ===== Workbar right: Notes + actions ===== */

.workbar-right{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.wb-notes-label{
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: rgba(255,255,255,0.75);
  margin-right: 6px;
  white-space: nowrap;
}

/* Icon buttons (reuse existing vibe) */
.wb-iconbtn{
  width: 32px;
  height: 32px;
  border-radius: 999px;

  display: grid;
  place-items: center;

  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.85);

  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.wb-iconbtn:hover{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
}

.wb-danger{
  color: rgba(239,68,68,0.85);
  border-color: rgba(239,68,68,0.25);
}

.wb-danger:hover{
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.40);
}
