/**
 * @file
 * WeebPal Chatbot widget styles — self-contained, CSS custom properties.
 */

.wp-chatbot {
  position: fixed;
  bottom: 88px;
  right: 24px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
}

/* FAB trigger */
.wp-chatbot__trigger {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, box-shadow 0.2s;
}

.wp-chatbot__trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Chat window */
.wp-chatbot__window {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 380px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
}

.wp-chatbot__window--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.wp-chatbot__header {
  padding: 14px 16px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wp-chatbot__header-info {
  display: flex;
  flex-direction: column;
}

.wp-chatbot__header-info strong {
  font-size: 15px;
}

.wp-chatbot__header-info small {
  font-size: 11px;
  opacity: 0.8;
}

.wp-chatbot__close {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.8;
  padding: 0 4px;
}

.wp-chatbot__close:hover {
  opacity: 1;
}

/* Messages area */
.wp-chatbot__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Message bubbles */
.wp-chatbot__msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.wp-chatbot__msg--bot {
  background: #f0f0f0;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.wp-chatbot__msg--user {
  background: #2563EB;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.wp-chatbot__msg--error {
  background: #fee2e2;
  color: #991b1b;
  align-self: flex-start;
  font-size: 13px;
}

/* Typing indicator */
.wp-chatbot__msg--typing {
  background: #f0f0f0;
  align-self: flex-start;
  padding: 12px 18px;
  border-radius: 16px;
  display: flex;
  gap: 4px;
}

.wp-chatbot__msg--typing span {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: wp-chatbot-bounce 1.4s infinite ease-in-out both;
}

.wp-chatbot__msg--typing span:nth-child(1) { animation-delay: -0.32s; }
.wp-chatbot__msg--typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes wp-chatbot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Input area */
.wp-chatbot__input-area {
  padding: 12px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.wp-chatbot__input-area textarea {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  resize: none;
  outline: none;
  font-family: inherit;
  max-height: 100px;
  line-height: 1.4;
}

.wp-chatbot__input-area textarea:focus {
  border-color: #2563EB;
}

#wp-chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

#wp-chatbot-send:hover {
  opacity: 0.85;
}

/* Mobile fullscreen */
@media (max-width: 480px) {
  .wp-chatbot__window {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
}
