/* ProcuraEditor — Full PDF Editor Overlay */

.pe-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg-canvas);
  display: flex;
  flex-direction: column;
}

/* ── Toolbar ───────────────────────────────────────────────────── */

.pe-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 48px;
  background: var(--bg-default);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.pe-toolbar-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 200px;
  margin-right: 6px;
  flex-shrink: 1;
}

.pe-toolbar-btns {
  display: flex;
  gap: 2px;
  align-items: center;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  height: 100%;
}
.pe-toolbar-btns::-webkit-scrollbar { display: none; }

.pe-toolbar-sep {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── Toolbar Buttons ───────────────────────────────────────────── */

.pe-btn {
  background: var(--bg-subtle);
  border: 1px solid transparent;
  color: var(--fg-muted);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  white-space: nowrap;
  transition: all .15s;
  flex-shrink: 0;
  min-width: 48px;
  height: 40px;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  position: relative;
}

.pe-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.pe-btn .pe-btn-label {
  font-size: 9px;
  line-height: 1;
  letter-spacing: .02em;
}

.pe-btn:hover {
  background: var(--bg-default);
  color: var(--fg);
  border-color: var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

.pe-btn:active {
  background: var(--accent-dim, rgba(56,139,253,.1));
  transform: scale(.97);
}

.pe-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pe-btn.primary:hover { opacity: .9; }

.pe-btn.success {
  color: var(--green);
}
.pe-btn.success:hover {
  background: var(--green-dim, rgba(46,160,67,.1));
  border-color: var(--green);
}

.pe-btn.danger {
  color: var(--fg-muted);
}
.pe-btn.danger:hover {
  color: var(--red);
  background: var(--red-dim, rgba(248,81,73,.1));
  border-color: var(--red);
}

.pe-btn.pe-close-btn {
  min-width: 36px;
  padding: 4px 6px;
}

.pe-btn:disabled { opacity: .4; cursor: default; }

/* ── Body ──────────────────────────────────────────────────────── */

.pe-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Thumbnail sidebar */
.pe-thumbs {
  width: 160px;
  background: var(--bg-default);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px;
  flex-shrink: 0;
}

.pe-thumb {
  position: relative;
  margin-bottom: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  transition: border-color .15s;
}

.pe-thumb img { width: 100%; display: block; }

.pe-thumb.selected { border-color: var(--accent); }

.pe-thumb-num {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
}

/* Main viewer */
.pe-viewer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: var(--bg-subtle);
  position: relative;
}

.pe-viewer iframe { width: 100%; height: 100%; border: none; }

/* Status bar */
.pe-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-default);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--fg-muted);
  flex-shrink: 0;
}

.pe-status-size { font-family: var(--font-mono); }
.pe-status-size.warning { color: var(--yellow); }
.pe-status-size.danger { color: var(--red); font-weight: 600; }

/* Loading */
.pe-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--fg-subtle);
  font-size: 13px;
}

/* Signature overlay */
.pe-sign-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.3); z-index: 10; cursor: crosshair; }
.pe-sign-box { position: absolute; border: 2px dashed var(--accent); background: rgba(9,105,218,.1); cursor: move; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--accent); user-select: none; }
.pe-sign-box .pe-sign-resize { position: absolute; right: -4px; bottom: -4px; width: 10px; height: 10px; background: var(--accent); border-radius: 2px; cursor: se-resize; }

/* ── Mobile ────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  .pe-thumbs { width: 70px; padding: 4px; }
  .pe-thumb-num { font-size: 9px; }
  .pe-toolbar { padding: 0 6px; height: 44px; }
  .pe-btn { min-width: 38px; height: 36px; padding: 3px 6px; }
  .pe-btn .pe-btn-label { display: none; }
  .pe-btn svg { width: 20px; height: 20px; }
  .pe-toolbar-title { max-width: 100px; font-size: 12px; }
}
