/* ===============================================
   LUCEM AI CHATBOT STYLES
   Floating chat widget with modern design
   =============================================== */

.chatbot-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--font-family-base);
}

/* ===== CHAT TOGGLE BUTTON ===== */
.chat-toggle-btn {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lucem-blue), var(--lucem-dark-blue));
  border: none;
  box-shadow: 0 8px 24px rgba(11, 111, 181, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(11, 111, 181, 0.5);
}

.chat-toggle-btn:active {
  transform: scale(0.95);
}

.chat-toggle-btn .chat-icon,
.chat-toggle-btn .close-icon {
  color: white;
  transition: all 0.3s ease;
}

.chat-toggle-btn .close-icon {
  position: absolute;
  opacity: 0;
  transform: rotate(90deg);
}

.chat-toggle-btn.active .chat-icon {
  opacity: 0;
  transform: rotate(-90deg);
}

.chat-toggle-btn.active .close-icon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Notification Dot */
.chat-notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 12px;
  height: 12px;
  background: var(--lucem-yellow);
  border: 2px solid white;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

/* ===== CHAT WINDOW ===== */
.chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-height: 600px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===== CHAT HEADER ===== */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--lucem-blue), var(--lucem-dark-blue));
  color: white;
  border-radius: 16px 16px 0 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-avatar svg {
  color: var(--lucem-yellow);
}

.chat-header-info strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

.chat-status {
  display: block;
  font-size: 12px;
  opacity: 0.9;
}

.chat-minimize {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-minimize:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ===== CHAT MESSAGES ===== */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 400px;
}

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

.chat-messages::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.chat-message {
  display: flex;
  gap: 12px;
  animation: fadeInUp 0.3s ease;
}

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

.bot-message {
  align-items: flex-start;
}

.user-message {
  justify-content: flex-end;
}

.message-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: var(--lucem-light-blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.message-avatar svg {
  width: 18px;
  height: 18px;
  color: var(--lucem-blue);
}

.message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 14px;
}

.bot-message .message-content {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.user-message .message-content {
  background: var(--lucem-blue);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-content p {
  margin: 0 0 8px 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.message-content li {
  margin: 4px 0;
}

/* ===== SUGGESTIONS ===== */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 16px;
}

.suggestion-btn {
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.suggestion-btn:hover {
  background: var(--lucem-light-blue);
  border-color: var(--lucem-blue);
  color: var(--lucem-blue);
  transform: translateY(-2px);
}

/* ===== TYPING INDICATOR ===== */
.chat-typing-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 12px 20px;
}

.chat-typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-10px); opacity: 1; }
}

/* ===== INPUT ===== */
.chat-input-container {
  border-top: 1px solid var(--border-light);
  background: var(--bg-primary);
  border-radius: 0 0 16px 16px;
}

.chat-input-form {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 8px;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s;
}

.chat-input:focus {
  border-color: var(--lucem-blue);
  box-shadow: 0 0 0 3px rgba(11, 111, 181, 0.1);
}

.chat-input::placeholder {
  color: var(--text-tertiary);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: var(--lucem-blue);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-send-btn:hover {
  background: var(--lucem-dark-blue);
  transform: scale(1.05);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-disclaimer {
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 0 16px 12px;
  margin: 0;
  line-height: 1.4;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .chatbot-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .chat-toggle-btn {
    position: absolute;
    right: 0;
  }

  .chat-window {
    width: 100%;
    max-height: 500px;
    bottom: 76px;
  }

  .message-content {
    max-width: 85%;
  }

  .chat-suggestions {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .chat-suggestions::-webkit-scrollbar {
    display: none;
  }
}

/* ===== DARK THEME ADJUSTMENTS ===== */
[data-theme="dark"] .chat-toggle-btn {
  box-shadow: 0 8px 24px rgba(11, 111, 181, 0.6);
}

[data-theme="dark"] .chat-window {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .message-avatar {
  background: rgba(93, 173, 226, 0.15);
}

/* ===== SLASH COMMAND CONTEXT MENU ===== */
.chat-command-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

.chat-command-menu.active {
  max-height: 350px;
  opacity: 1;
  overflow-y: auto;
}

.command-menu-header {
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.command-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) var(--spacing-lg);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.command-menu-item:last-child {
  border-bottom: none;
}

.command-menu-item:hover {
  background: var(--lucem-light-blue);
}

.command-menu-item:active {
  transform: scale(0.98);
}

.command-menu-item svg {
  flex-shrink: 0;
  color: var(--lucem-blue);
  transition: transform 0.2s;
}

.command-menu-item:hover svg {
  transform: scale(1.1);
}

.command-menu-item div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.command-menu-item strong {
  font-size: var(--font-size-base);
  color: var(--text-primary);
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

.command-menu-item span {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

[data-theme="dark"] .chat-command-menu {
  background: var(--bg-secondary);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .command-menu-header {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .command-menu-item:hover {
  background: rgba(93, 173, 226, 0.15);
}
