/* Video to GIF (inc/vgif-tool.inc.php): the video, its crop frame 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. */

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

/* ── Empty state: the samples ─────────────────────────────────────────── */
.vg-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. */
#vg-empty.hidden { display: none; }
.vg-editor .sample-thumbnails { display: flex; justify-content: center; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.vg-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;
}
.vg-editor .sample-thumbnail:hover,
.vg-editor .sample-thumbnail:focus-visible { border-color: var(--pt-accent, #0f70e6); box-shadow: 0 4px 12px rgba(15, 112, 230, 0.25); }
.vg-editor .sample-thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* A sample is a video: a play mark in the corner. */
.vg-sample-play {
  position: absolute;
  bottom: 6px;
  inset-inline-end: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(30, 34, 40, 0.78);
  color: #fff;
  pointer-events: none;
}
.vg-sample-play svg { width: 13px; height: 13px; margin-inline-start: 2px; }
[dir="rtl"] .vg-sample-play svg { margin-inline-start: 0; margin-inline-end: 2px; }
@media (max-width: 767px) { .vg-editor .sample-thumbnail { width: 84px; height: 84px; } }

/* ── The video and its crop frame ─────────────────────────────────────── */
/* By id: in the phone editor the box is in the stage, out of the card. */
#vg-viewport { display: flex; align-items: center; justify-content: center; padding: 12px; overflow: hidden; }
#vg-viewport.dragover { box-shadow: inset 0 0 0 3px var(--pt-accent, #0f70e6); }
/* The frame shrinks to the video, so the crop's percentages are the video's.
   The video's own picture runs left to right in every language. */
#vg-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;
}
#vg-video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  background: #000;
  cursor: pointer;
}
.vg-crop {
  position: absolute;
  z-index: 3;
  border: 2px solid #fff;
  border-radius: 2px;
  /* Everything outside the frame is dimmed. */
  box-shadow: 0 0 0 9999px rgba(20, 22, 26, 0.62), 0 0 0 1px rgba(0, 0, 0, 0.35) inset;
  cursor: move;
  touch-action: pan-y;
  outline: none;
}
.vg-crop::before,
.vg-crop::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border: 0 solid rgba(255, 255, 255, 0.45);
}
/* Thirds, as in a camera's grid. */
.vg-crop::before { inset: 0 33.33%; border-left-width: 1px; border-right-width: 1px; }
.vg-crop::after { inset: 33.33% 0; border-top-width: 1px; border-bottom-width: 1px; }
.vg-crop:focus-visible { border-color: var(--pt-accent, #0f70e6); box-shadow: 0 0 0 9999px rgba(20, 22, 26, 0.62), 0 0 0 3px rgba(15, 112, 230, 0.6); }
.vg-crop.is-dragging { border-color: #ffd34d; }
/* A pointer drags the frame; on a phone, the open editor does. */
@media (hover: hover) and (pointer: fine) { .vg-crop { touch-action: none; } }
.pt-app-stage .vg-crop { touch-action: none; }

/* ── Controls ─────────────────────────────────────────────────────────── */
.vg-hint { font-size: 0.75rem; line-height: 1.45; color: #6c757d; margin: 2px 0 0; }
.vg-section { font-weight: 700; }
.vg-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; width: 100%; align-items: end; }
.vg-dither-col { display: flex; align-items: center; min-height: calc(1.5em + 0.9rem + 2px); }
.vg-out { font-variant-numeric: tabular-nums; color: var(--pt-muted, #6c757d); }
.vg-out.is-warn { color: #8a5a00; font-weight: 600; }
.vg-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 .vg-time { color: rgba(255, 255, 255, 0.82); }
#vg-play { display: inline-flex; align-items: center; gap: 6px; }
#vg-play svg { width: 16px; height: 16px; }

/* ── Phone editor ─────────────────────────────────────────────────────── */
/* Play is in the tool bar there, and the time is under the video. */
.pt-app-open #vg-play { display: none !important; }
