/* Wade Blaylock Marketing — AI assistant chat widget.
   Floating button + panel. Matches site brand tokens. */
@import url("https://fonts.googleapis.com/css2?family=Rubik+Spray+Paint&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;600&display=swap");

#wbm-assistant-btn {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #0064e0 0%, #0082fb 60%, #00a5ff 100%);
  box-shadow: 0 6px 20px rgba(0, 100, 224, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  overflow: hidden;
  padding: 0;
}
#wbm-assistant-btn:hover { transform: scale(1.06); }
#wbm-assistant-btn .wbm-assistant-gif { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
#wbm-assistant-btn .wbm-assistant-close-icon { display: none; width: 28px; height: 28px; fill: #fff; }
#wbm-assistant-btn.open .wbm-assistant-gif { display: none; }
#wbm-assistant-btn.open .wbm-assistant-close-icon { display: block; }

#wbm-assistant-panel {
  position: fixed;
  right: 22px;
  bottom: 112px; /* desktop: docked bottom-right above the button */
  width: 360px;
  max-width: calc(100vw - 44px);
  height: 480px;
  max-height: calc(100vh - 130px);
  max-height: calc(100dvh - 130px); /* shrinks with the mobile keyboard */
  background: #10151f;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(26, 35, 50, 0.25);
  z-index: 1000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#wbm-assistant-panel.open { display: flex; }

.wbm-assistant-header {
  background: #141b2e url("/images/assistant-header-graffiti.jpg") center / cover no-repeat;
  color: #fff;
  padding: 26px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.wbm-assistant-header strong {
  display: block;
  font-family: "Rubik Spray Paint", system-ui, cursive;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 1px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}
.wbm-assistant-header span { font-size: 14px; color: #cfd9ea; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
.wbm-assistant-close {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: none;
  background: #e5484d;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
#wbm-assistant-btn.open { display: none; } /* header X closes the panel instead */

#wbm-assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  overscroll-behavior: contain; /* keep touch scrolling inside the chat, not the page */
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #161c28;
}
.wbm-msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 12px;
  font-family: "Chakra Petch", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.wbm-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0064e0 0%, #0082fb 60%, #00a5ff 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.wbm-msg.assistant {
  align-self: flex-start;
  background: #242e40;
  color: #e6ebf3;
  border: 1px solid #33405a;
  border-bottom-left-radius: 4px;
}
.wbm-msg.typing { color: #9fb3cc; font-style: italic; padding: 12px 16px; }
.wbm-typing-dots { display: inline-flex; gap: 6px; padding: 2px; }
.wbm-typing-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3d9bff;
  animation: wbm-bounce 1.2s infinite;
}
.wbm-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.wbm-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes wbm-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.wbm-assistant-form {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: #10151f;
  border-top: 1px solid #2a3444;
}
#wbm-assistant-input {
  flex: 1;
  border: 1px solid #33405a;
  background: #242e40;
  color: #e6ebf3;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px; /* 16px+ stops iOS Safari auto-zoom on focus — the #1 cause of fixed panels jumping on iPhone */
  font-family: "Chakra Petch", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  outline: none;
}
#wbm-assistant-input::placeholder { color: #8a94a6; }
#wbm-assistant-input:focus { border-color: #3d9bff; }
#wbm-assistant-send {
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-family: "Rubik Spray Paint", system-ui, cursive;
  font-size: 16px;
  letter-spacing: 1px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #0064e0 0%, #0082fb 60%, #00a5ff 100%);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
#wbm-assistant-send:disabled { opacity: 0.55; cursor: default; }

.wbm-assistant-cta {
  text-align: center;
  font-size: 13px;
  color: #8a94a6;
  padding: 6px 12px 10px;
  background: transparent;
  border-top: none;
  flex-shrink: 0;
}
.wbm-assistant-cta a {
  color: #5aa9ff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 480px) {
  #wbm-assistant-btn { right: 16px; bottom: 16px; }
  #wbm-assistant-panel {
    /* phones: full-screen takeover when opened (like Rob's OLS guide) */
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    transform: none;
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
}
