:root {
  --hale-chat-purple: #4b294f;
  --hale-chat-purple-dark: #3b1f40;
  --hale-chat-gold: #d4aa70;
  --hale-chat-bg: #fbfaf7;
  --hale-chat-card: #ffffff;
  --hale-chat-text: #24182a;
  --hale-chat-muted: rgba(36, 24, 42, 0.58);
  --hale-chat-border: rgba(75, 41, 79, 0.12);
  --hale-chat-shadow: 0 24px 80px rgba(24, 18, 28, 0.25);
}

#hale-chat-widget,
#hale-chat-widget * {
  box-sizing: border-box;
}

#hale-chat-widget {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 999999;
  font-family: Inter, Arial, Helvetica, sans-serif;
  text-align: left;
}

#hale-chat-floating-button {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 999px;
  border: none;
  background: var(--hale-chat-purple);
  color: #ffffff;
  cursor: pointer;
  box-shadow:
    0 18px 44px rgba(38, 18, 44, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.28s cubic-bezier(.2,.8,.2,1),
    box-shadow 0.28s ease,
    background 0.28s ease;
}

#hale-chat-floating-button::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 999px;
  background: rgba(75, 41, 79, 0.18);
  animation: halePulse 2.2s ease-in-out infinite;
  z-index: -1;
}

#hale-chat-floating-button:hover {
  transform: translateY(-4px) scale(1.035);
  background: var(--hale-chat-purple-dark);
  box-shadow:
    0 24px 58px rgba(38, 18, 44, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

@keyframes halePulse {
  0%, 100% { opacity: 0.52; transform: scale(0.92); }
  50% { opacity: 0; transform: scale(1.22); }
}

.hale-chat-icon-open {
  width: 30px;
  height: 30px;
  display: block;
}

.hale-chat-icon-close {
  display: none;
  font-size: 42px;
  line-height: 1;
  font-weight: 200;
  transform: translateY(-2px);
}

#hale-chat-floating-button.hale-chat-active .hale-chat-icon-open {
  display: none;
}

#hale-chat-floating-button.hale-chat-active .hale-chat-icon-close {
  display: block;
}

#hale-chat-window {
  position: absolute;
  right: 0;
  bottom: 88px;
  width: 392px;
  height: 638px;
  max-width: calc(100vw - 34px);
  max-height: calc(100vh - 124px);
  background: var(--hale-chat-bg);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: var(--hale-chat-shadow);
  border: 1px solid rgba(75, 41, 79, 0.1);
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  animation: haleChatOpen 0.34s cubic-bezier(.2,.8,.2,1) forwards;
}

@keyframes haleChatOpen {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.965);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.hale-chat-hidden {
  display: none !important;
}

#hale-chat-hero {
  position: relative;
  min-height: 228px;
  padding: 38px 30px 28px;
  background:
    radial-gradient(circle at 82% 12%, rgba(255, 255, 255, 0.10), transparent 28%),
    radial-gradient(circle at 0% 100%, rgba(212, 170, 112, 0.16), transparent 34%),
    linear-gradient(160deg, var(--hale-chat-purple) 0%, var(--hale-chat-purple-dark) 100%);
  color: #ffffff;
  overflow: hidden;
}

#hale-chat-hero::before {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -144px;
  top: -144px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#hale-chat-hero::after {
  content: "";
  position: absolute;
  left: 30px;
  right: 30px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hale-chat-gold), transparent);
}

#hale-chat-close-button {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 26px;
  font-weight: 200;
  line-height: 1;
  cursor: pointer;
  transition: background 0.22s ease, transform 0.22s ease;
}

#hale-chat-close-button:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: rotate(90deg);
}

.hale-chat-hero-content {
  position: relative;
  z-index: 2;
}

.hale-chat-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 30px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
  letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.82);
}

.hale-chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #7ee787;
  box-shadow: 0 0 0 5px rgba(126, 231, 135, 0.12);
}

.hale-chat-hero-content h2 {
  margin: 0 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 43px;
  line-height: 0.94;
  letter-spacing: -1.2px;
  font-weight: 500;
  color: #fff8ef;
}

.hale-chat-hero-content p {
  width: 92%;
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
}

#hale-chat-body {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 24px 22px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 100% 0%, rgba(212, 170, 112, 0.08), transparent 30%),
    var(--hale-chat-bg);
  scroll-behavior: smooth;
}

#hale-chat-body::-webkit-scrollbar { width: 7px; }
#hale-chat-body::-webkit-scrollbar-thumb {
  background: rgba(75, 41, 79, 0.18);
  border-radius: 999px;
}

#hale-chat-intro {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
  animation: haleFadeUp 0.42s ease both;
}

.hale-chat-card,
.hale-message {
  animation: haleFadeUp 0.32s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes haleFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hale-chat-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--hale-chat-border);
  box-shadow: 0 10px 30px rgba(35, 25, 40, 0.045);
  color: var(--hale-chat-text);
  border-radius: 18px;
  padding: 17px 18px;
  font-size: 15px;
  line-height: 1.5;
}

.hale-chat-card strong {
  display: block;
  margin-bottom: 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 500;
  color: var(--hale-chat-purple);
}

#hale-chat-lead-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: haleFadeUp 0.46s ease both;
}

.hale-chat-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hale-chat-field label {
  font-size: 12px;
  color: var(--hale-chat-muted);
  font-weight: 700;
  letter-spacing: 0.2px;
}

#hale-chat-lead-form input,
#hale-chat-country {
  width: 100%;
  height: 50px;
  border-radius: 16px;
  border: 1px solid rgba(75, 41, 79, 0.14);
  background: rgba(255, 255, 255, 0.96);
  padding: 0 15px;
  font-size: 14px;
  color: var(--hale-chat-text);
  outline: none;
  transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

#hale-chat-lead-form input::placeholder {
  color: rgba(36, 24, 42, 0.38);
}

#hale-chat-lead-form input:focus,
#hale-chat-country:focus {
  border-color: var(--hale-chat-purple);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(75, 41, 79, 0.08);
}

.hale-chat-phone-row {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px;
}

#hale-chat-country {
  appearance: none;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(36, 24, 42, 0.55) 50%),
    linear-gradient(135deg, rgba(36, 24, 42, 0.55) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 21px,
    calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

#hale-chat-start {
  width: 100%;
  height: 52px;
  margin-top: 4px;
  border-radius: 999px;
  border: none;
  background: var(--hale-chat-purple);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(75, 41, 79, 0.22);
  transition: background 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

#hale-chat-start:hover {
  background: var(--hale-chat-purple-dark);
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(75, 41, 79, 0.26);
}

#hale-chat-form-error {
  min-height: 18px;
  margin: 0;
  color: #b3261e;
  font-size: 13px;
  line-height: 1.35;
}

#hale-chat-conversation {
  height: 100%;
  min-height: 0;
}

#hale-chat-messages {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-height: 100%;
  padding-bottom: 4px;
}

.hale-message {
  max-width: 86%;
  padding: 14px 16px;
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 10px 28px rgba(35, 25, 40, 0.05);
}

.hale-bot-message {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--hale-chat-border);
  color: var(--hale-chat-text);
  border-radius: 18px 18px 18px 6px;
  text-align: left;
}

#hale-chat-messages .hale-bot-message:first-child {
  width: 100%;
  max-width: 100%;
}

.hale-user-message {
  align-self: flex-end;
  background: var(--hale-chat-purple);
  color: #ffffff;
  border-radius: 18px 18px 6px 18px;
}

.hale-typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 52px;
  min-height: 21px;
}

.hale-typing span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(75, 41, 79, 0.45);
  animation: haleTypingBounce 1.05s infinite ease-in-out;
}

.hale-typing span:nth-child(2) { animation-delay: 0.15s; }
.hale-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes haleTypingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-5px); opacity: 1; }
}

#hale-chat-input-area {
  min-height: 78px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(75, 41, 79, 0.10);
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

#hale-chat-message {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  border: none;
  resize: none;
  outline: none;
  background: transparent;
  color: var(--hale-chat-text);
  font-size: 15.5px;
  line-height: 1.4;
  font-family: inherit;
  padding: 11px 0;
}

#hale-chat-message::placeholder {
  color: rgba(36, 24, 42, 0.38);
}

#hale-chat-send {
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 999px;
  background: var(--hale-chat-purple);
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(75, 41, 79, 0.20);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#hale-chat-send:hover {
  background: var(--hale-chat-purple-dark);
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(75, 41, 79, 0.25);
}

#hale-chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 480px) {
  #hale-chat-widget { right: 16px; bottom: 16px; }
  #hale-chat-floating-button { width: 62px; height: 62px; }
  #hale-chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 104px);
    bottom: 78px;
    border-radius: 26px;
  }
  #hale-chat-hero { min-height: 210px; padding: 34px 24px 24px; }
  .hale-chat-hero-content h2 { font-size: 38px; }
  .hale-chat-hero-content p { font-size: 15px; }
  #hale-chat-body { padding: 20px 18px; }
  .hale-chat-phone-row { grid-template-columns: 122px 1fr; }
}
