/* Proteção forte contra Elementor - alta especificidade */
body .bdw-chat-panel .bdw-chat-button,
body .bdw-chat-panel button,
body .bdw-chat-panel input,
body .bdw-chat-panel textarea,
body .bdw-chat-panel select {
  background-color: var(--bdw-color-primary) !important;
  color: var(--bdw-color-white) !important;
  border: none !important;
}

/* Botões secundários específicos */
body .bdw-chat-panel .bdw-chat-button.bdw-chat-button-secondary {
  background-color: var(--bdw-color-surface-2) !important;
  color: var(--bdw-color-text) !important;
  border: 1px solid var(--bdw-color-border) !important;
}

/* Formulários */
body .bdw-chat-panel input,
body .bdw-chat-panel textarea,
body .bdw-chat-panel select {
  background-color: var(--bdw-color-surface) !important;
  color: var(--bdw-color-text) !important;
  border: 1px solid var(--bdw-color-border) !important;
}

:root {
  --bdw-color-primary: #0052CC;
  --bdw-color-highlight: #FFD300;
  --bdw-color-text: #0F172A;
  --bdw-color-text-2: #334155;
  --bdw-color-text-3: #1E293B;
  --bdw-color-muted: #475569;
  --bdw-color-muted-2: #94A3B8;
  --bdw-color-border: #CBD5E1;
  --bdw-color-border-soft: #E2E8F0;
  --bdw-color-surface: #F8FAFC;
  --bdw-color-surface-2: #F1F5F9;
  --bdw-color-white: #FFFFFF;
  --bdw-color-dark: #333333;
  --bdw-color-black: #000000;
  --bdw-color-neutral: #4A4A4A;
  /* Variáveis que serão sobrescritas pelo inline CSS */
  --bdw-widget-desktop-width: 400px;
  --bdw-widget-mobile-width: 100%;
}

.bdw-chat-widget {
  position: fixed;
  z-index: 10000;
  inset: auto;
}

.bdw-chat-widget.bdw-position-bottom-right {
  bottom: 0;
  right: 0;
}

.bdw-chat-widget.bdw-position-bottom-left {
  bottom: 0;
  left: 0;
}

.bdw-chat-widget.bdw-position-top-right {
  top: 0;
  right: 0;
}

.bdw-chat-widget.bdw-position-top-left {
  top: 0;
  left: 0;
}

.bdw-chat-toggle,
.bdw-chat-panel {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  direction: ltr;
}

.bdw-chat-toggle {
  position: fixed;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--bdw-color-primary);
  color: var(--bdw-color-white);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 82, 204, 0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

body .bdw-chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 82, 204, 0.5);
  background-color: var(--bdw-color-primary) !important;
  color: var(--bdw-color-white) !important;
}

.bdw-chat-toggle:focus {
  outline: 3px solid var(--bdw-color-highlight);
  outline-offset: 2px;
}

.bdw-chat-toggle[aria-expanded="true"] {
  background-color: var(--bdw-color-primary);
}

.bdw-chat-toggle .bdw-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.bdw-chat-toggle .bdw-icon {
  width: 28px;
  height: 28px;
}

.bdw-chat-toggle .bdw-avatar+.bdw-icon {
  display: none;
}

.bdw-chat-toggle:not(:has(.bdw-avatar)) .bdw-icon {
  display: block;
}

.bdw-position-bottom-right .bdw-chat-toggle {
  bottom: 24px;
  right: 24px;
  left: auto;
}

.bdw-position-bottom-left .bdw-chat-toggle {
  bottom: 24px;
  left: 24px;
  right: auto;
}

.bdw-position-top-right .bdw-chat-toggle {
  top: 24px;
  right: 24px;
  left: auto;
  bottom: auto;
}

.bdw-position-top-left .bdw-chat-toggle {
  top: 24px;
  left: 24px;
  right: auto;
  bottom: auto;
}

.bdw-chat-panel {
  position: fixed;
  width: var(--bdw-widget-desktop-width, 400px);
  max-width: calc(100vw - 48px);
  max-height: 600px;
  background-color: var(--bdw-color-white);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.95) translateY(8px);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
  z-index: 9999;
}

.bdw-chat-panel[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

.bdw-position-bottom-right .bdw-chat-panel {
  bottom: 92px;
  right: 24px;
}

.bdw-position-bottom-left .bdw-chat-panel {
  bottom: 92px;
  left: 24px;
  right: auto;
}

.bdw-position-top-right .bdw-chat-panel {
  top: 92px;
  right: 24px;
  bottom: auto;
}

.bdw-position-top-left .bdw-chat-panel {
  top: 92px;
  left: 24px;
  bottom: auto;
  right: auto;
}

.bdw-chat-header {
  background-color: var(--bdw-color-primary);
  color: var(--bdw-color-white);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bdw-chat-header .bdw-logo {
  height: 32px;
  max-width: 150px;
  object-fit: contain;
}

.bdw-chat-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  flex-grow: 1;
}

.bdw-chat-close {
  background: none;
  border: none;
  color: var(--bdw-color-white);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bdw-chat-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.bdw-chat-close:focus {
  outline: 2px solid var(--bdw-color-highlight);
  outline-offset: 2px;
}

.bdw-chat-close svg {
  width: 20px;
  height: 20px;
}

.bdw-chat-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 20px;
  background-color: var(--bdw-color-surface);
}

.bdw-chat-loading {
  text-align: center;
  color: var(--bdw-color-muted);
  padding: 40px 20px;
}

.bdw-chat-message.bdw-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
  max-width: 80px;
}

.bdw-chat-message.bdw-typing span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--bdw-color-muted-2);
  animation: bdw-typing-bounce 1.2s infinite ease-in-out;
}

.bdw-chat-message.bdw-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.bdw-chat-message.bdw-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bdw-typing-bounce {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bdw-chat-message.bdw-typing span {
    animation: none;
    opacity: 0.6;
  }
}

.bdw-chat-message {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.5;
}

.bdw-chat-message.bdw-message-bot {
  background-color: var(--bdw-color-surface-2);
  color: var(--bdw-color-text);
  border-bottom-left-radius: 4px;
}

.bdw-chat-message.bdw-message-user {
  background-color: var(--bdw-color-primary);
  color: var(--bdw-color-white);
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.bdw-chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.bdw-chat-option {
  background-color: var(--bdw-color-white);
  color: var(--bdw-color-text);
  border: 1px solid var(--bdw-color-border);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  text-align: left;
}

.bdw-chat-option:hover {
  background-color: var(--bdw-color-primary);
  color: var(--bdw-color-white);
  border-color: var(--bdw-color-primary);
}

.bdw-chat-option:focus {
  outline: 2px solid var(--bdw-color-highlight);
  outline-offset: 2px;
}

.bdw-chat-summary {
  background-color: var(--bdw-color-surface-2);
  border: 1px solid var(--bdw-color-border);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.bdw-chat-summary h4 {
  margin: 0 0 12px 0;
  color: var(--bdw-color-text);
  font-size: 14px;
  font-weight: 600;
}

.bdw-chat-summary ul {
  margin: 0;
  padding-left: 20px;
}

.bdw-chat-summary li {
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--bdw-color-text-2);
}

.bdw-chat-form {
  margin-top: 16px;
}

.bdw-chat-form .bdw-form-group {
  margin-bottom: 12px;
}

.bdw-chat-form label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--bdw-color-text);
}

.bdw-chat-form input,
.bdw-chat-form textarea,
.bdw-chat-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bdw-color-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.bdw-chat-form input:focus,
.bdw-chat-form textarea:focus,
.bdw-chat-form select:focus {
  outline: none;
  border-color: var(--bdw-color-primary);
}

.bdw-chat-form input.error,
.bdw-chat-form textarea.error {
  border-color: var(--bdw-color-primary);
}

.bdw-chat-form .bdw-error-message {
  color: var(--bdw-color-primary);
  font-size: 12px;
  margin-top: 4px;
}

.bdw-chat-form .bdw-form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.bdw-chat-form .bdw-form-checkbox input {
  width: auto;
  margin-top: 2px;
}

.bdw-chat-form .bdw-form-checkbox label {
  margin-bottom: 0;
}

.bdw-chat-next-hint {
  margin: 8px 0 12px;
  padding: 10px 12px;
  background-color: var(--bdw-color-surface-2);
  border-left: 3px solid var(--bdw-color-primary);
  border-radius: 4px;
  color: var(--bdw-color-text-2);
  font-size: 12px;
  line-height: 1.4;
}

.bdw-chat-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.bdw-chat-button {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bdw-chat-button-primary {
  background-color: var(--bdw-color-primary) !important;
  color: var(--bdw-color-white) !important;
  border: none !important;
}

.bdw-chat-button-primary:hover {
  background-color: #0041a3 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 82, 204, 0.3);
}

.bdw-chat-button-secondary {
  background-color: var(--bdw-color-surface-2) !important;
  color: var(--bdw-color-text) !important;
  border: 1px solid var(--bdw-color-border) !important;
}

.bdw-chat-button-secondary:hover {
  background-color: var(--bdw-color-border) !important;
}

.bdw-chat-button:focus {
  outline: 2px solid var(--bdw-color-highlight);
  outline-offset: 2px;
}

.bdw-chat-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.bdw-endpoint-card {
  background-color: var(--bdw-color-surface-2);
  border: 1px solid var(--bdw-color-border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
  text-align: center;
}

.bdw-endpoint-card h3 {
  margin: 0 0 8px 0;
  color: var(--bdw-color-text);
  font-size: 16px;
}

.bdw-endpoint-card p {
  margin: 0 0 16px 0;
  color: var(--bdw-color-text-2);
  font-size: 14px;
}

.bdw-endpoint-card .bdw-endpoint-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bdw-endpoint-card .bdw-endpoint-actions .bdw-endpoint-link,
.bdw-chat-actions .bdw-endpoint-link {
  display: inline-block;
  padding: 10px 16px;
  background-color: var(--bdw-color-primary);
  color: var(--bdw-color-white);
  text-decoration: none;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.2s ease;
  text-align: center;
}

.bdw-endpoint-card .bdw-endpoint-actions .bdw-endpoint-link:hover,
.bdw-chat-actions .bdw-endpoint-link:hover {
  background-color: color-mix(in srgb, var(--bdw-color-primary) 85%, black);
}

.bdw-endpoint-card .bdw-endpoint-actions .bdw-endpoint-link-secondary,
.bdw-chat-actions .bdw-endpoint-link-secondary {
  background-color: var(--bdw-color-surface-2);
  color: var(--bdw-color-text);
  border: 1px solid var(--bdw-color-border);
}

.bdw-endpoint-card .bdw-endpoint-actions .bdw-endpoint-link-secondary:hover,
.bdw-chat-actions .bdw-endpoint-link-secondary:hover {
  background-color: var(--bdw-color-border);
  color: var(--bdw-color-text);
}

.bdw-endpoint-card .bdw-endpoint-actions .bdw-endpoint-link:focus,
.bdw-chat-actions .bdw-endpoint-link:focus {
  outline: 2px solid var(--bdw-color-highlight);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .bdw-chat-panel {
    width: var(--bdw-widget-mobile-width, 100%);
    max-width: calc(100vw - 32px);
    max-height: 70vh;
  }

  .bdw-position-bottom-right .bdw-chat-panel {
    bottom: 88px;
    right: 16px;
    left: 16px;
  }

  .bdw-position-bottom-left .bdw-chat-panel {
    bottom: 88px;
    left: 16px;
    right: 16px;
  }

  .bdw-chat-toggle {
    width: 56px;
    height: 56px;
  }

  .bdw-position-bottom-right .bdw-chat-toggle {
    bottom: 20px;
    right: 20px;
  }

  .bdw-position-bottom-left .bdw-chat-toggle {
    bottom: 20px;
    left: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {

  .bdw-chat-toggle,
  .bdw-chat-panel,
  .bdw-chat-option,
  .bdw-chat-button,
  .bdw-endpoint-card .bdw-endpoint-actions .bdw-endpoint-link,
  .bdw-chat-actions .bdw-endpoint-link {
    transition: none;
  }
}