#hhf-chatbot-container {
  --hhf-primary: #203864;
  --hhf-primary-hover: #172849;
  --hhf-accent: #42B7A0;
  --hhf-accent-gold: #C86470;
  --hhf-bg-light: #f7f9fa;
  --hhf-surface: #ffffff;
  --hhf-text-main: #212529;
  --hhf-text-muted: #595959;
  --hhf-border: #e2e8f0;
  --hhf-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  --hhf-radius: 12px;
}

:where(#hhf-chatbot-container) * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  margin: 0;
  padding: 0;
}

#hhf-chatbot-trigger {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: auto;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--hhf-accent-gold);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: var(--hhf-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999990;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease;
}

#hhf-chatbot-trigger:hover,
#hhf-chatbot-trigger:focus-visible {
  background-color: #a94b57;
  transform: scale(1.06);
  outline: 3px solid var(--hhf-primary);
  outline-offset: 3px;
}

#hhf-chatbot-trigger svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

#hhf-chatbot-window {
  position: fixed;
  bottom: 96px;
  left: 24px;
  right: auto;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 120px);
  background-color: var(--hhf-surface);
  border: 1px solid var(--hhf-border);
  border-radius: var(--hhf-radius);
  box-shadow: var(--hhf-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999991;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

#hhf-chatbot-window.hhf-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

#hhf-chatbot-container .hhf-chat-header {
  background-color: var(--hhf-primary);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#hhf-chatbot-container .hhf-chat-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

#hhf-chatbot-container .hhf-chat-avatar {
  width: 36px;
  height: 36px;
  background-color: var(--hhf-accent);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

#hhf-chatbot-container .hhf-chat-title h2 {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
}

#hhf-chatbot-container .hhf-chat-title span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

#hhf-chatbot-container .hhf-chat-close-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#hhf-chatbot-container .hhf-chat-close-btn:focus-visible {
  outline: 2px solid var(--hhf-accent-gold);
}

#hhf-chatbot-container .hhf-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background-color: var(--hhf-bg-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#hhf-chatbot-container .hhf-msg-row {
  display: flex;
  flex-direction: column;
  max-width: 86%;
}

#hhf-chatbot-container .hhf-msg-row.hhf-bot {
  align-self: flex-start;
}

#hhf-chatbot-container .hhf-msg-row.hhf-user {
  align-self: flex-end;
}

#hhf-chatbot-container .hhf-msg-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--hhf-text-main);
  word-wrap: break-word;
}

#hhf-chatbot-container .hhf-msg-row.hhf-bot .hhf-msg-bubble {
  background-color: #ffffff;
  border: 1px solid var(--hhf-border);
  border-bottom-left-radius: 2px;
}

#hhf-chatbot-container .hhf-msg-row.hhf-user .hhf-msg-bubble {
  background-color: var(--hhf-accent);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

#hhf-chatbot-container .hhf-prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

#hhf-chatbot-container .hhf-chip-btn {
  background-color: #ffffff;
  border: 1px solid var(--hhf-accent);
  color: var(--hhf-accent);
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

#hhf-chatbot-container .hhf-chip-btn:hover,
#hhf-chatbot-container .hhf-chip-btn:focus-visible {
  background-color: var(--hhf-accent);
  color: #ffffff;
  outline: 2px solid var(--hhf-accent-gold);
}

#hhf-chatbot-container .hhf-course-card {
  margin-top: 10px;
  background-color: #ffffff;
  border: 1px solid var(--hhf-border);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#hhf-chatbot-container .hhf-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--hhf-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}

#hhf-chatbot-container .hhf-card-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  font-size: 12px;
  color: var(--hhf-text-muted);
  margin-bottom: 12px;
}

#hhf-chatbot-container .hhf-card-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--hhf-accent-gold);
  margin-top: 4px;
}

#hhf-chatbot-container .hhf-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#hhf-chatbot-container .hhf-btn-primary,
#hhf-chatbot-container .hhf-btn-secondary,
#hhf-chatbot-container .hhf-btn-enquire {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background-color 0.15s ease;
}

#hhf-chatbot-container .hhf-btn-primary { background-color: var(--hhf-primary); color: #ffffff; }
#hhf-chatbot-container .hhf-btn-primary:hover { background-color: var(--hhf-primary-hover); }

#hhf-chatbot-container .hhf-btn-secondary { background-color: var(--hhf-accent); color: #ffffff; }
#hhf-chatbot-container .hhf-btn-secondary:hover { background-color: #339782; }

#hhf-chatbot-container .hhf-btn-enquire { background-color: transparent; color: var(--hhf-primary); border: 1px solid var(--hhf-primary); }
#hhf-chatbot-container .hhf-btn-enquire:hover { background-color: rgba(32, 56, 100, 0.06); }

#hhf-chatbot-container .hhf-chat-input-bar {
  padding: 12px 16px;
  background-color: #ffffff;
  border-top: 1px solid var(--hhf-border);
  display: flex;
  gap: 8px;
  align-items: center;
}

#hhf-chatbot-container .hhf-chat-input {
  flex: 1;
  border: 1px solid var(--hhf-border);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--hhf-text-main);
  outline: none;
  transition: border-color 0.15s ease;
}

#hhf-chatbot-container .hhf-chat-input:focus {
  border-color: var(--hhf-accent);
}

#hhf-chatbot-container .hhf-chat-send-btn {
  background-color: var(--hhf-primary);
  color: #ffffff;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
}

#hhf-chatbot-container .hhf-chat-send-btn:hover:not(:disabled) { background-color: var(--hhf-primary-hover); }
#hhf-chatbot-container .hhf-chat-send-btn:disabled { background-color: #cbd5e1; cursor: not-allowed; }

#hhf-chatbot-container .hhf-typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 4px 8px;
}

#hhf-chatbot-container .hhf-typing-indicator span {
  width: 6px;
  height: 6px;
  background-color: var(--hhf-text-muted);
  border-radius: 50%;
  animation: hhfBounce 1.4s infinite ease-in-out both;
}

#hhf-chatbot-container .hhf-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
#hhf-chatbot-container .hhf-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes hhfBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

#hhf-chatbot-container .hhf-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(32, 56, 100, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#hhf-chatbot-container .hhf-modal-overlay.hhf-modal-open {
  opacity: 1;
  pointer-events: all;
}

#hhf-chatbot-container .hhf-lead-card {
  background: #ffffff;
  border-radius: 8px;
  width: 100%;
  max-height: 90%;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#hhf-chatbot-container .hhf-lead-card h3 { font-size: 16px; font-weight: 700; color: var(--hhf-primary); }
#hhf-chatbot-container .hhf-lead-field { display: flex; flex-direction: column; gap: 4px; }
#hhf-chatbot-container .hhf-lead-field label { font-size: 12px; font-weight: 600; color: var(--hhf-text-main); }
#hhf-chatbot-container .hhf-lead-field input, .hhf-lead-field textarea { border: 1px solid var(--hhf-border); border-radius: 6px; padding: 8px 12px; font-size: 13px; }
#hhf-chatbot-container .hhf-lead-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

@media (max-width: 480px) {
  #hhf-chatbot-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
}

#hhf-chatbot-container .hhf-msg-bubble { white-space: pre-wrap; }
#hhf-chatbot-container .hhf-visually-hidden, #hhf-chatbot-container .hhf-honeypot { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
#hhf-chatbot-container .hhf-chat-toolbar { display:flex; justify-content:space-between; padding:8px 12px; border-bottom:1px solid var(--hhf-border); }
#hhf-chatbot-container .hhf-chat-toolbar button { border:0; background:transparent; color:var(--hhf-primary); cursor:pointer; font-size:12px; padding:4px; }
#hhf-chatbot-container .hhf-card-image { width:100%; max-height:130px; object-fit:cover; border-radius:6px; margin-bottom:8px; }
#hhf-chatbot-container .hhf-card-summary { font-size:12px; line-height:1.5; margin-bottom:10px; }
#hhf-chatbot-container .hhf-consent { display:block; margin:10px 0; font-size:12px; line-height:1.5; }
#hhf-chatbot-container .hhf-consent input { margin-right:6px; }
#hhf-chatbot-container #hhf-lead-error { color:#a31525; font-size:12px; margin:8px 0; }
#hhf-chatbot-container button:focus-visible, #hhf-chatbot-container a:focus-visible { outline:2px solid var(--hhf-primary); outline-offset:2px; }
#hhf-chatbot-container .hhf-btn-secondary { color:#14294b; }
@media(prefers-reduced-motion:reduce) { #hhf-chatbot-container * { animation:none !important; transition:none !important; } }

/* Keep the message list scrollable and controls visible at every viewport size. */
#hhf-chatbot-container .hhf-chat-header,
#hhf-chatbot-container .hhf-chat-toolbar,
#hhf-chatbot-container .hhf-chat-input-bar { flex-shrink: 0; }
#hhf-chatbot-container .hhf-chat-messages { min-height: 0; min-width: 0; overscroll-behavior: contain; }
#hhf-chatbot-container .hhf-msg-row { flex-shrink: 0; min-width: 0; }
#hhf-chatbot-container .hhf-msg-row.hhf-bot { width: 100%; max-width: 100%; }
#hhf-chatbot-container .hhf-course-card { width: 100%; overflow-wrap: anywhere; }
#hhf-chatbot-container .hhf-chat-brand,
#hhf-chatbot-container .hhf-chat-title { min-width: 0; }
#hhf-chatbot-container .hhf-chat-avatar { flex-shrink: 0; overflow: hidden; }
#hhf-chatbot-container .hhf-chat-logo { width: 100%; height: 100%; object-fit: contain; background: white; }
#hhf-chatbot-container .hhf-chat-input { min-width: 0; }
#hhf-chatbot-container .hhf-chat-send-btn { flex-shrink: 0; }
#hhf-chatbot-container .hhf-card-actions > * { min-height: 40px; flex: 1 1 130px; text-align: center; white-space: normal; }
#hhf-chatbot-container .hhf-msg-row > .hhf-btn-secondary { margin-top: 12px; min-height: 40px; }
#hhf-chatbot-window { max-height: calc(100dvh - 120px); }
@media (max-width: 600px) {
  #hhf-chatbot-window { inset: 0; width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  #hhf-chatbot-container .hhf-chat-header { padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
  #hhf-chatbot-container .hhf-chat-input-bar { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  #hhf-chatbot-container .hhf-chat-input { font-size: 16px; }
}

#hhf-chatbot-container .hhf-selected-course { padding: 8px 12px; font-size: 12px; color: var(--hhf-primary); border-bottom: 1px solid var(--hhf-border); flex-shrink: 0; overflow-wrap: anywhere; max-height: 70px; overflow-y: auto; }
#hhf-chatbot-container .hhf-comparison-tray { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; max-height: 110px; overflow-y: auto; flex-shrink: 0; font-size: 12px; }
#hhf-chatbot-container .hhf-comparison-tray[hidden] { display: none; }
#hhf-chatbot-container .hhf-category-shortcuts { flex-shrink: 0; font-size: 14px; }
#hhf-chatbot-container .hhf-category-shortcuts summary { cursor: pointer; padding: 8px 0; color: var(--hhf-primary); }
#hhf-chatbot-container .hhf-comparison-wrap { overflow-x: auto; margin-top: 12px; max-width: 100%; border: 1px solid var(--hhf-border); border-radius: 6px; }
#hhf-chatbot-container .hhf-comparison-table { width: 100%; min-width: 520px; table-layout: fixed; border-collapse: collapse; font-size: 12px; background: white; }
#hhf-chatbot-container .hhf-comparison-table caption { text-align: left; padding: 10px; font-weight: 700; }
#hhf-chatbot-container .hhf-comparison-table th,
#hhf-chatbot-container .hhf-comparison-table td { padding: 10px; text-align: left; vertical-align: top; border: 1px solid var(--hhf-border); white-space: pre-wrap; overflow-wrap: anywhere; }
#hhf-chatbot-container .hhf-comparison-table th { background: var(--hhf-bg-light); color: var(--hhf-primary); }

#hhf-chatbot-container #hhf-chatbot-trigger { padding: 0; overflow: hidden; }
#hhf-chatbot-container .hhf-launcher-image { display: block; flex-shrink: 0; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; object-position: center; background: white; border: 0; border-radius: 50%; }
#hhf-chatbot-tooltip { position: fixed; left: 96px; bottom: 34px; max-width: calc(100vw - 112px); padding: 10px 12px; background: var(--hhf-primary); color: white; border-radius: 8px; font-size: 13px; line-height: 1.4; box-shadow: var(--hhf-shadow); z-index: 999992; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.15s ease; }
#hhf-chatbot-trigger:hover + #hhf-chatbot-tooltip,
#hhf-chatbot-trigger:focus-visible + #hhf-chatbot-tooltip { opacity: 1; visibility: visible; }
#hhf-chatbot-trigger[aria-expanded="true"] + #hhf-chatbot-tooltip { opacity: 0; visibility: hidden; }

#hhf-chatbot-container .hhf-comparison-difference td { background: #fff5df; border-left-color: #c8963e; }
#hhf-chatbot-container .hhf-comparison-note { font-size: 12px; line-height: 1.5; margin: 10px 0; }
