/* AI Chatbot Styles */
.ai-chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-yellow, #ffd000);
  color: var(--color-black, #000);
  border: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.ai-chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(0,0,0,0.4);
}
.ai-chat-fab.active {
  background: var(--color-black, #000);
  color: var(--color-yellow, #ffd000);
}

.ai-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.2);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: aiSlideUp 0.3s ease;
}

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

.ai-chat-header {
  background: var(--color-black, #000);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-yellow, #ffd000);
  color: var(--color-black, #000);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.ai-status-dot {
  color: #4ade80;
  font-size: .72rem;
}
.ai-status-dot::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  margin-right: 4px;
}

.ai-header-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.15s;
}
.ai-header-btn:hover { background: rgba(255,255,255,0.2); }

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-chat-messages::-webkit-scrollbar { width: 5px; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: #d4d4d4; border-radius: 3px; }

.ai-msg { display: flex; gap: 8px; max-width: 90%; }
.ai-msg-user { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg-bot { align-self: flex-start; }

.ai-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-yellow, #ffd000);
  color: var(--color-black, #000);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}

.ai-msg-user .ai-msg-avatar {
  background: var(--color-black, #000);
  color: var(--color-yellow, #ffd000);
}

.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .87rem;
  line-height: 1.5;
  word-break: break-word;
}

.ai-msg-bot .ai-msg-bubble {
  background: #f5f5f5;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.ai-msg-user .ai-msg-bubble {
  background: var(--color-yellow, #ffd000);
  color: var(--color-black, #000);
  border-bottom-right-radius: 4px;
}

.ai-msg-bubble p { margin: 0 0 6px; }
.ai-msg-bubble p:last-child { margin-bottom: 0; }
.ai-msg-bubble ul, .ai-msg-bubble ol { margin: 4px 0; padding-left: 18px; }
.ai-msg-bubble li { margin-bottom: 2px; }
.ai-msg-bubble strong { font-weight: 600; }
.ai-msg-bubble code { background: rgba(0,0,0,0.08); padding: 1px 5px; border-radius: 3px; font-size: .82rem; }
.ai-msg-bubble a { color: var(--color-yellow, #ffd000); text-decoration: underline; font-weight: 500; }
.ai-msg-bot .ai-msg-bubble a { color: #000; }

.ai-msg-time {
  font-size: .68rem;
  color: #a3a3a3;
  margin-top: 4px;
  text-align: right;
}

.ai-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ai-quick-btn {
  background: #fff;
  border: 1px solid #e5e5e5;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .78rem;
  cursor: pointer;
  transition: all 0.15s;
  color: #333;
}
.ai-quick-btn:hover {
  background: var(--color-yellow, #ffd000);
  border-color: var(--color-yellow, #ffd000);
  color: #000;
}

.ai-chat-input {
  border-top: 1px solid #e5e5e5;
  padding: 12px 16px 8px;
  flex-shrink: 0;
  background: #fff;
}

.ai-input-wrap {
  display: flex;
  align-items: center;
  background: #f5f5f5;
  border-radius: 24px;
  padding: 4px 4px 4px 16px;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.ai-input-wrap:focus-within {
  border-color: var(--color-yellow, #ffd000);
  background: #fff;
}

.ai-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: .88rem;
  padding: 8px 0;
  color: #1a1a1a;
}

.ai-input-wrap button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--color-yellow, #ffd000);
  color: var(--color-black, #000);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.15s;
  flex-shrink: 0;
}
.ai-input-wrap button:disabled { opacity: 0.4; cursor: not-allowed; }
.ai-input-wrap button:not(:disabled):hover { background: var(--color-primary-700, #d4aa00); transform: scale(1.05); }

.ai-powered-by {
  text-align: center;
  font-size: .65rem;
  color: #a3a3a3;
  margin-top: 6px;
}

/* Typing indicator */
.ai-typing {
  display: flex;
  gap: 4px;
  padding: 8px 0;
  align-items: center;
}
.ai-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a3a3a3;
  animation: aiTypingPulse 1.4s ease-in-out infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes aiTypingPulse {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* History panel */
.ai-history-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  z-index: 2;
  display: flex;
  flex-direction: column;
}
.ai-history-list {
  flex: 1;
  overflow-y: auto;
}
.ai-history-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.1s;
  gap: 10px;
}
.ai-history-item:hover { background: #f9f9f9; }
.ai-history-item .mdi { color: var(--color-yellow, #ffd000); font-size: 1.2rem; }
.ai-history-item-title { flex: 1; font-size: .85rem; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-history-item-date { font-size: .7rem; color: #a3a3a3; white-space: nowrap; }

/* Mobile responsive */
@media (max-width: 480px) {
  .ai-chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .ai-chat-fab { bottom: 16px; right: 16px; width: 54px; height: 54px; }
}
