/* ============ MotionForge layout ============ */
body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.main { flex: 1; display: flex; min-height: 0; }

/* ---- Media bin ---- */
.bin {
  width: 230px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.bin h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted);
  padding: 10px 12px 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.bin-list {
  flex: 1; overflow-y: auto;
  padding: 0 8px 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.bin-drop {
  margin: 8px;
  border: 1.5px dashed var(--border-lt);
  border-radius: 10px;
  padding: 14px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.bin-drop:hover, .bin-drop.over { border-color: var(--accent); color: var(--accent); }
.media-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  cursor: grab;
  user-select: none;
}
.media-item:hover { border-color: var(--border-lt); }
.media-item .mthumb {
  width: 56px; height: 34px;
  border-radius: 5px;
  background: var(--bg-deep);
  object-fit: cover;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 16px;
  overflow: hidden;
}
.media-item .mthumb img, .media-item .mthumb canvas { width: 100%; height: 100%; object-fit: cover; }
.media-item .minfo { flex: 1; min-width: 0; }
.media-item .mname {
  font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.media-item .mdur { font-size: 11px; color: var(--muted); }
.media-item .mdel {
  border: none; background: none; color: var(--muted); cursor: pointer;
  padding: 2px 5px; border-radius: 4px; flex-shrink: 0;
}
.media-item .mdel:hover { color: var(--danger); background: var(--panel-3); }

/* ---- Preview area ---- */
.preview-area {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0;
  background: var(--bg-deep);
}
.preview-wrap {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  min-height: 0;
}
#preview {
  max-width: 100%; max-height: 100%;
  background: #000;
  border-radius: 6px;
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 9;
}
.transport {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 16px 14px;
  flex-shrink: 0;
}
.transport .time {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: var(--muted);
  min-width: 150px;
  text-align: center;
}
.transport .time b { color: var(--text); font-weight: 600; }

/* ---- Right properties ---- */
.vprops {
  width: 250px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  flex-shrink: 0;
  overflow-y: auto;
}
.vprops h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted);
  padding: 10px 12px 8px;
}
.vprops .body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 9px; }
.vprops .prop-row { display: flex; align-items: center; gap: 8px; }
.vprops .prop-row label { width: 56px; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.vprops .prop-row input[type=range] { flex: 1; }
.vprops .prop-row .val { width: 38px; text-align: right; color: var(--muted); font-size: 11px; }
.vprops .prop-row input[type=number] { width: 62px; }
.vprops .prop-row textarea { flex: 1; min-height: 50px; resize: vertical; }
.vprops .hint { color: #5b5b68; font-size: 12px; }

/* ---- Timeline ---- */
.timeline-shell {
  height: 275px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.tl-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
}
.tl-toolbar .spacer { flex: 1; }
.tl-toolbar label { color: var(--muted); font-size: 12px; }

.timeline {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: auto;
  position: relative;
}
.tl-headers {
  position: sticky; left: 0;
  z-index: 20;
  background: var(--panel);
  border-right: 1px solid var(--border);
  width: 108px;
  flex-shrink: 0;
}
.tl-headers .ruler-corner { height: 26px; border-bottom: 1px solid var(--border); }
.track-header {
  height: 52px;
  display: flex; align-items: center; gap: 6px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.track-header .tname { flex: 1; font-weight: 600; }
.track-header .kind { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.track-header .mute {
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--muted); border-radius: 4px;
  width: 20px; height: 20px; cursor: pointer; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}
.track-header .mute.on { background: var(--danger); border-color: var(--danger); color: #fff; }

.tl-body { position: relative; flex-shrink: 0; }
#ruler {
  height: 26px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: block;
}
.track-lane {
  height: 52px;
  border-bottom: 1px solid var(--border);
  position: relative;
  background:
    repeating-linear-gradient(90deg, transparent 0, transparent 59px, #ffffff06 59px, #ffffff06 60px);
}
.track-lane.video-kind { background-color: #1e2029; }
.track-lane.audio-kind { background-color: #1c241f; }
.track-lane.drop-ok { outline: 2px dashed var(--accent); outline-offset: -2px; }

.clip {
  position: absolute; top: 5px; height: 42px;
  border-radius: 6px;
  border: 1px solid #0006;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  display: flex; align-items: center;
  font-size: 11px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.clip .cliplabel {
  padding: 0 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 2px #000a;
  pointer-events: none;
}
.clip.video { background: linear-gradient(180deg, #3b5bd9, #2e46ab); }
.clip.image { background: linear-gradient(180deg, #7c4dcf, #5f39a6); }
.clip.audio { background: linear-gradient(180deg, #2f9e63, #23784b); }
.clip.text  { background: linear-gradient(180deg, #c98a2e, #a06a1e); }
.clip.selected { outline: 2px solid #fff; outline-offset: -1px; }
.clip .thumbstrip {
  position: absolute; inset: 0;
  background-repeat: repeat-x;
  background-size: auto 100%;
  opacity: .55;
  pointer-events: none;
}
.clip .trim {
  position: absolute; top: 0; bottom: 0; width: 8px;
  cursor: ew-resize;
  z-index: 2;
}
.clip .trim.left { left: 0; border-left: 3px solid #ffffff88; border-radius: 6px 0 0 6px; }
.clip .trim.right { right: 0; border-right: 3px solid #ffffff88; border-radius: 0 6px 6px 0; }

#playhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 0;
  border-left: 2px solid var(--danger);
  z-index: 15;
  pointer-events: none;
}
#playhead::before {
  content: "";
  position: absolute; top: 0; left: -7px;
  border: 6px solid transparent;
  border-top: 9px solid var(--danger);
}

/* webcam recorder modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,14,.82);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
}
.record-box {
  background: var(--panel);
  border: 1px solid var(--border-lt);
  border-radius: 14px;
  padding: 22px;
  width: 560px;
  max-width: 92vw;
  box-shadow: var(--shadow);
}
.record-box h2 { font-size: 16px; margin-bottom: 12px; }
#camPreview {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  margin-bottom: 12px;
  object-fit: cover;
}
.rec-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
.rec-row select { flex: 1; min-width: 0; }
.rec-row.center { justify-content: center; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #4b4b57; }
.rec-dot.live { background: var(--danger); animation: rec-pulse 1s infinite; }
@keyframes rec-pulse { 50% { opacity: .3; } }
#recTime { font-family: ui-monospace, monospace; color: var(--muted); font-size: 13px; }

/* export overlay */
#exportOverlay {
  position: fixed; inset: 0;
  background: rgba(10,10,14,.82);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
}
#exportOverlay .box {
  background: var(--panel);
  border: 1px solid var(--border-lt);
  border-radius: 14px;
  padding: 28px 34px;
  width: 380px;
  text-align: center;
  box-shadow: var(--shadow);
}
#exportOverlay h2 { font-size: 17px; margin-bottom: 8px; }
#exportOverlay p { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }
.progress {
  height: 8px; border-radius: 4px;
  background: var(--panel-3);
  overflow: hidden;
  margin-bottom: 18px;
}
.progress > div {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .2s linear;
}
