/*
 * Image to Base64 / Base64 to Image (inc/b64-tool.inc.php). The shared
 * layout is pt-ui.css, the segmented tracks pt-theme.css (.pt-cseg); this is
 * the drop row, the list of images, the text boxes and the preview. Sizes in
 * px: the theme's rem is 20px.
 */
.b64-editor [hidden] { display: none !important; }
.b64-ic { width: 18px; height: 18px; flex: 0 0 auto; }
.b64-editor .btn:has(> .b64-ic) { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }

/* Which way: the two halves share the track evenly. */
.pt-tool-panel .b64-modes > button { flex: 1 1 0; min-width: 0; }

/* ── Image to Base64 ───────────────────────────────────────────────────── */
.b64-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.b64-drop-note { font-size: 13px; color: var(--cb-muted, #626973); }
.b64-over .b64-drop, .b64-over .b64-viewport { outline: 2px dashed var(--cb-accent, #d81878); outline-offset: 3px; }

.b64-files { display: flex; flex-direction: column; gap: 6px; max-height: 236px; overflow-y: auto; }
.b64-file { display: flex; align-items: stretch; gap: 4px; border: 1px solid var(--cb-line, #e4e1dc); border-radius: 12px; background: #fff; }
.b64-file.active { border-color: var(--cb-ink, #16181d); box-shadow: inset 0 0 0 1px var(--cb-ink, #16181d); }
.b64-file-pick { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; background: none; text-align: start; color: inherit; border-radius: 12px; }
.b64-file-pick:focus-visible, .b64-file-x:focus-visible { outline: 3px solid var(--pt-accent, #0f70e6); outline-offset: -3px; }
.b64-thumb { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: repeating-conic-gradient(#e6e9ee 0% 25%, #fff 0% 50%) 50% / 10px 10px; }
.b64-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.b64-file-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.b64-file-name { font-size: 13.5px; font-weight: 700; color: var(--cb-ink, #16181d); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b64-file-meta { font-size: 12px; color: var(--cb-muted, #626973); }
.b64-file-x { flex: 0 0 36px; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--cb-muted, #626973); border-radius: 12px; }
.b64-file-x:hover { color: #c0392b; background: #fbeceb; }
.b64-file-x svg { width: 18px; height: 18px; }

.b64-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px !important;
  line-height: 1.45;
  word-break: break-all;
  overflow-wrap: anywhere;
  text-align: left;
  resize: vertical;
  min-height: 120px;
}
.b64-text[readonly] { background: #fbfaf8; }
.b64-note, .b64-info { font-size: 12.5px; color: var(--cb-muted, #626973); line-height: 1.45; }
.b64-warn { font-size: 12.5px; font-weight: 600; color: #a25a00; line-height: 1.45; }
.b64-error { font-size: 13px; font-weight: 600; color: #c0392b; line-height: 1.45; }
.b64-anyway { font-weight: 600; }

.b64-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; margin: 0; }
.b64-facts dt { font-weight: 600; color: var(--cb-text, #3d434b); }
.b64-facts dd { margin: 0; color: var(--cb-ink, #16181d); font-variant-numeric: tabular-nums; }

/* ── Base64 to Image ───────────────────────────────────────────────────── */
.b64-in-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.b64-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.b64-actions .btn { flex: 1 1 auto; min-height: 44px; border-radius: 14px; font-weight: 700; }

/* ── The image ─────────────────────────────────────────────────────────── */
.b64-viewport { display: flex; align-items: center; justify-content: center; padding: 20px; overflow: hidden; }
/* At its own size, shrunk only to fit; see-through parts on a checkerboard. */
.b64-img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
  background: repeating-conic-gradient(#e6e9ee 0% 25%, #fff 0% 50%) 50% / 16px 16px; box-shadow: 0 6px 24px rgba(30, 34, 40, 0.12); }
.b64-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 320px; text-align: center; }
.b64-ghost { width: 72px; height: 72px; color: #c9d0da; }
.b64-samples { display: flex; gap: 10px; justify-content: center; }
.b64-sample-tile { width: 72px; height: 72px; padding: 4px; border: 1px solid var(--cb-line, #e4e1dc); border-radius: 14px; background: #fff; flex-shrink: 0; }
.b64-sample-tile:hover { border-color: var(--cb-ink, #16181d); }
.b64-sample-tile img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.b64-privacy { font-size: 12.5px; }

@media (max-width: 767px) {
  .b64-viewport { padding: 14px; min-height: 220px !important; height: auto !important; max-height: 60vh; }
  .b64-img { max-height: calc(60vh - 28px); }
  .b64-text { font-size: 16px !important; }
  .b64-file-x { flex-basis: 44px; }
}
