/* ── Chat section wrapper ────────────────────────────────────── */
.chat-section {
  background: var(--chat-bg, var(--accent-bg));
  border: 1px solid var(--chat-border, var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Chat header ─────────────────────────────────────────────── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--chat-header-bg, var(--muted));
  color: var(--header-text);
}

.chat-header-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.chat-header-text { flex: 1; }

.chat-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--header-text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* "Peptide-Specialized" trust badge in the chat header */
.chat-specialty-badge {
  display: inline-flex;
  align-items: center;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 20px;
  padding: 2px 9px;
  color: rgba(255,255,255,.95);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-subtitle {
  font-size: .78rem;
  color: rgba(255,255,255,.68);
  margin-top: 4px;
  line-height: 1.45;
}

/* ── Per-module chat header accent colors ─────────────────────── */
.chat-section[data-module="peptides"] .chat-header {
  background: var(--peptide-chat-header-bg, #2a4e7a);
}
.chat-section[data-module="supplements"] .chat-header {
  background: var(--supp-chat-header-bg, #3d6648);
}
.chat-section[data-module="beauty"] .chat-header {
  background: var(--beauty-chat-header-bg, #7a4a58);
}

.chat-clear-btn {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.85);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}

.chat-clear-btn:hover { background: rgba(255,255,255,.25); }

/* ── Suggestions ─────────────────────────────────────────────── */
.chat-suggestions {
  padding: 12px 16px 8px;
}

.suggestions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.suggestion-btn {
  background: var(--chat-bg, var(--accent-bg));
  border: 1.5px solid var(--chat-border, var(--border));
  color: var(--brand-dark);
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .15s, border-color .15s;
  line-height: 1.35;
}

.suggestion-btn:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

@media (max-width: 600px) {
  .chat-suggestions { padding: 10px 12px 6px; }
  .suggestion-btn   { font-size: .76rem; padding: 5px 11px; }
}

/* ── Messages area ───────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 120px;
  max-height: 420px;
}

.chat-messages:empty { display: none; }

/* Message bubbles */
.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 88%;
  animation: fadeSlideIn .2s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg-assistant .msg-avatar {
  background: var(--brand-light);
  border: 1px solid var(--border);
}

.msg-user .msg-avatar {
  background: var(--brand);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
}

.msg-bubble {
  padding: 11px 15px;
  border-radius: 14px;
  font-size: .9rem;
  line-height: 1.65;
  word-break: break-word;
}

.msg-assistant .msg-bubble {
  background: var(--bg);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
  color: var(--text);
}

.msg-user .msg-bubble {
  background: var(--brand);
  color: #fff;
  border-top-right-radius: 4px;
}

/* Peptide action buttons inside messages */
.peptide-action-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.peptide-view-btn {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 7px 15px;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.peptide-view-btn:hover { filter: brightness(1.12); }
.peptide-view-btn::after { content: " →"; }

/* Typing indicator */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-top-left-radius: 4px;
}

.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Input row ───────────────────────────────────────────────── */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .92rem;
  background: var(--input-bg);
  color: var(--text);
  resize: none;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.5;
  overflow-y: auto;
}

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

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

.chat-send-btn {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  height: 44px;
  transition: filter .15s, opacity .15s;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) { filter: brightness(1.1); }
.chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }

.chat-input-hint {
  font-size: .73rem;
  color: var(--muted);
  margin-top: 6px;
}

/* ── AI disclaimer ───────────────────────────────────────────── */
.chat-ai-disclaimer {
  padding: 8px 20px 12px;
  font-size: .73rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* ── Section divider ─────────────────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 22px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.section-divider::before,
.section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Error message ───────────────────────────────────────────── */
.msg-error .msg-bubble {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .msg { max-width: 95%; }
  .suggestions-grid .suggestion-btn { font-size: .78rem; }
  .chat-messages { max-height: 300px; }
}
