/* ==========================================================================
   NexoraAI — Theme tokens
   ========================================================================== */
:root {
  --accent: #6C5CE7;
  --accent-hover: #5B4BD1;
  --accent-soft: rgba(108, 92, 231, 0.14);
  --danger: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 268px;
  --header-height: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* Darker dark theme — closer to ChatGPT / Claude's near-black surfaces. */
html[data-theme="dark"] {
  --bg-primary: #171717;
  --bg-secondary: #0f0f0f;
  --bg-tertiary: #232323;
  --bg-hover: #1f1f1f;
  --bg-input: #1f1f1f;
  --text-primary: #ececec;
  --text-secondary: #b0b0b0;
  --text-tertiary: #7a7a7a;
  --border-color: #262626;
  --border-soft: rgba(255, 255, 255, 0.08);
  --bubble-user: #262626;
  --code-bg: #0d0d0d;
  --code-header: #1a1a1a;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

html[data-theme="light"] {
  --bg-primary: #FAF9F5;
  --bg-secondary: #F4F3EE;
  --bg-tertiary: #ECEBE4;
  --bg-hover: #ECEBE4;
  --bg-input: #FFFFFF;
  --text-primary: #2D2A26;
  --text-secondary: #73716C;
  --text-tertiary: #A3A099;
  --border-color: #E5E3DB;
  --border-soft: rgba(0, 0, 0, 0.06);
  --bubble-user: #F0EEE6;
  --code-bg: #F4F3EE;
  --code-header: #ECEBE4;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 16px;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

button {
  font-family: inherit;
  cursor: pointer;
}

textarea {
  font-family: inherit;
}

/* ==========================================================================
   Layout
   ========================================================================== */
.app {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  transition: transform 0.25s ease, width 0.25s ease;
  z-index: 40;
}

.sidebar.collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar-top {
  display: flex;
  align-items: center;
  padding: 6px 6px 12px;
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  padding: 4px;
}

.logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #9B8CFF);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 14.5px;
  font-weight: 500;
  margin: 4px 4px 12px;
  transition: background 0.15s ease;
}

.new-chat-btn:hover {
  background: var(--bg-hover);
}

/* "Pinned" / "Recent" labels — bumped up from 11px so they're readable. */
.sidebar-section-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  padding: 6px 10px;
}

.conversation-list .sidebar-section-label:first-child {
  margin-top: 0;
}

.conversation-list .sidebar-section-label {
  margin-top: 10px;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 2px;
}

.conversation-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, color 0.15s ease;
}

.conversation-item span.conv-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.conversation-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  cursor: pointer;
}

.conversation-item.active {
  background: var(--accent-soft);
  color: var(--text-primary);
}

.conv-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.conversation-item:hover .conv-actions,
.conversation-item.pinned .conv-actions {
  opacity: 1;
}

.conv-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.conv-action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.conv-action-btn.active {
  color: var(--accent);
}

.conv-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.conversation-empty {
  color: var(--text-tertiary);
  font-size: 14px;
  padding: 10px;
}

.sidebar-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  margin-top: 6px;
}

/* "Light mode / Dark mode" toggle text — bumped up from 13.5px. */
.sidebar-footer-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
}

.sidebar-footer-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 30;
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  position: relative;
}

.chat-header {
  height: var(--header-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid transparent;
}

.chat-header-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: none;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}

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

.mobile-only { display: none; }

/* Model selector — now lives inside the composer on the right side, next to
   the mic/send buttons (like Claude's picker: plain text + chevron, no
   pill background). */
.model-select {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  padding: 0 20px 0 8px;
  height: 34px;
  border-radius: var(--radius-sm);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  flex-shrink: 0;
  max-width: 170px;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none'><path d='M6 9l6 6 6-6' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 4px center;
}

.model-select:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.model-select:focus {
  outline: none;
}

/* ---------- Chat window ---------- */
.chat-window {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.welcome-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #9B8CFF);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 18px;
}

.welcome-screen h1 {
  font-size: 30px;
  margin: 0 0 6px;
  font-weight: 600;
}

.welcome-sub {
  color: var(--text-secondary);
  margin: 0 0 28px;
  font-size: 16px;
}

.suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.suggestion-card {
  text-align: left;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.suggestion-card:hover {
  background: var(--bg-hover);
}

.suggestion-card strong { font-size: 14.5px; font-weight: 600; }
.suggestion-card span { font-size: 13.5px; color: var(--text-secondary); }

.messages {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ---------- Message bubbles ---------- */
.message-row {
  display: flex;
  gap: 14px;
  padding: 18px 4px;
  align-items: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #D4A27F);
}

.message-row.user .avatar {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  order: 2;
}

.message-content-wrap {
  max-width: 82%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message-row.user .message-content-wrap {
  align-items: flex-end;
}

.message-bubble {
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text-primary);
  word-wrap: break-word;
}

.message-row.user .message-bubble {
  background: var(--bubble-user);
  padding: 10px 14px;
  border-radius: var(--radius-lg);
}

.message-bubble p { margin: 0 0 12px; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { margin: 0 0 12px; padding-left: 22px; }
.message-bubble li { margin-bottom: 4px; }
.message-bubble a { color: var(--accent); }
.message-bubble h1, .message-bubble h2, .message-bubble h3 {
  margin: 16px 0 8px;
  font-weight: 600;
}
.message-bubble blockquote {
  border-left: 3px solid var(--border-color);
  margin: 0 0 12px;
  padding-left: 12px;
  color: var(--text-secondary);
}
.message-bubble table {
  border-collapse: collapse;
  margin-bottom: 12px;
  width: 100%;
  font-size: 14.5px;
}
.message-bubble th, .message-bubble td {
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  text-align: left;
}
.message-bubble code {
  font-family: var(--mono);
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 14px;
}

/* Attached-file chips shown above a sent message (e.g. an uploaded PDF). */
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.message-attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}

.message-attachment-chip svg {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.message-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.message-row:hover .message-actions { opacity: 1; }

.msg-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 12.5px;
  padding: 5px 7px;
  border-radius: 6px;
}

.msg-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ---------- Code blocks ---------- */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin: 0 0 14px;
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--code-header);
  padding: 7px 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-family: var(--mono);
}

.code-copy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  padding: 3px 7px;
  border-radius: 5px;
}

.code-copy-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.code-block pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
}

.code-block code {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  background: none;
  padding: 0;
  color: var(--text-primary);
}

/* minimal syntax highlight palette */
.hljs-keyword, .hljs-selector-tag, .hljs-literal { color: #c678dd; }
.hljs-string, .hljs-attr { color: #98c379; }
.hljs-number { color: #d19a66; }
.hljs-comment { color: var(--text-tertiary); font-style: italic; }
.hljs-title, .hljs-function_ { color: #61afef; }
.hljs-built_in, .hljs-type { color: #e5c07b; }

/* ---------- Typing indicator ---------- */
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 6px 0;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: blink 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

/* ==========================================================================
   Input area
   ========================================================================== */
.input-area {
  flex-shrink: 0;
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.input-shell {
  width: 100%;
  max-width: 780px;
}

.attachment-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
}

.attachment-chip .remove-chip {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 14px;
  line-height: 1;
}

.attachment-chip.uploading { color: var(--text-secondary); }
.attachment-chip.error { border-color: var(--danger); color: var(--danger); }

.input-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 26px;
  padding: 6px 8px 6px 10px;
  box-shadow: var(--shadow);
}

.message-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 16.5px;
  resize: none;
  max-height: 200px;
  padding: 9px 4px;
  line-height: 1.4;
  align-self: center;
}

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

.send-btn, .stop-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, opacity 0.15s ease;
}

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

.send-btn:disabled {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.stop-btn { background: var(--text-primary); color: var(--bg-primary); }

.disclaimer {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin: 10px 0 0;
  text-align: center;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Per-message model badge (Claude-style attribution line)
   ========================================================================== */
.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.message-meta .assistant-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.model-tag {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: 0.01em;
}

/* ==========================================================================
   Sidebar user profile / auth menu
   ========================================================================== */
.profile-section {
  position: relative;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  margin-top: 6px;
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 8px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-align: left;
}

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

.profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #9B8CFF);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.profile-name {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-email {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 6px;
  right: 6px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
}

.profile-menu.open { display: flex; }

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  background: none;
  border: none;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  text-align: left;
}

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

.profile-menu-item.danger {
  color: var(--danger);
}

/* ==========================================================================
   Auth pages (login / signup)
   ========================================================================== */
.auth-body {
  height: 100%;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  background: var(--bg-primary);
}

.auth-theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  text-align: center;
  box-shadow: var(--shadow);
}

.auth-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #9B8CFF);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
}

.auth-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--text-primary);
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 26px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 14.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-group input:focus {
  border-color: var(--accent);
}

.form-group input::placeholder {
  color: var(--text-tertiary);
}

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  font-size: 13.5px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
}

.auth-submit-btn {
  position: relative;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 4px;
  transition: background 0.15s ease, opacity 0.15s ease;
}

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

.auth-submit-btn:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.btn-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.auth-switch {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 22px 0 0;
}

.auth-switch a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar.collapsed { width: var(--sidebar-width); }
  .sidebar-overlay.show { display: block; }
  .mobile-only { display: flex; }
  .suggestions { grid-template-columns: 1fr; }
  .message-content-wrap { max-width: 92%; }
  .model-select { max-width: 110px; font-size: 12.5px; }
}

/* ==========================================================================
   Share modal
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-sub {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0 0 16px;
}

.share-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.share-link-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  min-width: 0;
}

.share-copy-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
  flex-shrink: 0;
}

.share-copy-btn:hover {
  background: var(--accent-hover);
}

.modal-danger-btn {
  width: 100%;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 14px;
  font-weight: 500;
}

.modal-danger-btn:hover {
  background: rgba(239, 68, 68, 0.08);
}

/* ==========================================================================
   Public share page
   ========================================================================== */
.share-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.share-header .brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 15px;
}

.share-banner {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 8px;
}


/* ==========================================================================
   Voice input (mic button)
   ========================================================================== */
.mic-btn {
  position: relative;
}

.mic-btn.recording {
  color: #fff;
  background: var(--danger);
}

.mic-btn.recording:hover {
  background: var(--danger);
}

.mic-btn.recording::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--danger);
  animation: mic-pulse 1.4s ease-out infinite;
}

@keyframes mic-pulse {
  0% { transform: scale(0.85); opacity: 0.9; }
  70% { transform: scale(1.6); opacity: 0; }
  100% { opacity: 0; }
}

/* ==========================================================================
   Voice output (read-aloud button on assistant messages)
   ========================================================================== */
.msg-action-btn.speaking {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ==========================================================================
   Drag & drop file upload overlay
   ========================================================================== */
.chat-window {
  position: relative;
}

.drop-overlay {
  display: none;
  position: absolute;
  inset: 10px;
  background: var(--accent-soft);
  backdrop-filter: blur(2px);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
}

.drop-overlay.show {
  display: flex;
}

.drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
}