/* ── AI CHAT WIDGET ── */
.chat-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--chat-accent, #10a37f); border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(16,163,127,0.4);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.chat-fab:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(16,163,127,0.6); }
.chat-fab svg { width: 22px; height: 22px; fill: white; }
@keyframes chat-sparkle {
  0%,100% { box-shadow: 0 4px 16px rgba(16,163,127,0.4); }
  50% { box-shadow: 0 0 24px rgba(16,163,127,0.8), 0 0 48px rgba(16,163,127,0.3); }
}
.chat-fab.sparkle { animation: chat-sparkle 1.5s ease-in-out; }

#ai-chat-popup {
  position: fixed; bottom: 84px; right: 24px; z-index: 1001;
  width: 400px; max-height: 460px;
  background: rgba(10,10,11,0.95); backdrop-filter: blur(12px);
  border: 1px solid rgba(16,163,127,0.3); border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 40px rgba(16,163,127,0.1);
  display: flex; flex-direction: column;
  font-family: var(--mono);
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  opacity: 1; transform: translateY(0);
}
#ai-chat-popup.hidden {
  opacity: 0; transform: translateY(20px); pointer-events: none;
}
.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(16,163,127,0.2);
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(0,0,0,0.3); border-radius: 12px 12px 0 0;
}
.chat-header h3 {
  font-size: 13px; font-weight: 500; color: var(--chat-accent, #10a37f);
  font-family: var(--mono); letter-spacing: 0.5px;
}
.chat-header h3::before { content: '> '; opacity: 0.5; }
.chat-close {
  background: none; border: none; color: rgba(255,255,255,0.5);
  cursor: pointer; font-size: 18px; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: all 0.2s;
}
.chat-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  max-height: 300px; font-size: 13px; line-height: 1.5;
}
.chat-message {
  margin-bottom: 10px; padding: 10px 12px; border-radius: 6px;
  font-size: 13px; color: rgba(255,255,255,0.9);
}
.chat-message.user {
  background: rgba(16,163,127,0.25); border-left: 2px solid var(--chat-accent, #10a37f); margin-left: 20px;
}
.chat-message.assistant {
  background: rgba(255,255,255,0.05); border-left: 2px solid rgba(255,255,255,0.2); margin-right: 20px;
}
.chat-message.assistant a { color: var(--chat-accent, #10a37f); text-decoration: none; }
.chat-message.assistant a:hover { text-decoration: underline; }
.chat-message.assistant strong { color: #fff; }
.chat-message.assistant code {
  background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; font-size: 12px;
}
.chat-message.assistant ul, .chat-message.assistant ol { margin: 6px 0; padding-left: 20px; }
.chat-message.assistant li { margin: 3px 0; }
.chat-input-area {
  padding: 12px 16px; border-top: 1px solid rgba(16,163,127,0.2);
  display: flex; gap: 8px; background: rgba(0,0,0,0.2); border-radius: 0 0 12px 12px;
}
.chat-input-area input {
  flex: 1; padding: 10px 12px;
  background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; color: rgba(255,255,255,0.9);
  font-size: 13px; font-family: var(--mono);
}
.chat-input-area input::placeholder { color: rgba(255,255,255,0.3); }
.chat-input-area input:focus {
  outline: none; border-color: rgba(16,163,127,0.5);
  box-shadow: 0 0 0 2px rgba(16,163,127,0.1);
}
.chat-input-area button {
  padding: 10px 14px; background: rgba(16,163,127,0.8);
  border: none; border-radius: 6px; color: white; cursor: pointer;
  font-size: 12px; font-family: var(--mono); font-weight: 500; transition: all 0.2s;
}
.chat-input-area button:hover { background: var(--chat-accent, #10a37f); }

@media (max-width: 480px) {
  #ai-chat-popup { width: calc(100vw - 32px); right: 16px; }
}
