/* ============================================================
   HEBERT PROFESSIONAL SERVICES - Chatbot Widget Styles
   Uses the site's existing CSS variables (--primary, --accent,
   fonts) so the widget matches the rest of the site.
   ============================================================ */

.hps-chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1200;
  font-family: 'Montserrat', sans-serif;
}

/* ---------- Launcher pill ---------- */
.hps-chat-bubble {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 50px;
  padding: 0 22px;
  border-radius: 26px;
  border: none;
  background: var(--primary, #0B3A75);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(11, 58, 117, 0.35);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, background 0.2s ease;
}

.hps-chat-bubble:hover {
  background: var(--accent, #1E5DAA);
  transform: translateY(-2px);
}

.hps-chat-bubble svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hps-chat-bubble-label {
  line-height: 1;
}

/* Hide the bubble while the panel is open. */
.hps-chatbot.is-open .hps-chat-bubble {
  display: none;
}

/* ---------- Panel ---------- */
.hps-chat-panel {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 12px 40px rgba(11, 58, 117, 0.28), 0 0 0 1px rgba(11, 58, 117, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
}

/* The panel is only shown (and animates open) when the widget is open. */
.hps-chatbot.is-open .hps-chat-panel {
  display: flex;
  animation: hps-chat-grow 0.22s ease;
}

/* The panel grows up and out of the launcher pill each time it opens. */
@keyframes hps-chat-grow {
  from {
    opacity: 0;
    transform: scale(0.55) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hps-chat-panel {
    animation: none;
  }
}

.hps-chat-header {
  background: var(--primary, #0B3A75);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hps-chat-title strong {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
}

.hps-chat-title span {
  display: block;
  font-size: 0.7rem;
  opacity: 0.8;
}

.hps-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.85;
}

.hps-chat-close:hover {
  opacity: 1;
}

/* ---------- Messages ---------- */
.hps-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f5f7fa;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hps-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.hps-msg-bot {
  align-self: flex-start;
  background: #fff;
  color: var(--text-dark, #4A4A4A);
  border: 1px solid #e3e8ef;
  border-bottom-left-radius: 4px;
}

.hps-msg-user {
  align-self: flex-end;
  background: var(--primary, #0B3A75);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ---------- Controls ---------- */
.hps-chat-controls {
  border-top: 1px solid #e3e8ef;
  padding: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.hps-choice {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--accent, #1E5DAA);
  background: #fff;
  color: var(--primary, #0B3A75);
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  font-family: inherit;
}

.hps-choice:hover {
  background: var(--accent, #1E5DAA);
  color: #fff;
}

.hps-submit {
  background: var(--primary, #0B3A75);
  color: #fff;
  text-align: center;
}

.hps-submit:hover {
  background: var(--accent, #1E5DAA);
}

/* ---------- Lead form ---------- */
.hps-lead-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hps-lead-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c7d0db;
  border-radius: 8px;
  font-size: 0.86rem;
  font-family: inherit;
  color: var(--text-dark, #4A4A4A);
}

.hps-lead-input:focus {
  outline: none;
  border-color: var(--accent, #1E5DAA);
  box-shadow: 0 0 0 3px rgba(30, 93, 170, 0.12);
}

.hps-lead-feedback {
  font-size: 0.74rem;
  color: #c0392b;
  min-height: 0;
}

.hps-lead-feedback:empty {
  display: none;
}

.hps-lead-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.hps-lead-next {
  width: auto;
  flex: 1 1 auto;
  text-align: center;
}

.hps-mini {
  padding: 8px 12px;
  border: 1px solid #c7d0db;
  background: #fff;
  color: var(--text-mid, #7A7A7A);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s ease;
}

.hps-mini:hover {
  background: #eef2f7;
}

.hps-cancel {
  color: #c0392b;
  border-color: #e7b9b4;
}

.hps-cancel:hover {
  background: #fdf3f3;
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .hps-chatbot {
    bottom: 16px;
    right: 16px;
  }

  .hps-chat-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 32px);
    max-height: calc(100vh - 32px);
  }
}
