/**
 * ALI Docs Chatbot Widget Styles
 * Matches Aliunde brand colors (steel blue, amber)
 */

#ali-chatbot {
  --chat-primary: #1976A8;
  --chat-accent: #F5A623;
  --chat-bg: #ffffff;
  --chat-border: #e0e0e0;
  --chat-user-bg: #1976A8;
  --chat-bot-bg: #f5f5f5;
  font-family: 'Roboto', sans-serif;
}

/* Toggle button */
#ali-chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--chat-primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
  z-index: 1000;
}

#ali-chat-toggle:hover {
  background: #0D4A6F;
  transform: scale(1.05);
}

#ali-chat-toggle.hidden {
  display: none;
}

/* Chat panel */
#ali-chat-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 480px;
  max-height: calc(100vh - 100px);
  background: var(--chat-bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
}

#ali-chat-panel.open {
  display: flex;
}

/* Header */
#ali-chat-header {
  background: var(--chat-primary);
  color: white;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  font-size: 14px;
}

#ali-chat-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Mode toggle */
#ali-chat-mode-toggle {
  display: flex;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  overflow: hidden;
}

.ali-mode-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.ali-mode-btn:hover {
  color: white;
  background: rgba(255,255,255,0.1);
}

.ali-mode-btn.active {
  background: rgba(255,255,255,0.25);
  color: white;
  font-weight: 500;
}

#ali-chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.8;
}

#ali-chat-close:hover {
  opacity: 1;
}

/* Messages area */
#ali-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ali-chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  line-height: 1.4;
  font-size: 14px;
}

.ali-chat-message p {
  margin: 0;
}

.ali-chat-user {
  background: var(--chat-user-bg);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.ali-chat-bot {
  background: var(--chat-bot-bg);
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Sources */
.ali-chat-sources {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--chat-border);
  font-size: 12px;
}

.ali-chat-sources ul {
  margin: 4px 0 0 0;
  padding-left: 16px;
}

.ali-chat-sources a {
  color: var(--chat-primary);
  text-decoration: none;
}

.ali-chat-sources a:hover {
  text-decoration: underline;
}

/* Loading dots */
.ali-chat-dots {
  display: flex;
  gap: 4px;
}

.ali-chat-dots span {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: ali-chat-bounce 1.4s infinite ease-in-out both;
}

.ali-chat-dots span:nth-child(1) { animation-delay: -0.32s; }
.ali-chat-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes ali-chat-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input form */
#ali-chat-form {
  display: flex;
  padding: 12px;
  border-top: 1px solid var(--chat-border);
  gap: 8px;
}

#ali-chat-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--chat-border);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
}

#ali-chat-input:focus {
  border-color: var(--chat-primary);
}

#ali-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--chat-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#ali-chat-send:hover:not(:disabled) {
  background: var(--chat-accent);
}

#ali-chat-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Dark mode support */
[data-md-color-scheme="slate"] #ali-chatbot {
  --chat-bg: #2d2d2d;
  --chat-border: #404040;
  --chat-bot-bg: #3d3d3d;
}

[data-md-color-scheme="slate"] .ali-chat-bot {
  color: #e0e0e0;
}

[data-md-color-scheme="slate"] #ali-chat-input {
  background: #3d3d3d;
  color: #e0e0e0;
}
