/* TN Střihátko – tmavé prostředí ve stylu Premiere Pro */
:root {
  --bg: #1b1b1b;
  --panel: #232323;
  --panel2: #2b2b2b;
  --head: #1f1f1f;
  --line: #3a3a3a;
  --text: #d6d6d6;
  --dim: #8e8e8e;
  --accent: #2d8ceb;
  --accent2: #4aa3ff;
  --ph: #4aa3ff;
  --vclip: #6a73c9;
  --vclip-b: #8f97e6;
  --aclip: #3f9b70;
  --aclip-b: #5fc896;
  --sel: #f0b532;
  --inout: rgba(74, 163, 255, .18);
  --danger: #e2574c;
  --lane-h: 46px;
  --font: 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 12px var(--font); overflow: hidden; user-select: none; }
button { font: inherit; color: var(--text); background: #353535; border: 1px solid #444; border-radius: 3px; padding: 3px 8px; cursor: pointer; }
button:hover { background: #3f3f3f; border-color: #555; }
button:active { background: #2a2a2a; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
input, select, textarea { font: inherit; color: var(--text); background: #1a1a1a; border: 1px solid #444; border-radius: 3px; padding: 3px 6px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.spacer { flex: 1; }
.dim { color: var(--dim); }

#app { display: flex; flex-direction: column; height: 100vh; }
#topbar { height: 32px; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: #141414; border-bottom: 1px solid #000; }
.brand { font-size: 13px; letter-spacing: .3px; }
.brand b { background: var(--accent); color: #fff; padding: 1px 5px; border-radius: 3px; margin-right: 3px; }
.brand i { font-style: normal; color: var(--dim); margin-left: 3px; }
.proj-name { color: var(--dim); }
.tb { padding: 3px 10px; }
.tb.on { border-color: var(--accent); color: #fff; }
.bridge { color: var(--dim); font-size: 11px; }
.bridge.on::before { content: '●'; color: #3ecf6e; margin-right: 4px; }
.bridge.off::before { content: '●'; color: var(--danger); margin-right: 4px; }

#workspace { flex: 1; display: flex; min-height: 0; }
#mainCol { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#topRow { height: 52%; display: flex; min-height: 160px; }
#bottomRow { flex: 1; display: flex; min-height: 160px; }
#sourcePanel, #programPanel { flex: 1; min-width: 200px; }
#projectPanel { width: 330px; min-width: 200px; }
#timelinePanel { flex: 1; min-width: 300px; position: relative; }
#aiPanel { width: 400px; min-width: 300px; background: var(--panel); border-left: 1px solid #000; display: flex; }
#aiPanel.hidden, #aiSplit.hidden { display: none; }
#aiFrame { flex: 1; border: 0; background: #1e1e1e; }

.panel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; border: 1px solid #111; position: relative; }
.panel.focus { border-color: var(--accent); }
.panel-head { height: 26px; display: flex; align-items: center; gap: 8px; padding: 0 8px; background: var(--head); border-bottom: 1px solid #111; flex: none; }
.ptitle { font-weight: 600; }
.psub { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-foot { display: flex; gap: 6px; padding: 5px 6px; border-top: 1px solid #111; background: var(--head); flex: none; }
.hsplit { height: 5px; cursor: row-resize; background: #111; flex: none; }
.vsplit { width: 5px; cursor: col-resize; background: #111; flex: none; }
.hsplit:hover, .vsplit:hover { background: var(--accent); }

/* monitory */
.monitor { flex: 1; position: relative; background: #0d0d0d; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
.screen { position: relative; background: #000; overflow: hidden; }
.monitor-video { position: absolute; object-fit: fill; visibility: hidden; }
.monitor-blank { position: absolute; inset: 0; background: #000; }
.dip-overlay { position: absolute; inset: 0; opacity: 0; pointer-events: none; z-index: 4; }
.mon-empty { position: absolute; color: #555; font-size: 13px; pointer-events: none; }
.caption-overlay { position: absolute; left: 6%; right: 6%; bottom: 5%; text-align: center; color: #fff; font-weight: 600;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 6px #000; white-space: pre-line; pointer-events: none; display: none; z-index: 5; font-size: 4.2cqh; }
.screen { container-type: size; }
.scrub { height: 14px; background: #151515; position: relative; cursor: pointer; flex: none; border-top: 1px solid #111; }
.scrub .ph { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ph); margin-left: -1px; }
.scrub .ph::before { content: ''; position: absolute; top: 0; left: -4px; border: 5px solid transparent; border-top-color: var(--ph); }
.scrub .inout { position: absolute; top: 0; bottom: 0; background: var(--inout); display: none; }
.transport { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 8px; flex: none; }
.transport .tbtns { flex: 1; display: flex; justify-content: center; gap: 3px; flex-wrap: nowrap; overflow: hidden; }
.transport button { padding: 2px 7px; min-width: 28px; }
.transport button.play { min-width: 38px; color: #fff; }
.tc { font: 600 14px Consolas, monospace; color: var(--accent2); min-width: 98px; }
.tc.dim { color: var(--dim); text-align: right; }

/* projekt */
.search { width: 120px; padding: 2px 6px; }
.proj-list { flex: 1; overflow: auto; outline: none; padding: 4px; }
.proj-list.drop { background: #22303f; }
.pi { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 3px; cursor: default; }
.pi:hover { background: #2c2c2c; }
.pi.sel { background: #24456b; }
.pi .thumb { width: 64px; height: 36px; background: #111 center/cover no-repeat; border-radius: 2px; flex: none; position: relative; }
.pi .thumb.seq { background: #3a3f63; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.pi .thumb.aud { background: #244a38; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.pi .meta { min-width: 0; flex: 1; }
.pi .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi .info { color: var(--dim); font-size: 11px; }
.pi .prog { height: 3px; background: #333; margin-top: 2px; }
.pi .prog i { display: block; height: 100%; background: var(--accent); }
.pi.missing .nm { color: var(--danger); }

/* timeline */
.tl-toolbar { height: 30px; display: flex; align-items: center; gap: 8px; padding: 0 6px; background: var(--head); border-bottom: 1px solid #111; flex: none; }
.seq-tabs { display: flex; gap: 2px; overflow: hidden; min-width: 0; }
.seq-tab { padding: 4px 8px 4px 10px; border-radius: 3px 3px 0 0; background: #2a2a2a; color: var(--dim); white-space: nowrap; cursor: pointer; display: flex; gap: 6px; align-items: center; max-width: 260px; }
.seq-tab span { overflow: hidden; text-overflow: ellipsis; }
.seq-tab.on { background: #3a3a3a; color: #fff; }
.seq-tab .x { opacity: .5; padding: 0 2px; }
.seq-tab .x:hover { opacity: 1; color: var(--danger); }
.tools { display: flex; gap: 2px; }
.tool { width: 28px; padding: 2px 0; }
.tool.on { background: #22476f; border-color: var(--accent); }
#zoom { width: 140px; }
.tl-main { flex: 1; display: flex; overflow: hidden; min-height: 0; position: relative; }
.tl-heads { width: 128px; flex: none; background: var(--panel2); border-right: 1px solid #111; position: relative; overflow: hidden; }
.tl-heads .ruler-spacer { height: 28px; border-bottom: 1px solid #111; position: sticky; top: 0; background: var(--head); z-index: 3; display: flex; align-items: center; padding-left: 6px; }
.tl-heads .ruler-spacer .tc { font-size: 13px; min-width: 0; }
.th { height: var(--lane-h); display: flex; align-items: center; gap: 3px; padding: 0 4px; border-bottom: 1px solid #1a1a1a; }
.th.audio { background: #262b28; }
.th.sep { height: 6px; background: #111; border: 0; padding: 0; }
.th .tname { width: 30px; text-align: center; border-radius: 3px; padding: 2px 0; border: 1px solid #444; cursor: pointer; font-weight: 600; }
.th .tname.target { background: var(--accent); border-color: var(--accent); color: #fff; }
.th .tb2 { width: 22px; height: 20px; padding: 0; font-size: 11px; background: #2e2e2e; }
.th .tb2.on { background: #6b4b16; border-color: #a07020; }
.th .tb2.mute.on { background: #7a2d2d; border-color: #b04040; }
.tl-area { flex: 1; position: relative; overflow: auto; min-width: 0; }
.tl-area::-webkit-scrollbar { height: 0; width: 10px; }
.tl-area::-webkit-scrollbar-thumb { background: #4a4a4a; border-radius: 5px; }
.tl-area::-webkit-scrollbar-track { background: #1b1b1b; }
/* zoom/scroll lišta dole jako v Premiere */
.zoombar { height: 18px; flex: none; background: #1b1b1b; border-top: 1px solid #111; padding: 2px 10px 2px 128px; }
.zb-track { position: relative; height: 100%; background: #262626; border-radius: 7px; }
.zb-thumb { position: absolute; top: 0; bottom: 0; background: #4b4b4b; border-radius: 7px; cursor: grab; min-width: 24px; }
.zb-thumb:hover { background: #575757; }
.zb-thumb.drag { cursor: grabbing; background: #5e5e5e; }
.zb-h { position: absolute; top: 50%; width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%; background: #2a2a2a; border: 2px solid #cfcfcf; cursor: ew-resize; box-sizing: border-box; }
.zb-h.l { left: 0; }
.zb-h.r { right: 0; }
.zb-h:hover { border-color: #fff; background: #444; }
.tl-ruler { position: sticky; top: 0; left: 0; height: 28px; display: block; background: var(--head); border-bottom: 1px solid #111; z-index: 3; cursor: text; }
.tl-lanes { position: relative; }
.lane { height: var(--lane-h); border-bottom: 1px solid #1a1a1a; position: relative; background: #202020; }
.lane.audio { background: #1e2320; }
.lane.sep { height: 6px; background: #111; }
.lane.drop { background: #263548; }
.clip { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; overflow: hidden; cursor: default; border: 1px solid rgba(0,0,0,.6); box-sizing: border-box; }
.clip.video { background: var(--vclip); }
.clip.audio { background: var(--aclip); }
.clip.sel { outline: 2px solid var(--sel); outline-offset: -2px; z-index: 2; }
.clip.disabled { opacity: .45; }
.clip .cl { position: absolute; left: 4px; top: 1px; right: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; font-size: 11px; text-shadow: 0 0 2px rgba(0,0,0,.8); z-index: 2; pointer-events: none; }
.clip .fx { position: absolute; top: 1px; right: 4px; font-size: 10px; color: #ffe; z-index: 2; pointer-events: none; }
.clip canvas { position: absolute; left: 0; top: 0; pointer-events: none; }
.clip .thumbs { position: absolute; left: 0; top: 14px; bottom: 0; background-repeat: no-repeat; background-size: auto 100%; opacity: .85; pointer-events: none; }
.clip .fade { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 1; }
.clip .fade.in { left: 0; background: linear-gradient(to bottom right, rgba(0,0,0,.45) 50%, transparent 50%); }
.clip .fade.out { right: 0; background: linear-gradient(to bottom left, rgba(0,0,0,.45) 50%, transparent 50%); }
.clip.ghost { opacity: .7; outline: 1px dashed #fff; }
.gap-sel { position: absolute; top: 2px; bottom: 2px; background: rgba(240,181,50,.25); outline: 1px solid var(--sel); pointer-events: none; }
.tl-playhead { position: absolute; top: 0; width: 1px; background: var(--ph); pointer-events: none; z-index: 6; }
.tl-snapline { position: absolute; top: 28px; width: 1px; background: #fff; pointer-events: none; z-index: 7; display: none; box-shadow: 0 0 3px #fff; }
.tl-marquee { position: absolute; border: 1px dashed #ddd; background: rgba(255,255,255,.07); display: none; z-index: 8; pointer-events: none; }
.tl-empty { position: absolute; inset: 30px 0 0 0; display: none; align-items: center; justify-content: center; color: #666; font-size: 13px; pointer-events: none; }
.tl-empty.show { display: flex; }
.lane .marker { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(76, 214, 120, .5); pointer-events: none; }
.lane.captions { background: #252232; }
.cap { position: absolute; top: 3px; bottom: 3px; background: #6b5aa8; border-radius: 3px; color: #fff; font-size: 10px; padding: 1px 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border: 1px solid rgba(0,0,0,.5); }
.th.captions { background: #2a2733; }

/* žiletka jako v Premiere: kurzor čepel + čára řezu přes klip */
.tl-lanes.razor, .tl-lanes.razor .clip {
  cursor: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Cg transform='rotate(-40 15 11)'%3E%3Cpath d='M8 6 h14 a1 1 0 0 1 1 1 v8 a1 1 0 0 1 -1 1 h-14 l-2 -5 z' fill='white' stroke='black' stroke-width='1.3'/%3E%3Crect x='11' y='10' width='8' height='2.2' rx='1.1' fill='black'/%3E%3Cpath d='M10 7 v8 M13 7 v2 M13 13 v2' stroke='black' stroke-width='0.8'/%3E%3C/g%3E%3Cline x1='3' y1='1' x2='3' y2='25' stroke='white' stroke-width='1'/%3E%3C/svg%3E") 3 13, crosshair;
}
#tlRazorMarks { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 7; pointer-events: none; }
.razor-mark { position: absolute; width: 0; border-left: 1px dashed #fff; box-shadow: 0 0 2px #000; pointer-events: none; }
.clip.edge-l, .clip.edge-r { cursor: ew-resize; }

/* stavový řádek */
#statusbar { height: 22px; display: flex; align-items: center; padding: 0 10px; background: #141414; border-top: 1px solid #000; color: var(--dim); font-size: 11px; gap: 10px; }
#status.err { color: var(--danger); }
.progress-inline { display: inline-block; width: 120px; height: 6px; background: #333; vertical-align: middle; margin-left: 6px; }
.progress-inline i { display: block; height: 100%; background: var(--accent); }

/* kontextové menu, modální okno, toast */
.ctx-menu { position: fixed; display: none; background: #2b2b2b; border: 1px solid #555; border-radius: 4px; padding: 4px 0; min-width: 210px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.ctx-menu div { padding: 5px 14px; display: flex; justify-content: space-between; gap: 20px; }
.ctx-menu div:hover { background: var(--accent); color: #fff; }
.ctx-menu div.dis { opacity: .4; pointer-events: none; }
.ctx-menu hr { border: 0; border-top: 1px solid #444; margin: 4px 0; }
.ctx-menu .k { color: var(--dim); }
.ctx-menu div:hover .k { color: #e6f0ff; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: center; justify-content: center; z-index: 60; }
.modal.show { display: flex; }
.modal-box { background: #2a2a2a; border: 1px solid #555; border-radius: 6px; padding: 16px 18px; min-width: 420px; max-width: 760px; max-height: 86vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.modal-box h2 { margin: 0 0 12px; font-size: 15px; }
.modal-box .row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.modal-box .row label { width: 130px; color: var(--dim); }
.modal-box .row input[type=text], .modal-box .row select { flex: 1; }
.modal-box .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-box .bar { height: 8px; background: #333; border-radius: 4px; overflow: hidden; margin: 10px 0 4px; }
.modal-box .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.keys { columns: 2; column-gap: 28px; font-size: 12px; }
.keys div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; break-inside: avoid; }
.keys kbd { background: #3a3a3a; border: 1px solid #555; border-radius: 3px; padding: 0 5px; font: 11px Consolas, monospace; color: #fff; }
.keys h3 { margin: 8px 0 4px; font-size: 12px; color: var(--accent2); }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: #333; border: 1px solid #555; padding: 8px 14px; border-radius: 5px; display: none; z-index: 70; max-width: 70vw; }
.toast.show { display: block; }
.toast.err { border-color: var(--danger); }

/* přepínač jazyka (vlaječky) v pravém horním rohu */
.lang-sw { display: inline-flex; gap: 2px; margin-left: 8px; padding: 2px; border: 1px solid #3a3a3a; border-radius: 3px; background: #1e1e1e; }
.lang-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 20px; padding: 0; border: 1px solid transparent; border-radius: 2px; background: transparent; cursor: pointer; opacity: .45; filter: saturate(.5); }
.lang-btn svg { display: block; border-radius: 1px; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.lang-btn:hover { opacity: .85; filter: none; }
.lang-btn.on { opacity: 1; filter: none; border-color: #8d8d8d; background: #2c2c2c; }
