/*!
 * 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, #3f78e0); }
.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, #3f78e0); 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, #3f78e0); }
.tb-del:hover { color: #d63939; }
.tb-icon:focus-visible { outline: 3px solid var(--pt-accent, #3f78e0); 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; }
/* 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; }

/* ── 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; }
.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, #3f78e0); }
.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; }
.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: 4px 2px 2px; 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: rgba(255, 255, 255, 0.08); }
.pt-app-strip .tb-pick[aria-pressed="true"] { box-shadow: 0 0 0 3px #fff; }
.pt-app-strip .tb-thumb { width: 64px; height: 64px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); }
.pt-app-strip .tb-ext { color: #e8ecf3; }
.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 { 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); }
#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); }
