/* Promptheus Ember — Chat-UI Styles */
/* Dark theme, Ember/Glut-Farben (Amber/Fire, Hue 35-55) */

:root {
  --bg: #0d0b09;
  --bg-surface: #1a1612;
  --bg-elevated: #231e18;
  --bg-hover: #2d261e;
  --border: #3d3228;
  --border-light: #4a3d30;
  --text: #e8ddd0;
  --text-muted: #9a8b7a;
  --text-dim: #6b5e50;
  --ember: #e8913a;
  --ember-glow: #f4a54a;
  --ember-dim: #c47028;
  --ember-bg: rgba(232, 145, 58, 0.08);
  --success: #5cb85c;
  --error: #d9534f;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Header --- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--ember);
  letter-spacing: -0.3px;
}

.logo span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 14px;
  margin-left: 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-light);
}

.btn-ember {
  background: var(--ember-dim);
  color: #fff;
  border-color: var(--ember);
}

.btn-ember:hover {
  background: var(--ember);
}

/* --- Sidebar (Conversations) --- */

.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.sidebar-header h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.conv-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s ease;
}

.conv-item:hover {
  background: var(--bg-hover);
}

.conv-item.active {
  background: var(--ember-bg);
  border: 1px solid rgba(232, 145, 58, 0.2);
}

.conv-item .conv-preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item .conv-date {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* --- Chat Area --- */

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
}

.message-user {
  align-self: flex-end;
  background: var(--ember-dim);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message-assistant {
  align-self: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.message-assistant p {
  margin-bottom: 8px;
}

.message-assistant p:last-child {
  margin-bottom: 0;
}

.message-assistant code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.message-assistant pre {
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid var(--border);
}

.message-assistant pre code {
  background: none;
  padding: 0;
}

/* Tool indicators */
.tool-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--ember-bg);
  border: 1px solid rgba(232, 145, 58, 0.15);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--ember-glow);
  margin: 4px 0;
  align-self: flex-start;
}

.tool-indicator .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(232, 145, 58, 0.3);
  border-top-color: var(--ember);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.tool-indicator.done {
  color: var(--success);
  border-color: rgba(92, 184, 92, 0.15);
  background: rgba(92, 184, 92, 0.05);
}

.tool-indicator.done .spinner {
  display: none;
}

.tool-indicator.done::before {
  content: '✓';
  font-size: 14px;
}

/* Diff display */
.diff-block {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  border: 1px solid var(--border);
  background: var(--bg);
}

.diff-block .diff-remove {
  color: var(--error);
  text-decoration: line-through;
  opacity: 0.7;
}

.diff-block .diff-add {
  color: var(--success);
}

/* Preview link */
.preview-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--ember-bg);
  border: 1px solid var(--ember-dim);
  border-radius: var(--radius-sm);
  color: var(--ember-glow);
  text-decoration: none;
  font-size: 13px;
  margin: 8px 0;
  transition: all 0.15s ease;
}

.preview-link:hover {
  background: rgba(232, 145, 58, 0.15);
  border-color: var(--ember);
}

/* Welcome state */
.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.welcome h2 {
  font-size: 24px;
  color: var(--ember);
  margin-bottom: 8px;
  font-weight: 600;
}

.welcome p {
  font-size: 14px;
  max-width: 400px;
  line-height: 1.6;
}

.welcome .suggestions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.welcome .suggestion {
  padding: 10px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.welcome .suggestion:hover {
  background: var(--bg-hover);
  border-color: var(--ember-dim);
}

/* --- Input Area --- */

.input-area {
  padding: 16px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.input-row textarea {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  resize: none;
  min-height: 42px;
  max-height: 150px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-row textarea:focus {
  border-color: var(--ember-dim);
}

.input-row textarea::placeholder {
  color: var(--text-dim);
}

.send-btn {
  padding: 10px 20px;
  background: var(--ember);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.send-btn:hover {
  background: var(--ember-glow);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- Login Screen --- */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  flex-direction: column;
  gap: 20px;
}

.login-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 360px;
  text-align: center;
}

.login-box h1 {
  font-size: 22px;
  color: var(--ember);
  margin-bottom: 4px;
}

.login-box p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-box input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
}

.login-box input:focus {
  border-color: var(--ember-dim);
}

.login-box .login-btn {
  width: 100%;
  padding: 10px;
  background: var(--ember);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.login-box .login-btn:hover {
  background: var(--ember-glow);
}

.login-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 8px;
  display: none;
}

/* --- Scrollbar --- */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* --- Responsive --- */

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .messages {
    padding: 12px 16px;
  }

  .message {
    max-width: 90%;
  }

  .input-area {
    padding: 12px 16px;
  }
}
