/* Harris Prescott chat widget */
#hp-chat {
  --hp-dark: #1C1A22;
  --hp-mid: #494558;
  --hp-lavender: #B9B1CC;
  --hp-light: #EAE4FB;
  --hp-accent: #7B6FA0;
  --hp-white: #FFFFFF;
  font-family: 'Inter', system-ui, sans-serif;
}
#hp-chat [hidden] { display: none !important; }

.hp-chat-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--hp-light);
  color: var(--hp-dark);
  border: none;
  cursor: pointer;
  font-size: 24px;
  z-index: 9998;
  box-shadow: 0 8px 28px rgba(28, 26, 34, 0.35);
  transition: transform 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hp-chat-toggle:hover { background: var(--hp-lavender); transform: translateY(-2px); }
.hp-chat-toggle.is-open { background: var(--hp-dark); color: var(--hp-light); }

.hp-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--hp-dark);
  border: 1px solid rgba(185, 177, 204, 0.18);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  animation: hp-rise 0.22s ease;
}
@keyframes hp-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hp-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(185, 177, 204, 0.12);
  background: linear-gradient(180deg, rgba(123, 111, 160, 0.18) 0%, transparent 100%);
}
.hp-chat-header strong {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: var(--hp-white);
  display: block;
  margin-bottom: 2px;
}
.hp-chat-header span {
  font-size: 11px;
  letter-spacing: 1px;
  color: rgba(185, 177, 204, 0.65);
  text-transform: uppercase;
}
.hp-chat-close {
  background: none;
  border: none;
  color: rgba(185, 177, 204, 0.6);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.hp-chat-close:hover { color: var(--hp-white); }

.hp-chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(185, 177, 204, 0.2) transparent;
}
.hp-chat-thread::-webkit-scrollbar { width: 6px; }
.hp-chat-thread::-webkit-scrollbar-thumb { background: rgba(185, 177, 204, 0.2); border-radius: 3px; }

.hp-msg {
  font-size: 14px;
  line-height: 1.55;
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 85%;
  word-wrap: break-word;
}
.hp-msg.user {
  background: var(--hp-light);
  color: var(--hp-dark);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.hp-msg.assistant {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(234, 228, 251, 0.92);
  border: 1px solid rgba(185, 177, 204, 0.12);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.hp-msg p { margin: 0 0 6px; }
.hp-msg p:last-child { margin-bottom: 0; }
.hp-msg ul { margin: 4px 0 4px 18px; padding: 0; }
.hp-msg li { margin-bottom: 2px; }

.hp-msg.assistant.typing {
  display: inline-flex;
  gap: 4px;
  padding: 14px;
}
.hp-msg.assistant.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(185, 177, 204, 0.5);
  animation: hp-blink 1.2s infinite;
}
.hp-msg.assistant.typing span:nth-child(2) { animation-delay: 0.15s; }
.hp-msg.assistant.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes hp-blink {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.hp-schedule-btn {
  align-self: flex-start;
  background: var(--hp-light);
  color: var(--hp-dark);
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin: 4px 0 8px;
  font-family: inherit;
  transition: background 0.2s;
}
.hp-schedule-btn:hover { background: var(--hp-lavender); }

.hp-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(185, 177, 204, 0.12);
  background: rgba(0, 0, 0, 0.18);
}
.hp-chat-form input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(185, 177, 204, 0.18);
  color: var(--hp-white);
  padding: 11px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  min-width: 0;
}
.hp-chat-form input::placeholder { color: rgba(185, 177, 204, 0.4); }
.hp-chat-form input:focus { border-color: rgba(185, 177, 204, 0.45); }
.hp-chat-form input:disabled { opacity: 0.5; cursor: not-allowed; }
.hp-chat-form button {
  background: var(--hp-light);
  color: var(--hp-dark);
  border: none;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  flex-shrink: 0;
}
.hp-chat-form button:hover:not(:disabled) { background: var(--hp-lavender); }
.hp-chat-form button:disabled { opacity: 0.4; cursor: not-allowed; }

.hp-chat-footer {
  font-size: 10px;
  color: rgba(185, 177, 204, 0.35);
  text-align: center;
  padding: 0 14px 10px;
  letter-spacing: 0.3px;
}

/* Calendly modal */
.hp-cal-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.hp-cal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 14, 20, 0.78);
  backdrop-filter: blur(4px);
}
.hp-cal-card {
  position: relative;
  width: 100%;
  max-width: 720px;
  height: min(720px, calc(100vh - 40px));
  background: var(--hp-dark);
  border-radius: 16px;
  border: 1px solid rgba(185, 177, 204, 0.18);
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}
.hp-cal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(28, 26, 34, 0.9);
  border: 1px solid rgba(185, 177, 204, 0.2);
  color: var(--hp-light);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.hp-cal-close:hover { background: var(--hp-mid); }
.hp-cal-card .calendly-inline-widget {
  flex: 1;
  min-height: 0;
}

@media (max-width: 480px) {
  .hp-chat-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 86px;
    height: calc(100vh - 110px);
    max-height: none;
  }
  .hp-chat-toggle { right: 16px; bottom: 16px; width: 54px; height: 54px; font-size: 22px; }
  .hp-cal-modal { padding: 0; }
  .hp-cal-card { max-width: none; height: 100vh; border-radius: 0; }
}
