/* ===== Altar of Grace — Site Assistant Chat Widget ===== */
#aoge-chat-launcher {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, #4A1A8E, #3B1F6E);
  box-shadow: 0 8px 24px rgba(59, 31, 110, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#aoge-chat-launcher:hover { transform: scale(1.06); box-shadow: 0 10px 28px rgba(59, 31, 110, 0.55); }
#aoge-chat-launcher .aoge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #E8C96A;
  border: 2px solid #fff;
}

#aoge-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 22px;
  z-index: 9999;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: calc(100vh - 140px);
  background: #F9F5FF;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(37, 14, 78, 0.35);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, sans-serif;
  border: 1px solid rgba(59,31,110,0.08);
}
#aoge-chat-panel.aoge-open { display: flex; }

#aoge-chat-header {
  background: linear-gradient(120deg, #3B1F6E, #5A3A9A);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#aoge-chat-header .aoge-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #E8C96A; color: #3B1F6E;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
#aoge-chat-header .aoge-title { font-weight: 700; font-size: 14.5px; line-height: 1.2; }
#aoge-chat-header .aoge-sub { font-size: 11.5px; opacity: 0.85; }
#aoge-chat-header .aoge-status { display:flex; align-items:center; gap:5px; }
#aoge-chat-header .aoge-status-dot { width:7px; height:7px; border-radius:50%; background:#5FE38C; }
#aoge-chat-close {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
#aoge-chat-close:hover { background: rgba(255,255,255,0.28); }

#aoge-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #F9F5FF;
}
.aoge-msg { max-width: 86%; font-size: 13.5px; line-height: 1.45; padding: 10px 12px; border-radius: 14px; white-space: pre-wrap; }
.aoge-msg-bot {
  align-self: flex-start;
  background: #fff;
  color: #2A1A47;
  border: 1px solid rgba(59,31,110,0.10);
  border-bottom-left-radius: 4px;
}
.aoge-msg-user {
  align-self: flex-end;
  background: #3B1F6E;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.aoge-msg a { color: #4A1A8E; font-weight: 600; }
.aoge-msg-bot a { color: #4A1A8E; }
.aoge-msg-user a { color: #E8C96A; }
.aoge-msg-source { display:block; margin-top:6px; font-size: 11px; color: #7A6A9A; }

.aoge-chip-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 12px; }
.aoge-chip {
  border: 1px solid rgba(59,31,110,0.25);
  background: #fff;
  color: #3B1F6E;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.aoge-chip:hover { background: #EFE6FF; }

.aoge-typing { display:flex; gap:4px; align-items:center; padding: 4px 2px; }
.aoge-typing span {
  width:6px; height:6px; border-radius:50%; background:#B7A6D9;
  animation: aoge-bounce 1s infinite ease-in-out;
}
.aoge-typing span:nth-child(2) { animation-delay: 0.15s; }
.aoge-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aoge-bounce { 0%,60%,100%{ transform: translateY(0); opacity:.5;} 30%{ transform: translateY(-4px); opacity:1;} }

#aoge-chat-inputbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid rgba(59,31,110,0.10);
  background: #fff;
}
#aoge-chat-input {
  flex: 1;
  border: 1px solid rgba(59,31,110,0.20);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 16px; /* keep at 16px+ so iOS Safari doesn't auto-zoom the page on focus */
  font-family: inherit;
  outline: none;
  color: #2A1A47;
}
#aoge-chat-input:focus { border-color: #5A3A9A; }
#aoge-chat-send {
  background: #3B1F6E;
  color: #fff;
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
  display:flex; align-items:center; justify-content:center;
}
#aoge-chat-send:hover { background: #4A1A8E; }
#aoge-chat-send:disabled { opacity: 0.5; cursor: default; }

/* Mobile: the site's own floating social-media icons anchor to the bottom
   right below 600px wide, so the assistant moves to the bottom LEFT here to
   avoid the two overlapping. Sizing uses --aoge-vh (kept in sync with the
   real visible viewport by chatbot.js) instead of raw vh, so the panel
   isn't cut off by the on-screen keyboard or mobile browser chrome. */
@media (max-width: 600px) {
  #aoge-chat-launcher {
    right: auto;
    left: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  #aoge-chat-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    height: auto;
    max-height: calc(var(--aoge-vh, 1vh) * 100 - 116px);
  }
  #aoge-chat-inputbar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
}
