/* ============================================================
   Huberman Lab Support Chat — Styles
   Scoped under #chat-root for safe Webflow embedding.
   ============================================================ */

#chat-root *,
#chat-root *::before,
#chat-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---- Layout ---- */

#chat-root .chat-page {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  height: 100%;
  min-height: 480px;
  display: flex;
  flex-direction: column;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  color: #1a1a1a;
  line-height: 1.5;
}

/* ---- Header ---- */

#chat-root .chat-header {
  flex-shrink: 0;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eee;
  background: #fff;
}

#chat-root .chat-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

#chat-root .chat-header p {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: #666;
}

/* ---- Messages area ---- */

#chat-root .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ---- Message bubbles ---- */

#chat-root .message {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9375rem;
  line-height: 1.5;
  animation: hlc-fade-in 0.2s ease-out;
}

#chat-root .message.user {
  align-self: flex-end;
  background: #1a1a1a;
  color: #fff;
}

#chat-root .message.assistant {
  align-self: flex-start;
  background: #f0f0f0;
  color: #1a1a1a;
}

#chat-root .message .content {
  white-space: pre-wrap;
  word-break: break-word;
}

@keyframes hlc-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Sources ---- */

#chat-root .message .sources-toggle {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  color: #666;
  cursor: pointer;
  text-decoration: underline;
}

#chat-root .message .sources-body {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  font-size: 0.8125rem;
  color: #444;
}

/* ---- Typing / pulse indicator ---- */

#chat-root .typing-indicator {
  align-self: flex-start;
  max-width: 85%;
  padding: 0.875rem 1.25rem;
  border-radius: 12px;
  background: #f0f0f0;
  display: flex;
  gap: 6px;
  align-items: center;
  animation: hlc-fade-in 0.2s ease-out;
}

#chat-root .typing-indicator span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: hlc-pulse 1.4s ease-in-out infinite;
}

#chat-root .typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

#chat-root .typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes hlc-pulse {
  0%, 80%, 100% {
    transform: scale(0.5);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ---- Progress text ---- */

#chat-root .progress-indicator {
  align-self: flex-start;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: #666;
  font-style: italic;
}

/* ---- Input bar ---- */

#chat-root .chat-input-bar {
  flex-shrink: 0;
  padding: 1rem 1.25rem;
  border-top: 1px solid #eee;
  background: #fff;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

#chat-root .chat-input-bar input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  font-family: inherit;
  color: inherit;
  background: #fff;
}

#chat-root .chat-input-bar input:focus {
  border-color: #1a1a1a;
}

#chat-root .chat-input-bar input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

#chat-root .chat-input-bar button {
  padding: 0.75rem 1.25rem;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

#chat-root .chat-input-bar button:hover:not(:disabled) {
  background: #333;
}

#chat-root .chat-input-bar button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---- Error ---- */

#chat-root .error-message {
  align-self: flex-start;
  padding: 0.75rem 1rem;
  background: #fee;
  color: #c00;
  border-radius: 8px;
  font-size: 0.875rem;
}
