/**
 * PAPERMOTION — Editor Workspace Styles
 * Left controls sidebar, center canvas stage, right inspector, bottom timeline
 */

/* ==========================================================================
   Editor Top Navigation Bar
   ========================================================================== */
.editor-navbar {
  height: var(--editor-header-height);
  background-color: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  z-index: var(--z-nav);
  flex-shrink: 0;
}

.editor-nav-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.btn-back-home:hover {
  color: var(--color-text-primary);
  background-color: var(--color-bg-surface-hover);
}

.editor-project-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.project-title-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-primary);
  font-family: var(--font-headline);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  width: 220px;
  transition: all var(--transition-fast);
}

.project-title-input:hover {
  border-color: var(--color-border-subtle);
}

.project-title-input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  background-color: var(--color-bg-surface-subtle);
}

.editor-nav-center {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.editor-nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ==========================================================================
   Editor Main Grid Layout
   ========================================================================== */
.editor-main-layout {
  display: grid;
  grid-template-columns: var(--editor-sidebar-left) 1fr var(--editor-sidebar-right);
  grid-template-rows: 1fr var(--editor-timeline-height);
  grid-template-areas:
    "sidebar-left canvas sidebar-right"
    "timeline timeline timeline";
  height: calc(100vh - var(--editor-header-height));
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   Left Sidebar — Text, Scenes & Presets
   ========================================================================== */
.editor-sidebar-left {
  grid-area: sidebar-left;
  background-color: var(--color-bg-surface);
  border-right: 1px solid var(--color-border-primary);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

/* Scene Tab Bar */
.scene-manager-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-bg-surface-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
}

.scene-tabs-list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.scene-tab {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-xs);
  background-color: transparent;
  border: 1px solid transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.scene-tab:hover {
  color: var(--color-text-primary);
  background-color: var(--color-bg-surface-hover);
}

.scene-tab.active {
  background-color: var(--color-bg-surface);
  color: var(--color-text-primary);
  border-color: var(--color-border-primary);
  font-weight: var(--weight-bold);
}

.btn-add-scene {
  background: transparent;
  border: 1px dashed var(--color-border-primary);
  color: var(--color-text-secondary);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.btn-add-scene:hover {
  border-color: var(--color-accent-primary);
  color: var(--color-accent-primary);
}

/* Pivot Selection Feedback Banner */
.pivot-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background-color: var(--color-accent-subtle);
  border: 1px solid var(--color-accent-border);
  border-radius: var(--radius-sm);
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-primary);
}

.pivot-word-name {
  font-weight: var(--weight-bold);
  color: var(--color-accent-primary);
  text-decoration: underline;
}

/* ==========================================================================
   Center Workspace — Canvas Stage & Viewport
   ========================================================================== */
.editor-canvas-stage {
  grid-area: canvas;
  background-color: var(--color-canvas-stage);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Stage Toolbar */
.canvas-toolbar {
  height: 40px;
  background-color: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  font-size: var(--text-xs);
  flex-shrink: 0;
  z-index: 5;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.canvas-dimension-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
}

/* Canvas Viewport */
.canvas-viewport {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  /* Subtle dark stage pattern */
  background-image: radial-gradient(var(--color-border-primary) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* The Newspaper Canvas Frame (Simulates Video Rendering Frame) */
.canvas-frame {
  background-color: var(--color-paper-sheet);
  color: var(--color-paper-ink);
  border: 1px solid var(--color-border-primary);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-xs);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: width var(--transition-base), height var(--transition-base), max-width var(--transition-base), max-height var(--transition-base);
}

/* Aspect Ratio Modifiers */
.canvas-frame.ratio-16-9 {
  width: 100%;
  max-width: 780px;
  aspect-ratio: 16 / 9;
}

.canvas-frame.ratio-9-16 {
  height: 100%;
  max-height: 460px;
  aspect-ratio: 9 / 16;
}

.canvas-frame.ratio-1-1 {
  height: 100%;
  max-height: 440px;
  aspect-ratio: 1 / 1;
}

.canvas-frame.ratio-4-5 {
  height: 100%;
  max-height: 460px;
  aspect-ratio: 4 / 5;
}

/* Inside the Newspaper Frame: Editorial Broadsheet Design */
.broadsheet-paper {
  width: 100%;
  height: 100%;
  padding: clamp(12px, 2.5vw, 24px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  box-sizing: border-box;
}

.broadsheet-header {
  border-bottom: 2px solid var(--color-paper-ink);
  padding-bottom: 6px;
  margin-bottom: clamp(8px, 1.5vw, 14px);
}

.broadsheet-masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-headline);
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  font-weight: var(--weight-black);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  text-align: center;
  border-bottom: 1px solid var(--color-paper-rule);
  padding-bottom: 4px;
  margin-bottom: 3px;
}

.broadsheet-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: clamp(8px, 1vw, 10px);
  color: var(--color-paper-dim);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* Main Broadside Content Area */
.broadsheet-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(8px, 1.5vw, 16px);
  overflow: hidden;
}

.broadsheet-kicker {
  font-family: var(--font-mono);
  font-size: clamp(9px, 1.2vw, 11px);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--color-accent-primary);
}

.broadsheet-headline {
  font-family: var(--font-headline);
  font-size: clamp(1.2rem, 3.2vw, 2.4rem);
  font-weight: var(--weight-black);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-paper-ink);
  transition: all var(--transition-fast);
}

/* The Live Match Cut Highlight Inside Canvas */
.broadsheet-headline .pivot-highlight {
  background-color: var(--color-highlight-bg);
  color: var(--color-highlight-text);
  padding: 0 4px;
  border-radius: var(--radius-xs);
  box-shadow: 0 0 14px var(--color-highlight-outline);
  display: inline-block;
  transform: scale(1.02);
  transition: all var(--transition-fast);
}

.broadsheet-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(8px, 2vw, 18px);
  font-size: clamp(9px, 1.1vw, 12px);
  line-height: 1.45;
  color: var(--color-paper-dim);
}

.broadsheet-column p {
  text-align: justify;
}

.broadsheet-column p::first-letter {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 2.5vw, 2.2rem);
  float: left;
  line-height: 0.8;
  padding-right: 6px;
  font-weight: var(--weight-bold);
  color: var(--color-paper-ink);
}

.broadsheet-footer {
  border-top: 1px solid var(--color-paper-rule);
  padding-top: 4px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: clamp(7px, 0.9vw, 9px);
  color: var(--color-paper-dim);
  text-transform: uppercase;
}

/* Overlay Guides */
.canvas-guides-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}

.canvas-guides-overlay.active {
  display: block;
}

.guide-line-h {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background-color: rgba(229, 169, 60, 0.35);
}

.guide-line-v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: rgba(229, 169, 60, 0.35);
}

/* ==========================================================================
   Right Sidebar — Settings, Pacing & Export
   ========================================================================== */
.editor-sidebar-right {
  grid-area: sidebar-right;
  background-color: var(--color-bg-surface);
  border-left: 1px solid var(--color-border-primary);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 10;
}

/* ==========================================================================
   Bottom Area — Timeline & Playhead
   ========================================================================== */
.editor-timeline-area {
  grid-area: timeline;
  background-color: var(--color-timeline-bg);
  border-top: 1px solid var(--color-border-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
}

/* Timeline Controls Header */
.timeline-controls-bar {
  height: 38px;
  background-color: var(--color-bg-surface);
  border-bottom: 1px solid var(--color-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  flex-shrink: 0;
}

.timeline-playback-group {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.timecode-display {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-primary);
  background-color: var(--color-bg-surface-subtle);
  border: 1px solid var(--color-border-primary);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

.timecode-current {
  font-weight: var(--weight-bold);
  color: var(--color-accent-primary);
}

.timecode-divider {
  color: var(--color-text-muted);
}

.timeline-tools-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* Timeline Ruler & Track Stage */
.timeline-tracks-stage {
  flex-grow: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: auto;
  overflow-y: hidden;
  user-select: none;
  cursor: crosshair;
}

/* Ruler */
.timeline-ruler {
  height: 22px;
  background-color: var(--color-bg-surface-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
  position: relative;
  display: flex;
}

.ruler-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--color-border-primary);
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--color-text-muted);
  padding-left: 3px;
  line-height: 18px;
}

/* Tracks */
.timeline-track-list {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-2) var(--space-4);
  position: relative;
}

.timeline-track {
  height: 38px;
  background-color: var(--color-timeline-track);
  border-radius: var(--radius-xs);
  position: relative;
  display: flex;
  align-items: center;
}

.track-label {
  position: sticky;
  left: 0;
  z-index: 5;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
  background-color: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  margin-left: 4px;
  text-transform: uppercase;
}

/* Clip Blocks */
.timeline-clip {
  position: absolute;
  height: 30px;
  background-color: var(--color-timeline-clip);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timeline-clip:hover {
  border-color: var(--color-accent-primary);
  background-color: var(--color-timeline-clip-active);
}

.timeline-clip.active {
  border-color: var(--color-accent-primary);
  background-color: var(--color-timeline-clip-active);
  box-shadow: 0 0 8px rgba(229, 169, 60, 0.2);
}

.timeline-clip-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-text-muted);
  margin-left: var(--space-2);
}

/* Pivot Marker (Match Cut Point) */
.timeline-pivot-marker {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 14px;
  background-color: var(--color-highlight-bg);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-highlight-text);
  font-size: 8px;
  box-shadow: 0 0 10px var(--color-highlight-outline);
  cursor: grab;
  z-index: 10;
}

/* Playhead Scrubber */
.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 25%;
  width: 2px;
  background-color: var(--color-playhead);
  z-index: 30;
  pointer-events: none;
  transition: left 80ms linear;
}

.playhead-handle {
  position: absolute;
  top: 0;
  left: -6px;
  width: 14px;
  height: 14px;
  background-color: var(--color-playhead);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%);
  pointer-events: auto;
  cursor: ew-resize;
}

