/* ── Variables ──────────────────────────────────────── */
:root {
  --bg-base:    #0f0f10;
  --bg-panel:   #1a1a1e;
  --bg-input:   #111114;
  --bg-hover:   #222228;
  --accent:     #e8ff57;
  --accent-dim: rgba(232, 255, 87, 0.15);
  --text:       #e8e8ea;
  --text-dim:   #666670;
  --text-muted: #44444c;
  --border:     #2a2a32;
  --danger:     #ff4d4d;
  --success:    #57ff8e;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;
  --font-sans:  'DM Sans', system-ui, sans-serif;
  --radius:     6px;
  --radius-lg:  10px;
}

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Typography ─────────────────────────────────────── */
h1, h2, h3 { font-weight: 600; }
.mono { font-family: var(--font-mono); }

/* ── Layout ─────────────────────────────────────────── */
.app-header {
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-header .logo {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.app-header .subtitle {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.app-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Panel / Card ───────────────────────────────────── */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header h2 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.panel-body { padding: 20px; }

/* ── Upload Zone ────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-zone .upload-icon {
  font-size: 32px;
  margin-bottom: 12px;
  color: var(--text-dim);
}
.upload-zone .upload-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.upload-zone .upload-hint {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.upload-zone.has-file {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-dim);
}
.upload-zone.has-file .upload-label { color: var(--accent); }

.upload-progress {
  margin-top: 12px;
  display: none;
}
.upload-progress.visible { display: block; }
.progress-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.2s;
  width: 0%;
}
.progress-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* ── Overlay Editor ─────────────────────────────────── */
.overlay-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.overlay-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}
.overlay-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.overlay-item-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 120px;
}
.field-group label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.field-group input,
.field-group select {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.field-group input:focus,
.field-group select:focus {
  border-color: var(--accent);
}
.field-group input[type="number"] {
  font-family: var(--font-mono);
}
.field-group select option {
  background: var(--bg-panel);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  color: #0f0f10;
  border-color: var(--accent);
}
.btn-primary:hover { background: #d4eb3f; border-color: #d4eb3f; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); border-color: #3a3a44; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
  padding: 4px 8px;
}
.btn-danger:hover { background: rgba(255, 77, 77, 0.1); }

.btn-add {
  width: 100%;
  justify-content: center;
  border-style: dashed;
  color: var(--text-dim);
  border-color: var(--border);
  background: transparent;
  padding: 10px;
}
.btn-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ── Credits Form ───────────────────────────────────── */
.credits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.credits-zusatz-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.zusatz-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.zusatz-row input { flex: 1; }

/* ── AI Suggestions ─────────────────────────────────── */
#section-ai { display: none; }
#section-ai.visible { display: block; }

.ai-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.ai-card.accepted { border-color: var(--success); opacity: 0.5; }
.ai-card.rejected { opacity: 0.3; }
.ai-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai-card-time {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}
.ai-card-context {
  font-size: 12px;
  color: var(--text-dim);
}
.ai-card-actions { display: flex; gap: 8px; }

/* ── Render / Status ────────────────────────────────── */
.render-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#btn-render {
  align-self: flex-start;
  padding: 12px 32px;
  font-size: 14px;
}

.status-block {
  display: none;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  gap: 10px;
  flex-direction: column;
}
.status-block.visible { display: flex; }

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.status-phase {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.status-phase.error { color: var(--danger); }
.status-pct {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}
.status-detail {
  font-size: 11px;
  color: var(--text-dim);
  min-height: 14px;
  transition: opacity 0.2s;
}

.download-block {
  display: none;
}
.download-block.visible { display: flex; gap: 12px; align-items: center; }

/* ── Overlay type badge ─────────────────────────────── */
.type-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--bg-hover);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* ── Renders List ───────────────────────────────────── */
.renders-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 8px 0;
}

.render-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.render-row:last-child { border-bottom: none; }

.render-row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.render-row-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.render-row-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.render-row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn-download-sm {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(232, 255, 87, 0.3);
  padding: 6px 12px;
  font-size: 11px;
}
.btn-download-sm:hover { background: var(--accent); color: #0f0f10; }

.btn-delete-sm {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 11px;
}
.btn-delete-sm:hover { color: var(--danger); border-color: var(--danger); background: rgba(255,77,77,0.08); }

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a44; }
