/* Widget de Chat Flutuante - Dablyo */
:root {
  --wchat-primary: #7c3aed;
  --wchat-bg: #faf8ff;
  --wchat-text: #374151;
}
.wpchat-floating-button {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--wchat-primary);
  color: white;
  padding: 12px 20px;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  outline: none;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans;
}

.wpchat-floating-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.wpchat-window {
  position: fixed;
  right: 20px;
  bottom: 80px;
  width: 350px;
  height: 450px;
  background: var(--wchat-bg);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 9998;
  display: none;
  flex-direction: column;
  border: 1px solid #e5e7eb;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans;
}

.wpchat-header {
  padding: 12px 16px;
  background: var(--wchat-primary);
  color: white;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}

.wpchat-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.wpchat-close:hover {
  background-color: rgba(255,255,255,0.2);
}

.wpchat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--wchat-bg);
}

.wpchat-msg {
  margin-bottom: 10px;
  line-height: 1.35;
  animation: fadeIn 0.3s ease;
}

.wpchat-msg.user {
  text-align: right;
}

.wpchat-msg .bubble {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 18px;
  max-width: 85%;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.wpchat-msg.user .bubble {
  background: #dbeafe;
  color: #1e40af;
  border-bottom-right-radius: 4px;
}

.wpchat-msg.bot .bubble {
  background: #e5e7eb;
  color: var(--wchat-text);
  border-bottom-left-radius: 4px;
}

.wpchat-input-container {
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  background: var(--wchat-bg);
  border-radius: 0 0 12px 12px;
}

.wpchat-input-row {
  display: flex;
  gap: 8px;
}

.wpchat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.wpchat-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.wpchat-send {
  padding: 8px 16px;
  background: #7c3aed;
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: background-color 0.2s ease;
}

.wpchat-send:hover:not(:disabled) {
  background: #6d28d9;
}

.wpchat-send:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* Animações */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scrollbar personalizada */
.wpchat-messages::-webkit-scrollbar {
  width: 6px;
}

.wpchat-messages::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.wpchat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.wpchat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Responsividade */
@media (max-width: 768px) {
  .wpchat-window {
    width: calc(100vw - 40px);
    height: calc(100vh - 120px);
    right: 20px;
    left: 20px;
    bottom: 80px;
  }
  
  .wpchat-floating-button {
    right: 20px;
    left: auto;
  }
}

/* Posições alternativas */
.wpchat-window[data-position="bottom-left"] {
  right: auto;
  left: 20px;
}

.wpchat-floating-button[data-position="bottom-left"] {
  right: auto;
  left: 20px;
}

.wpchat-window[data-position="center"] {
  right: 50%;
  left: 50%;
  transform: translateX(-50%);
}

.wpchat-floating-button[data-position="center"] {
  right: 50%;
  left: 50%;
  transform: translateX(-50%);
}

/* Tamanhos alternativos */
.wpchat-window[data-size="small"] {
  width: 300px;
  height: 400px;
}

.wpchat-window[data-size="large"] {
  width: 500px;
  height: 600px;
}

/* Estados de loading */
.wpchat-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #6b7280;
}

.wpchat-loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #7c3aed;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Suporte para shortcode inline */
.wpchat-container {
  min-height: 400px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #faf8ff;
  position: relative;
}

.wpchat-container .wpchat-window {
  position: relative;
  right: auto;
  bottom: auto;
  width: 100%;
  height: 100%;
  box-shadow: none;
  border: none;
  border-radius: 12px;
  display: flex;
}

.wpchat-container .wpchat-floating-button {
  display: none;
}