/* PDF Image Placer — tool-specific styles */

/* ── card override ── */
.pip-card { padding: 0; overflow: hidden; }
#pdfDropSection { padding: 22px; }

/* ── toolbar ── */
.pip-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 9px 14px; background: var(--bg-soft); border-bottom: 1px solid var(--line);
}
.tb-group  { display: flex; align-items: center; gap: 6px; }
.tb-label  { font-size: .75rem; font-weight: 600; color: var(--muted-2); white-space: nowrap; }
.tb-sep    { width: 1px; height: 20px; background: var(--line); flex-shrink: 0; }
.tb-spacer { flex: 1; }
.tb-select {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  padding: 6px 9px; border-radius: var(--radius-sm); font-family: inherit; font-size: .83rem; cursor: pointer;
}
.tb-select:focus { outline: none; border-color: var(--accent); }
.tb-btn {
  font-family: inherit; font-weight: 600; font-size: .8rem; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  padding: 6px 11px; border-radius: var(--radius-sm); transition: all .14s;
}
.tb-btn:hover { color: var(--text); border-color: var(--accent); }
.tb-icon-btn {
  font-family: inherit; font-weight: 700; font-size: 1.05rem; line-height: 1;
  cursor: pointer; background: var(--card); border: 1px solid var(--line); color: var(--muted);
  width: 28px; height: 28px; border-radius: var(--radius-sm); display: grid; place-items: center; transition: all .14s;
}
.tb-icon-btn:hover { color: var(--text); border-color: var(--accent); }
.tb-zoom-range { width: 72px; accent-color: var(--accent); cursor: pointer; }
.tb-zoom-lbl   { font-size: .8rem; font-weight: 600; color: var(--muted); min-width: 34px; text-align: center; }
.tb-dl-btn     { font-size: .85rem; padding: 8px 16px; white-space: nowrap; }

.unit-tabs { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.unit-tab  {
  font-family: inherit; font-weight: 600; font-size: .78rem; cursor: pointer;
  background: transparent; border: none; color: var(--muted); padding: 5px 9px; transition: all .13s;
}
.unit-tab:hover  { color: var(--text); }
.unit-tab.active { background: var(--accent); color: #0b0e1c; }

/* ── editor outer ── */
.pip-editor-outer {
  display: flex;
  height: 72vh;
  min-height: 460px;
  max-height: 860px;
}

/* ── editor main (grid: corner | ruler-h / ruler-v | workspace) ── */
.pip-editor-main {
  flex: 1; min-width: 0;
  display: grid;
  grid-template-rows: 24px 1fr;
  grid-template-columns: 24px 1fr;
  position: relative; overflow: hidden;
}

.ruler-corner {
  grid-row: 1; grid-column: 1;
  background: #11152a;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  z-index: 3;
}
.ruler-h-wrap {
  grid-row: 1; grid-column: 2;
  overflow: hidden; border-bottom: 1px solid var(--line);
  background: #1a1e35; z-index: 2;
}
.ruler-v-wrap {
  grid-row: 2; grid-column: 1;
  overflow: hidden; border-right: 1px solid var(--line);
  background: #1a1e35; z-index: 2;
}
#rulerH, #rulerV { display: block; }

.pip-workspace {
  grid-row: 2; grid-column: 2;
  overflow: auto; position: relative;
  /* Dot-grid background */
  background:
    radial-gradient(circle, rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 18px 18px,
    #0b0e1e;
}
#workspaceInner { position: relative; }

/* Page drop-shadow card */
.pip-page-wrap {
  position: absolute;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.07);
}
#pageCanvas { display: block; }

/* ── handle overlay ── */
.handles {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: visible;
}
.handle {
  position: absolute; transform: translate(-50%,-50%);
  pointer-events: all; touch-action: none;
  border-radius: 50%; z-index: 10;
  transition: transform .1s, box-shadow .1s;
}
.handle:active { transform: translate(-50%,-50%) scale(1.15); }

.handle-resize {
  width: 13px; height: 13px; border-radius: 3px;
  background: #fff; border: 2px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.5); cursor: nwse-resize;
}
.handle-move {
  width: 24px; height: 24px;
  background: rgba(108,139,255,.15); border: 2px solid var(--accent);
  cursor: move;
}
/* crosshair inside move handle */
.handle-move::before, .handle-move::after {
  content: ''; position: absolute; background: var(--accent); border-radius: 1px;
}
.handle-move::before { width: 2px; height: 13px; left: 50%; top: 50%; transform: translate(-50%,-50%); }
.handle-move::after  { width: 13px; height: 2px;  left: 50%; top: 50%; transform: translate(-50%,-50%); }

.handle-rotate {
  width: 14px; height: 14px;
  background: var(--accent-2); border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 2px 8px rgba(0,0,0,.5); cursor: grab;
}
.handle-rotate:active { cursor: grabbing; }

.handle-warp {
  width: 15px; height: 15px; border-radius: 4px;
  background: #ff9f4a; border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.55); cursor: grab;
}
.handle-warp:active { cursor: grabbing; }

/* ── cursor position readout ── */
.pos-readout {
  position: absolute; bottom: 7px; right: 8px; z-index: 5;
  font-size: .68rem; font-weight: 600; color: var(--muted-2);
  background: rgba(11,14,28,.78); padding: 2px 9px; border-radius: 5px;
  pointer-events: none; font-variant-numeric: tabular-nums;
}

/* ── controls sidebar ── */
.pip-controls {
  width: 266px; flex-shrink: 0;
  border-left: 1px solid var(--line);
  background: var(--bg-soft); overflow-y: auto;
  display: flex; flex-direction: column;
}
.ctrl-section { padding: 13px 15px; border-bottom: 1px solid var(--line); }
.ctrl-section:last-child { border-bottom: none; }
.ctrl-hdr {
  font-size: .74rem; font-weight: 700; color: var(--muted); margin-bottom: 10px;
  display: flex; align-items: center; gap: 5px;
  text-transform: uppercase; letter-spacing: .05em;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ctrl-hint { font-size: .76rem; color: var(--muted-2); line-height: 1.5; margin: 0; }
.ctrl-actions { display: flex; flex-direction: column; gap: 8px; }
.rot-range { width: 100%; accent-color: var(--accent); cursor: pointer; display: block; }

.lock-btn {
  margin-left: auto; display: flex; align-items: center;
  background: transparent; border: 1px solid var(--line); color: var(--muted-2);
  padding: 3px 7px; border-radius: 5px; cursor: pointer; transition: all .13s;
}
.lock-btn.active { color: var(--accent); border-color: var(--accent); background: rgba(108,139,255,.1); }
.lock-btn:hover  { border-color: var(--muted); color: var(--muted); }

.warp-toggle {
  margin-left: auto; font-family: inherit; font-size: .68rem; font-weight: 700;
  background: var(--card); border: 1px solid var(--line); color: var(--muted-2);
  padding: 3px 8px; border-radius: 4px; cursor: pointer; transition: all .13s;
}
.warp-toggle.active { background: rgba(255,159,74,.15); border-color: #ff9f4a; color: #ff9f4a; }

/* ── mobile ── */
@media (max-width: 820px) {
  .pip-editor-outer { flex-direction: column; height: auto; }
  .pip-editor-main  { height: 56vw; min-height: 300px; }
  .pip-controls     { width: 100%; border-left: none; border-top: 1px solid var(--line); }
  .pip-toolbar      { gap: 6px; }
  .tb-sep           { display: none; }
  .tb-zoom-range    { width: 54px; }
}
@media (max-width: 480px) {
  .two-col { grid-template-columns: 1fr; }
  .pip-editor-main { height: 64vw; }
  .handle-resize   { width: 18px; height: 18px; }
  .handle-move     { width: 30px; height: 30px; }
  .handle-rotate, .handle-warp { width: 20px; height: 20px; }
  .tb-dl-btn { display: none; }
}
