/* Warmes, gemuetliches Studio-Theme fuer das CrewAI-Buero */

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

:root {
  --bg: #241f1a;
  --panel: #2f2822;
  --panel-2: #3a322a;
  --line: #4a4038;
  --text: #efe6d8;
  --muted: #a89a86;
  --accent: #f5b942;
  --ok: #2ecc71;
  --warn: #f1c40f;
  --busy: #e67e22;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
  gap: 12px;
  padding: 12px;
}

/* ------------------------------------------------ Buehne (Canvas) */

#stage {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#topbar h1 {
  font-size: 18px;
  letter-spacing: 0.5px;
}

#status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
}

.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--muted);
}
.dot.ok   { background: var(--ok);   box-shadow: 0 0 8px var(--ok); }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.dot.busy { background: var(--busy); box-shadow: 0 0 8px var(--busy); animation: pulse 1.2s infinite; }

@keyframes pulse { 50% { opacity: 0.4; } }

#canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}

#office {
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 3 / 2;
  image-rendering: pixelated;
  border-radius: 6px;
}

#controls {
  display: flex;
  gap: 8px;
}

#theme-input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}
#theme-input:focus { outline: 1px solid var(--accent); }

#controls button {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
#start-btn {
  background: var(--accent);
  color: #2b2010;
}
#start-btn:hover { filter: brightness(1.1); }

#resume-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line) !important;
}
#resume-btn:hover:not(:disabled) { border-color: var(--accent) !important; color: var(--accent); }
#resume-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ------------------------------------------------ Seitenleiste */

#sidebar {
  flex: 0 0 330px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

#sidebar section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#sidebar section:nth-child(1) { flex: 0 0 auto; }
#sidebar section:nth-child(2) { flex: 1 1 auto; }
#sidebar section:nth-child(3) { flex: 0 1 220px; }

#sidebar h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Fortschritt */

#progress-bar {
  height: 8px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
}
#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #f5d98a);
  transition: width 0.6s ease;
}
#progress-label {
  font-size: 11px;
  color: var(--muted);
  margin: 6px 0 8px;
}

#task-list { list-style: none; }
#task-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 2px;
  font-size: 12.5px;
  color: var(--muted);
}
#task-list li .task-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
#task-list li.active { color: var(--text); }
#task-list li.active .task-dot { background: var(--busy); box-shadow: 0 0 6px var(--busy); animation: pulse 1.2s infinite; }
#task-list li.done .task-dot { background: var(--ok); border-color: var(--ok); }
#task-list li.done .task-label { text-decoration: line-through; opacity: 0.75; }
#task-list .task-label { flex: 1; }
#task-list .task-agent { font-size: 11px; }

/* Log */

#log {
  flex: 1;
  overflow-y: auto;
  font-family: "SF Mono", "Courier New", monospace;
  font-size: 11.5px;
  line-height: 1.5;
  min-height: 0;
}
.log-entry {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.04);
}
.log-time { color: var(--muted); flex: 0 0 auto; font-size: 10px; }
.log-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; align-self: center; }

/* Artefakte */

#artifact-list {
  list-style: none;
  overflow-y: auto;
  min-height: 0;
}
#artifact-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
}
#artifact-list li:hover { background: var(--panel-2); }
#artifact-list li.empty { color: var(--muted); cursor: default; font-style: italic; }
#artifact-list li.empty:hover { background: none; }
#artifact-list .art-label { flex: 1; }
#artifact-list .art-file { color: var(--muted); font-size: 10.5px; font-family: monospace; }

/* ------------------------------------------------ Modal */

#modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 50;
  padding: 5vh 5vw;
}
#modal.open { display: block; }

#modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}

.mini-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}
.mini-btn:hover { border-color: var(--accent); }

#modal-body {
  flex: 1;
  overflow: auto;
  padding: 14px;
  font-family: "SF Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: #ded4c2;
}

/* ------------------------------------------------ Schmalere Screens */

@media (max-width: 1100px) {
  #app { flex-direction: column; overflow-y: auto; }
  body { overflow: auto; }
  #sidebar { flex: 0 0 auto; }
  #sidebar section:nth-child(2) { flex: 0 0 auto; }
  #log { max-height: 180px; }
}
