/**
 * TaijiFlow AI - Chatbot Styles
 */

/* Chat Toggle Button */
#chat-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  z-index: 9999;
  transition: all 0.3s ease;
}

#chat-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(139, 92, 246, 0.6);
}

/* Chat Container */
#chat-container {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  height: 500px;
  background: #1a1a2e;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

#chat-container.hidden {
  display: none;
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  padding: 15px 20px;
  color: white;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header button {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.chat-header button:hover {
  opacity: 1;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-welcome {
  background: rgba(139, 92, 246, 0.1);
  border-radius: 12px;
  padding: 15px;
  font-size: 14px;
  color: #e0e0e0;
  line-height: 1.6;
}

.chat-welcome p {
  margin: 0 0 10px 0;
}

.chat-welcome ul {
  margin: 0;
  padding-left: 20px;
}

.chat-welcome li {
  margin: 5px 0;
}

/* Chat Message Bubbles */
.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.bot {
  align-self: flex-start;
  background: #2d2d44;
  color: #e0e0e0;
  border-bottom-left-radius: 4px;
}

.chat-message.system {
  align-self: center;
  background: rgba(255, 193, 7, 0.1);
  color: #ffc107;
  font-size: 13px;
  padding: 8px 12px;
}

/* Chat Input Area */
.chat-input-area {
  padding: 15px;
  background: #16162a;
  display: flex;
  gap: 10px;
  border-top: 1px solid rgba(139, 92, 246, 0.2);
}

.chat-input-area input {
  flex: 1;
  padding: 12px 15px;
  border-radius: 25px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  background: #1a1a2e;
  color: white;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-area input:focus {
  border-color: #8b5cf6;
}

.chat-input-area input::placeholder {
  color: #6b6b8d;
}

.chat-input-area button {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s;
}

.chat-input-area button:hover {
  transform: scale(1.05);
}

/* API Setup */
.chat-api-setup {
  padding: 15px;
  background: rgba(255, 193, 7, 0.1);
  border-top: 1px solid rgba(255, 193, 7, 0.3);
  text-align: center;
}

.chat-api-setup.hidden {
  display: none;
}

.chat-api-setup p {
  margin: 0 0 10px 0;
  color: #ffc107;
  font-size: 13px;
}

.chat-api-setup input {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 193, 7, 0.3);
  background: #1a1a2e;
  color: white;
  font-size: 13px;
  margin-bottom: 10px;
}

.chat-api-setup button {
  padding: 8px 20px;
  border-radius: 20px;
  background: #ffc107;
  border: none;
  color: #1a1a2e;
  font-weight: bold;
  cursor: pointer;
  margin-right: 10px;
}

.chat-api-setup a {
  color: #8b5cf6;
  font-size: 12px;
  text-decoration: none;
}

.chat-api-setup a:hover {
  text-decoration: underline;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 3px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  #chat-container {
    width: calc(100% - 20px);
    right: 10px;
    bottom: 80px;
    height: 60vh;
  }

  #chat-toggle-btn {
    width: 50px;
    height: 50px;
    font-size: 24px;
    right: 15px;
    bottom: 15px;
  }
}

/* Light Mode Support */
body:not(.dark) #chat-container {
  background: #f8f8fc;
  border-color: rgba(139, 92, 246, 0.2);
}

body:not(.dark) .chat-messages {
  background: #f8f8fc;
}

body:not(.dark) .chat-welcome {
  background: rgba(139, 92, 246, 0.08);
  color: #333;
}

body:not(.dark) .chat-message.bot {
  background: #e8e8f0;
  color: #333;
}

body:not(.dark) .chat-input-area {
  background: #ebebf4;
}

body:not(.dark) .chat-input-area input {
  background: white;
  color: #333;
  border-color: #ddd;
}

body:not(.dark) .chat-input-area input::placeholder {
  color: #999;
}
