/* Video editor: looking around, files in, safety nets (features/vedit_view.js).
   This file loads before video_editor.css, so rules that change the editor's own boxes start with `.ve `. */

/* the view: rulers around a scrolling canvas that holds the picture */
.ve .ve-viewhost { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); grid-template-rows: 18px minmax(0, 1fr); min-height: 260px; min-width: 0; border-radius: 12px; overflow: hidden; background: #20242c; }
.ve .ve-viewhost.norulers { grid-template-columns: 0 minmax(0, 1fr); grid-template-rows: 0 minmax(0, 1fr); }
.ve .ve-viewhost.norulers .ve-ruler, .ve .ve-viewhost.norulers .ve-ruler-corner { display: none; }
.ve-ruler-corner { grid-area: 1 / 1; background: #20242c; border-right: 1px solid #3a404c; border-bottom: 1px solid #3a404c; }
.ve-viewhost > .ve-ruler, .ve-viewhost .ve-ruler.x, .ve-viewhost .ve-ruler.y { position: absolute; display: block; touch-action: none; box-sizing: border-box; }
.ve-ruler.x { left: 18px; top: 0; width: calc(100% - 18px); height: 18px; cursor: s-resize; border-bottom: 1px solid #3a404c; }
.ve-ruler.y { left: 0; top: 18px; width: 18px; height: calc(100% - 18px); cursor: e-resize; border-right: 1px solid #3a404c; }
.ve .ve-stagewrap { grid-area: 2 / 2; display: block; border-radius: 0; min-height: 0; overscroll-behavior: contain; }
.ve .ve-canvas { position: relative; }
.ve .ve-stage { position: absolute; }
.ve-viewhost.ve-spacepan .ve-stagewrap, .ve-viewhost.ve-spacepan .ve-overlay { cursor: grab !important; }
.ve-viewhost.ve-panning .ve-stagewrap, .ve-viewhost.ve-panning .ve-overlay { cursor: grabbing !important; }

/* zoom box and view menu (transport row) */
.ve-zoombox { display: inline-flex; align-items: center; gap: 3px; }
.ve .btn.ve-zoompct { min-width: 74px; font-variant-numeric: tabular-nums; }
.ve-pop { position: fixed; z-index: 1200; min-width: 220px; max-width: min(420px, 94vw); max-height: min(70vh, 560px); overflow: auto; padding: 5px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow, 0 8px 28px rgba(0,0,0,.25)); color: var(--ink); font-size: 13px; }
.ve-pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.ve-popitem { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent; color: inherit; text-align: left; padding: 6px 8px; border-radius: 7px; cursor: pointer; font: inherit; }
.ve-popitem:hover, .ve-popitem:focus-visible { background: var(--soft); outline: none; }
.ve-popitem:disabled { opacity: .45; cursor: default; background: transparent; }
.ve-popcheck { color: var(--brand); font-weight: 700; }
.ve-pop kbd, .ve-keytable kbd { font: 11px/1.5 ui-monospace, Menlo, Consolas, monospace; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.ve-pophead { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px 2px; font-weight: 600; }
.ve-popnote { padding: 2px 8px 6px; color: var(--muted); font-size: 12px; }

/* history list */
.ve-histpop { width: 340px; }
.ve-histlist { display: grid; gap: 1px; }
.ve-hist { grid-template-columns: minmax(0, 1fr) auto; }
.ve-hist .ve-poplabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-hist.cur { background: var(--brand); color: var(--brand-ink, #fff); }
.ve-hist.cur .ve-histtime { color: inherit; opacity: .85; }
.ve-hist.undone { color: var(--muted); font-style: italic; }
.ve-histtime { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* saved / not saved mark, top bar tools */
.ve-toptools { display: inline-flex; gap: 6px; align-items: center; }
.ve-savemark { border: 1px solid transparent; background: transparent; border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: default; color: var(--muted); white-space: nowrap; }
.ve-savemark.saved { color: var(--ok, #2f8f4e); }
.ve-savemark.saved.draft { color: var(--muted); }
.ve-savemark.pending { color: #c26a12; border-color: rgba(194, 106, 18, .35); cursor: pointer; }
.ve-savemark.saving { color: var(--muted); font-style: italic; }
.ve-savemark.failed { color: var(--danger); border-color: var(--danger); cursor: pointer; white-space: normal; max-width: 320px; }
.ve-vline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ve-vline .chip.small { font-size: 11px; padding: 0 6px; }
.ve-vline .chip.snap { color: var(--brand); }

/* user guide lines and the grid (inside the overlay) */
.ve-uguide { position: absolute; z-index: 3; pointer-events: auto; }
.ve-uguide.v { top: 0; bottom: 0; width: 9px; margin-left: -4px; cursor: ew-resize; }
.ve-uguide.h { left: 0; right: 0; height: 9px; margin-top: -4px; cursor: ns-resize; }
.ve-uguide::after { content: ''; position: absolute; background: #00c2ff; }
.ve-uguide.v::after { left: 4px; top: 0; bottom: 0; width: 1px; }
.ve-uguide.h::after { top: 4px; left: 0; right: 0; height: 1px; }
.ve-uguide:hover::after, .ve-uguide.dragging::after { background: #ff3d8b; box-shadow: 0 0 0 1px rgba(255, 61, 139, .3); }
.ve-uguide.locked { pointer-events: none; }
.ve-uguide.off::after { background: rgba(255, 61, 139, .45); }
.ve-uguide-label { position: absolute; top: 4px; left: 8px; background: #ff3d8b; color: #fff; font: 11px/1.4 system-ui, sans-serif; padding: 0 5px; border-radius: 3px; white-space: nowrap; }
.ve-uguide.h .ve-uguide-label { top: 8px; left: 4px; }
.ve-grid { position: absolute; pointer-events: none; background: rgba(255, 255, 255, .45); box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.ve-grid.v { top: 0; bottom: 0; width: 1px; }
.ve-grid.h { left: 0; right: 0; height: 1px; }
.ve-gridcol { position: absolute; top: 0; bottom: 0; pointer-events: none; background: rgba(255, 61, 139, .09); border-left: 1px solid rgba(255, 61, 139, .3); border-right: 1px solid rgba(255, 61, 139, .3); }

/* drop targets and uploads */
.ve.ve-dragging .ve-viewhost, .ve.ve-dragging .ve-timeline, .ve.ve-dragging .ve-left { position: relative; outline: 2px dashed rgba(56, 163, 255, .55); outline-offset: -2px; }
.ve.ve-dragging .ve-dropon { outline: 3px solid #38a3ff; }
.ve.ve-dragging .ve-dropon::after { content: attr(data-drop); position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; padding: 12px; text-align: center; background: rgba(56, 163, 255, .16); color: #fff; font-weight: 700; font-size: 15px; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); pointer-events: none; border-radius: 12px; }
.ve-uploads { position: absolute; left: 26px; bottom: 8px; z-index: 8; display: grid; gap: 4px; width: min(380px, calc(100% - 40px)); pointer-events: none; }
.ve-uprow { pointer-events: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; padding: 6px 9px; border-radius: 8px; background: rgba(20, 23, 30, .9); color: #fff; font-size: 12px; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.ve-upname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-upbar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.ve-upbar span { display: block; height: 100%; width: 0; background: #38a3ff; transition: width .15s; }
.ve-uprow.ok .ve-upbar span { background: #5fc66e; }
.ve-uprow.bad { background: rgba(120, 20, 30, .92); }
.ve-uprow.bad .ve-upname { white-space: normal; }
.ve-uprow .ve-icon { color: #fff; font-size: 15px; }

/* busy mark, missing / broken files, tips */
.ve-busy { position: absolute; right: 10px; top: 26px; z-index: 8; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: rgba(20, 23, 30, .85); color: #fff; font-size: 12px; pointer-events: none; }
.ve-busy[hidden] { display: none; }
.ve-busy .spin { width: 12px; height: 12px; }
.ve-problems { position: absolute; left: 26px; right: 8px; top: 26px; z-index: 9; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; justify-items: start; pointer-events: none; }
.ve-problem { pointer-events: auto; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 100%; padding: 5px 6px 5px 10px; border-radius: 9px; background: #fff4e5; color: #6b3a00; border: 1px solid #f0b46b; font-size: 13px; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.ve-problem { flex-wrap: nowrap; }
.ve-problem > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ve-problem .btn { white-space: nowrap; flex: none; }
.ve-problem .ve-icon { color: inherit; font-size: 16px; padding: 0 4px; }
.ve-tips { position: absolute; left: 26px; right: 8px; bottom: 8px; z-index: 7; display: flex; align-items: flex-start; gap: 8px; padding: 7px 10px; border-radius: 9px; background: rgba(20, 23, 30, .88); color: #e9edf3; font-size: 12.5px; line-height: 1.45; }
.ve-tips span { flex: 1; }
.ve-tips .ve-icon { color: #fff; font-size: 16px; line-height: 1; }

/* full-screen preview (+ phone frame for 9:16) */
.ve .ve-viewhost.ve-full { position: fixed; inset: 0; z-index: 1000; border-radius: 0; grid-template-columns: 0 minmax(0, 1fr); grid-template-rows: 0 minmax(0, 1fr); background: #000; }
.ve .ve-viewhost.ve-full .ve-ruler, .ve .ve-viewhost.ve-full .ve-ruler-corner, .ve .ve-viewhost.ve-full .ve-tips, .ve .ve-viewhost.ve-full .ve-problems { display: none; }
.ve .ve-viewhost.ve-full .ve-stagewrap { background: #000; }
.ve .ve-viewhost.ve-full .ve-overlay { visibility: hidden; }
.ve-fullbar { display: none; }
.ve-viewhost.ve-full .ve-fullbar { display: flex; position: absolute; right: 16px; bottom: 16px; z-index: 12; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; background: rgba(20, 23, 30, .82); color: #fff; }
.ve-viewhost.ve-full .ve-fullbar .ve-time { color: #dfe4ea; }
.ve-viewhost.ve-full .ve-fullbar .btn { color: var(--ink); }
.ve-phone { display: none; }
.ve-viewhost.ve-full.ve-phoneview .ve-phone { display: block; position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: 4.5% / 2.5%; box-shadow: 0 0 0 14px #111, 0 0 0 16px #444; color: #fff; font: 600 clamp(9px, 1.6vh, 15px)/1.3 system-ui, sans-serif; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.ve-ph-top { position: absolute; top: 1.2%; left: 7%; }
.ve-ph-side { position: absolute; right: 3.5%; bottom: 17%; display: grid; gap: 2.2vh; font-size: 1.5em; text-align: center; }
.ve-ph-cap { position: absolute; left: 4%; right: 22%; bottom: 6%; display: grid; gap: .6vh; }
.ve-ph-cap i { display: block; height: .9vh; border-radius: 4px; background: rgba(255, 255, 255, .55); }
.ve-ph-cap i + i { width: 60%; }

/* the Shortcuts window */
dialog.ve-keysdlg { width: min(760px, 94vw); }
.ve-keys { display: grid; gap: 8px; }
.ve-keysearch { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font: inherit; background: var(--panel); color: var(--ink); }
.ve-keyscroll { max-height: 62vh; overflow: auto; }
.ve-keytable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ve-keytable th, .ve-keytable td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ve-keytable thead th { position: sticky; top: 0; background: var(--panel); color: var(--muted); font-weight: 600; font-size: 12px; }
.ve-keytable .ve-keygroup th { padding-top: 12px; font-size: 13px; color: var(--brand); border-bottom: 1px solid var(--brand); }
.ve-keyscell { width: 38%; white-space: nowrap; }
.ve-keyscell kbd { font-size: 12px; color: var(--ink); }

@media (max-width: 1100px) { .ve .ve-viewhost { height: 60vh; } }
@media (min-width: 1101px) {
  .ve .ve-top { flex-wrap: nowrap; min-width: 0; }
  .ve .ve-top h1 { min-width: 0; flex: 0 1 auto; }
  .ve .ve-top > a, .ve .ve-top .btn, .ve .ve-top .chip { flex: none; white-space: nowrap; }
}
/* the tips strip lies over the bottom of the picture: clicks and right-clicks go through it, only its close button takes them */
.ve-tips { pointer-events: none; }
.ve-tips .ve-icon { pointer-events: auto; }
