.aiw-button {
  position: fixed;
  bottom: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: var(--aiw-pos-left, auto);
  right: var(--aiw-pos-right, auto);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px -2px rgba(var(--primary-rgb), 0.4);
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55), box-shadow 0.25s;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
    pointer-events: auto;
}

.aiw-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px -2px rgba(var(--primary-rgb), 0.5);
}

.aiw-button:active {
  transform: scale(0.95);
}

.aiw-button svg {
  width: 24px;
  height: 24px;
}

.aiw-chat {
  position: fixed;
  bottom: 100px;
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  left: var(--aiw-pos-left, auto);
  right: var(--aiw-pos-right, auto);
  width: min(380px, calc(100vw - 2rem));
  height: min(550px, calc(100vh - 8rem));
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 30px -5px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483646;
  animation: slideUp 0.25s ease-out;
    pointer-events: auto;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.aiw-header {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.aiw-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.aiw-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aiw-avatar svg {
  width: 20px;
  height: 20px;
}

.aiw-info {
  flex: 1;
}

.aiw-name {
  font-weight: 600;
  font-size: 14px;
}

.aiw-status {
  font-size: 12px;
  opacity: 0.9;
}

.aiw-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aiw-close:hover {
  background: rgba(255,255,255,0.3);
}

.aiw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f0f2f5;
}

.aiw-message {
  max-width: 85%;
  padding: 10px 16px;
  border-radius: 16px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.aiw-message-agent {
  background: white;
  color: #1a1a1a;
  border-top-left-radius: 4px;
}

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

.aiw-message a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 500;
  margin-top: 8px;
}

.aiw-whatsapp-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #25D366 !important;
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  margin-top: 8px;
  width: 100%;
  box-sizing: border-box;
  transition: opacity 0.2s;
}

.aiw-whatsapp-btn:hover {
  opacity: 0.9;
}

.aiw-whatsapp-btn svg {
  flex-shrink: 0;
}

.aiw-instagram-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888) !important;
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  margin-top: 8px;
  width: 100%;
  box-sizing: border-box;
  transition: opacity 0.2s;
}

.aiw-instagram-btn:hover {
  opacity: 0.9;
}

.aiw-instagram-btn svg {
  flex-shrink: 0;
}

.aiw-calendly-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #006BFF !important;
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  margin-top: 8px;
  width: 100%;
  box-sizing: border-box;
  transition: opacity 0.2s;
}

.aiw-calendly-btn:hover {
  opacity: 0.9;
}

.aiw-calendly-btn svg {
  flex-shrink: 0;
}

.aiw-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 4px;
}

.aiw-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.aiw-action-btn:hover {
  background: var(--primary);
  color: white;
}

.aiw-message-agent a {
  background: var(--primary);
}

.aiw-message-user a {
  background: rgba(255,255,255,0.2);
}

.aiw-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 16px;
  border-top-left-radius: 4px;
  width: fit-content;
}

.aiw-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.aiw-typing-dot:nth-child(1) { animation-delay: 0ms; }
.aiw-typing-dot:nth-child(2) { animation-delay: 200ms; }
.aiw-typing-dot:nth-child(3) { animation-delay: 400ms; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

.aiw-form {
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  margin: 12px;
}

.aiw-form p {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
}

.aiw-form input,
.aiw-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 8px;
  outline: none;
  background: #ffffff;
  color: #1a1a1a;
  box-sizing: border-box;
}

.aiw-form input::placeholder {
  color: #9ca3af;
}

.aiw-form input:focus,
.aiw-form select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.aiw-phone-row {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
}

.aiw-phone-row .aiw-country-select,
.aiw-phone-row .aiw-ddd-input,
.aiw-phone-row .aiw-phone-input {
  margin-bottom: 0;
}

.aiw-country-select {
  appearance: none;
  -webkit-appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23555'/%3E%3C/svg%3E") no-repeat right 8px center;
  background-size: 10px 6px;
  padding: 10px 28px 10px 10px;
  width: 110px !important;
  cursor: pointer;
  flex-shrink: 0;
}

.aiw-ddd-input {
  width: 70px !important;
  flex-shrink: 0;
}

.aiw-phone-input {
  flex: 1;
  min-width: 0;
}

.aiw-lgpd-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  margin-top: 4px;
  margin-bottom: 4px;
}

.aiw-lgpd-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.aiw-lgpd-label span {
  font-size: 11px;
  color: #888;
  line-height: 1.4;
}

.aiw-lgpd-label strong {
  color: #555;
}

.aiw-lgpd-error {
  font-size: 12px;
  color: #dc2626;
  margin: 0;
  margin-top: -4px;
}

.aiw-form button {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

.aiw-form button:hover {
  opacity: 0.9;
}

.aiw-input-area {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e0e0e0;
  background: white;
}

.aiw-input-area input {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 24px;
  background: #f0f2f5;
  color: #1a1a1a;
  font-size: 14px;
  outline: none;
}

.aiw-input-area input::placeholder {
  color: #9ca3af;
}

.aiw-input-area button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aiw-input-area button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.aiw-hidden {
  display: none !important;
}
.aiw-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
