/* chat-widget.css
   Link this in index.html <head>, AFTER styles.css:
   <link rel="stylesheet" href="chat-widget.css">

   Uses the same CSS variables already defined in styles.css
   (--navy, --gold, --ivory, --white, --border, --radius, --shadow-lg, --td)
   so it matches the site's existing design system automatically.

   Positioned to stack ABOVE the existing .wa-float WhatsApp button
   (which sits at bottom:28px right:28px) instead of overlapping it.
*/

.bl-launcher {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--navy);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 901; /* one above .wa-float's 900 */
  transition: var(--transition, transform 0.2s ease);
}
.bl-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 20px 50px rgba(13,35,64,0.30);
}
.bl-launcher:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.bl-launcher-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #3cb878;
  border: 2px solid var(--white);
}

/* Little "hi" bubble that pops up near the launcher to invite a click */
.bl-teaser {
  position: fixed;
  bottom: 108px;
  right: 96px;
  max-width: 200px;
  background: var(--white);
  color: var(--td);
  padding: 10px 14px;
  border-radius: var(--radius);
  border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-md);
  font-family: "DM Sans", -apple-system, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  z-index: 900;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.bl-teaser.bl-show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.bl-panel {
  position: fixed;
  bottom: 172px;
  right: 28px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: calc(100vh - 200px);
  background: var(--ivory);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 901;
  font-family: "DM Sans", -apple-system, sans-serif;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.bl-panel.bl-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.bl-header {
  background: var(--navy);
  color: var(--white);
  padding: 16px 16px 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.bl-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #a97a24);
  display: flex;
  align-items: center;
  justify-content: center;
}
.bl-header-text {
  flex: 1;
  min-width: 0;
}
.bl-header-text h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 20px;
  line-height: 1.2;
}
.bl-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.75);
  margin-top: 2px;
}
.bl-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3cb878;
  flex: none;
}
.bl-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.bl-close:hover {
  background: rgba(255,255,255,0.12);
  color: var(--white);
}

.bl-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.bl-messages::-webkit-scrollbar {
  width: 6px;
}
.bl-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.bl-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 88%;
  animation: blFadeIn 0.25s ease;
}
.bl-row--assistant {
  align-self: flex-start;
}
.bl-row--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.bl-mini-avatar {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bl-msg {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.bl-msg--assistant {
  background: var(--white);
  color: var(--td);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.bl-msg--user {
  background: var(--navy);
  color: var(--white);
  border-bottom-right-radius: 4px;
}
.bl-msg a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.5);
}
.bl-msg--assistant a {
  color: var(--navy);
  text-decoration-color: var(--gold);
  font-weight: 600;
}

.bl-time {
  font-size: 10.5px;
  color: var(--tll);
  margin-top: 3px;
  padding: 0 4px;
}
.bl-row--user .bl-time {
  text-align: right;
}

.bl-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
}
.bl-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tl);
  opacity: 0.6;
  animation: blBounce 1.2s infinite ease-in-out;
}
.bl-typing span:nth-child(2) { animation-delay: 0.15s; }
.bl-typing span:nth-child(3) { animation-delay: 0.3s; }

.bl-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 14px 14px;
}
.bl-chip {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition, all 0.2s ease);
  white-space: nowrap;
}
.bl-chip:hover {
  background: var(--navy-pale);
  border-color: var(--navy);
}

.bl-inputRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--white);
}
.bl-inputRow input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--navy-pale, #f0f4f9);
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--td);
}
.bl-inputRow input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.bl-inputRow button {
  border: none;
  background: var(--navy);
  color: var(--white);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition, background 0.2s ease);
}
.bl-inputRow button:hover:not(:disabled) {
  background: var(--navy-mid);
}
.bl-inputRow button:disabled {
  opacity: 0.4;
  cursor: default;
}

.bl-footer-note {
  text-align: center;
  font-size: 10.5px;
  color: var(--tll);
  padding: 0 14px 10px;
  background: var(--white);
}

@keyframes blFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes blBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 480px) {
  .bl-panel {
    right: 16px;
    left: 16px;
    width: auto;
    /* Anchor between the navbar and the screen bottom instead of floating
       up from a fixed bottom + height — that was pushing the panel's top
       (and its header) up underneath the site navbar and clipping it. */
    top: 84px;
    bottom: 16px;
    height: auto;
    max-height: none;
  }
  .bl-launcher {
    right: 20px;
  }
  .bl-teaser {
    /* Keep the same horizontal clearance from the launcher as desktop has
       (launcher right:20 + 60px width = 80px), so the launcher icon can't
       sit on top of the message text. */
    right: 88px;
    max-width: 150px;
    bottom: 100px;
  }
}



@media (prefers-reduced-motion: reduce) {
  .bl-launcher, .bl-panel, .bl-row, .bl-typing span {
    transition: none;
    animation: none;
  }
}
