/* Styly jen pro video Peekless (společné styly převzaté z obrázků a PDF editoru jsou v landing.css – hlídá je tools/shared-check.py).
   Plocha zpracování je stavěná jako u obrázků (assets/css/img.css v img.peekless.app). */

/* ------------------------------------------------------------- plocha zpracování (ui/workspace.js) */
.work { padding: var(--sp-6) 0 var(--sp-12); }
.work-in { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--sp-6); align-items: start; }
.work-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.work-title { font-size: 20px; margin: 0; }
.work-head-acts { display: flex; gap: var(--sp-2); }
.work-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3); }
.work-note { display: flex; align-items: center; gap: 6px; margin-top: var(--sp-4); }
/* karta ořezu pod seznamem */
.work-edit { display: flex; align-items: center; gap: 12px; margin-top: var(--sp-4); padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border)); border-radius: var(--r-lg); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.work-edit-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: var(--accent-text); }
.work-edit-text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 13.5px; line-height: 1.45; color: var(--text-2); }
.work-edit-text b { color: var(--text); font-size: 14px; }
.work-edit-btn { flex: none; }
@media (max-width: 560px) {
  .work-edit { flex-wrap: wrap; }
  .work-edit-btn { width: 100%; }
}

.tile { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; outline: none; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.tile:focus-visible { box-shadow: var(--focus-ring); }
.tile[data-state="done"] { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.tile[data-state="error"] { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); }
.tile-img { position: relative; aspect-ratio: 16 / 10; background: #0b1020; display: grid; place-items: center; overflow: hidden; cursor: pointer; }
.tile-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.tile-ph { display: grid; justify-items: center; gap: 4px; color: #94a3b8; }
.tile-ph small { font-weight: 600; font-size: 12px; }
/* štítky vlevo nahoře (vpravo nahoře jsou Stáhnout a Odebrat); neprůhledné – čitelné i přes snímek videa */
.tile-badges { position: absolute; left: 8px; top: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: calc(100% - 84px); pointer-events: none; }
.tile-badge { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--warning) 16%, var(--surface)); color: var(--warning); font-size: 12px; font-weight: 700; box-shadow: var(--shadow-xs); }
.tile-badge.is-gone { background: color-mix(in srgb, var(--success) 16%, var(--surface)); color: var(--success); }
.tile-badge-edit { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: var(--accent-text); font-variant-numeric: tabular-nums; }
/* délka videa vpravo dole (při ořezu výřez / celé) */
.tile-dur { position: absolute; right: 8px; bottom: 8px; padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; }
.tile-dur[hidden] { display: none; }
/* Oříznout: otevře ořez videa (ui/trim.js) */
.tile-edit {
  position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px 0 11px; border: 0; border-radius: var(--r-pill);
  background: var(--btn-primary-bg); color: #fff; font: inherit; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-sm); cursor: pointer; transition: background var(--dur) var(--ease);
}
.tile-edit:hover { background: var(--btn-primary-hover); }
.tile-edit:focus-visible { box-shadow: var(--focus-ring); outline: none; }
.tile-edit[hidden] { display: none; }
.tile-body { padding: 8px 10px 10px; display: grid; gap: 4px; min-width: 0; }
.tile-name { margin: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-info { margin: 0; font-size: 12px; color: var(--text-2); line-height: 1.45; }
.tile-info b { color: var(--text); }
.tile-old { color: var(--text-3); }
.tile-save { color: var(--success); font-weight: 700; }
.tile-more { color: var(--warning); font-weight: 700; }
.tile[data-state="error"] .tile-info { color: var(--danger); }
.tile-notes { margin: 0; font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.tile-notes:empty { display: none; }
.tile-notes.is-warn { color: var(--warning); font-weight: 600; }
.tile-progress { height: 4px; }
.tile-acts { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; }
.tile-acts .btn { background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: var(--shadow-xs); }

.work-side { position: sticky; top: 80px; display: grid; gap: var(--sp-3); padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-md); }
.work-tabs { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; }
.work-tabs > button { display: grid; justify-items: center; align-content: start; gap: 3px; height: auto; min-height: 50px; padding: 7px 2px 6px; font-size: 11.5px; min-width: 0; }
/* delší popisky (němčina, francouzština) se zalomí s dělením slov – nikdy se neuříznou */
.work-tabs > button span { max-width: 100%; text-align: center; line-height: 1.15; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
.work-panel .field { margin-bottom: var(--sp-3); }
.work-panel > :last-child { margin-bottom: 0; }
.work-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
.work-seg > button { padding: 7px 4px; font-size: 13px; }
.work-kb-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); }
.work-kb-wrap .input { width: 96px; }
.work-target { display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--sp-3); row-gap: 6px; }
.work-target .check { margin: 0; }
.work-target .hint, .work-chips { flex-basis: 100%; }
.work-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--text); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent-text); }
.work-explain { margin: 0 0 var(--sp-2); font-size: 14px; line-height: 1.55; }
.work-more { font-size: 14px; }
.work-more summary { cursor: pointer; font-weight: 600; color: var(--text-2); padding: 4px 0; }
.work-more[open] summary { margin-bottom: var(--sp-2); }
.work-run { margin-top: var(--sp-1); }
.work-status { margin: 0; font-size: 13px; color: var(--text-2); min-height: 1.2em; }

@media (max-width: 900px) {
  .work-in { grid-template-columns: 1fr; }
  .work-side { position: static; order: -1; }
  /* jedno nebo dvě videa: nejdřív video s tlačítkem Oříznout, pod ním úpravy */
  .work.is-few .work-side { order: 0; }
}
@media (max-width: 560px) {
  .work-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .tile-body { padding: 6px 8px 8px; }
  .tile-edit { height: 28px; padding: 0 10px 0 8px; font-size: 12px; }
  .tile-edit span { display: none; }
}

/* ------------------------------------------------------------- ořez (ui/trim.js) */
.trim { display: grid; gap: var(--sp-3); }
.trim-stage { display: grid; place-items: center; background: #000; border-radius: var(--r-md); overflow: hidden; }
.trim-video { display: block; width: 100%; max-height: min(52vh, 440px); object-fit: contain; background: #000; }
/* nízké okno (notebook): menší náhled, ať jsou vidět volby i vysvětlení nad tlačítky */
@media (max-height: 820px) { .trim-video { max-height: 36vh; } }
.trim { gap: var(--sp-2) var(--sp-3); }
.trim-video[hidden] { display: none; }
.trim-bar { position: relative; height: 8px; border-radius: 4px; background: var(--surface-3); }
.trim-sel { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--accent); }
.trim-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.trim-grid .field { margin: 0; }
.trim-row { display: flex; gap: var(--sp-2); align-items: center; margin-top: 6px; }
.trim-time { width: 104px; font-variant-numeric: tabular-nums; }
.trim-length { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.trim-shots { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
@media (max-width: 560px) {
  .trim-grid { grid-template-columns: 1fr; gap: var(--sp-3); }
  .trim-video { max-height: 34vh; }
}
.trim-explain { margin: 0; }
.work-trim-info { display: flex; align-items: flex-start; gap: 6px; margin: 0; padding: 8px 10px; border-radius: var(--r-md); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); color: var(--text-2); }
.work-trim-info[hidden] { display: none; }
.work-trim-info .icon { flex: none; margin-top: 2px; color: var(--accent-text); }

/* ------------------------------------------------------------- editor videa (ui/editor.js) */
dialog.dlg.dlg-editor { width: min(980px, calc(100vw - 24px)); }
.ed-stage { position: relative; }
.ed-crop { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ed-crop[hidden] { display: none; }
.ed-crop-rect { position: absolute; box-sizing: border-box; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55); cursor: move; pointer-events: auto; touch-action: none; }
.ed-handle { position: absolute; width: 18px; height: 18px; background: #fff; border: 2px solid var(--accent); border-radius: 4px; touch-action: none; }
.ed-handle-nw { left: -3px; top: -3px; cursor: nwse-resize; }
.ed-handle-ne { right: -3px; top: -3px; cursor: nesw-resize; }
.ed-handle-sw { left: -3px; bottom: -3px; cursor: nesw-resize; }
.ed-handle-se { right: -3px; bottom: -3px; cursor: nwse-resize; }
.ed-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
.ed-tabs > button { justify-content: center; min-width: 0; }
.ed-tabs > button span { min-width: 0; text-align: center; line-height: 1.15; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  /* na telefonu pruh záložek posuvný do strany */
  .ed-tabs { grid-auto-columns: minmax(62px, 1fr); overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
  .ed-tabs::-webkit-scrollbar { display: none; }
  .ed-tabs > button { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 12px; letter-spacing: -0.01em; height: auto; min-height: 44px; scroll-snap-align: start; }
}
.ed-panel { display: grid; gap: var(--sp-3); }
.ed-panel .field { margin: 0; }
.ed-seg { display: flex; flex-wrap: wrap; width: 100%; }
.ed-seg > button { flex: 1 0 auto; justify-content: center; }
.ed-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.ed-row .check { margin: 0; }
.ed-info { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.ed .trim-video { transition: transform var(--dur) var(--ease); }
/* efekty: náhled nad videem a rámečky k tažení */
.ed-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ed-boxes { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ed-boxes[hidden] { display: none; }
.ed-box { position: absolute; box-sizing: border-box; border: 2px dashed rgba(255, 255, 255, 0.85); outline: 1px solid rgba(0, 0, 0, 0.45); cursor: move; pointer-events: auto; touch-action: none; }
.ed-box.is-sel { border-style: solid; border-color: #fff; outline: 2px solid var(--accent); }
.ed-box:not(.is-sel) .ed-handle { display: none; }
.ed-scrub { display: flex; align-items: center; gap: var(--sp-3); }
.ed-scrub[hidden] { display: none; }
.ed-scrub .range { flex: 1; }
.ed-val { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 500; }
.ed-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.ed-scan { display: flex; align-items: center; gap: var(--sp-3); }
.ed-scan[hidden] { display: none; }
.ed-scan .progress { flex: 1; height: 6px; }
.ed-scan-msg { margin: 0; }
.ed-scan-msg:empty { display: none; }
.ed-list { display: grid; gap: 4px; max-height: 220px; overflow: auto; padding: 2px; }
.ed-list[hidden], .ed-detail[hidden] { display: none; }
.ed-item { display: flex; align-items: center; gap: var(--sp-2); padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.ed-item.is-sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.ed-item > input[type="checkbox"] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.ed-thumb { width: 36px; height: 36px; flex: none; border-radius: 6px; object-fit: cover; background: var(--surface-3); }
.ed-thumb-icon { display: grid; place-items: center; color: var(--text-2); }
.ed-item-name { display: flex; flex: 1; min-width: 0; flex-direction: column; align-items: flex-start; padding: 2px 0; border: 0; background: none; text-align: left; cursor: pointer; }
.ed-item-name b, .ed-item-name span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-item-name span { color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.ed-detail { display: grid; gap: var(--sp-3); padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2, var(--surface-3)); }
.ed-detail .hint { margin: 0; }
.ed-time { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--sp-2); }
.ed-time .label { margin: 0; }
.ed-when { font-weight: 600; font-variant-numeric: tabular-nums; }
.ed-time-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.ed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.ed-grid .field { margin: 0; }
.ed-label { display: flex; justify-content: space-between; gap: var(--sp-2); }
.ed-textarea { min-height: 0; }
.ed-colors { display: flex; align-items: center; gap: 6px; }
.ed-swatches { display: flex; gap: 6px; }
.ed-swatch { width: 28px; height: 28px; padding: 0; border: 1px solid rgba(127, 127, 127, 0.6); border-radius: 50%; cursor: pointer; }
.ed-swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.ed-color { width: 34px; height: 30px; padding: 0 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; }
@media (max-width: 560px) {
  .ed-grid { grid-template-columns: 1fr; }
  .ed-time-btns { margin-left: 0; }
}

/* ------------------------------------------------------------- pořadí a spojení videí */
.tile-name-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.tile-name-row .tile-name { flex: 1; min-width: 0; }
.tile-order { display: flex; flex: none; gap: 2px; }
.tile-order[hidden] { display: none; }
.tile-order .btn { width: 26px; height: 26px; padding: 0; }
.tile[draggable="true"] .tile-body { cursor: grab; }
.work-merge { display: grid; gap: var(--sp-2); margin-top: var(--sp-4); padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--success) 40%, var(--border)); border-radius: var(--r-lg); background: color-mix(in srgb, var(--success) 6%, var(--surface)); }
.work-merge[hidden] { display: none; }
.work-merge-head { display: flex; align-items: center; gap: 12px; }
.work-merge-acts { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.work-merge .progress { height: 6px; }
/* chytrý výřez: koho sledovat */
.ed-follow { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-follow[hidden] { display: none; }
.ed-follow-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); font: inherit; font-size: 14px; cursor: pointer; }
.ed-follow-btn img { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; }
.ed-follow-btn:has(img) { padding: 3px; }
.ed-follow-btn[aria-pressed="true"] { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
/* titulky */
.ed-subs { max-height: 260px; }
.ed-sub { align-items: flex-start; }
.ed-sub-time { flex: none; width: 8.5em; padding: 6px 4px; border: 0; background: none; color: var(--accent-text); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; text-align: left; cursor: pointer; }
.ed-sub-text { flex: 1; min-width: 0; min-height: 0; padding: 4px 8px; resize: vertical; }
@media (max-width: 560px) {
  .ed-sub { flex-wrap: wrap; }
  .ed-sub-time { width: auto; }
  .ed-sub-text { flex-basis: 100%; order: 3; }
}
