/* Wilsons Systems Chatbot Widget */

/* Reset */
#ws-chatbot, #ws-chatbot * { box-sizing: border-box; margin: 0; padding: 0; }
#ws-chatbot { font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif; }

/* ── Floating Button ── */
#ws-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #C41E2A;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(196,30,42,0.4), 0 0 40px rgba(196,30,42,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform 0.25s cubic-bezier(0.25,0.46,0.45,0.94), box-shadow 0.25s cubic-bezier(0.25,0.46,0.45,0.94);
}
#ws-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(196,30,42,0.55), 0 0 50px rgba(196,30,42,0.2);
}
#ws-chat-btn:active { transform: scale(0.95); }
#ws-chat-btn.ws-hidden { display: none; }

/* ── Chat Window ── */
#ws-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.25,0.46,0.45,0.94), transform 0.25s cubic-bezier(0.25,0.46,0.45,0.94);
}
#ws-chat-window.ws-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Header ── */
#ws-chat-header {
  background: #111111;
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#ws-chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
#ws-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: #111;
}
#ws-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
}
#ws-chat-title strong { display: block; font-size: 15px; font-weight: 600; }
#ws-chat-title small { font-size: 11px; color: rgba(255,255,255,0.55); }
#ws-chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.2s;
}
#ws-chat-close:hover { color: #fff; }

/* ── Welcome Screen ── */
#ws-chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  background: #f8f8f8;
}
#ws-chat-welcome.ws-hidden { display: none; }
#ws-chat-welcome h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #111;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
#ws-chat-welcome p {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 28px;
}
.ws-welcome-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 280px;
}
.ws-welcome-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.2s cubic-bezier(0.25,0.46,0.45,0.94), box-shadow 0.2s;
  text-decoration: none;
  text-align: left;
}
.ws-welcome-btn:hover { transform: translateY(-2px); }
.ws-welcome-btn:active { transform: translateY(0); }

.ws-welcome-btn--ai {
  background: #111;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.ws-welcome-btn--ai:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.3); }

.ws-welcome-btn--wa {
  background: #25D366;
  color: #fff;
  box-shadow: 0 4px 16px rgba(37,211,102,0.3);
}
.ws-welcome-btn--wa:hover { box-shadow: 0 6px 24px rgba(37,211,102,0.4); }

.ws-welcome-btn svg { flex-shrink: 0; }
.ws-welcome-btn span { flex: 1; }
.ws-welcome-btn small { display: block; font-weight: 400; font-size: 11px; opacity: 0.75; margin-top: 2px; }

/* ── Messages ── */
#ws-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8f8f8;
}
#ws-chat-messages.ws-hidden { display: none; }
.ws-message {
  max-width: 88%;
  padding: 16px 20px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.7;
  word-wrap: break-word;
}
.ws-message p { margin: 0; }
.ws-bot {
  background: #fff;
  color: #111;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.ws-user {
  background: #C41E2A;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ws-typing {
  display: flex;
  gap: 5px;
  padding: 14px 16px;
  align-self: flex-start;
  background: #fff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.ws-typing span {
  width: 7px;
  height: 7px;
  background: #aaa;
  border-radius: 50%;
  animation: ws-bounce 1.4s infinite ease-in-out both;
}
.ws-typing span:nth-child(1) { animation-delay: -0.32s; }
.ws-typing span:nth-child(2) { animation-delay: -0.16s; }
@keyframes ws-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ── Input Form ── */
#ws-chat-form {
  display: flex;
  padding: 12px;
  gap: 8px;
  background: #fff;
  border-top: 1px solid #eee;
  flex-shrink: 0;
}
#ws-chat-form.ws-hidden { display: none; }
#ws-chat-input {
  flex: 1;
  padding: 11px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  font-size: 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  background: #f8f8f8;
  color: #111;
}
#ws-chat-input:focus { border-color: #C41E2A; background: #fff; }
#ws-chat-input::placeholder { color: #999; }
#ws-chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #C41E2A;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
#ws-chat-send:hover { background: #a8192e; }
#ws-chat-send:disabled { background: #ccc; cursor: not-allowed; }

/* WhatsApp link in chat */
.ws-wa-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 7px 14px;
  background: #25D366;
  color: #fff;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s;
}
.ws-wa-link:hover { transform: scale(1.03); }

/* ── Mobile ── */
@media (max-width: 480px) {
  #ws-chat-window {
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  #ws-chat-btn { bottom: 16px; right: 16px; }
}
