/* Video maker (wwwroot/js/tools/video-maker.js) */
.vm { --vm-sel: #F43F5E; --vm-clip: #FFE4E6; position: relative; margin: 0 0 24px; }
.vm button { font-family: var(--text); }
.vm-note { margin: 6px 0; color: var(--slate); font-size: 0.82rem; line-height: 1.45; }
.vm-wide { width: 100%; justify-content: center; }
.vm-spacer { flex: 1; }
.vm-ibtn { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); cursor: pointer; }
.vm-ibtn:disabled { opacity: 0.4; cursor: default; }

/* Start: choose a size */
.vm-start { padding: 26px 22px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--paper); text-align: center; }
.vm-start-title { margin: 0 0 16px; font: 700 1.2rem var(--display); }
.vm-ratios { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-width: 720px; margin: 0 auto; }
.vm-ratios button { display: grid; justify-items: center; gap: 4px; padding: 18px 10px 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper); color: var(--ink); cursor: pointer; }
.vm-ratios button:hover { border-color: var(--vm-sel); background: #FFF1F2; }
.vm-ratios strong { font-size: 0.95rem; }
.vm-ratios span:not(.vm-ratio-box) { color: var(--slate); font-size: 0.8rem; }
.vm-ratio-box { display: block; height: 64px; max-width: 100px; margin-bottom: 8px; border: 2.5px solid var(--ink); border-radius: 6px; }
.vm-start-note { margin: 16px 0 0; color: var(--slate); font-size: 0.88rem; }

/* Editor */
.vm-app { border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--paper); overflow: hidden; }
.vm-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.vm-name { width: min(280px, 40vw); padding: 7px 10px; border: 1px solid transparent; border-radius: 8px; background: none; font: 600 0.95rem var(--text); color: var(--ink); }
.vm-name:hover, .vm-name:focus { border-color: var(--line-strong); background: var(--paper); }
.vm-saved { color: var(--slate-2); font-size: 0.8rem; white-space: nowrap; }
.vm-top .btn { white-space: nowrap; }
.vm-main { display: grid; grid-template-columns: 250px minmax(0, 1fr) 270px; min-height: 420px; }
.vm-side, .vm-inspect { padding: 12px; overflow-y: auto; max-height: 560px; }
.vm-side { border-right: 1px solid var(--line); }
.vm-inspect { border-left: 1px solid var(--line); }
.vm-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 12px; padding: 3px; border-radius: 10px; background: var(--mist); }
.vm-tabs button { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 4px; border: 0; border-radius: 8px; background: none; color: var(--slate); font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.vm-tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-1); }
.vm-tabs .icon { width: 15px; height: 15px; }
.vm-bin { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.vm-bin-item { position: relative; padding: 0; aspect-ratio: 16 / 10; border: 1px solid var(--line); border-radius: 8px; background: var(--mist); overflow: hidden; cursor: pointer; }
.vm-bin-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vm-bin-item span { position: absolute; right: 4px; bottom: 4px; padding: 1px 5px; border-radius: 4px; background: rgb(0 0 0 / 0.65); color: #fff; font-size: 0.7rem; }
.vm-bin-item.is-unused { opacity: 0.55; }
.vm-text-presets { display: grid; gap: 6px; }
.vm-preset { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #1F2937; color: #fff; font-size: 1.05rem; cursor: pointer; text-align: center; }
.vm-preset:hover { border-color: var(--vm-sel); }
.vm-music-info p { margin: 10px 0 6px; font-weight: 600; font-size: 0.88rem; overflow-wrap: anywhere; }

.vm-center { display: flex; flex-direction: column; min-width: 0; background: var(--mist); }
.vm-stage { position: relative; flex: 1; display: grid; place-items: center; min-height: 300px; height: 420px; }
.vm-stage canvas { display: block; background: #000; border-radius: 4px; box-shadow: var(--shadow-2); touch-action: none; }
.vm-empty { position: absolute; color: #fff; font-weight: 600; pointer-events: none; }
.vm-controls { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--paper); }
.vm-play { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: var(--ink); color: #fff; cursor: pointer; }
.vm-play .icon { width: 18px; height: 18px; }
.vm-time { font: 600 0.85rem var(--mono); color: var(--ink); }
.vm-inspect-title { margin: 0 0 10px; font: 700 0.95rem var(--display); }
.vm-inspect .field { margin-bottom: 10px; }
.vm-inspect textarea { width: 100%; }
.vm-inspect input[type="range"] { width: 100%; }
.vm-inspect input[type="color"] { width: 54px; height: 32px; padding: 2px; }
.vm-inspect .checkbox { margin: 4px 0 10px; }
.vm-inspect-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* Stage 2: captions, stickers, shapes, voiceover, filters */
.vm-label { margin: 16px 0 6px; font-weight: 700; font-size: 0.85rem; }
.vm-row { display: flex; gap: 6px; align-items: center; }
.vm-row select { flex: 1; min-width: 0; }
.vm-link { padding: 0; border: 0; background: none; color: var(--signal-ink); font: 600 0.82rem var(--text); text-decoration: underline; cursor: pointer; }
.vm-stickers { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.vm-stickers button { aspect-ratio: 1; padding: 0; border: 0; border-radius: 8px; background: none; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.vm-stickers button:hover { background: var(--mist); }
.vm-shapes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.vm-shapes button { display: grid; place-items: center; aspect-ratio: 1; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--canvas); cursor: pointer; }
.vm-shapes button:hover { border-color: var(--vm-sel); }
.vm-shapes svg { width: 100%; height: 100%; fill: #55627A; stroke: #55627A; }
#vm-record.is-rec { border-color: #EF4444; background: #FEF2F2; color: #B91C1C; }
#vm-record.is-rec .icon { animation: vm-pulse 1s ease-in-out infinite; }
@keyframes vm-pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { #vm-record.is-rec .icon { animation: none; } }
.vm-details { margin: 6px 0 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.vm-details summary { cursor: pointer; font-weight: 600; font-size: 0.88rem; }
.vm-details[open] summary { margin-bottom: 8px; }
.vm-track-voice { height: 30px; }
.vm-track-voice[hidden] { display: none; }
.vm-voice { position: absolute; top: 0; height: 26px; border-radius: 7px; border: 2px solid #FCD34D; background: #FEF3C7; cursor: grab; box-sizing: border-box; overflow: hidden; }
.vm-voice.is-sel { border-color: var(--vm-sel); box-shadow: 0 0 0 2px rgb(244 63 94 / 0.25); z-index: 2; }
.vm-voice .vm-clip-label { top: 50%; bottom: auto; transform: translateY(-50%); background: none; }

/* Stage 3: templates, free music, brand */
.vm-start-or { margin-top: 26px; }
.vm-templates { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; max-width: 900px; margin: 0 auto; }
.vm-templates button { display: grid; justify-items: center; align-content: start; gap: 4px; padding: 12px 8px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper); color: var(--ink); cursor: pointer; }
.vm-templates button:hover { border-color: var(--vm-sel); background: #FFF1F2; }
.vm-templates strong { font-size: 0.9rem; }
.vm-templates span:not(.vm-tpl-look) { color: var(--slate); font-size: 0.75rem; }
.vm-tpl-look { display: block; height: 96px; max-width: 100%; margin-bottom: 6px; border-radius: 8px; box-shadow: var(--shadow-1); }
.vm-label-note { font-weight: 400; color: var(--slate); font-size: 0.75rem; }
.vm-search { width: 100%; }
.vm-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 4px; }
.vm-chip { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); font: 500 0.78rem var(--text); cursor: pointer; }
.vm-chip:hover { border-color: var(--vm-sel); }
.vm-songs { display: grid; gap: 4px; margin: 6px 0 0; padding: 0; list-style: none; }
.vm-songs li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.vm-song-play { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: var(--mist); color: var(--ink); font-size: 0.7rem; cursor: pointer; }
.vm-song-name { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vm-songs small { color: var(--slate); font: 0.72rem var(--mono); }
.vm-brand { margin-bottom: 4px; }
.vm-brand .vm-label { margin-top: 0; }
.vm-brand .vm-row { flex-wrap: wrap; }

/* Timeline */
.vm-timeline-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: 1px solid var(--line); }
.vm-zoom { display: inline-flex; align-items: center; gap: 6px; color: var(--slate); }
.vm-zoom .icon { width: 16px; height: 16px; }
.vm-zoom input { width: 140px; }
.vm-timeline { overflow-x: auto; overflow-y: hidden; padding: 0 0 8px; background: var(--canvas); border-top: 1px solid var(--line); }
.vm-tl-inner { position: relative; min-width: 100%; padding: 0 12px; user-select: none; -webkit-user-select: none; touch-action: pan-x; }
.vm-ruler { position: relative; height: 22px; border-bottom: 1px solid var(--line); cursor: pointer; }
.vm-ruler span { position: absolute; top: 4px; padding-left: 3px; border-left: 1px solid var(--line-strong); color: var(--slate); font: 0.68rem var(--mono); }
.vm-track { position: relative; margin-top: 6px; }
.vm-track-clips { height: 58px; }
.vm-track-texts { min-height: 38px; }
.vm-track-music { height: 30px; }
.vm-clip, .vm-text, .vm-music { position: absolute; top: 0; border-radius: 7px; overflow: hidden; cursor: grab; box-sizing: border-box; }
.vm-clip { height: 56px; border: 2px solid #FDA4AF; background-color: var(--vm-clip); background-size: auto 100%; background-repeat: repeat-x; }
.vm-text { height: 26px; border: 2px solid #A5B4FC; background: #E0E7FF; }
.vm-music { left: 0; height: 26px; border: 2px solid #86EFAC; background: #DCFCE7; cursor: pointer; }
.vm-clip.is-sel, .vm-text.is-sel, .vm-music.is-sel { border-color: var(--vm-sel); box-shadow: 0 0 0 2px rgb(244 63 94 / 0.25); z-index: 2; }
.vm-clip-label { position: absolute; left: 6px; bottom: 3px; max-width: calc(100% - 12px); padding: 0 4px; border-radius: 4px; background: rgb(255 255 255 / 0.85); color: var(--ink); font-size: 0.7rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.vm-text .vm-clip-label, .vm-music .vm-clip-label { top: 50%; bottom: auto; transform: translateY(-50%); background: none; }
.vm-handle { position: absolute; top: 0; bottom: 0; width: 10px; cursor: ew-resize; background: rgb(15 29 58 / 0.0); }
.vm-handle-l { left: 0; } .vm-handle-r { right: 0; }
.is-sel > .vm-handle { background: var(--vm-sel); }
.is-sel > .vm-handle::after { content: ""; position: absolute; left: 4px; top: 30%; bottom: 30%; width: 2px; border-radius: 1px; background: #fff; }
.vm-tr { position: absolute; left: -1px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 3px; background: #fff; border: 2px solid var(--vm-sel); transform: rotate(45deg); pointer-events: none; }
.vm-playhead { position: absolute; top: 0; bottom: 0; left: 12px; width: 2px; background: var(--vm-sel); pointer-events: none; z-index: 5; }
.vm-playhead i { position: absolute; top: 0; left: -6px; border: 7px solid transparent; border-top-color: var(--vm-sel); }

/* Export */
.vm-dialog { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgb(15 29 58 / 0.45); }
.vm-dialog[hidden] { display: none; }
.vm-dialog-box { width: min(420px, 100%); padding: 20px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-3); }
.vm-dialog-title { margin: 0 0 12px; font: 700 1.1rem var(--display); }
.vm-progress { height: 8px; margin: 12px 0 4px; border-radius: 999px; background: var(--mist); overflow: hidden; }
.vm-progress i { display: block; width: 0; height: 100%; background: var(--vm-sel); transition: width 0.2s; }
.vm-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

@media (max-width: 1000px) {
    .vm-templates { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    /* Phones and tablets: preview, then the timeline, then the panels. */
    .vm-app:not([hidden]) { display: flex; flex-direction: column; }
    .vm-main { display: contents; }
    .vm-top { order: 0; } .vm-center { order: 1; } .vm-timeline-bar { order: 2; } .vm-timeline { order: 3; } .vm-side { order: 4; } .vm-inspect { order: 5; }
    .vm-side, .vm-inspect { max-height: none; border: 0; border-top: 1px solid var(--line); }
    .vm-stage { height: min(60vh, 460px); }
    .vm-hide-sm { display: none; }
}
@media (max-width: 600px) {
    .vm-ratios { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vm-templates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vm-name { width: 40vw; }
}
