/* Universal Editor — Shared styles
   Black & Orange signature theme
   ============================================================ */
:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --surface-3: #242424;
  --orange: #ff6b00;
  --orange-dim: #cc5500;
  --orange-glow: rgba(255, 107, 0, 0.28);
  --text: #f0f0f0;
  --muted: #888;
  --border: #222;
  --border-strong: #333;
  --success: #2ecc71;
  --danger: #e74c3c;
  --radius: 8px;
  --radius-md: 12px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

/* Header */
header {
  background: var(--surface);
  border-bottom: 3px solid var(--orange);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex-shrink: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}
.logo-svg { width: 36px; height: 36px; }
.logo-text { font-size: 1.2rem; font-weight: 700; }
.logo-text span { color: var(--orange); }
nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1.1rem;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.15s;
}
nav a:hover,
nav a.active { color: var(--orange); }

/* Tabs */
.tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.65rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: all 0.15s;
}
.tab:hover { border-color: var(--orange); color: var(--text); }
.tab.active {
  background: var(--orange);
  border-color: var(--orange);
  color: #000;
}

/* Workspace */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.panel { display: none; height: 100%; }
.panel.active { display: flex; flex-direction: column; }

/* Generic buttons */
button, .btn {
  background: var(--orange);
  color: #000;
  border: none;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
button:hover, .btn:hover { background: var(--orange-dim); }
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
button.secondary:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* Status */
.status {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.3em;
}
.status.ok { color: var(--success); }
.status.err { color: var(--danger); }

/* Dropzone (simple panels) */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  text-align: center;
  background: var(--surface);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  margin-bottom: 1rem;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--orange);
  background: var(--surface-2);
}
.dropzone p { color: var(--muted); margin-top: 0.35rem; font-size: 0.875rem; }
.dropzone strong { color: var(--orange); }
input[type="file"] { display: none; }

/* Simple panel content */
.simple-workspace {
  flex: 1;
  padding: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  overflow: auto;
}
h2 { font-size: 1.35rem; margin-bottom: 0.3rem; }
.sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.1rem; }
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

/* Lists */
.rom-list, .file-list { list-style: none; margin-top: 0.75rem; }
.rom-list li, .file-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.rom-list li span, .file-list li span { color: var(--muted); font-size: 0.8rem; }

textarea, .file-content {
  width: 100%;
  min-height: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  resize: vertical;
}
textarea:focus { outline: 2px solid var(--orange); outline-offset: -1px; }

video, audio {
  max-width: 100%;
  border-radius: 10px;
  background: #000;
  margin-top: 0.5rem;
}
video { max-height: 360px; }

/* Footer */
footer {
  text-align: center;
  padding: 0.9rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}
footer a { color: var(--orange); text-decoration: none; }

/* ============================================================
   VIDEO EDITOR — Filmora / traditional layout
   ============================================================ */
.ve {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  min-height: 0;
  background: var(--bg);
}

/* Top toolbar */
.ve-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.ve-toolbar .group {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  padding-right: 0.6rem;
  border-right: 1px solid var(--border);
}
.ve-toolbar .group:last-child { border-right: none; }
.ve-toolbar button {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 6px;
}
.ve-toolbar .tool-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-right: 0.25rem;
}

/* Main 3-column area */
.ve-main {
  display: grid;
  grid-template-columns: 200px 1fr 210px;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 900px) {
  .ve-main { grid-template-columns: 1fr; }
  .ve-sidebar, .ve-props { display: none; }
}

.ve-sidebar,
.ve-props {
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 0.65rem;
}
.ve-props { border-right: none; border-left: 1px solid var(--border); }

.ve-sidebar h3,
.ve-props h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.ve-media-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ve-media-item:hover,
.ve-media-item.active {
  border-color: var(--orange);
}
.ve-media-item .icon {
  width: 28px;
  height: 20px;
  background: #000;
  border-radius: 3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--orange);
}

/* Preview monitor */
.ve-preview {
  display: flex;
  flex-direction: column;
  background: #050505;
  min-height: 0;
}
.ve-preview-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  min-height: 0;
  position: relative;
}
.ve-preview-stage video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  background: #000;
  box-shadow: 0 0 0 1px var(--border), 0 8px 32px rgba(0,0,0,0.6);
}
.ve-preview-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.4rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.ve-preview-controls button {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}
.ve-time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 90px;
  text-align: center;
}

/* Properties */
.ve-prop-row {
  margin-bottom: 0.65rem;
}
.ve-prop-row label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.ve-prop-row input[type="range"] {
  width: 100%;
  accent-color: var(--orange);
}
.ve-prop-row input[type="number"],
.ve-prop-row select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 5px;
  padding: 0.3rem 0.45rem;
  font-size: 0.85rem;
}

/* Timeline */
.ve-timeline {
  background: var(--surface);
  border-top: 2px solid var(--border-strong);
  height: 160px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.ve-timeline-ruler {
  height: 22px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  font-size: 0.65rem;
  color: var(--muted);
  font-family: var(--mono);
}
.ve-timeline-tracks {
  flex: 1;
  overflow: auto;
  position: relative;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 49px,
    var(--border) 49px,
    var(--border) 50px
  );
}
.ve-track {
  height: 40px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 4px;
}
.ve-track-label {
  position: sticky;
  left: 0;
  width: 56px;
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--surface);
  z-index: 2;
  padding: 0 4px;
  height: 100%;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--border);
}
.ve-clip {
  position: absolute;
  left: 60px;
  height: 30px;
  top: 5px;
  background: linear-gradient(180deg, #ff8c33, var(--orange));
  border-radius: 4px;
  min-width: 40px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  cursor: grab;
  overflow: hidden;
  white-space: nowrap;
}
.ve-clip.audio {
  background: linear-gradient(180deg, #4a9eff, #2563eb);
  color: #fff;
}
.ve-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--orange);
  z-index: 5;
  left: 60px;
  pointer-events: none;
}
.ve-playhead::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -5px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--orange);
}

/* ============================================================
   RUST / CODE EDITOR panel
   ============================================================ */
.rust-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.rust-toolbar {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}
.rust-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
}
@media (max-width: 800px) {
  .rust-body { grid-template-columns: 1fr; }
}
.rust-code-wrap,
.rust-output-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
}
.rust-output-wrap { border-right: none; }
.rust-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
#rust-code,
#rust-output {
  flex: 1;
  width: 100%;
  min-height: 200px;
  border: none;
  border-radius: 0;
  resize: none;
  background: #0d0d0d;
  color: #e6e6e6;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.55;
}
#rust-code:focus { outline: none; }
#rust-output { color: #a0e0a0; }

/* Module cards on index */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.3rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.card:hover {
  border-color: var(--orange);
  background: var(--surface-2);
  transform: translateY(-3px);
}
.card h3 { color: var(--orange); margin-bottom: 0.35rem; font-size: 1.05rem; }
.card p { color: var(--muted); font-size: 0.92rem; }
