/* Зураг ↔ PDF хэрэгслүүд (jpg-to-pdf, pdf-to-jpg). Бүгд .tool-box дотор. */

.tool-box .pt [hidden] { display: none !important; }
.tool-box .pt { position: relative; }

/* Файл сонгох хэсэг */
.tool-box .pt-drop {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 28px 16px; text-align: center;
  border: 2px dashed var(--c-line); border-radius: var(--radius);
  background: var(--c-bg); color: var(--c-muted);
  transition: border-color .15s, background-color .15s;
}
.tool-box .pt.is-over .pt-drop,
.tool-box .pt.is-over .pt-work { border-color: var(--c-accent); background: color-mix(in srgb, var(--c-accent) 6%, var(--c-surface)); }
.tool-box .pt-drop-icon { color: var(--c-accent); }
.tool-box .pt-pick { position: relative; cursor: pointer; }
.tool-box .pt-drop .pt-pick { min-height: 48px; padding: 10px 22px; font-size: 1rem; }
.tool-box .pt-pick:focus-within { outline: 3px solid color-mix(in srgb, var(--c-accent) 45%, transparent); outline-offset: 2px; }
.tool-box .pt-file { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.tool-box .pt-hint { margin: 0; font-size: .9rem; color: var(--c-muted); }
.tool-box .pt-private { font-size: .85rem; }
.tool-box .pt-drag-hint { display: none; }
@media (hover: hover) and (pointer: fine) {
  .tool-box .pt-drag-hint { display: inline; }
}

/* Ажлын хэсэг */
.tool-box .pt-work { border: 2px solid transparent; border-radius: var(--radius); transition: border-color .15s, background-color .15s; }
.tool-box .pt-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 12px; }
.tool-box .pt-bar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-box .pt-count { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.tool-box .pt-count span { font-weight: 400; color: var(--c-muted); }
.tool-box .pt-name { font-weight: 600; }

/* Зургийн жагсаалт */
.tool-box .pt-grid {
  list-style: none; margin: 0 0 16px; padding: 0;
  display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}
.tool-box .pt-item {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 6px; border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-surface);
}
.tool-box .pt-item[draggable="true"] { cursor: grab; }
.tool-box .pt-item.is-drag { opacity: .4; }
.tool-box .pt-thumb {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; overflow: hidden; border-radius: 6px; background: var(--c-bg);
}
.tool-box .pt-thumb img {
  display: block; max-width: 100%; max-height: 100%; object-fit: contain;
  transition: transform .2s ease; pointer-events: none; user-select: none; -webkit-user-drag: none;
}
.tool-box .pt-num {
  position: absolute; top: 10px; left: 10px; z-index: 1;
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c-text); color: var(--c-surface); font-size: .8rem; font-weight: 600; line-height: 1;
}
.tool-box .pt-name-sm { margin: 0; font-size: .78rem; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-box .pt-tools { display: flex; justify-content: space-between; gap: 4px; }
.tool-box .pt-ib {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 1 38px; min-width: 30px; height: 34px; padding: 0; border-radius: 8px;
  border: 1px solid var(--c-line); background: var(--c-surface); color: var(--c-text);
  cursor: pointer; font: inherit;
}
.tool-box .pt-ib:hover:not([disabled]) { border-color: var(--c-accent); color: var(--c-accent); }
.tool-box .pt-ib[disabled] { opacity: .35; cursor: default; }
.tool-box .pt-del {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  width: 30px; min-width: 0; height: 30px; border-radius: 15px;
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
}
.tool-box .pt-del:hover:not([disabled]) { border-color: var(--c-danger, #b42318); color: var(--c-danger, #b42318); }
.tool-box .pt-spin {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--c-line); border-top-color: var(--c-accent);
  animation: pt-spin .8s linear infinite;
}
@keyframes pt-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .tool-box .pt-spin { animation-duration: 2.4s; }
  .tool-box .pt-thumb img { transition: none; }
}

/* PDF хуудсууд (сонгох) */
.tool-box .pt-pages { align-items: start; }
.tool-box .pt-pages .pt-item { padding: 0; cursor: pointer; }
.tool-box .pt-pnum { display: block; margin-top: 4px; text-align: center; font-size: .85rem; color: var(--c-muted); }
.tool-box .pt-pages .pt-item.is-on .pt-pnum { color: var(--c-text); font-weight: 600; }
.tool-box .pt-pagebox { display: block; padding: 6px; cursor: pointer; border-radius: var(--radius); }
.tool-box .pt-pages .pt-thumb { aspect-ratio: var(--ar, .7071); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 4px; }
.tool-box .pt-pages .pt-thumb img { width: 100%; height: 100%; }
.tool-box .pt-check {
  position: absolute; top: 12px; right: 12px; z-index: 1;
  width: 22px; height: 22px; margin: 0; accent-color: var(--c-accent); cursor: pointer;
}
.tool-box .pt-pages .pt-item.is-on { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
.tool-box .pt-pages .pt-item:not(.is-on) .pt-thumb { opacity: .55; }
.tool-box .pt-pages .pt-item:has(.pt-check:focus-visible) { outline: 3px solid color-mix(in srgb, var(--c-accent) 45%, transparent); outline-offset: 2px; }
.tool-box .pt-thumb-err { font-size: .8rem; color: var(--c-muted); padding: 8px; text-align: center; }
.tool-box .pt-selbar { padding: 8px 10px; border-radius: 8px; background: var(--c-bg); }
.tool-box .pt-all { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.tool-box .pt-all input { width: 20px; height: 20px; margin: 0; accent-color: var(--c-accent); }
.tool-box .pt-selcount { font-size: .9rem; color: var(--c-muted); }

/* Тохиргоо */
.tool-box .pt-opts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 0 0 16px; }
.tool-box .pt-opt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tool-box .pt-opt label { margin: 0; font-weight: 600; }
.tool-box .pt-opt select { width: 100%; min-height: 44px; }

/* Товч, явц, үр дүн */
.tool-box .pt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tool-box .pt-go { width: 100%; min-height: 48px; font-size: 1rem; }
@media (min-width: 600px) {
  .tool-box .pt-go { width: auto; min-width: 200px; }
}
.tool-box .pt-progress { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; font-size: .9rem; color: var(--c-muted); }
.tool-box .pt-progress progress { width: 100%; height: 8px; accent-color: var(--c-accent); }
.tool-box .pt-result:empty { display: none; }
.tool-box .pt-result {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px;
  padding: 12px 14px; border-radius: 8px; background: var(--c-accent-soft, #e6f3f0); color: var(--c-text);
}
.tool-box .pt-result p { margin: 0; }
.tool-box .pt-loading { margin: 12px 0 0; color: var(--c-muted); }

/* Мэдэгдэл */
.tool-box .pt-msg { margin: 14px 0 0; padding: 10px 14px; border-radius: 8px; font-size: .92rem; background: #fffaeb; color: #4a3d00; border-left: 3px solid #d6a400; }
.tool-box .pt-msg.is-error { background: #fdecea; color: var(--c-danger, #b42318); border-left-color: var(--c-danger, #b42318); }
.tool-box .pt-msg p { margin: 0; }
.tool-box .pt-msg p + p { margin-top: 6px; }

/* Нууц үг */
.tool-box .pt-pass { margin: 14px 0 0; padding: 14px; border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-bg); }
.tool-box .pt-pass label { display: block; font-weight: 600; margin-bottom: 8px; }
.tool-box .pt-pass-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-box .pt-pass input { flex: 1 1 180px; width: auto; min-width: 0; min-height: 44px; }
.tool-box .pt-pass-err { margin: 8px 0 0; color: var(--c-danger, #b42318); font-size: .9rem; }
