/* ── AI Chat Widget ── */
.chat-fab {
  position:fixed; bottom:24px; right:24px; z-index:900;
  width:56px; height:56px; border-radius:50%;
  background:var(--red, #E54424); color:white; border:none;
  font-size:24px; cursor:pointer; display:flex;
  align-items:center; justify-content:center;
  box-shadow:0 4px 16px rgba(0,0,0,0.3);
  transition:all 0.2s;
}
.chat-fab:hover { transform:scale(1.08); box-shadow:0 6px 24px rgba(0,0,0,0.4); }
.chat-fab.hidden { display:none; }

.chat-panel {
  position:fixed; bottom:24px; right:24px; z-index:901;
  width:400px; max-width:calc(100vw - 32px);
  height:520px; max-height:calc(100vh - 48px);
  background:var(--surface, #242424); border:1px solid var(--border, rgba(255,255,255,0.1));
  border-radius:14px; display:none; flex-direction:column;
  box-shadow:0 8px 40px rgba(0,0,0,0.5);
  overflow:hidden;
}
.chat-panel.open { display:flex; animation:chatSlideUp 0.25s ease; }

.chat-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px; border-bottom:1px solid var(--border, rgba(255,255,255,0.1));
  flex-shrink:0;
}
.chat-title { font-family:'Syne',sans-serif; font-weight:700; font-size:14px; }
.chat-close {
  background:none; border:none; color:var(--text-muted, #9E9E9E);
  font-size:22px; cursor:pointer; line-height:1; padding:0 4px;
  transition:color 0.15s;
}
.chat-close:hover { color:var(--text, #F2F2F2); }

.chat-messages {
  flex:1; overflow-y:auto; padding:16px;
  display:flex; flex-direction:column; gap:12px;
}

.chat-msg { display:flex; }
.chat-msg.user { justify-content:flex-end; }
.chat-msg.bot { justify-content:flex-start; }

.chat-bubble {
  max-width:85%; padding:10px 14px; border-radius:12px;
  font-size:13px; line-height:1.6; word-break:break-word;
}
.chat-msg.user .chat-bubble {
  background:var(--red, #E54424); color:white;
  border-bottom-right-radius:4px;
}
.chat-msg.bot .chat-bubble {
  background:var(--surface2, #2E2E2E); color:var(--text, #F2F2F2);
  border-bottom-left-radius:4px;
}
.chat-bubble code {
  background:rgba(255,255,255,0.1); padding:1px 5px;
  border-radius:3px; font-family:'DM Mono',monospace; font-size:12px;
}
.chat-bubble strong { color:var(--red, #E54424); }

.chat-input-row {
  display:flex; gap:8px; padding:12px 16px;
  border-top:1px solid var(--border, rgba(255,255,255,0.1));
  flex-shrink:0;
}
.chat-input {
  flex:1; background:var(--surface2, #2E2E2E);
  border:1px solid var(--border, rgba(255,255,255,0.1));
  color:var(--text, #F2F2F2); font-family:'DM Sans',sans-serif;
  font-size:13px; padding:8px 12px; border-radius:8px; outline:none;
}
.chat-input:focus { border-color:rgba(229,68,36,0.5); }
.chat-input::placeholder { color:var(--text-muted, #9E9E9E); }
.chat-send {
  background:var(--red, #E54424); color:white; border:none;
  width:36px; height:36px; border-radius:8px; cursor:pointer;
  font-size:16px; display:flex; align-items:center; justify-content:center;
  transition:background 0.15s;
}
.chat-send:hover { background:#C43B1E; }

/* Loading dots */
.chat-loading { display:flex; gap:4px; padding:4px 0; }
.chat-loading span {
  width:6px; height:6px; border-radius:50%;
  background:var(--text-muted, #9E9E9E);
  animation:chatBounce 1.2s ease-in-out infinite;
}
.chat-loading span:nth-child(2) { animation-delay:0.15s; }
.chat-loading span:nth-child(3) { animation-delay:0.3s; }

@keyframes chatBounce {
  0%,80%,100% { transform:translateY(0); }
  40% { transform:translateY(-6px); }
}
@keyframes chatSlideUp {
  from { opacity:0; transform:translateY(16px); }
  to { opacity:1; transform:none; }
}

/* Responsive */
@media (max-width:500px) {
  .chat-panel { width:calc(100vw - 16px); right:8px; bottom:8px; height:calc(100vh - 16px); }
  .chat-fab { bottom:16px; right:16px; }
}

/* Print: hide chat */
@media print { .chat-fab, .chat-panel { display:none !important; } }
