/* scholar-chat.css — "Ask the Scholar" AI chat widget styles */

.sc-root {
  --sc-accent: #4a6da7;
  --sc-accent-dark: #3a5a8f;
  --sc-bg: #ffffff;
  --sc-fg: #222;
  --sc-border: #d9dee7;
  --sc-user-bg: #4a6da7;
  --sc-ai-bg: #f1f4f9;
  position: fixed;
  z-index: 99990;
  bottom: 0;
  right: 0;
  font-family: "Segoe UI", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 14px;
  color: var(--sc-fg);
}

/* Floating action button */
.sc-fab {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--sc-accent);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}
.sc-fab:hover { background: var(--sc-accent-dark); transform: scale(1.06); }

/* Panel */
.sc-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  max-width: calc(100vw - 28px);
  height: 540px;
  max-height: calc(100vh - 40px);
  background: var(--sc-bg);
  border: 1px solid var(--sc-border);
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.sc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--sc-accent);
  color: #fff;
}
.sc-title { font-weight: 600; flex: 1; font-size: 14px; }
.sc-modes { display: flex; gap: 4px; }
.sc-mode {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #fff;
  border-radius: 12px;
  padding: 3px 9px;
  font-size: 12px;
  cursor: pointer;
}
.sc-mode-on { background: #fff; color: var(--sc-accent); font-weight: 600; }
.sc-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

/* Messages */
.sc-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fafbfd;
}
.sc-msg {
  max-width: 88%;
  padding: 8px 11px;
  border-radius: 10px;
  line-height: 1.5;
  word-break: break-word;
  white-space: normal;
}
.sc-msg-user {
  align-self: flex-end;
  background: var(--sc-user-bg);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.sc-msg-ai {
  align-self: flex-start;
  background: var(--sc-ai-bg);
  border-bottom-left-radius: 3px;
}
.sc-msg-status {
  align-self: center;
  background: transparent;
  color: #777;
  font-size: 12px;
  font-style: italic;
  padding: 2px 6px;
}
.sc-msg-meta {
  align-self: center;
  background: transparent;
  color: #999;
  font-size: 11px;
  padding: 0 6px;
}

/* Deep-mode research trail */
.sc-msg-steps {
  align-self: stretch;
  max-width: 100%;
  background: #eef2f8;
  border: 1px dashed var(--sc-border);
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  color: #445;
}
.sc-steps-title {
  font-weight: 700;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 11px;
  color: #667;
  margin-bottom: 3px;
}
.sc-step { padding: 1px 0; overflow-wrap: anywhere; }
.sc-step-err { color: #a55; }

/* Citations like [馬唐納_] */
.sc-cite { color: var(--sc-accent-dark); font-weight: 600; }

.sc-hint { color: #888; font-size: 12px; }

/* Input row */
.sc-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--sc-border);
  background: var(--sc-bg);
}
.sc-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--sc-border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  outline: none;
  max-height: 110px;
}
.sc-input:focus { border-color: var(--sc-accent); }
.sc-send {
  border: none;
  background: var(--sc-accent);
  color: #fff;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
}
.sc-send:disabled { opacity: 0.6; cursor: default; }
.sc-send:hover:not(:disabled) { background: var(--sc-accent-dark); }

/* Small screens: full-width sheet */
@media (max-width: 480px) {
  .sc-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 8px;
    height: 70vh;
  }
}
