@charset "UTF-8";

/* ─── Mobile editor bottom navigation (only when editor is open on mobile/tablet) ─── */
@media (max-width: 1024px) {
  #mobEditorNav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 99500; /* below pricing-overlay (10000) and sheet (99700) but above normal UI */
    display: none;
    justify-content: space-around;
    align-items: stretch;
    background: linear-gradient(180deg, rgba(8,10,14,0.88), rgba(6,8,12,0.98));
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 6px 4px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    font-family: var(--font-main, system-ui);
    box-shadow: 0 -6px 30px rgba(0,0,0,0.4);
  }
  body.editor-active #mobEditorNav { display: flex; }

  .mob-nav-btn {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    background: none;
    border: none;
    padding: 6px 4px;
    color: rgba(255,255,255,0.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    border-radius: 10px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(79,142,247,0.2);
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
  }
  .mob-nav-btn:active { background: rgba(255,255,255,0.04); }
  .mob-nav-btn.active {
    color: #6BA3FF;
    background: rgba(107,163,255,0.08);
  }
  .mob-nav-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
  }
  .mob-nav-icon { font-size: 20px; line-height: 1; }
  .mob-nav-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1;
  }

  /* Push editor content up so the timeline/export bar never sits under the nav */
  body.editor-active .editor-overlay,
  body.editor-active #editorOverlay {
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ─── Reusable bottom sheet ─── */
@media (max-width: 1024px) {
  #mobSheetBackdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99600;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  body.mobSheetOpen #mobSheetBackdrop { display: block; opacity: 1; }

  #mobSheet {
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    z-index: 99700;
    background: linear-gradient(180deg, rgba(16,19,26,0.99), rgba(10,12,18,1));
    border-top: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -20px 60px rgba(0,0,0,0.6);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-main, system-ui);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  body.mobSheetOpen #mobSheet { transform: translateY(0); }

  #mobSheet .ms-handle-row {
    padding: 8px 0 4px;
    display: flex;
    justify-content: center;
    touch-action: none;
  }
  #mobSheet .ms-handle {
    width: 42px; height: 4px;
    border-radius: 3px;
    background: rgba(255,255,255,0.22);
  }
  #mobSheet .ms-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  #mobSheet .ms-title {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.2px;
  }
  #mobSheet .ms-close {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; line-height: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255,255,255,0.15);
  }
  #mobSheet .ms-close:active { background: rgba(255,255,255,0.12); }
  #mobSheet .ms-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 14px 20px;
    min-height: 0;
  }

  /* When #editorControlsCol (Style panel) is re-parented into sheet, neutralize desktop sizing */
  #mobSheet .ms-body #editorControlsCol {
    display: flex !important;
    position: static !important;
    inset: auto !important;
    left: auto !important; right: auto !important; top: auto !important; bottom: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: none !important;
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  /* When .editor-export-bar is re-parented into sheet, neutralize its sticky-footer styling */
  #mobSheet .ms-body .editor-export-bar {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  #mobSheet .ms-body .editor-export-bar > div {
    width: 100% !important;
  }
  #mobSheet .ms-body .editor-export-bar .btn-export-main,
  #mobSheet .ms-body .editor-export-bar .btn-export-secondary {
    min-height: 48px !important;
    font-size: 14px !important;
    touch-action: manipulation !important;
  }

  /* Hide desktop-only controls (detach, dock, resize, minimize) while panel is in sheet */
  #mobSheet .ms-body #editorControlsCol .detach-handle,
  #mobSheet .ms-body #editorControlsCol .detach-dock-btn,
  #mobSheet .ms-body #editorControlsCol .panel-resize-handle,
  #mobSheet .ms-body #editorControlsCol .panel-toggle-btn,
  #mobSheet .ms-body #editorControlsCol #panelControlStrip {
    display: none !important;
  }

  /* When #toolsMenuDropdown is re-parented into the sheet, neutralize its desktop fixed position */
  #mobSheet .ms-body #toolsMenuDropdown {
    display: block !important;
    position: static !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: none !important;
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* ─── Phase 5: Polish ─── */
  /* Hide top-row workspace mode tabs on mobile — redundant with bottom nav */
  body.editor-active #wsModeBar { display: none !important; }

  /* Hide keyboard-shortcuts hint strip on mobile — J/K/L etc. don't apply */
  body.editor-active #s5HintStrip { display: none !important; }

  /* Hide original in-editor sticky export bar on mobile (we have Export sheet in bottom nav). Re-parent still works — when sheet opens, we move the real DOM node. This CSS only hides it when it's in its desktop location. */
  body.editor-active .editor-export-bar {
    display: none !important;
  }
  /* But when it's been re-parented INTO our sheet, show it */
  #mobSheet .ms-body .editor-export-bar {
    display: flex !important;
  }

  /* Timeline playhead — bigger touch target on mobile */
  body.editor-active #timelinePlayhead,
  body.editor-active #novaPlayhead,
  body.editor-active .timeline-playhead,
  body.editor-active .nova-timeline-playhead {
    touch-action: none;
  }
  body.editor-active #timelinePlayhead::before,
  body.editor-active #novaPlayhead::before {
    content: '';
    position: absolute;
    inset: -14px;
    background: transparent;
    cursor: grab;
  }

  /* Trim handles — bigger mobile tap area */
  body.editor-active .trim-handle {
    min-width: 18px !important;
  }
  body.editor-active .trim-handle::before {
    content: '';
    position: absolute;
    inset: -10px;
    background: transparent;
  }

  /* Razor / Cut / Ripple / Snap buttons in timeline — min 44px tap */
  body.editor-active .tl-king-btn,
  body.editor-active [onclick*="editorCut"],
  body.editor-active [onclick*="editorRazor"],
  body.editor-active [onclick*="editorRipple"] {
    min-width: 44px !important;
    min-height: 44px !important;
    touch-action: manipulation !important;
  }

  /* Landscape: make bottom nav shorter + still usable */
  @media (max-width: 1024px) and (orientation: landscape) {
    #mobEditorNav {
      padding: 4px 4px;
      padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    }
    .mob-nav-btn { min-height: 40px; padding: 4px 2px; }
    .mob-nav-icon { font-size: 16px; }
    .mob-nav-label { font-size: 9px; }
    #mobSheet { max-height: 92vh; }
    body.editor-active .editor-overlay,
    body.editor-active #editorOverlay {
      padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px)) !important;
    }
  }
}
