/* =========================================
   HamroCampus AI Chatbot Widget
   Uses the theme's existing CSS variables
   (--color-primary, --color-secondary, etc.)
   so it auto-matches light/dark mode.
========================================= */

#hc-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-primary, #1D4ED8);
  color: var(--color-text-on-primary, #fff);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  transition: transform .2s ease;
}
#hc-chat-launcher:hover { transform: scale(1.07); }
#hc-chat-launcher svg { width: 28px; height: 28px; }

/* Auto greeting bubble */
#hc-chat-bubble {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 99999;
  max-width: 240px;
  background: var(--color-card, #fff);
  color: var(--color-text-primary, #1E293B);
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: 14px 14px 4px 14px;
  padding: 12px 14px;
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  animation: hc-pop .35s ease;
  cursor: pointer;
}
#hc-chat-bubble .hc-close-bubble {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--color-text-secondary, #64748B);
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
@keyframes hc-pop {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Chat window */
#hc-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 99999;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: var(--color-bg, #F8FAFC);
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
}
#hc-chat-window.hc-open { display: flex; }

#hc-chat-header {
  background: var(--color-primary, #1D4ED8);
  color: var(--color-text-on-primary, #fff);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
}
#hc-chat-header .hc-header-sub {
  font-weight: 400;
  font-size: 12px;
  opacity: 0.85;
}
#hc-chat-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

#hc-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hc-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  word-wrap: break-word;
}
.hc-msg a { color: inherit; text-decoration: underline; font-weight: 600; }
.hc-msg-bot {
  align-self: flex-start;
  background: var(--color-card, #fff);
  color: var(--color-text-primary, #1E293B);
  border: 1px solid var(--color-border, #E2E8F0);
  border-bottom-left-radius: 4px;
}
.hc-msg-user {
  align-self: flex-end;
  background: var(--color-primary, #1D4ED8);
  color: var(--color-text-on-primary, #fff);
  border-bottom-right-radius: 4px;
}
.hc-msg-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--color-card, #fff);
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.hc-msg-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-text-secondary, #94A3B8);
  animation: hc-blink 1.1s infinite ease-in-out;
}
.hc-msg-typing span:nth-child(2) { animation-delay: .15s; }
.hc-msg-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes hc-blink { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }

#hc-chat-footer {
  border-top: 1px solid var(--color-border, #E2E8F0);
  padding: 10px;
  display: flex;
  gap: 8px;
  background: var(--color-card, #fff);
}
#hc-chat-input {
  flex: 1;
  border: 1px solid var(--color-border, #E2E8F0);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
  background: var(--color-bg, #F8FAFC);
  color: var(--color-text-primary, #1E293B);
}
#hc-chat-input:focus { border-color: var(--color-border-focus, #3B82F6); }
#hc-chat-send {
  background: var(--color-primary, #1D4ED8);
  color: var(--color-text-on-primary, #fff);
  border: none;
  border-radius: 10px;
  width: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#hc-chat-send:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 480px) {
  #hc-chat-window { right: 16px; bottom: 88px; width: calc(100vw - 32px); }
  #hc-chat-launcher { right: 16px; bottom: 16px; }
  #hc-chat-bubble { right: 16px; }
}
