/* ============================================================
   Video Studio PRO — Advanced Web Video Editor Styles
   ============================================================ */

:root {
  --bg-main: #080c14;
  --bg-sidebar: #0f172a;
  --bg-panel: #141e33;
  --bg-card: #1e293b;
  --bg-card-hover: #28374d;
  --bg-input: #0b1120;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: #3b82f6;
  --border-focus: rgba(59, 130, 246, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-primary: #10b981;
  --accent-primary-hover: #059669;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-danger: #ef4444;
  --accent-warning: #f59e0b;

  --radius-xl: 14px;
  --radius-lg: 10px;
  --radius-md: 6px;
  --radius-sm: 4px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --header-height: 52px;
}

/* Reset & Global */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.editor-body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Top Header Navigation ──────────────────────────────── */
.editor-header {
  height: var(--header-height);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  flex-shrink: 0;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-header-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
}

.btn-header-back:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.btn-header-back i {
  width: 15px;
  height: 15px;
}

.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
}

.brand-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  font-size: 1.3rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-pro {
  background: linear-gradient(135deg, #8b5cf6, #3b82f6);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.brand-sub {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.header-center {
  display: flex;
  align-items: center;
}

.project-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-title {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: text;
  border: 1px dashed transparent;
  transition: border-color 0.2s;
}

.project-title:hover, .project-title:focus {
  border-color: var(--accent-blue);
  background: rgba(255, 255, 255, 0.04);
}

.badge-aspect {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.btn-header-action {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-header-action:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.btn-header-action i {
  width: 14px;
  height: 14px;
}

.btn-export-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-export-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-export-primary i {
  width: 15px;
  height: 15px;
}

/* ── Main Studio Grid ───────────────────────────────────── */
.studio-container {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

/* ── Left Sidebar (Tools & Settings) ────────────────────── */
.studio-sidebar {
  width: 320px;
  min-width: 300px;
  max-width: 360px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: row;
  height: 100%;
  flex-shrink: 0;
  z-index: 50;
}

/* Vertical Tabs Rail */
.sidebar-tabs {
  width: 60px;
  background: #090e1a;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 4px;
  flex-shrink: 0;
}

.tab-btn {
  width: 48px;
  height: 48px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.65rem;
  font-weight: 500;
}

.tab-btn i {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Sidebar Panels Area */
.sidebar-panels-wrap {
  flex: 1;
  background: var(--bg-panel);
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.sidebar-panels-wrap::-webkit-scrollbar {
  width: 5px;
}
.sidebar-panels-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.panel-content {
  display: none;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.2s ease-in-out;
}

.panel-content.active {
  display: flex;
}

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

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.panel-header h3 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
}

.panel-counter {
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--bg-card);
  padding: 2px 7px;
  border-radius: 10px;
}

.btn-add-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 4px 9px;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-item:hover {
  background: rgba(59, 130, 246, 0.25);
}

.btn-add-item i {
  width: 13px;
  height: 13px;
}

/* ── Upload Dropzones ───────────────────────────────────── */
.upload-dropzone {
  border: 2px dashed rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.03);
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
}

.dropzone-compact {
  padding: 12px;
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dropzone-icon {
  width: 36px;
  height: 36px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.dropzone-icon i {
  width: 18px;
  height: 18px;
}

.dropzone-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.dropzone-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-browse {
  margin-top: 6px;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  padding: 5px 12px;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

/* ── Item Lists & Empty States ──────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
  color: var(--text-dim);
  text-align: center;
  gap: 4px;
}

.empty-state i {
  width: 26px;
  height: 26px;
  stroke-width: 1.5;
}

.empty-state p {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.empty-state small {
  font-size: 0.7rem;
}

/* Clips List Cards */
.clips-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.clip-card-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.clip-card-item:hover, .clip-card-item.active {
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
}

.clip-thumb {
  width: 48px;
  height: 32px;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

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

.clip-thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.clip-card-item:hover .clip-thumb-play {
  opacity: 1;
  background: rgba(59, 130, 246, 0.6);
}

.clip-thumb-play i {
  width: 12px;
  height: 12px;
}

.clip-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.clip-name {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clip-meta {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.clip-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.btn-icon-sm {
  width: 22px;
  height: 22px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon-sm:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.btn-icon-sm.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-danger);
}

/* Layer Inspector Panel */
.layer-inspector {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.inspector-header h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: #60a5fa;
}

.btn-icon-danger {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-icon-danger:hover {
  background: var(--accent-danger);
  color: #fff;
}

/* Form Controls & Sliders */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 8px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}

.form-control:focus {
  border-color: var(--accent-blue);
}

.form-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: #233148;
  border-radius: 4px;
  outline: none;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
  border: 2px solid #fff;
}

.form-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-blue);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
  border: 2px solid #fff;
}

/* Image Scale Special Highlight */
.highlight-control {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 8px;
}

.label-with-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.control-val-badge {
  background: var(--accent-blue);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}

.scale-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.btn-step-size {
  width: 24px;
  height: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-step-size:hover {
  background: var(--accent-blue);
}

.quick-size-chips {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.chip-size {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 10px;
  cursor: pointer;
}

.chip-size:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.4);
}

/* Color Picker Row */
.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.color-picker-wrap input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-wrap input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  cursor: pointer;
}

.btn-group-segmented {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 2px;
  border: 1px solid var(--border-color);
}

.btn-seg {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 6px;
  font-size: 0.72rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-seg.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.preset-positions, .preset-positions-grid {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.preset-positions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.btn-preset-pos {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.68rem;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
}

.btn-preset-pos:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

/* ── Aspect Ratio Preset Grid ───────────────────────────── */
.ratio-options-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ratio-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.ratio-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(59, 130, 246, 0.4);
}

.ratio-card.active {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.ratio-preview {
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.ratio-card.active .ratio-preview {
  color: var(--accent-blue);
}

.ratio-details {
  display: flex;
  flex-direction: column;
}

.ratio-details strong {
  font-size: 0.8rem;
  color: var(--text-main);
}

.ratio-details span {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.divider-sub {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

.fill-style-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fill-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  cursor: pointer;
}

.fill-radio.active {
  border-color: var(--accent-blue);
}

/* ── Audio Card ─────────────────────────────────────────── */
.audio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
}

.audio-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-icon {
  width: 30px;
  height: 30px;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.audio-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.audio-meta strong {
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-meta span {
  font-size: 0.68rem;
  color: var(--text-dim);
}

/* ── Filters Tab ────────────────────────────────────────── */
.btn-reset-text {
  background: transparent;
  border: none;
  color: #60a5fa;
  font-size: 0.72rem;
  cursor: pointer;
}

.filter-controls-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.label-val {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label-val label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.label-val span {
  font-size: 0.68rem;
  color: var(--text-dim);
}

/* ── Center Stage & Viewport ────────────────────────────── */
.studio-viewport-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #060910;
  position: relative;
  overflow: hidden;
  height: 100%;
}

.canvas-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #111a2f 0%, #060910 100%);
  min-height: 0;
}

.canvas-aspect-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.85);
  border-radius: var(--radius-md);
  background: #000;
}

#main-canvas {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 275px);
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
  border-radius: var(--radius-md);
}

/* Interactive Selection Box on Canvas */
.interactive-selection-box {
  position: absolute;
  border: 2px dashed #3b82f6;
  pointer-events: auto;
  cursor: move;
  z-index: 20;
}

.sel-handle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #fff;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  pointer-events: auto;
}

.handle-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.handle-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.handle-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.handle-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }

.sel-quick-bar {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 0.68rem;
  color: #fff;
}

.sel-quick-bar button {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
}

/* Empty Canvas Welcome Hint */
.canvas-welcome {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.canvas-welcome.hidden {
  display: none;
}

.welcome-card {
  pointer-events: auto;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 28px;
  border-radius: var(--radius-xl);
  text-align: center;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
}

.welcome-icon {
  font-size: 2.5rem;
}

.welcome-card h2 {
  font-size: 1.2rem;
  font-weight: 800;
}

.welcome-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn-welcome-upload {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 6px;
}

/* ── Player Controls Bar ────────────────────────────────── */
.player-controls-bar {
  height: 42px;
  background: #0b101c;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  flex-shrink: 0;
}

.ctrl-left, .ctrl-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-player {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-player:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-player-play {
  background: var(--accent-blue);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.btn-player-play:hover {
  background: #2563eb;
  color: #fff;
  transform: scale(1.05);
}

.timecode-display {
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--text-main);
  background: var(--bg-input);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.active-track-name {
  font-size: 0.74rem;
  color: var(--text-dim);
}

/* ── Bottom Timeline Multi-Track System ─────────────────── */
.timeline-container {
  height: 165px;
  max-height: 180px;
  background: #090d16;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-top: 1px solid var(--border-color);
}

.timeline-toolbar {
  height: 32px;
  background: #0d1322;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
}

.timeline-tools-left, .timeline-tools-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tl-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-tl-tool {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.btn-tl-tool:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.tl-zoom-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-dim);
}

.tl-zoom-wrap input[type="range"] {
  width: 60px;
  height: 4px;
}

/* Scrollable Timeline Board */
.timeline-board-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  position: relative;
  background: #080c14;
}

.timeline-board-scroll::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}
.timeline-board-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.timeline-board {
  min-width: 100%;
  position: relative;
  padding-left: 80px;
  user-select: none;
}

/* Time Ruler */
.timeline-ruler {
  height: 20px;
  background: #0b1120;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
}

.ruler-tick {
  position: absolute;
  bottom: 0;
  height: 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.62rem;
  color: var(--text-dim);
  padding-left: 3px;
  pointer-events: none;
}

.ruler-tick.major {
  height: 12px;
  border-left-color: rgba(255, 255, 255, 0.4);
}

/* Red Playhead */
.timeline-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 30;
  pointer-events: auto;
  cursor: ew-resize;
  transform: translateX(-1px);
}

.playhead-handle {
  width: 12px;
  height: 12px;
  background: #ef4444;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

/* Tracks */
.timeline-track {
  height: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
  display: flex;
  align-items: center;
}

.track-header {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: #0e1526;
  border-right: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  z-index: 15;
}

.track-header i {
  width: 12px;
  height: 12px;
}

.track-items-lane {
  position: absolute;
  left: 80px;
  right: 0;
  top: 0;
  bottom: 0;
}

/* Timeline Item Blocks */
.tl-item-block {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.tl-item-block.active {
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.block-video {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: #fff;
}

.block-text {
  background: linear-gradient(135deg, #065f46, #10b981);
  color: #fff;
}

.block-image {
  background: linear-gradient(135deg, #6b21a8, #8b5cf6);
  color: #fff;
}

.block-audio {
  background: linear-gradient(135deg, #9a3412, #f97316);
  color: #fff;
}

/* ── Export Modal ───────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: #131b2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

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

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon {
  width: 36px;
  height: 36px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title-wrap h3 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-title-wrap p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
}

.btn-modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
}

.export-presets-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.export-preset {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.export-preset.active {
  border-color: var(--accent-primary);
  background: rgba(16, 185, 129, 0.1);
}

.export-preset input {
  display: none;
}

.export-preset strong {
  font-size: 0.82rem;
  color: #fff;
}

.export-preset span {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.export-summary-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 12px 0;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
}

.summary-item span {
  color: var(--text-muted);
}

.btn-start-render {
  width: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.btn-start-render:hover {
  transform: translateY(-1px);
}

/* Render Progress */
.export-progress-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 0;
  gap: 10px;
}

.progress-spinner-wrap {
  position: relative;
  width: 100px;
  height: 100px;
}

.ring-svg {
  transform: rotate(-90deg);
}

.progress-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: #10b981;
}

.export-done-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.done-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  padding: 6px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
}

.btn-download-final {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  text-decoration: none;
  padding: 10px;
  border-radius: var(--radius-md);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-render-again {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* Toast */
.editor-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1e293b;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.editor-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ── Responsive Mobile Rules ────────────────────────────── */
@media (max-width: 900px) {
  .studio-container {
    flex-direction: column;
  }
  .studio-sidebar {
    width: 100%;
    max-width: 100%;
    height: 40vh;
  }
  .timeline-container {
    height: 140px;
  }
  .header-center {
    display: none;
  }
}

/* ── Strictly Suppress & Block All Injected Ads in Studio View ── */
ins.adsbygoogle,
.google-auto-placed,
div[id^="google_ads_iframe"],
iframe[id^="aswift_"],
iframe[name^="google_ads"],
div[class*="ad-container"],
div[class*="adsbygoogle"],
#google_esf,
div[id^="ad_"],
div[id*="google_ads"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  pointer-events: none !important;
  position: absolute !important;
  top: -9999px !important;
  left: -9999px !important;
  z-index: -9999 !important;
}

