/* Kanvas.ai — chat UI (white minimal + black) */

:root {
  --bg: #FFFFFF;
  --bg-alt: #F5F5F5;
  --ink: #1A1A1A;
  --ink-muted: #6B7280;
  --ink-dim: #9CA3AF;
  --border: #E5E5E5;
  --accent: #000000;
  --accent-hover: #333333;
}

/* ── 3-pane layout ─────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Left pane ─────────────────────────────────────────────── */
.left-pane {
  width: 280px;
  min-width: 280px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow-y: auto;
}

.new-chat-btn {
  width: 100%;
  padding: 8px 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.new-chat-btn:hover { background: var(--accent-hover); }

.section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
  padding: 12px 12px 4px;
  margin: 0;
}

.history-section { flex: 0 0 auto; max-height: 200px; overflow-y: auto; }
.session-list { display: flex; flex-direction: column; }
.session-item {
  display: block;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ink-muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 4px;
  margin: 0 4px;
}
.session-item:hover { background: var(--bg-alt); color: var(--ink); }
.session-item.active { background: var(--bg-alt); color: var(--ink); font-weight: 500; }

.agents-section { flex: 1; overflow-y: auto; }
.cat-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 12px;
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.cat-header:hover { background: var(--bg-alt); }
.cat-icon { font-size: 14px; }
.cat-agents { display: none; padding-left: 8px; }
.cat-agents.open { display: block; }
.agent-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 12px;
  background: none;
  border: none;
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
  text-align: left;
}
.agent-item:hover { background: var(--bg-alt); color: var(--ink); }
.agent-icon { font-size: 12px; }

.workspace-section {
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.workspace-link {
  font-size: 12px;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 4px 0;
}
.workspace-link:hover { color: var(--ink); }

.auth-section {
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  margin-top: auto;
}

/* ── Center pane ───────────────────────────────────────────── */
.center-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 48px;
}
.chat-header-left { display: flex; align-items: center; gap: 8px; }
.chat-header-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.chat-header-dot { color: var(--ink-dim); }
.chat-header-agent { font-size: 12px; color: var(--ink-muted); }
.chat-header-actions { display: flex; gap: 4px; }
.header-action-btn {
  padding: 4px 10px;
  font-size: 11px;
  color: var(--ink-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}
.header-action-btn:hover { background: var(--bg-alt); color: var(--ink); }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink);
}

/* ── Messages ──────────────────────────────────────────────── */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.welcome-hero {
  text-align: center;
  padding: 48px 16px;
}

.sample-cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}
.sample-card {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  max-width: 280px;
  text-align: left;
}
.sample-card:hover { border-color: var(--ink); color: var(--ink); }

.msg { margin-bottom: 16px; max-width: 720px; }
.msg-user { margin-left: auto; }
.msg-assistant { margin-right: auto; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-user .msg-bubble {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}
.msg-assistant .msg-bubble {
  background: var(--bg-alt);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

.msg-agent {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}
.msg-agent-icon { font-size: 12px; color: var(--ink-dim); }
.msg-agent-label { font-size: 11px; color: var(--ink-muted); font-weight: 500; }

.tool-log {
  margin-top: 4px;
  padding: 4px 0;
}
.tool-step {
  font-size: 11px;
  color: var(--ink-dim);
  font-family: 'JetBrains Mono', monospace;
  padding: 1px 0;
}
.tool-name { font-weight: 500; color: var(--ink-muted); }
.tool-args { color: var(--ink-dim); }

/* ── Thinking indicator ────────────────────────────────────── */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  color: var(--ink-muted);
}
.thinking-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-dim);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.thinking-indicator .secs { color: var(--ink-dim); }

/* ── Chat form ─────────────────────────────────────────────── */
.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border);
}
.chat-form textarea {
  flex: 1;
  resize: none;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  min-height: 42px;
  max-height: 240px;
  outline: none;
}
.chat-form textarea:focus { border-color: var(--ink); }

.send-btn {
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
}
.send-btn:hover { background: var(--accent-hover); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Right pane ────────────────────────────────────────────── */
.right-pane {
  width: 0;
  overflow: hidden;
  transition: width 0.2s ease;
  border-left: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.right-pane.open { width: 420px; min-width: 420px; }

.artifact-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.artifact-title { font-size: 14px; font-weight: 600; margin: 0; }
.artifact-subtitle { font-size: 11px; color: var(--ink-muted); }

.artifact-empty {
  padding: 32px 16px;
  text-align: center;
}

.artifact-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.artifact-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}
.artifact-card .meta {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 4px;
}
.artifact-card h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
}

.artifact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.artifact-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  font-size: 11px;
  color: var(--ink-muted);
}
.artifact-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}
.artifact-table tr:hover { background: var(--bg-alt); }

.table-toolbar {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}
.table-action-btn {
  padding: 3px 8px;
  font-size: 10px;
  color: var(--ink-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
}
.table-action-btn:hover { color: var(--ink); }

/* ── Overlays ──────────────────────────────────────────────── */
.signin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.signin-overlay.visible { display: flex; }

.left-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  z-index: 40;
}
.left-overlay.visible { display: block; }

/* ── Analytics ─────────────────────────────────────────────── */
.analytics-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.analytics-sugg {
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
}
.analytics-sugg:hover { border-color: var(--ink); color: var(--ink); }

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .left-pane {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    z-index: 50;
    transition: left 0.2s ease;
  }
  .left-pane.open { left: 0; }
  .mobile-menu-btn { display: block; }
  .right-pane.open { width: 100%; min-width: 100%; position: fixed; top: 0; left: 0; z-index: 60; }
  .pane-closed .right-pane { width: 0; }
}
