/* bbbchat.css */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Geist Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #f5f5f5;
  /* explicit base font size */
  font-size: 16px;
}

/* Chat Widget Button */
#chat-widget-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #854fff, #6b3fd4);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(133, 79, 255, 0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#chat-widget-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(133, 79, 255, 0.4);
}

/* Chat Widget Container */
#chat-widget-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 1001;
}

#chat-widget-container.active {
  display: flex;
}

/* Sidebar */
#chat-sidebar {
  width: 300px;
  background: #1a1a1a;
  color: white;
  display: flex;
  flex-direction: column;
  height: 100%;
}

#sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #333;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
}

#new-chat-btn {
  width: 100%;
  padding: 10px;
  background: #854fff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

#new-chat-btn:hover {
  background: #6b3fd4;
}

#chat-history {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.chat-history-section h3 {
  font-size: 14px;
  color: #888;
  margin-bottom: 10px;
}

.chat-item {
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 5px;
  font-size: 14px;
  transition: background 0.2s;
}

.chat-item:hover {
  background: #333;
}

.chat-item.active {
  background: #854fff;
}

#sidebar-footer {
  padding: 20px;
  border-top: 1px solid #333;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

/* Main Chat Area */
#chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  height: 100%;
}

/* Header */
#chat-header {
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title {
  font-size: 18px;
  font-weight: 600;
}

#close-chat {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
  padding: 5px;
}

#close-chat:hover {
  color: #333;
}

/* Messages wrapper */
.chat-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Scrollable messages */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Message bubbles */
.welcome-message,
.bot-message,
.user-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
}

.user-message {
  justify-content: flex-end;
}

.bot-avatar,
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.bot-avatar {
  background: #f0f0f0;
}

.user-avatar {
  background: #854fff;
  color: white;
}

/* Message content formatting */
.message-content {
  background: #f8f9fa;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: calc(100% - 50px);
  word-wrap: break-word;
  font-size: 1rem;
}

/* Paragraph spacing */
.message-content p {
  margin-top: 0;
  margin-bottom: 1em;
  line-height: 1.4;
}

/* Remove default list bullets */
.message-content ul,
.message-content ol {
  list-style: none;
  margin: 0 0 1em 0;
  padding-left: 0;
}

.user-message .message-content {
  background: #854fff;
  color: white;
}

/* Fixed input area */
#chat-input-area {
  padding: 20px;
  border-top: 1px solid #e0e0e0;
  background: white;
  display: flex;
  justify-content: center;
}

.input-container {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Input field */
#chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 25px;
  font-size: 1rem;
  outline: none;
  background: #f8f9fa;
  transition: border-color 0.3s;
}

#chat-input:focus {
  border-color: #854fff;
  background: white;
}

/* Dictation & file buttons */
#dictate-btn,
#upload-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

#dictate-btn:hover,
#upload-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Send button */
#send-btn {
  padding: 12px 20px;
  background: #854fff;
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.3s;
  white-space: nowrap;
}

#send-btn:hover {
  background: #6b3fd4;
}

/* Shared layout: align chat column & input bar */
.chat-content-wrapper,
.input-container {
  width: 66.6667%;
  margin-left: 16.66665%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #chat-sidebar {
    width: 250px;
  }
  .chat-content-wrapper,
  .input-container {
    width: 80%;
    margin-left: 10%;
  }
}

@media (max-width: 600px) {
  #chat-sidebar {
    display: none;
  }
  #chat-main {
    width: 100%;
  }
  .chat-content-wrapper,
  .input-container {
    width: 90%;
    margin-left: 5%;
  }
}

/* Clear spacing between any two block elements in a message */
.message-content > * + * {
  margin-top: 1em;
  margin-bottom: 1em;
}