/* Split GIF and Video to JPG (inc/frames-tool.inc.php): the samples, a
   GIF's frames as a grid, the video and the controls. The layout is
   pt-ui.css's, the phone editor pt-app.css's, and the progress bar is
   gif-tool.css's. */

.fr-editor [hidden] { display: none !important; }

/* ── Empty state: the samples ─────────────────────────────────────────── */
.fr-editor .sample-thumbnails-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  /* Without a width it shrinks to half the box (left: 50%). */
  width: 90%;
}
/* By id: in the phone editor the box is out of the card. */
#fr-empty.hidden { display: none; }
.fr-editor .sample-thumbnails { display: flex; justify-content: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.fr-editor .sample-thumbnail {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  overflow: hidden;
  width: 110px;
  height: 110px;
  padding: 0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.fr-editor .sample-thumbnail:hover,
.fr-editor .sample-thumbnail:focus-visible { border-color: var(--pt-accent, #0f70e6); box-shadow: 0 4px 12px rgba(15, 112, 230, 0.25); }
.fr-editor .sample-thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* What a sample is: a play mark for a video, "GIF" for a GIF. */
.fr-sample-mark {
  position: absolute;
  bottom: 6px;
  inset-inline-end: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-radius: 13px;
  background: rgba(30, 34, 40, 0.78);
  color: #fff;
  pointer-events: none;
}
.fr-sample-mark svg { width: 13px; height: 13px; margin-inline-start: 2px; }
[dir="rtl"] .fr-sample-mark svg { margin-inline-start: 0; margin-inline-end: 2px; }
.fr-sample-gif { padding: 0 7px; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; }
@media (max-width: 767px) { .fr-editor .sample-thumbnail { width: 84px; height: 84px; } }

/* ── The stage ────────────────────────────────────────────────────────── */
/* By id: in the phone editor the box is in the stage, out of the card. */
#fr-viewport { display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
#fr-viewport.dragover { box-shadow: inset 0 0 0 3px var(--pt-accent, #0f70e6); }
/* A GIF's frames: a grid that scrolls in the box, starting at the top. */
#fr-viewport.fr-is-grid { align-items: stretch; justify-content: stretch; padding: 0; }
.fr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  align-content: start;
  gap: 10px;
  width: 100%;
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
/* The closed phone page scrolls under a finger: the grid only shows its
   first rows there, and a tap opens the editor, where it scrolls. */
@media (max-width: 767px) {
  .fr-grid { overflow: hidden; overscroll-behavior: auto; }
  .pt-app-stage .fr-grid { overflow-y: auto; overscroll-behavior: contain; }
}
.fr-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 6px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(22, 24, 29, 0.1), 0 2px 6px -2px rgba(22, 24, 29, 0.18);
  cursor: pointer;
  color: var(--cb-text, #3d434b);
  transition: box-shadow 0.15s ease, opacity 0.15s ease;
  /* the picture runs left to right in every language */
  direction: ltr;
}
.fr-tile canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  border-radius: 7px;
  background: repeating-conic-gradient(#e6e6e6 0% 25%, #fff 0% 50%) 0 0 / 12px 12px;
}
.fr-tile-n { font-size: 12px; font-weight: 700; line-height: 1.2; text-align: start; padding-inline-start: 2px; }
.fr-tile-t {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(22, 24, 29, 0.66);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* Picked: a blue tick; left out: dimmed, an empty ring. */
.fr-tile-check {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cb-cta, #0f70e6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8.5'/%3E%3C/svg%3E") center / 15px no-repeat;
  box-shadow: 0 0 0 2px #fff;
}
.fr-tile[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--cb-cta, #0f70e6), 0 2px 6px -2px rgba(22, 24, 29, 0.18); }
.fr-tile.is-off { opacity: 0.5; }
.fr-tile.is-off .fr-tile-check { background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 2px rgba(22, 24, 29, 0.45) inset; }
.fr-tile:focus-visible { outline: 3px solid var(--cb-focus, #d81878); outline-offset: 2px; }
@media (hover: hover) { .fr-tile:hover { opacity: 1; } .fr-tile.is-off:hover { opacity: 0.75; } }
/* Extract Images from PDF (pi-grid, a class: the grid moves into the phone
   editor): pictures of any shape in one 4:3 box each, and a longer label
   ("JPG · Page 12") that stops short of the tick. */
.pi-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pi-grid .fr-tile canvas { aspect-ratio: 4 / 3; height: auto; object-fit: contain; }
.pi-grid .fr-tile-t { max-width: calc(100% - 48px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The video. Its picture runs left to right in every language. */
#fr-frame {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 100%;
  line-height: 0;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(30, 34, 40, 0.18), 0 4px 14px rgba(30, 34, 40, 0.1);
  direction: ltr;
}
#fr-video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  background: #000;
  cursor: pointer;
}

/* ── Controls ─────────────────────────────────────────────────────────── */
.fr-hint { font-size: 0.75rem; line-height: 1.45; color: #6c757d; margin: 2px 0 0; }
.fr-section { font-weight: 700; }
.fr-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; width: 100%; align-items: end; }
.fr-out { font-variant-numeric: tabular-nums; color: var(--pt-muted, #6c757d); }
.fr-out.is-warn { color: #8a5a00; font-weight: 600; }
.fr-time { min-width: 7.5em; font-size: 0.85rem; font-weight: 600; color: var(--pt-muted, #6c757d); font-variant-numeric: tabular-nums; text-align: center; }
/* On the dark bar under the video. */
.pt-tool-deskbar .fr-time { color: rgba(255, 255, 255, 0.82); }
#fr-play, #fr-shot { display: inline-flex; align-items: center; gap: 6px; }
#fr-play svg { width: 16px; height: 16px; }

/* ── Phone editor ─────────────────────────────────────────────────────── */
/* Play, This frame, Select all and Select none are in the tool bar there. */
.pt-app-open #fr-play, .pt-app-open #fr-shot, .pt-app-open #fr-all, .pt-app-open #fr-none { display: none !important; }
