/* Dashboard-like chat UI */

:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --border: #e4e6eb;
  --text: #1c1e21;
  --text-muted: #65676b;
  --accent: #1877f2;
  --accent-hover: #166fe5;
  --user-bubble: #1877f2;
  --assistant-bubble: #e4e6eb;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header – dashboard-style bar */
.header {
  background: var(--surface);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.logo {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Main chat area */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 1rem;
}

.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 0.5rem;
}

.welcome {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.welcome p {
  margin: 0 0 0.75rem;
}

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

.welcome .hint {
  font-size: 0.9rem;
}

.welcome code {
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.85em;
}

/* Message bubbles – ChatGPT style */
.msg {
  display: flex;
  gap: 0.75rem;
  max-width: 85%;
  align-self: flex-start;
}

.msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--assistant-bubble);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.msg.user .msg-avatar {
  background: var(--user-bubble);
  color: #fff;
}

.msg-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  min-width: 120px;
}

.msg.user .msg-content {
  background: var(--user-bubble);
  color: #fff;
  border-color: var(--user-bubble);
}

.msg-content p {
  margin: 0 0 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-content p:last-child {
  margin-bottom: 0;
}

.msg-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.msg.user .msg-meta {
  color: rgba(255, 255, 255, 0.85);
}

/* Streaming / thinking block */
.msg-thinking,
.msg-tools {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.msg.user .msg-thinking,
.msg.user .msg-tools {
  border-top-color: rgba(255, 255, 255, 0.3);
}

.msg-thinking-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}

.msg-thinking-inner {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}

.tool-call {
  font-size: 0.8rem;
  background: var(--bg);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  border-left: 3px solid var(--accent);
}

.tool-call:last-child {
  margin-bottom: 0;
}

.tool-name {
  font-weight: 600;
  color: var(--accent);
}

.tool-output {
  margin-top: 0.25rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
}

/* Input area – dashboard card style */
.input-area {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 0.75rem;
}

.form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.input {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
}

.input::placeholder {
  color: var(--text-muted);
}

.submit {
  flex-shrink: 0;
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.submit:hover:not(:disabled) {
  background: var(--accent-hover);
}

.submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Loading state */
.msg.loading .msg-content {
  color: var(--text-muted);
}

.typing-dots::after {
  content: "";
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: "."; }
  40% { content: ".."; }
  60%, 100% { content: "..."; }
}

/* Login screen – symmetric card, aligned buttons */
.login-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  min-height: 280px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 2rem 2.5rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.login-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 600;
}

.login-hint {
  margin: 0 0 1.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}

.login-buttons > div {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.login-buttons > div iframe,
.login-buttons > div > div {
  width: 100% !important;
  min-width: 100%;
}

.btn-linkedin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 1.25rem;
  background: #0a66c2;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.15s;
  box-sizing: border-box;
}

.btn-linkedin:hover {
  background: #004182;
}

.login-error {
  margin: 1rem 0 0;
  color: #b32d2e;
  font-size: 0.9rem;
  text-align: center;
}

.login-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* User bar in header */
.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.user-bar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.logout-btn {
  padding: 0.35rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-muted);
}

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