/*
 * Copyright © 2026 Sooly Music Limited (UK)
 * Copyright © 2026 Soykan Medya Anonim Şirketi (TR)
 * RTV Global® is a registered trademark.
 *
 * RTV Video Editor — Styles
 */

/* =========================================
   IMPORTS & VARIABLES
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Background Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-tertiary: #16161f;
  --bg-panel: rgba(17, 17, 24, 0.85);
  --bg-panel-solid: #111118;
  --bg-surface: rgba(22, 22, 31, 0.9);
  --bg-surface-hover: rgba(30, 30, 42, 0.95);
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --bg-glass: rgba(17, 17, 24, 0.6);

  /* Accent Colors */
  --accent-cyan: #00d4ff;
  --accent-cyan-dim: rgba(0, 212, 255, 0.15);
  --accent-cyan-glow: rgba(0, 212, 255, 0.4);
  --accent-magenta: #ff006e;
  --accent-magenta-dim: rgba(255, 0, 110, 0.15);
  --accent-magenta-glow: rgba(255, 0, 110, 0.4);
  --accent-green: #00ff87;
  --accent-green-dim: rgba(0, 255, 135, 0.15);
  --accent-green-glow: rgba(0, 255, 135, 0.4);
  --accent-yellow: #ffd600;
  --accent-orange: #ff6b35;
  --accent-purple: #a855f7;

  /* Text Colors */
  --text-primary: #f0f0f5;
  --text-secondary: #9a9ab0;
  --text-tertiary: #5e5e72;
  --text-muted: #3d3d50;

  /* Border Colors */
  --border-primary: rgba(255, 255, 255, 0.06);
  --border-secondary: rgba(255, 255, 255, 0.1);
  --border-active: rgba(0, 212, 255, 0.3);
  --border-hover: rgba(255, 255, 255, 0.15);

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow-cyan: 0 0 20px rgba(0, 212, 255, 0.2);
  --shadow-glow-magenta: 0 0 20px rgba(255, 0, 110, 0.2);
  --shadow-glow-green: 0 0 20px rgba(0, 255, 135, 0.2);

  /* Sizing */
  --header-height: 48px;
  --panel-left-width: 280px;
  --panel-right-width: 300px;
  --timeline-height: 260px;
  --timeline-ruler-height: 28px;
  --timeline-track-height: 48px;
  --scrollbar-width: 6px;

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index */
  --z-panel: 10;
  --z-dropdown: 100;
  --z-modal: 1000;
  --z-tooltip: 2000;
  --z-toast: 3000;

  /* Font */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* =========================================
   RESET & BASE
   ========================================= */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: var(--scrollbar-width);
  height: var(--scrollbar-width);
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* =========================================
   APP LAYOUT
   ========================================= */
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
}

/* =========================================
   HEADER
   ========================================= */
#header {
  display: flex;
  align-items: center;
  height: var(--header-height);
  min-height: var(--header-height);
  padding: 0 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
  z-index: var(--z-panel);
  gap: 8px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 20px;
}

.header-logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--shadow-glow-cyan);
}

.header-logo-text {
  font-weight: 700;
  font-size: 15px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}

.header-logo-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
  border: 1px solid rgba(0, 212, 255, 0.2);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  letter-spacing: 1px;
}

/* Header Menu */
.header-menu {
  display: flex;
  align-items: center;
  gap: 2px;
}

.header-menu-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.header-menu-btn .icon {
  font-size: 14px;
}

/* Header Spacer */
.header-spacer { flex: 1; }

/* Header Project Name */
.header-project-name {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
}

.header-project-name .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: var(--shadow-glow-green);
}

.header-project-name .name {
  font-weight: 500;
  color: var(--text-primary);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 20px;
}

.header-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

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

.header-action-btn.export-btn {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  color: white;
  font-size: 12px;
  font-weight: 600;
  width: auto;
  padding: 0 14px;
  gap: 6px;
  box-shadow: var(--shadow-glow-cyan);
}

.header-action-btn.export-btn:hover {
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
  transform: translateY(-1px);
}

/* =========================================
   MAIN CONTENT AREA
   ========================================= */
#main-content {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* =========================================
   LEFT PANEL (Media Library)
   ========================================= */
#panel-left {
  width: var(--panel-left-width);
  min-width: 200px;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-primary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: var(--z-panel);
}

/* Panel Tabs */
.panel-tabs {
  display: flex;
  padding: 8px 8px 0;
  gap: 2px;
  border-bottom: 1px solid var(--border-primary);
}

.panel-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: all var(--transition-fast);
  position: relative;
}

.panel-tab .tab-icon {
  font-size: 18px;
  transition: all var(--transition-fast);
}

.panel-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.panel-tab.active {
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.05);
}

.panel-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent-cyan);
  border-radius: var(--radius-full);
  box-shadow: 0 0 8px var(--accent-cyan-glow);
}

/* Panel Content */
.panel-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
}

/* Media Drop Zone */
.media-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 16px;
  border: 2px dashed var(--border-secondary);
  border-radius: var(--radius-lg);
  background: rgba(0, 212, 255, 0.02);
  cursor: pointer;
  transition: all var(--transition-normal);
  margin-bottom: 16px;
}

.media-drop-zone:hover,
.media-drop-zone.drag-over {
  border-color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.06);
  box-shadow: inset 0 0 30px rgba(0, 212, 255, 0.05);
}

.media-drop-zone .drop-icon {
  font-size: 36px;
  opacity: 0.5;
  transition: all var(--transition-normal);
}

.media-drop-zone:hover .drop-icon {
  opacity: 0.8;
  transform: scale(1.1);
}

.media-drop-zone .drop-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.media-drop-zone .drop-hint {
  font-size: 10px;
  color: var(--text-tertiary);
}

/* Media Items Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.media-item {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: grab;
  border: 1px solid var(--border-primary);
  transition: all var(--transition-fast);
  background: var(--bg-tertiary);
}

.media-item:hover {
  border-color: var(--accent-cyan);
  box-shadow: var(--shadow-glow-cyan);
  transform: scale(1.02);
}

.media-item img,
.media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-item .media-duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  padding: 1px 5px;
  background: rgba(0, 0, 0, 0.75);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 9px;
  color: white;
}

.media-item .media-name {
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 40px;
  font-size: 10px;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-item .media-type-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 1px 5px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-xs);
  font-size: 10px;
}

/* Effect/Filter/Text Items */
.effect-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.effect-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.effect-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
}

.effect-item .effect-preview {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.effect-item .effect-info {
  flex: 1;
  min-width: 0;
}

.effect-item .effect-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.effect-item .effect-desc {
  font-size: 10px;
  color: var(--text-tertiary);
}

/* Panel Section Headers */
.panel-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  margin-bottom: 8px;
}

.panel-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* =========================================
   PREVIEW AREA (Center)
   ========================================= */
#preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-primary);
}

/* Preview Canvas Wrapper */
.preview-canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
  min-height: 0;
  background: 
    radial-gradient(ellipse at center, rgba(0, 212, 255, 0.02) 0%, transparent 70%),
    var(--bg-primary);
}

#preview-canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  background: #000;
  cursor: crosshair;
}

/* Aspect Ratio Badge */
.preview-aspect-badge {
  position: absolute;
  top: 24px;
  right: 24px;
  padding: 4px 10px;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
}

/* Empty State */
.preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-tertiary);
  text-align: center;
}

.preview-empty .empty-icon {
  font-size: 64px;
  opacity: 0.2;
}

.preview-empty .empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.preview-empty .empty-desc {
  font-size: 12px;
  max-width: 280px;
  line-height: 1.6;
}

.preview-empty .empty-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  color: white;
  font-weight: 600;
  font-size: 13px;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-glow-cyan);
}

.preview-empty .empty-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(0, 212, 255, 0.3);
}

/* Preview Controls */
.preview-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
}

.preview-controls .ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preview-controls .ctrl-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.preview-controls .ctrl-btn.play-btn {
  width: 42px;
  height: 42px;
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  font-size: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.preview-controls .ctrl-btn.play-btn:hover {
  background: rgba(0, 212, 255, 0.25);
  box-shadow: var(--shadow-glow-cyan);
}

.preview-controls .ctrl-btn.play-btn.playing {
  background: var(--accent-magenta-dim);
  color: var(--accent-magenta);
  border-color: rgba(255, 0, 110, 0.2);
}

.preview-controls .ctrl-btn.play-btn.playing:hover {
  background: rgba(255, 0, 110, 0.25);
  box-shadow: var(--shadow-glow-magenta);
}

.preview-controls .time-display {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  padding: 0 12px;
  min-width: 120px;
  text-align: center;
}

.preview-controls .time-display .current {
  color: var(--text-primary);
  font-weight: 600;
}

.preview-controls .volume-control {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.preview-controls .volume-slider {
  width: 80px;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.preview-controls .volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent-cyan);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-cyan-glow);
}

/* =========================================
   RIGHT PANEL (Properties)
   ========================================= */
#panel-right {
  width: var(--panel-right-width);
  min-width: 220px;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-primary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: var(--z-panel);
  overflow-y: auto;
}

.properties-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-primary);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.properties-header .prop-icon {
  font-size: 16px;
}

/* Property Groups */
.prop-group {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-primary);
}

.prop-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  cursor: pointer;
}

.prop-group-title .toggle-icon {
  font-size: 12px;
  transition: transform var(--transition-fast);
}

.prop-group.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.prop-group.collapsed .prop-group-content {
  display: none;
}

/* Property Row */
.prop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.prop-label {
  flex: 0 0 80px;
  font-size: 11px;
  color: var(--text-secondary);
}

.prop-value {
  flex: 1;
  min-width: 0;
}

/* Slider */
.prop-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.prop-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent-cyan);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-cyan-glow);
  transition: transform var(--transition-fast);
}

.prop-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.prop-number {
  width: 48px;
  padding: 4px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  outline: none;
  transition: border-color var(--transition-fast);
}

.prop-number:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px var(--accent-cyan-dim);
}

/* Empty Properties State */
.properties-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--text-tertiary);
  text-align: center;
}

.properties-empty .empty-icon {
  font-size: 32px;
  opacity: 0.3;
}

.properties-empty .empty-text {
  font-size: 12px;
}

/* =========================================
   RESIZE HANDLES
   ========================================= */
.panel-resize-handle {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: calc(var(--z-panel) + 1);
  transition: background var(--transition-fast);
}

.panel-resize-handle:hover,
.panel-resize-handle.active {
  background: var(--accent-cyan);
  box-shadow: var(--shadow-glow-cyan);
}

.timeline-resize-handle {
  height: 4px;
  cursor: row-resize;
  background: transparent;
  position: relative;
  z-index: calc(var(--z-panel) + 1);
  transition: background var(--transition-fast);
}

.timeline-resize-handle:hover,
.timeline-resize-handle.active {
  background: var(--accent-cyan);
  box-shadow: var(--shadow-glow-cyan);
}

/* =========================================
   TIMELINE
   ========================================= */
#timeline-area {
  height: var(--timeline-height);
  min-height: 150px;
  max-height: 500px;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
}

/* Timeline Toolbar */
.timeline-toolbar {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 8px;
  border-bottom: 1px solid var(--border-primary);
  min-height: 36px;
}

.timeline-toolbar .tl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timeline-toolbar .tl-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.timeline-toolbar .tl-btn.active {
  color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
}

.timeline-toolbar .tl-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.timeline-toolbar .separator {
  width: 1px;
  height: 20px;
  background: var(--border-secondary);
}

.timeline-toolbar .tl-zoom {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.timeline-toolbar .tl-zoom .zoom-slider {
  width: 100px;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.timeline-toolbar .tl-zoom .zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  background: var(--accent-cyan);
  border-radius: 50%;
  cursor: pointer;
}

.timeline-toolbar .tl-total-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-xs);
}

/* Timeline Track Area */
.timeline-tracks-wrapper {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Track Labels (Left side) */
.timeline-track-labels {
  width: 120px;
  min-width: 120px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-primary);
  overflow-y: auto;
}

.track-label-ruler-spacer {
  height: var(--timeline-ruler-height);
  border-bottom: 1px solid var(--border-primary);
}

.track-label {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--timeline-track-height);
  min-height: var(--timeline-track-height);
  padding: 0 10px;
  border-bottom: 1px solid var(--border-primary);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.track-label:hover {
  background: rgba(255, 255, 255, 0.03);
}

.track-label .track-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.track-label .track-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-label .track-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.track-label:hover .track-actions {
  opacity: 1;
}

.track-label .track-action-btn {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.track-label .track-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Track Canvas Area */
.timeline-tracks-canvas {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
}

#timeline-canvas {
  display: block;
}

/* Playhead */
.timeline-playhead {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--accent-magenta);
  z-index: 5;
  pointer-events: none;
  box-shadow: 0 0 8px var(--accent-magenta-glow);
}

.timeline-playhead::before {
  content: '';
  position: absolute;
  top: 0;
  left: -5px;
  width: 12px;
  height: 14px;
  background: var(--accent-magenta);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  pointer-events: auto;
  cursor: pointer;
}

/* =========================================
   MODALS
   ========================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-primary);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 0, 110, 0.1);
  color: var(--accent-magenta);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border-secondary);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #0099cc);
  border-color: transparent;
  color: white;
  box-shadow: var(--shadow-glow-cyan);
}

.btn-primary:hover {
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(255, 0, 110, 0.1);
  border-color: rgba(255, 0, 110, 0.2);
  color: var(--accent-magenta);
}

.btn-danger:hover {
  background: rgba(255, 0, 110, 0.2);
}

/* Format Selection Cards */
.format-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.format-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border: 2px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  background: transparent;
}

.format-card:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.03);
}

.format-card.selected {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan-dim);
  box-shadow: var(--shadow-glow-cyan);
}

.format-card .format-icon {
  font-size: 28px;
}

.format-card .format-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.format-card .format-size {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
}

/* =========================================
   CONTEXT MENU
   ========================================= */
.context-menu {
  position: fixed;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: 4px;
  z-index: var(--z-dropdown);
  display: none;
  animation: contextIn 0.15s ease;
}

.context-menu.active {
  display: block;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.context-menu-item:hover {
  background: var(--accent-cyan-dim);
  color: var(--text-primary);
}

.context-menu-item .cm-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

.context-menu-item .cm-shortcut {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
}

.context-menu-separator {
  height: 1px;
  background: var(--border-primary);
  margin: 4px 8px;
}

.context-menu-item.danger {
  color: var(--accent-magenta);
}

.context-menu-item.danger:hover {
  background: var(--accent-magenta-dim);
}

/* =========================================
   TOAST NOTIFICATIONS
   ========================================= */
.toast-container {
  position: fixed;
  top: 60px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  color: var(--text-primary);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  max-width: 320px;
}

.toast.success {
  border-left: 3px solid var(--accent-green);
}

.toast.error {
  border-left: 3px solid var(--accent-magenta);
}

.toast.info {
  border-left: 3px solid var(--accent-cyan);
}

.toast .toast-icon {
  font-size: 16px;
}

.toast .toast-message {
  flex: 1;
}

/* =========================================
   EXPORT PROGRESS
   ========================================= */
.export-progress {
  text-align: center;
}

.export-progress .progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 16px 0;
}

.export-progress .progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  position: relative;
}

.export-progress .progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 2s infinite;
}

.export-progress .progress-percent {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.export-progress .progress-status {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* =========================================
   TOOLTIP
   ========================================= */
.tooltip {
  position: fixed;
  padding: 4px 10px;
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  z-index: var(--z-tooltip);
  pointer-events: none;
  animation: fadeIn 0.15s ease;
  white-space: nowrap;
}

.tooltip .tooltip-shortcut {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 10px;
  margin-left: 8px;
}

/* =========================================
   LOADING / SPLASH
   ========================================= */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  font-size: 40px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 900;
  letter-spacing: 2px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-primary);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 1px;
}

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes contextIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px var(--accent-cyan-glow); }
  50% { box-shadow: 0 0 20px var(--accent-cyan-glow); }
}

@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* =========================================
   DRAG STATES
   ========================================= */
body.dragging * {
  cursor: grabbing !important;
}

body.dragging-horizontal * {
  cursor: col-resize !important;
}

body.dragging-vertical * {
  cursor: row-resize !important;
}

.drag-ghost {
  position: fixed;
  pointer-events: none;
  opacity: 0.7;
  z-index: 9998;
  transform: scale(0.8);
}

/* =========================================
   HIDDEN ELEMENTS
   ========================================= */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================
   SELECTION
   ========================================= */
::selection {
  background: var(--accent-cyan-dim);
  color: var(--text-primary);
}

/* =========================================
   FOCUS VISIBLE
   ========================================= */
:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
}

button:focus:not(:focus-visible) {
  outline: none;
}
