/*!
 * The converter, compress and resize pages (inc/tool-page.inc.php, assets/js/
 * tool-batch.js): the shared tool layout with a list of files, the chosen
 * file's result in the photo box, and the phone editor's file strip.
 */

/* ── The files ──────────────────────────────────────────────────────────── */
.tb-files { display: flex; flex-direction: column; gap: 6px; max-height: 336px; overflow-y: auto; padding: 2px; margin: -2px; }
.tb-file { position: relative; display: flex; align-items: center; gap: 4px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--pt-line, #e3e7ee); }
.tb-file:has(.tb-pick[aria-pressed="true"]) { background: var(--pt-accent-soft, #e8f0fc); box-shadow: inset 0 0 0 2px var(--pt-accent, #0f70e6); }
.tb-pick {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 56px;
  padding: 6px 4px 6px 6px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--pt-ink, #343f52);
  text-align: start;
}
[dir="rtl"] .tb-pick { padding: 6px 6px 6px 4px; }
.tb-pick:focus-visible { outline: 3px solid var(--pt-accent, #0f70e6); outline-offset: 1px; }
.tb-thumb {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 8px;
  background: #e9eef6;
}
.tb-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.tb-ext { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.02em; color: #5b6b85; text-transform: uppercase; }
.tb-meta { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; line-height: 1.25; }
.tb-name { overflow: hidden; font-size: 0.8rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tb-stat { font-size: 0.72rem; color: #6c757d; font-variant-numeric: tabular-nums; unicode-bidi: plaintext; }
.tb-file[data-state="done"] .tb-stat { color: #1d7f4d; }
.tb-file[data-state="error"] .tb-stat { color: #c0392b; white-space: normal; }
.tb-gain { font-weight: 700; }
.tb-gain.tb-up { color: #a76400; }
.tb-icon {
  position: relative;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #5b6b85;
}
.tb-icon svg { width: 18px; height: 18px; }
.tb-icon:hover { background: rgba(30, 34, 40, 0.06); color: var(--pt-accent, #0f70e6); }
.tb-del:hover { color: #d63939; }
.tb-icon:focus-visible { outline: 3px solid var(--pt-accent, #0f70e6); outline-offset: 1px; }
.tb-icon:disabled { visibility: hidden; }
.tb-file .tb-del { margin-inline-end: 4px; }
/* The busy dot on a file while it is converted. */
.tb-spin { display: inline-block; width: 10px; height: 10px; margin-inline-end: 5px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -1px; animation: tb-spin 0.8s linear infinite; }
@keyframes tb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tb-spin { animation-duration: 2.4s; } }
.tb-addtile { display: none; }

/* ── The settings ───────────────────────────────────────────────────────── */
.tb-row[hidden], .tb-files-row[hidden] { display: none !important; }
.tb-seg { display: flex; width: 100%; }
.tb-seg button { flex: 1 1 0; font-variant-numeric: tabular-nums; }
.tb-size { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; align-items: end; }
.tb-size .form-check { grid-column: 1 / -1; margin: 0; }
.tb-size .tb-apply { grid-column: 1 / -1; }
.tb-help { margin-top: -4px; }
/* GIF Compressor: Colors, Frames and Size limit each on one line, the name in
   the sliders' column (pt-theme.css --pt-sl-cols), so the panel fits. */
.tb-inline { display: grid; grid-template-columns: minmax(84px, 30%) minmax(0, 1fr); column-gap: 10px; align-items: center; }
.tb-inline > .form-label { margin: 0 !important; line-height: 1.25; overflow-wrap: anywhere; hyphens: auto; }
.tb-inline > :not(.form-label) { grid-column: 2; }
/* The target size (Reduce / Increase Image Size in KB): presets and a field. */
.tb-kb { display: flex; flex-wrap: wrap; gap: 8px; }
.tb-kb-presets { flex: 1 1 220px; }
.tb-kb-presets button { padding: 0 6px; white-space: nowrap; }
.tb-kb-field { flex: 1 0 120px; max-width: 160px; }
.tb-kb-field .form-control { font-variant-numeric: tabular-nums; }
/* KB or MB next to the size: the field always reads left to right. */
#tb-kb-ctl .tb-kb-field { flex-basis: 150px; max-width: 200px; }
/* Six presets, 20 KB to 1 MB: three to a row in the panel, not 4 + 2. */
.pt-tool-panel #tb-kb-ctl .tb-kb-presets > button { flex: 1 1 30%; }
/* Batch Crop: ten ratios, five to a row; Custom's two numbers. */
.tb-crop-ratios { flex-wrap: wrap; }
.pt-tool-panel #tb-crop-ctl .tb-crop-ratios > button { flex: 1 1 18%; padding-inline: 4px; }
.tb-crop-custom { display: flex; align-items: center; gap: 8px; max-width: 240px; margin-top: 8px; }
.tb-crop-custom[hidden] { display: none !important; }
.tb-crop-custom .form-control { flex: 1 1 0; min-width: 0; font-variant-numeric: tabular-nums; }
/* The frame on the photo (tool-batch.js placeFrame): outside it dimmed,
   thirds inside. A drag on it moves it; on a phone page with the editor
   closed, an up-and-down swipe still scrolls the page. */
.tb-crop-view { position: absolute; z-index: 2; overflow: hidden; cursor: crosshair; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.tb-crop-view[hidden] { display: none !important; }
@media (pointer: fine) { .tb-crop-view { touch-action: none; } }
#pt-app .tb-crop-view { touch-action: none; }
.tb-crop-frame { position: absolute; box-sizing: border-box; border: 2px solid #fff; outline: none; cursor: move;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 0 0 9999px rgba(15, 17, 21, 0.55); }
.tb-crop-frame::before, .tb-crop-frame::after { content: ""; position: absolute; pointer-events: none; border: 0 solid rgba(255, 255, 255, 0.5); }
.tb-crop-frame::before { inset: 0 33.333%; border-inline-width: 1px; }
.tb-crop-frame::after { inset: 33.333% 0; border-block-width: 1px; }
.tb-crop-frame:focus-visible { border-color: #0f70e6; box-shadow: inset 0 0 0 2px #fff, 0 0 0 9999px rgba(15, 17, 21, 0.55); }
.tb-kb-field .tb-kb-unit { flex: 0 0 auto; width: auto; padding-inline-end: 2rem; }

/* ── The chosen file ────────────────────────────────────────────────────── */
.tb-viewport { position: relative; display: flex; align-items: center; justify-content: center; }
.tb-preview { display: block; max-width: 100%; max-height: 100%; background: repeating-conic-gradient(#eef1f5 0% 25%, #fff 0% 50%) 0 0/16px 16px; box-shadow: 0 1px 2px rgba(30, 34, 40, 0.18), 0 4px 14px rgba(30, 34, 40, 0.1); }
.tb-preview[hidden], .tb-text[hidden], .tb-card[hidden], .tb-busy[hidden], .tb-note[hidden], .tb-empty[hidden] { display: none !important; }
.tb-viewport.tb-working .tb-preview { opacity: 0.45; filter: saturate(0.6); }
.tb-text { width: 100%; height: 100%; min-height: 300px; padding: 14px; border: 1px solid var(--pt-line, #e3e7ee); border-radius: 12px; background: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; line-height: 1.5; resize: none; }
.tb-copy { position: absolute; bottom: 12px; inset-inline-end: 12px; min-width: 88px; }
/* Image to Text: room under the last line, so Copy never covers it. */
.tb-text:has(+ .tb-copy:not([hidden])) { padding-bottom: 64px; }
.tb-copy[hidden] { display: none !important; }
.tb-card { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 320px; padding: 20px; text-align: center; color: var(--pt-ink, #343f52); }
.tb-card-icon { display: flex; align-items: center; justify-content: center; width: 88px; height: 108px; margin-bottom: 8px; border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(30, 34, 40, 0.18), 0 4px 14px rgba(30, 34, 40, 0.1); font-size: 1.1rem; font-weight: 800; color: var(--pt-accent, #0f70e6); }
.tb-card-name { max-width: 100%; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tb-card-text { font-size: 0.85rem; color: #6c757d; }
.tb-card.tb-failed .tb-card-icon { color: #c0392b; }
.tb-busy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; pointer-events: none; color: var(--pt-ink, #343f52); font-weight: 600; }
.tb-busy .spinner-border { width: 2.6rem; height: 2.6rem; }
.tb-busy span:last-child { padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.85); }
/* The new size on the photo: the phone editor only (the line under the photo
   is out of sight there). */
.tb-out { display: none; }
#pt-app .tb-out:not([hidden]) { display: block; position: absolute; top: 10px; inset-inline: 0; width: max-content; max-width: calc(100% - 24px); margin-inline: auto; padding: 4px 12px; border-radius: 999px; background: rgba(13, 15, 18, 0.72); color: #fff; font-size: 0.8rem; font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; pointer-events: none; }
.tb-note { position: absolute; inset-inline: 12px; bottom: 12px; padding: 6px 12px; border-radius: 10px; background: rgba(30, 34, 40, 0.78); color: #fff; font-size: 0.78rem; text-align: center; }
.tb-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 20px; text-align: center; }
.tb-ghost { width: 96px; height: 96px; margin-bottom: 12px; color: #b9c3d2; }
.tb-empty-text { max-width: 360px; margin-bottom: 16px; color: var(--pt-ink, #343f52); }
.tb-empty-sub { max-width: 380px; margin: 0; font-size: 0.85rem; color: #6c757d; }
/* Select Files, and beside it Select Folder (desktop browsers only). */
.tb-add-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
.tb-add-folder:not([hidden]) { display: inline-flex; align-items: center; justify-content: center; }
/* A ghost pill the height of Select Files. */
.tb-add-row .btn.tb-add-folder { min-height: 50px; padding: 10px 22px; border-radius: 999px; border: 1.5px solid #cfcac3; background: #fff; color: var(--cb-ink, #16181d); font-size: 16px; }
.tb-add-row .btn.tb-add-folder:hover, .tb-add-row .btn.tb-add-folder:focus-visible { border-color: var(--cb-ink, #16181d); background: #fff; color: var(--cb-ink, #16181d); }
/* In the panel, beside the compact Select Files. */
#tb-upload .tb-add-row .btn.tb-add-folder { min-height: 0; align-self: stretch; padding: 6px 16px; font-size: 14px; }
.tb-sizes { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; min-height: 1.4em; margin-top: 8px; font-size: 0.85rem; color: #6c757d; font-variant-numeric: tabular-nums; }
.tb-sizes b { color: var(--pt-ink, #343f52); font-weight: 600; unicode-bidi: isolate; }
.tb-sizes .tb-gain { color: #1d7f4d; }
.tb-sizes .tb-gain.tb-up { color: #a76400; }

/* ── The phone editor ───────────────────────────────────────────────────── */
/* The files in the bottom bar: one row of pictures that scrolls sideways. */
.pt-app-strip.tb-files { flex-direction: row; gap: 10px; max-height: none; overflow: visible; padding: 5px; margin: 0; }
.pt-app-strip .tb-file { flex: 0 0 64px; flex-direction: column; width: 64px; background: none; box-shadow: none; }
.pt-app-strip .tb-file:has(.tb-pick[aria-pressed="true"]) { background: none; box-shadow: none; }
.pt-app-strip .tb-pick { display: block; width: 64px; height: 64px; min-height: 0; padding: 0; border-radius: 10px; background: var(--pt-app-fill); }
.pt-app-strip .tb-pick[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--pt-app-fg); }
.pt-app-strip .tb-thumb { width: 64px; height: 64px; border-radius: 10px; background: var(--pt-app-fill); }
.pt-app-strip .tb-ext { color: var(--pt-app-fg); }
.pt-app-strip .tb-meta { position: absolute; inset-inline: 0; bottom: 0; padding: 2px 4px; border-radius: 0 0 10px 10px; background: rgba(13, 15, 18, 0.72); }
.pt-app-strip .tb-name { display: none; }
.pt-app-strip .tb-stat { overflow: hidden; color: #fff !important; font-size: 0.6rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.pt-app-strip .tb-from, .pt-app-strip .tb-stat .tb-gain, .pt-app-strip .tb-spin { display: none; }
.pt-app-strip .tb-get { display: none; }
.pt-app-strip .tb-file .tb-del { position: absolute; top: 3px; inset-inline-end: 3px; width: 24px; height: 24px; margin: 0; background: rgba(30, 34, 40, 0.75); color: #fff; }
.pt-app-strip .tb-del svg { width: 14px; height: 14px; }
/* A bigger target round the small badge, grown outwards only: a tap in the
   middle of the picture shows the file, and must never remove it. */
.pt-app-strip .tb-del::before { content: ""; position: absolute; inset-block-start: -7px; inset-inline-end: -7px; inset-block-end: 0; inset-inline-start: 0; }
.pt-app-strip .tb-addtile { display: block; flex: 0 0 64px; width: 64px; }
.tb-addbtn { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; padding: 0; border: 2px dashed rgba(255, 255, 255, 0.3); border-radius: 10px; background: rgba(255, 255, 255, 0.06); color: #fff; }
.tb-addbtn svg { width: 24px; height: 24px; }
/* The target size in the bottom bar: the presets and the field on one row. */
#pt-app #tb-kb-ctl.pt-app-panel-on, #pt-app #tb-dpi-ctl.pt-app-panel-on { display: flex !important; flex-wrap: nowrap; gap: 8px; }
#pt-app .tb-kb-presets { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.16); }
#pt-app .tb-kb-presets button { min-width: 0; min-height: 40px; padding: 0 4px; color: var(--pt-app-muted); font-size: 0.75rem; }
#pt-app .tb-kb-presets button.active { background: var(--pt-app-accent-soft); color: var(--pt-app-fg); box-shadow: none; }
#pt-app .tb-kb-field { flex: 0 0 104px; max-width: none; flex-wrap: nowrap; }
#pt-app .tb-kb-field .form-control { min-width: 0; padding-inline: 8px; }
#pt-app .tb-kb-field .input-group-text { padding-inline: 8px; background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.18); color: var(--pt-app-fg); }
/* Six presets in the bar: the numbers, with KB next to the field (1 MB stays). */
#pt-app .tb-kb-presets .tb-u { display: none; }
#pt-app #tb-kb-ctl .tb-kb-field { flex: 0 0 140px; max-width: none; }
#pt-app .tb-kb-field .tb-kb-unit { font-size: 16px; padding-inline: 8px 26px; background-position: right 6px center; }
/* Batch Crop in the bottom bar: the ratios in one row that scrolls, then Custom's fields. */
#pt-app #tb-crop-ctl.pt-app-panel-on { align-items: center; }
#pt-app .tb-crop-ratios { flex: none; flex-wrap: nowrap; background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.16); }
#pt-app .tb-crop-ratios button { flex: none; min-width: 44px; min-height: 40px; padding: 0 10px; color: var(--pt-app-muted); font-size: 0.75rem; }
#pt-app .tb-crop-ratios button.active { background: var(--pt-app-accent-soft); color: var(--pt-app-fg); box-shadow: none; }
#pt-app .tb-crop-custom { flex: none; width: 190px; margin: 0; }
#pt-app .tb-crop-custom .form-control { font-size: 16px; padding-inline: 8px; }
#pt-app .tb-no-settings { margin-top: 0; }
#pt-app .tb-no-settings .pt-tool-save { margin-top: 0; padding-top: 0; border-top: 0; }
#pt-app .tb-text { min-height: 0; }
#pt-app .tb-card { color: #e8ecf3; }
#pt-app .tb-card-text { color: #aab4c3; }
#pt-app .tb-busy { color: #fff; }
#pt-app .tb-busy span:last-child { background: rgba(13, 15, 18, 0.72); }
/* Check DPI's Original takes the width its word needs; the numbers share the rest. */
.tb-seg button[data-dpi="0"] { flex: 0 0 auto; }
#pt-app .tb-kb-presets button[data-dpi="0"] { padding: 0 8px; }
/* In the phone bar the active Original button says it; the narrow field would clip the word. */
#pt-app #tb-dpi::placeholder { color: transparent; }
/* A 320px phone has no room for Original and three numbers in every language: 600 can be typed. */
@media (max-width: 359.98px) { #pt-app .tb-dpi-keep button[data-dpi="600"] { display: none; } }
/* "Save All (2)": the space before the count, which a flex button drops. */
#tb-all-count:not(:empty) { margin-inline-start: 0.3em; unicode-bidi: isolate; }

/* Batch Photo Editor (tool-batch.js ADJ): Filter and Adjust as two tabs; the
   looks four to a row, each drawn on the photo on show; the twelve sliders
   one line each (name, slider, value); a settings link. On a phone the
   looks are a row in the bottom bar (.pt-app-strip). */
.tb-adj-tabs { margin-bottom: 12px; }
.pt-tool-panel .tb-adj-off { display: none !important; }
.tb-looks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px; }
#tb-adj-saved:not([hidden]) { margin-top: 12px; }
#tb-adj-saved .form-label { margin-bottom: 6px; }
#tb-adj-saved-none { margin-top: 10px; }
.tb-look { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: center; cursor: pointer; }
.tb-look-thumb { display: block; aspect-ratio: 1 / 1; border-radius: 12px; background: #e4e1dc center / cover no-repeat; transition: box-shadow 0.15s; }
.tb-look-thumb.is-empty { background-image: linear-gradient(135deg, #d9d5cf, #f1eee9); }
.tb-look-name { font-size: 12px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; hyphens: auto; }
.tb-look:hover .tb-look-thumb { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #cfcac3; }
.tb-look.active .tb-look-thumb { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cb-ink, #16181d); }
.tb-look:focus { outline: none; }
.tb-look:focus-visible .tb-look-thumb { outline: 2px solid var(--pt-accent, #0f70e6); outline-offset: 5px; }
.tb-adj-sliders { display: grid; grid-template-columns: max-content minmax(0, 1fr) 2.6em; align-items: center; column-gap: 10px; row-gap: 2px; margin-top: 4px; }
.tb-adj-sliders label { max-width: 8.5em; margin: 0; font-size: 13.6px; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; hyphens: auto; }
.tb-adj-sliders .form-range { min-width: 0; height: 32px; }
.tb-adj-sliders output { color: var(--cb-muted, #626973); font-size: 13.6px; font-variant-numeric: tabular-nums; text-align: end; direction: ltr; unicode-bidi: isolate; }
.tb-adj-sliders output.tb-adj-on { color: var(--cb-ink, #16181d); font-weight: 700; }
.tb-adj-link { margin-top: 14px; }
.tb-adj-link .form-control { min-width: 0; }
#tb-adj-msg:empty { display: none; }
.pt-app-strip .tb-looks, .pt-app-strip #tb-adj-saved:not([hidden]) { display: flex; flex-wrap: nowrap; gap: 8px; margin: 0; }
.pt-app-strip #tb-adj-saved:not([hidden]) { padding-inline-start: 8px; border-inline-start: 1px solid var(--pt-app-line-strong, rgba(22, 24, 29, 0.2)); }
.pt-app-strip .tb-adj-h { display: none !important; }
.pt-app-strip .tb-look { flex: 0 0 64px; width: 64px; }
.pt-app-strip .tb-look-thumb { width: 64px; height: 64px; border-radius: 10px; }
.pt-app-strip .tb-look-name { overflow: hidden; color: var(--pt-app-fg); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.pt-app-strip .tb-look.active .tb-look-thumb { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--pt-app-fg); }
