/* FrameLoom Design System */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --black: #0a0a0a;
  --white: #f5f5f0;
  --accent: #c8ff00;
  --accent-dim: #a3cc00;
  --muted: #666;
  --border: #1a1a1a;
  --surface: #111;
  --surface-hover: #161616;
  --danger: #ff4444;
  --success: #00cc88;
  --warning: #ffaa00;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--black);
  color: var(--white);
  overflow-x: hidden;
  min-height: 100vh;
}

.grain {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
}

/* ── Nav ── */
.app-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 48px;
  border-bottom: 1px solid var(--border);
}

.app-nav .logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.5px;
  text-decoration: none;
  color: var(--white);
}

.app-nav .logo span { color: var(--accent); }

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

.nav-links a {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--white); }
.nav-links a.active { color: var(--accent); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--black);
}

.btn-primary:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--white);
  border: 1px solid #333;
}

.btn-secondary:hover {
  border-color: #555;
  background: var(--surface);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 17px;
  border-radius: 10px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

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

.form-label {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid #222;
  border-radius: 8px;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 255, 0, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #444;
}

.form-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23666'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

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

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: #333;
}

.card-clickable {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-clickable:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

/* ── Status Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-pending { background: #1a1a00; color: var(--warning); border: 1px solid #332200; }
.badge-generating { background: #001a1a; color: #00cccc; border: 1px solid #003333; animation: pulse 2s infinite; }
.badge-ready { background: #001a0d; color: var(--success); border: 1px solid #003319; }
.badge-failed { background: #1a0000; color: var(--danger); border: 1px solid #330000; }

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

/* ── Page Layout ── */
.page-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 48px 120px;
}

.page-container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 48px 120px;
}

.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -1.5px;
  margin-bottom: 12px;
}

.page-subtitle {
  font-size: 17px;
  color: #777;
  line-height: 1.6;
  margin-bottom: 48px;
}

/* ── Loading States ── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #222;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 24px;
  text-align: center;
}

.loading-state p {
  color: var(--muted);
  font-size: 15px;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--muted);
  margin-bottom: 24px;
}

/* ── Footer ── */
.app-footer {
  padding: 32px 48px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-footer .footer-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: #444;
}

.app-footer .footer-right {
  font-size: 12px;
  color: #333;
}

/* ── Video Player ── */
.video-container {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.video-canvas {
  width: 100%;
  display: block;
  aspect-ratio: 16/9;
}

.video-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(10px);
  border-top: 1px solid #1a1a1a;
}

.video-controls button {
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.video-controls button:hover {
  background: rgba(255,255,255,0.1);
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: #333;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.1s linear;
}

.time-display {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  color: var(--muted);
  min-width: 80px;
  text-align: right;
}

/* ── Storyboard Timeline ── */
.storyboard-timeline {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.scene-card {
  flex: 0 0 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.scene-card.active {
  border-color: var(--accent);
  background: #111a00;
}

.scene-card:hover {
  border-color: #444;
}

.scene-card .scene-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.scene-card .scene-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.scene-card .scene-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Project Detail ── */
.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 32px;
}

.project-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .app-nav { padding: 20px 24px; }
  .nav-links { gap: 16px; }
  .page-container, .page-container-wide { padding: 40px 24px 80px; }
  .form-row { grid-template-columns: 1fr; }
  .project-header { flex-direction: column; }
  .project-actions { width: 100%; }
  .project-actions .btn { flex: 1; justify-content: center; }
  .app-footer { padding: 24px; flex-direction: column; gap: 12px; }
  .video-controls { padding: 12px 16px; }
  .storyboard-timeline { gap: 8px; }
  .scene-card { flex: 0 0 140px; padding: 12px; }
}
