/* ===== CHAT SIDEBAR (desktop ≥1024px) ===== */
.chat-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.chat-widget {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  background: var(--accent);
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.chat-header-info strong { display: block; font-size: 0.95rem; }
.chat-header-info span { font-size: 0.75rem; opacity: 0.85; }

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

.chat-msg { max-width: 85%; padding: 0.6rem 0.9rem; border-radius: 12px; font-size: 0.9rem; line-height: 1.5; word-break: break-word; }
.chat-msg--bot { background: var(--accent-light); color: var(--text-primary); align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-msg--user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

.chat-typing { display: flex; gap: 4px; align-items: center; padding: 0.6rem 0.9rem; background: var(--accent-light); border-radius: 12px; border-bottom-left-radius: 4px; align-self: flex-start; }
.chat-typing span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: 0.4; animation: typing-bounce 1.2s infinite; }
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce { 0%, 60%, 100% { transform: none; opacity: 0.4; } 30% { transform: translateY(-6px); opacity: 1; } }

.chat-quick-replies { display: flex; flex-wrap: wrap; gap: 0.4rem; align-self: flex-start; max-width: 85%; }
.chat-quick-reply { background: none; border: 1px solid var(--accent); color: var(--accent); font-size: 0.8rem; padding: 0.3rem 0.7rem; border-radius: 16px; cursor: pointer; transition: background 0.15s; }
.chat-quick-reply:hover { background: var(--accent-light); }

.chat-input-area {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.chat-input-area textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  resize: none;
  font-family: inherit;
  outline: none;
}
.chat-input-area textarea:focus { border-color: var(--accent); }

.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
}
.chat-send:hover { background: var(--accent-hover); }

/* ===== MOBILE CHAT BUTTON ===== */
.chat-mobile-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 0.8rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(44,82,130,0.4);
  z-index: 200;
  white-space: nowrap;
}

/* ===== MOBILE CHAT OVERLAY ===== */
.chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-card);
  z-index: 300;
  flex-direction: column;
}
.chat-overlay.open { display: flex; }

.chat-overlay-header {
  background: var(--accent);
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.chat-overlay-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* ===== SUBSCRIBE BUTTONS (segment B/C) ===== */
.chat-subscribe-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0;
}
.chat-subscribe-btn {
  display: block;
  padding: 0.6rem 1rem;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.chat-subscribe-btn:hover { background: #d6e8ff; text-decoration: none; }

/* ===== RESPONSIVE VISIBILITY ===== */
@media (max-width: 1024px) {
  .chat-sidebar { display: none; }
  .chat-mobile-btn { display: block; }
}
