/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-hover: #1c2129;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --orange: #d29922;
  --purple: #bc8cff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Navbar ────────────────────────────────────────────── */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.nav-links { display: flex; gap: 16px; align-items: center; }

/* ─── Container ─────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

h1 { font-size: 1.8rem; margin-bottom: 24px; }

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #4090e0; }
.btn-secondary { background: var(--bg-card); }
.btn-accent { background: var(--purple); color: #fff; border-color: var(--purple); }
.btn-accent:hover { background: #a070e0; }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #d03030; }
.btn-small { padding: 4px 10px; font-size: 0.8rem; }

/* ─── Status Badges ─────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.draft { background: #30363d; color: var(--text-muted); }
.status-badge.processing { background: #3d2e00; color: var(--orange); }
.status-badge.completed { background: #0d3117; color: var(--green); }
.status-badge.error { background: #3d1418; color: var(--red); }
.status-badge.pending { background: #30363d; color: var(--text-muted); }
.status-badge.generating { background: #3d2e00; color: var(--orange); }

/* ─── Projects Grid ─────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.project-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  transition: all 0.15s;
  color: var(--text);
}

.project-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  text-decoration: none;
}

.project-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 12px; }
.project-header h3 { font-size: 1.1rem; }
.project-meta { display: flex; gap: 16px; color: var(--text-muted); font-size: 0.85rem; }

/* ─── Queue Status ──────────────────────────────────────── */
.queue-status { margin-bottom: 16px; }

/* ─── Scenes List ───────────────────────────────────────── */
.scenes-list { display: flex; flex-direction: column; gap: 20px; }

.scene-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.scene-card.completed { border-color: #1a4a25; }
.scene-card.error { border-color: #5a1a1a; }
.scene-card.generating { border-color: #4a3a0a; }

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

.scene-header h3 { font-size: 1rem; }

.scene-body { padding: 16px 20px; }

.scene-text {
  color: var(--text-muted);
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.prompt-details {
  margin-bottom: 16px;
}

.prompt-details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.prompt-text {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font-family: monospace;
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.scene-actions {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

/* ─── Video ─────────────────────────────────────────────── */
.video-container {
  margin-top: 12px;
}

.video-container video {
  width: 100%;
  max-width: 640px;
  border-radius: 8px;
  background: #000;
}

/* ─── Header Row ────────────────────────────────────────── */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.header-row h1 { margin-bottom: 8px; }

.progress-large {
  display: inline-block;
  margin-left: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ─── Modal ─────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 500px;
}

.modal-large { max-width: 700px; }

.modal-content h2 { margin-bottom: 20px; font-size: 1.3rem; }

/* ─── Forms ─────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.form-group textarea { resize: vertical; }

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── Utilities ─────────────────────────────────────────── */
.empty { color: var(--text-muted); text-align: center; padding: 40px; }
.loading { color: var(--text-muted); }
.error { color: var(--red); }
