.ai-sidebar {
  position: fixed;
  right: -550px;
  top: 0;
  min-width: 300px;
  height: 100%;
  background-color: #f8f9fa;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
  transition: right 0.3s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  resize: horizontal;
  overflow: hidden;
}

.ai-sidebar.open {
  right: 0;
}

.ai-sidebar:not(.expanded) {
  width: 550px;
  max-width: 1024px;
}

.ai-sidebar.expanded {
  width: 80%;
  max-width: 100%;
}

.ai-sidebar .sidebar-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.ai-sidebar .tab-content,
.ai-sidebar .tab-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-sidebar .ai-chat-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 15px 20px 15px 20px;
}

.chat-message {
  padding: 10px;
  margin: 8px;
  border-radius: 8px;
  max-width: 85%;
  position: relative;
  display: flex;
}

.chat-message .content {
  padding: 5px;
  white-space: pre-wrap;
}

.chat-message.chatbot {
  background-color: #f0f2f5;
  align-self: flex-start;
  margin-right: auto;
}

.chat-message.user {
  background-color: #e3f2fd;
  align-self: flex-end;
  margin-left: auto;
  flex-direction: row-reverse;
}

.chat-message.chatbot .avatar {
  width: 20px;
  height: 20px;
}

.chat-message.chatbot .avatar {
  margin: 8px 8px 0 0;
}

.chat-message.user .avatar {
  margin: 8px 0 0 8px;
}

.chat-message h1,
.chat-message h2,
.chat-message h3,
.chat-message h4,
.chat-message p {
  margin: 0;
}

.chat-message h1 {
  font-size: 20px;
}

.chat-message h2 {
  font-size: 18px;
}

.chat-message h3 {
  font-size: 16px;
}

.chat-message h4 {
  font-size: 14px;
}

.chat-message ol,
.chat-message ul {
  margin-top: -3ex;
  margin-bottom: -1ex;
  padding-left: 28px;
}

.chat-message li {
  margin-bottom: -3ex;
}

.context-indicator {
  font-size: 11px;
  color: #666;
  padding: 4px 8px;
  border-radius: 10px;
  background-color: #f0f0f0;
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
}

.context-indicator i {
  margin-right: 4px;
  font-size: 12px;
}

.context-active {
  background-color: #e6f3e6;
  color: #2a7d2a;
}

.ai-thinking {
  font-style: italic;
  color: #666;
}

.ai-sidebar .ai-branding {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.ai-sidebar .ai-branding img {
  height: 24px;
  margin-right: 10px;
}

#ai-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 100%;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.05) 70%, transparent 100%);
  cursor: ew-resize;
  z-index: 1001;
  transition: background 0.2s ease;
}

.resize-handle:hover {
  background: linear-gradient(90deg, rgba(0, 123, 255, 0.3) 0%, rgba(0, 123, 255, 0.15) 70%, transparent 100%);
}

.resize-handle::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 50px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.resize-handle:hover::before {
  background: rgba(0, 123, 255, 0.7);
}

.ai-sidebar.resizing {
  border-left: 3px solid #007bff;
  box-shadow: -5px 0 15px rgba(0, 123, 255, 0.3), -2px 0 5px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
  .ai-sidebar {
    right: -320px;
    width: 320px;
    min-width: 280px;
  }
}

@media (max-width: 480px) {
  .ai-sidebar {
    right: -300px;
    width: 300px;
    min-width: 260px;
  }
}

/* Chat popup styles (signup) */
#chat-popup.signup {
  height: 450px;
  width: 330px;
  padding: 10px;
  background-color: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  border: 1px solid grey;
  display: none;
  position: fixed;
  bottom: 20px;
  right: 70px;
  z-index: 1000;
}

#chat-popup.signup.active {
  display: flex;
}

#chat-popup.signup div.input-group {
  margin-top: 3px;
}

#chat-toggle {
  height: 38px;
  width: 38px;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 500;
  background: rgba(241, 89, 42, 1);
  padding: 9px 8px;
  text-align: center;
  color: white;
  border-radius: 50%;
}