/* PDF editor page — extends converter styles from styles.css */
[hidden] { display: none !important; }

.pdf-page .converter-hero h1 span { color: var(--blue); }
.pdf-page .converter-drop:focus-visible,
.pdfe button:focus-visible,
.pdfe select:focus-visible,
.pdfe summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.pdfe { display: flex; flex-direction: column; gap: 12px; }
.pdfe-sep { width: 1px; height: 24px; background: #dfe4ec; margin: 0 4px; }

/* top bar */
.pdfe-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.pdfe-name {
  font-weight: 700;
  color: var(--text);
  flex: 1 1 200px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdfe-grp { display: flex; align-items: center; gap: 4px; }
.pdfe-icon {
  font: inherit;
  font-size: 18px;
  line-height: 1;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.pdfe-icon:hover:not(:disabled) { background: #e8edf5; }
.pdfe-icon:disabled { opacity: .35; cursor: default; }
.pdfe-zoom { min-width: 52px; text-align: center; font-size: 14px; color: var(--muted); }
.pdfe-dl { padding: 9px 16px; font-size: 14px; white-space: nowrap; }

/* toolbar */
.pdfe-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px solid #dfe4ec;
  border-radius: 12px;
  background: #fff;
}
.pdfe-tool {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #3d4454;
  cursor: pointer;
  list-style: none;
  transition: background-color .15s, color .15s;
}
.pdfe-tool:hover { background: #eef3fb; }
.pdfe-tool.is-active { background: var(--btn); color: #fff; }
.pdfe-tool::-webkit-details-marker { display: none; }
.pdfe-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.pdfe-field input[type="color"] {
  width: 32px;
  height: 30px;
  padding: 0;
  border: 1px solid #dfe4ec;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.pdfe-field select {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid #dfe4ec;
  border-radius: 8px;
  background: #fff;
}

/* more tools menu */
.pdfe-more { position: relative; }
.pdfe-more[open] > summary { background: #eef3fb; }
.pdfe-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border: 1px solid #dfe4ec;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .14);
}
.pdfe-menu > button,
.pdfe-menu > label {
  font: inherit;
  font-size: 14px;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.pdfe-menu > button:hover,
.pdfe-menu > label:hover { background: #eef3fb; }
.pdfe-check { display: flex; align-items: center; gap: 8px; }
.pdfe-exp {
  display: flex;
  gap: 6px;
  padding: 6px 4px 2px;
  border-top: 1px solid #eef1f6;
  margin-top: 4px;
}
.pdfe-exp select {
  font: inherit;
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid #dfe4ec;
  border-radius: 8px;
}
.pdfe-exp button { flex: 1; }

/* body: thumbnails + page canvas */
.pdfe-body {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  min-height: 560px;
  max-height: 78vh;
}
.pdfe-thumbs {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px;
  border: 1px solid #dfe4ec;
  border-radius: 12px;
  background: #f4f6fa;
}
.th {
  position: relative;
  align-self: center;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}
.th canvas { display: block; }
.th.is-cur { border-color: var(--blue); }
.th.is-drag { opacity: .4; }
.th-no {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(15, 23, 42, .6);
  color: #fff;
}

.pdfe-pages {
  overflow: auto;
  padding: 16px;
  border: 1px solid #dfe4ec;
  border-radius: 12px;
  background: #e9edf3;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.pdfe-pages[data-tool]:not([data-tool="select"]) {
  cursor: crosshair;
  touch-action: none;
}
.pdfe-pages[data-tool="select"] { touch-action: pan-x pan-y; }

.pg-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 0 auto; margin: 0 auto; }
.pg {
  position: relative;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .16);
  user-select: none;
  -webkit-user-select: none;
}
.pg.is-cur { outline: 2px solid var(--blue); outline-offset: 3px; }
.pg-in { position: absolute; transform-origin: 50% 50%; }
.pg-canvas { position: absolute; left: 0; top: 0; display: block; }
.pg-ann { position: absolute; inset: 0; }
.pg-no { font-size: 12px; color: var(--muted); }

/* annotations */
.ann { position: absolute; box-sizing: border-box; }
.ann-text {
  padding: 0;
  margin: 0;
  cursor: move;
  min-width: 4px;
  min-height: 4px;
}
.ann-img { cursor: move; }
.ann-img img { cursor: move; }
.ann-hl { cursor: move; }
.ann-wo { cursor: move; }
.ann-rect { cursor: move; }
.ann-draw { pointer-events: none; }
.ann-draw svg { pointer-events: visibleStroke; }
.ann.is-sel { outline: 1.5px dashed var(--blue); outline-offset: 2px; }
.ann.is-live { opacity: .85; pointer-events: none; }
.ann.is-sel::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 9px;
  height: 9px;
  background: var(--blue);
  border-radius: 2px;
}

/* dialogs */
.pdfe-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
  color: var(--text);
}
.pdfe-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.pdfe-dialog h3 { margin: 0 0 8px; font-size: 1.1rem; }
.pdfe-dialog textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid #dfe4ec;
  border-radius: 10px;
  resize: vertical;
}
.pdfe-dlg-sub { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
#pdfe-sign-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 600 / 240;
  background: #fff;
  border: 1px dashed #c3cad6;
  border-radius: 10px;
  cursor: crosshair;
  touch-action: none;
}
.pdfe-dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.pdfe-dlg-actions button:not(.btn) {
  font: inherit;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: #e8edf5;
  color: var(--text);
  cursor: pointer;
}
.pdfe-dlg-actions .btn { padding: 9px 16px; }

/* footer */
.pdfe-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.pdfe-foot p { margin: 0; }

/* mobile: thumbnails become a horizontal strip */
@media (max-width: 760px) {
  .pdfe-top { gap: 8px; }
  .pdfe-name { flex-basis: 100%; }
  .pdfe-tools { padding: 6px; }
  .pdfe-tool { padding: 6px 9px; font-size: 13px; }
  .pdfe-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    max-height: none;
  }
  .pdfe-thumbs {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
  }
  .th { align-self: center; flex: 0 0 auto; }
  .pdfe-pages { min-height: 420px; max-height: 70vh; padding: 10px; }
  .pdfe-menu { width: min(280px, calc(100vw - 40px)); }
}
