/* ==========================================================================
   timeline.css — خط زمان چندمسیره (جهت زمان همیشه چپ به راست، مثل همه‌ی
   برنامه‌های تدوین؛ طبق قواعد Material برای کنترل‌های رسانه)
   ========================================================================== */
.tl-root { position: absolute; inset: 0; direction: ltr; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; background: var(--bg1); }
.tl-ruler { position: absolute; left: 0; right: 0; top: 0; height: 26px; z-index: 3; background: var(--bg1); }
.tl-ruler canvas { width: 100%; height: 100%; }
.tl-body { position: absolute; left: 0; right: 0; top: 26px; bottom: 0; overflow: hidden; }
.tl-layer { position: absolute; left: 0; top: 0; will-change: transform; }
.tl-row { position: absolute; left: 0; height: 40px; }
.tl-row.main { height: 58px; }
.tl-row.audio { height: 46px; }
.tl-row.layer { height: 34px; }
.tl-row-bg { position: absolute; left: 0; right: 0; top: 0; bottom: 0; }
.tl-canvas { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 1; }

.tl-item {
  position: absolute; top: 3px; bottom: 3px; border-radius: 9px; overflow: visible; z-index: 2;
  display: flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 11.5px; font-weight: 700; color: #fff; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10);
  transition: box-shadow 0.15s;
}
.tl-item .lbl { overflow: hidden; text-overflow: ellipsis; min-width: 0; pointer-events: none; direction: rtl; unicode-bidi: plaintext; }
.tl-item .ic { width: 15px; height: 15px; flex: 0 0 auto; pointer-events: none; }
.tl-item.k-video, .tl-item.k-image { background: transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12); padding: 0; }
.tl-item.main { top: 2px; bottom: 2px; border-radius: 10px; }
.tl-item.k-text { background: linear-gradient(180deg, #d4860a, #b86f05); }
.tl-item.k-sticker { background: linear-gradient(180deg, #db2777, #be185d); }
.tl-item.k-fx { background: linear-gradient(180deg, #9333ea, #7e22ce); }
.tl-item.k-look { background: linear-gradient(180deg, #0d9488, #0f766e); }
.tl-item.k-adjust { background: linear-gradient(180deg, #65a30d, #4d7c0f); }
.tl-item.k-audio { background: rgba(16,185,129,0.22); box-shadow: inset 0 0 0 1px rgba(16,185,129,0.55); color: #d1fae5; align-items: flex-start; padding-top: 3px; }
.tl-item.k-audio.voice { background: rgba(6,182,212,0.22); box-shadow: inset 0 0 0 1px rgba(6,182,212,0.6); }
.tl-item.k-audio.sfx { background: rgba(249,115,22,0.22); box-shadow: inset 0 0 0 1px rgba(249,115,22,0.6); }
.tl-item.k-video.overlay, .tl-item.k-image.overlay { box-shadow: inset 0 0 0 1.5px rgba(14,165,233,0.85); }
.tl-item .tag { position: absolute; top: 3px; left: 6px; display: flex; gap: 3px; z-index: 3; pointer-events: none; }
.tl-item .tag i { font-style: normal; font-size: 9.5px; font-weight: 800; background: rgba(0,0,0,0.6); color: #fff; padding: 1px 5px; border-radius: 5px; display: inline-flex; align-items: center; gap: 3px; }
.tl-item .tag .ic { width: 11px; height: 11px; }
.tl-row.layer .tl-item .dur { display: none; }
.tl-item .dur { position: absolute; bottom: 3px; left: 6px; font-size: 9.5px; font-weight: 800; background: rgba(0,0,0,0.6); padding: 0 5px; border-radius: 5px; direction: ltr; pointer-events: none; z-index: 3; }
.tl-item.sel { box-shadow: 0 0 0 2px #fff, 0 6px 18px rgba(0,0,0,0.5); z-index: 4; }
.tl-item.dragging { opacity: 0.85; z-index: 20; box-shadow: 0 0 0 2px var(--ac-l), 0 12px 30px rgba(0,0,0,0.6); }
.tl-item.ghost { opacity: 0.25; }
.tl-item .up { position: absolute; inset: 0; border-radius: inherit; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; z-index: 3; pointer-events: none; }
.tl-item .up.err { background: rgba(120,10,30,0.7); }
.tl-item .up .spinner { width: 16px; height: 16px; border-width: 2px; }

/* دستگیره‌های برش */
.tl-h { position: absolute; top: -2px; bottom: -2px; width: 18px; z-index: 6; display: none; align-items: center; justify-content: center; touch-action: none; cursor: ew-resize; }
.tl-h::before { content: ""; position: absolute; inset: 0 3px; background: #fff; border-radius: 5px; box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.tl-h::after { content: ""; position: relative; width: 2px; height: 40%; max-height: 16px; border-radius: 2px; background: #555; }
.tl-h.l { left: -15px; }
.tl-h.r { right: -15px; }
.tl-item.sel .tl-h { display: flex; }

/* دکمه‌ی ترنزیشن بین کلیپ‌ها */
.tl-tr {
  position: absolute; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 7px; z-index: 7;
  background: #fff; color: #111; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.tl-tr .ic { width: 15px; height: 15px; stroke-width: 2.2; }
.tl-tr.has { background: var(--ac); color: #fff; }
.tl-tr.near-sel { opacity: 0; pointer-events: none; }

/* نشانگر زمان */
.tl-ph { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; z-index: 10; pointer-events: none; box-shadow: 0 0 8px rgba(0,0,0,0.6); }
.tl-ph::before { content: ""; position: absolute; top: 0; left: -6px; width: 14px; height: 12px; border-radius: 3px 3px 7px 7px; background: #fff; }
.tl-root.desk .tl-ph { pointer-events: auto; cursor: ew-resize; }

.tl-add { position: absolute; width: 40px; height: 40px; border-radius: 12px; background: #fff; color: #111; display: flex; align-items: center; justify-content: center; z-index: 5; box-shadow: var(--sh1); }
.tl-add .ic { stroke-width: 2.4; }
.tl-hint { position: absolute; height: 30px; white-space: nowrap; border-radius: 8px; border: 1px dashed rgba(255,255,255,0.18); color: var(--tx3); font-size: 11.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; padding: 0 10px; z-index: 2; direction: rtl; }
.tl-hint .ic { width: 15px; height: 15px; }
.tl-heads { position: absolute; left: 0; top: 26px; bottom: 0; width: 0; z-index: 8; pointer-events: none; }
.tl-head { position: absolute; left: 4px; display: flex; flex-direction: column; gap: 2px; pointer-events: auto; }
.tl-head button { width: 30px; height: 26px; border-radius: 8px; background: rgba(20,20,29,0.92); color: var(--tx2); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 1px var(--line); }
.tl-head button .ic { width: 15px; height: 15px; }
.tl-head button.off { color: var(--err); }
.tl-snap { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--warn); z-index: 9; pointer-events: none; display: none; box-shadow: 0 0 6px var(--warn); }
.tl-snap.on { display: block; }
.tl-ins { position: absolute; top: 2px; width: 3px; border-radius: 3px; background: var(--ac-l); z-index: 21; display: none; box-shadow: 0 0 10px var(--ac); }
.tl-ins.on { display: block; }
.tl-kf { position: absolute; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; background: var(--warn); transform: rotate(45deg); border-radius: 2px; z-index: 7; border: 1.5px solid #3b2800; pointer-events: none; }
.tl-kf.on { background: #fff; }
.tl-beat { position: absolute; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #fde047; z-index: 4; pointer-events: none; }
.tl-marker { position: absolute; top: 0; width: 9px; height: 13px; margin-left: -4.5px; z-index: 4; }
.tl-marker::before { content: ""; position: absolute; inset: 0; background: var(--warn); clip-path: polygon(0 0, 100% 0, 100% 65%, 50% 100%, 0 65%); }
.tl-sel-range { position: absolute; top: 0; bottom: 0; background: rgba(124,92,255,0.12); z-index: 0; pointer-events: none; }

/* نوار ابزار خط زمان (دسکتاپ) */
.tl-bar { flex: 0 0 auto; height: 42px; display: flex; align-items: center; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--bg1); }
.tl-bar .ibtn { width: 34px; height: 34px; border-radius: 9px; }
.tl-bar .ibtn .ic { width: 19px; height: 19px; }
.tl-bar .sepv { width: 1px; height: 20px; background: var(--line2); margin: 0 6px; }
.tl-bar .zoom { width: 130px; }
.tl-bar .zoom .sl { padding: 0; }
.tl-bar .zoom .sl-track { height: 24px; }
.tl-bar .zoom .sl-track::before, .tl-bar .zoom .sl-fill { top: 10px; }
.tl-bar .zoom .sl-knob { top: 4px; width: 16px; height: 16px; margin-left: -8px; }

/* بعد از پایان ویدیو: لایه‌ها دیده می‌شوند ولی در خروجی نمی‌آیند */
.tl-after { position: absolute; top: 0; z-index: 5; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(10,10,15,0.55) 0 6px, rgba(10,10,15,0.38) 6px 12px);
  border-left: 1.5px dashed rgba(255,255,255,0.35); }
