/* Layout des lokalen KI-Chats: Steuerung links, Chatverlauf rechts. */

/* hidden zuverlässig durchsetzen — .btn (display:inline-flex) würde das
   UA-[hidden] sonst überstimmen. */
[hidden] { display: none !important; }

.chatapp {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 16px;
  max-width: 1400px;
  margin: 0 auto;
}

.sidebar { display: flex; flex-direction: column; gap: 12px; }
.hint { font-size: 0.8rem; color: var(--text-dim); margin: 0; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field:last-child { margin-bottom: 0; }

select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
textarea { resize: vertical; }
select:focus, textarea:focus { outline: none; border-color: var(--accent); }

.status { font-size: 0.85rem; min-height: 1.4em; margin: 0; }
.status.working { color: var(--accent); }
.status.error { color: var(--danger); }
.status.ok { color: var(--accent-2); }

/* Fortschrittsbalken beim Modell-Download */
.progress { margin-top: 10px; }
.progress[hidden] { display: none; }
.progress .bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress .bar > div {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s;
}
.progress-text {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* Chatbereich */
.chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 57px - 32px);
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.empty-state { margin: auto; text-align: center; color: var(--text-dim); }
.empty-state p { margin: 0 0 6px; }

.msg { display: flex; }
.msg .bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.assistant .bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg.assistant .bubble .caret {
  display: inline-block;
  width: 7px;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--accent-2);
  animation: caret-blink 1s steps(2, start) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

/* Eingabe */
.composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.composer textarea {
  flex: 1;
  max-height: 160px;
  resize: none;
}
.composer .btn { align-self: stretch; }

@media (max-width: 1000px) {
  .chatapp { grid-template-columns: 1fr; }
  .chat { height: 70vh; }
}
