/* Chatbot Design System */
:root {
  --chat-primary: #0072c6;
  --chat-bg: rgba(18, 18, 18, 0.95);
  --chat-text: #ffffff;
  --chat-bubble-user: #0072c6;
  --chat-bubble-bot: #2a2a2a;
  --chat-border: rgba(255, 255, 255, 0.1);
  --chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Floating Trigger Button */
.chatbot-trigger {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--chat-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--chat-shadow);
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: none;
}

.chatbot-trigger:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 15px 50px rgba(0, 114, 198, 0.4);
}

.chatbot-trigger svg {
  width: 28px;
  height: 28px;
  transition: transform 0.3s ease;
}

.chatbot-trigger.active svg {
  transform: rotate(90deg);
}

/* Chat Window */
.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 380px;
  height: 550px;
  background: var(--chat-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--chat-border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--chat-shadow);
  z-index: 9998;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  overflow: hidden;
}

.chatbot-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Chat Header */
.chatbot-header {
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-header .bot-avatar {
  width: 40px;
  height: 40px;
  background: var(--chat-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-header .bot-info h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: white;
}

.chatbot-header .bot-info span {
  font-size: 12px;
  color: #00ff88;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chatbot-header .bot-info span::before {
  content: '';
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  display: inline-block;
}

/* Messages Area */
.chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.5;
  animation: messageAppear 0.3s ease forwards;
}

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

.message.bot {
  align-self: flex-start;
  background: var(--chat-bubble-bot);
  color: white;
  border-bottom-left-radius: 2px;
}

.message.user {
  align-self: flex-end;
  background: var(--chat-bubble-user);
  color: white;
  border-bottom-right-radius: 2px;
}

.message.admin {
  align-self: flex-start;
  background: #1e3a6c; /* Elegant dark blue for admin takeover */
  color: white;
  border-bottom-left-radius: 2px;
  border-left: 4px solid var(--accent);
  position: relative;
  padding-top: 24px;
}

.message.admin .operator-badge {
  position: absolute;
  top: 4px;
  left: 12px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.05em;
  display: block;
}

/* Typing Indicator */
.typing {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
}

.typing span {
  width: 6px;
  height: 6px;
  background: rgba(255,255,255,0.5);
  border-radius: 50%;
  animation: typing 1s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Chat Input */
.chatbot-input-area {
  padding: 20px;
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid var(--chat-border);
  display: flex;
  gap: 10px;
}

.chatbot-input-area input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--chat-border);
  border-radius: 10px;
  padding: 10px 15px;
  color: white;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s ease;
}

.chatbot-input-area input:focus {
  border-color: var(--chat-primary);
}

.chatbot-input-area button {
  background: var(--chat-primary);
  color: white;
  border: none;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

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

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .chatbot-window {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .chatbot-trigger {
    bottom: 20px;
    right: 20px;
  }
}
