/* ===== AI AGENT WIDGET ===== */
#ai-agent-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #0098dd);
  border: none;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 24px rgba(0,152,221,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: pulse-ring 2.5s ease-out infinite;
}
#ai-agent-btn:hover { transform: scale(1.1); box-shadow: 0 6px 32px rgba(0,152,221,0.6); }

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(0,152,221,0.5); }
  70%  { box-shadow: 0 0 0 14px rgba(0,152,221,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,152,221,0); }
}

#ai-agent-label {
  position: fixed;
  bottom: 94px;
  right: 28px;
  background: rgba(10,14,20,0.95);
  border: 1px solid rgba(0,152,221,0.3);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
  z-index: 9998;
  pointer-events: none;
  animation: fadeInLabel 0.5s ease 1.5s both;
}
@keyframes fadeInLabel {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

#ai-agent-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 360px;
  max-height: 520px;
  background: #0a0e14;
  border: 1px solid rgba(0,152,221,0.2);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  box-shadow: 0 16px 60px rgba(0,0,0,0.6);
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
#ai-agent-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.agent-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(124,58,237,0.3), rgba(0,152,221,0.2));
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #0098dd);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.agent-header-info { flex: 1; }
.agent-header-name { font-size: 0.88rem; font-weight: 700; color: #fff; }
.agent-header-status { font-size: 0.7rem; color: #10b981; display: flex; align-items: center; gap: 4px; }
.agent-header-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #10b981; display: inline-block; }
.agent-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  transition: color 0.2s;
}
.agent-close:hover { color: #fff; }

.agent-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: msgIn 0.3s ease both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.user { flex-direction: row-reverse; }

.msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
}
.msg.bot .msg-bubble {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.06);
  color: #e0e0e0;
  border-bottom-left-radius: 4px;
}
.msg.user .msg-bubble {
  background: linear-gradient(135deg, #7c3aed, #0098dd);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-bubble a {
  color: #6ee7ff;
  text-decoration: underline;
  font-weight: 600;
}
.msg-bubble a:hover { color: #0098dd; }

/* Quick replies */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}
.qr-btn {
  background: rgba(0,152,221,0.1);
  border: 1px solid rgba(0,152,221,0.3);
  color: #6ee7ff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.qr-btn:hover { background: rgba(0,152,221,0.25); border-color: #0098dd; }

/* Typing indicator */
.typing-indicator .msg-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
}
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  animation: typingBounce 1s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Input */
.agent-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
#agent-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
#agent-input:focus { border-color: rgba(0,152,221,0.5); }
#agent-input::placeholder { color: rgba(255,255,255,0.3); }
#agent-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #0098dd);
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
#agent-send:hover { opacity: 0.85; }

@media (max-width: 480px) {
  #ai-agent-window { width: calc(100vw - 32px); right: 16px; bottom: 90px; }
  #ai-agent-btn { bottom: 20px; right: 16px; }
  #ai-agent-label { right: 16px; bottom: 86px; }
}

/* ===== BACK TO PORTFOLIO BUTTON (inside page header) ===== */
.agent-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(10,14,20,0.7);
  border: 1px solid rgba(106,227,255,0.35);
  color: #6ae3ff !important;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none !important;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 12px;
}
.agent-back-btn:hover {
  background: rgba(106,227,255,0.12);
  border-color: #6ae3ff;
}
