/* BlitzDoc landing chat widget — bottom-right launcher + slide-up panel.
 * Self-contained: no dependencies on landing.css.
 * Z-index 99 keeps the panel above sticky nav but below modal banners. */

.bd-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #1E6FD9 0%, #3A8AEE 100%);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(30, 111, 217, 0.32), 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.bd-chat-launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(30, 111, 217, 0.4), 0 3px 8px rgba(0, 0, 0, 0.12);
}
.bd-chat-launcher:focus-visible {
  outline: 3px solid rgba(58, 138, 238, 0.45);
  outline-offset: 2px;
}
.bd-chat-launcher svg { flex: 0 0 auto; }
.bd-chat-launcher-label { white-space: nowrap; }

@media (max-width: 480px) {
  .bd-chat-launcher {
    right: 12px;
    bottom: 12px;
    padding: 11px 14px;
    font-size: 13px;
  }
  .bd-chat-launcher-label { display: none; }
}

.bd-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 40px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 56px rgba(11, 37, 69, 0.22), 0 4px 14px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0B2545;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
/* CRITICAL: without this rule the `display: flex` above overrides the HTML
 * `hidden` attribute, leaving an invisible-but-pointer-grabbing panel on top
 * of the entire page (including the launcher button). Fix: when hidden,
 * actually hide. */
.bd-chat-panel[hidden] {
  display: none !important;
}
.bd-chat-panel-open {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 480px) {
  .bd-chat-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 92vh;
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
  }
}

.bd-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #E8EEF7;
  background: linear-gradient(180deg, #F8FAFD 0%, #FFFFFF 100%);
}
.bd-chat-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: #0B2545;
}
.bd-chat-subtitle {
  margin-top: 2px;
  font-size: 11px;
  color: #6B7B8C;
  line-height: 1.4;
}
.bd-chat-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6B7B8C;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.bd-chat-close:hover { background: #EEF3F9; color: #0B2545; }
.bd-chat-close:focus-visible { outline: 2px solid #3A8AEE; outline-offset: 2px; }

.bd-chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #FCFDFF;
}
.bd-chat-empty {
  padding: 14px 0;
  text-align: center;
  font-size: 13px;
  color: #6B7B8C;
  line-height: 1.55;
}
.bd-chat-msg {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.bd-chat-msg-user {
  align-self: flex-end;
  background: #1E6FD9;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bd-chat-msg-assistant {
  align-self: flex-start;
  background: #EEF3F9;
  color: #0B2545;
  border-bottom-left-radius: 4px;
}
.bd-chat-msg a {
  color: inherit;
  text-decoration: underline;
}
.bd-chat-msg-user a { color: #FFFFFF; }

.bd-chat-typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px;
}
.bd-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6B7B8C;
  opacity: 0.5;
  animation: bd-chat-bounce 1s infinite ease-in-out;
}
.bd-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.bd-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bd-chat-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.3; }
  40%           { transform: translateY(-4px); opacity: 0.9; }
}

.bd-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #E8EEF7;
  background: #fff;
}
.bd-chat-input {
  flex: 1 1 auto;
  padding: 10px 12px;
  border: 1px solid #D8E1EC;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: #0B2545;
  background: #fff;
  outline: 0;
}
.bd-chat-input:focus { border-color: #3A8AEE; box-shadow: 0 0 0 3px rgba(58, 138, 238, 0.18); }
.bd-chat-input:disabled { background: #F4F7FB; cursor: not-allowed; }

.bd-chat-send {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: #1E6FD9;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}
.bd-chat-send:hover { background: #1657AB; }
.bd-chat-send:focus-visible { outline: 3px solid rgba(58, 138, 238, 0.45); outline-offset: 2px; }
.bd-chat-send:disabled { background: #B8C4D4; cursor: not-allowed; }
.bd-chat-send-pending { opacity: 0.6; }

.bd-chat-footer {
  padding: 8px 14px 12px;
  font-size: 10.5px;
  color: #6B7B8C;
  text-align: center;
  line-height: 1.45;
  border-top: 1px solid #F2F5FA;
  background: #FCFDFF;
}

.bd-chat-reset-cta {
  align-self: center;
  margin-top: 10px;
  padding: 8px 14px;
  border: 1px solid #1E6FD9;
  background: #fff;
  color: #1E6FD9;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}
.bd-chat-reset-cta:hover {
  background: #1E6FD9;
  color: #fff;
}
.bd-chat-reset-cta:focus-visible {
  outline: 3px solid rgba(58, 138, 238, 0.45);
  outline-offset: 2px;
}
