body {
  font-family: 'Open Sans', sans-serif;
  margin: 0;
  padding: 0;
  background: #f4f4f4;
}

#chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #0077cc;
  color: white;
  padding: 16px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  z-index: 999998;
}

#chat-widget {
  position: fixed;
  bottom: 96px;                /* leaves space above launcher */
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 80vh;                /* was 520px — responsive height */
  min-height: 420px;           /* sensible floor on short screens */
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition: transform .18s ease, opacity .18s ease;
  z-index: 999999;             /* ensure it sits above other UI */
}

#chat-widget.hidden { display: none; }
#chat-widget.open { opacity: 1; transform: scale(1); pointer-events: all; }
#chat-widget.closed { opacity: 0; transform: scale(0.9); pointer-events: none; }

#chat-header {
  background: #0077cc;
  color: white;
  padding: 14px 16px;
}

#chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  background: #fafafa;
  -webkit-overflow-scrolling: touch; /* smoother iOS scroll */
}

.message {
  padding: 10px 12px;
  border-radius: 10px;
  margin: 8px 0;
  line-height: 1.4;
  font-size: 15px;
}

.message.user {
  background: #e3f2ff;
  align-self: flex-end;
}

.message.bot {
  background: #f1f1f1;
  align-self: flex-start;
}

.typing {
  font-style: italic;
  color: #666;
  margin: 6px 0 2px;
}

#chat-form {
  display: flex;
  border-top: 1px solid #eee;
  padding-bottom: env(safe-area-inset-bottom, 0px); /* avoid iOS home indicator */
}

#chat-input {
  flex: 1;
  border: none;
  padding: 12px;
  font-size: 15px;
  outline: none;
}

#chat-send {
  border: none;
  background: #0077cc;
  color: white;
  padding: 0 16px;
  font-size: 18px;
  cursor: pointer;
}

.chat-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #eee;
}

#upload-image-button.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* --- PoolBot embed mode: hide any internal launcher when embedded --- */
.poolbot-embedded #launcher,
.poolbot-embedded .launcher,
.poolbot-embedded .chat-launcher,
.poolbot-embedded [data-launcher],
.poolbot-embedded .rcw-launcher,
.poolbot-embedded .intercom-lightweight-app-launcher,
.poolbot-embedded .chatwoot-widget-bubble,
.poolbot-embedded .tawk-button,
.poolbot-embedded .react-chatbot-kit-chat-btn {
  display: none !important;
}

/* Hide the floating launcher when the chat panel is open */
.chat-open #chat-launcher { display: none !important; }

/* Prevent any duplicate launcher inside the widget area from showing */
#chat-widget #chat-launcher { display: none !important; }

/* --- Mobile tweaks --- */
@media (max-width: 480px) {
  #chat-widget {
    right: 12px;
    bottom: 80px;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    height: 90vh;             /* taller on mobile */
    min-height: 420px;
  }
}
