/* ── Live Chat Web Inteligente ── */

.smart-chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99990;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #0f766e;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.smart-chat-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}
.smart-chat-fab.has-unread::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: #e53935;
  border-radius: 50%;
  border: 2px solid #fff;
}

.smart-chat-widget {
  position: fixed;
  right: 20px;
  bottom: 92px;
  z-index: 99991;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.24);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.smart-chat-widget.is-open {
  display: flex;
}

/* Header */
.smart-chat-header {
  background: #0c2a3d;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.smart-chat-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-weight: 800;
  color: #0c2a3d;
  font-size: 13px;
  flex-shrink: 0;
}
.smart-chat-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
  box-sizing: border-box;
}
.smart-chat-msg.bot strong {
  font-weight: 700;
  color: #0c2a3d;
}
.smart-chat-msg.bot a {
  color: #0c7db0;
  text-decoration: underline;
}
.smart-chat-title {
  flex: 1;
  min-width: 0;
}
.smart-chat-title strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}
.smart-chat-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #6ee7b7;
  margin-top: 2px;
}
.smart-chat-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}
.smart-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  opacity: 0.8;
}
.smart-chat-menu {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  line-height: 1;
  opacity: 0.9;
  white-space: nowrap;
  flex-shrink: 0;
}
.smart-chat-menu:hover {
  opacity: 1;
}
.smart-chat-close:hover {
  opacity: 1;
}

/* Body */
.smart-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
}
.smart-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.smart-chat-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.smart-chat-msg.bot {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
  color: #1e293b;
  align-self: flex-start;
}
.smart-chat-msg.user {
  background: #0f766e;
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.smart-chat-msg.typing {
  color: #64748b;
  font-style: italic;
  background: transparent;
  border: none;
}

/* Intent buttons */
.smart-chat-intents {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.smart-chat-intent {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  color: #1e293b;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
  font-family: inherit;
}
.smart-chat-intent:hover {
  background: #f0fdfa;
  border-color: #0f766e;
}
.smart-chat-intent .icon {
  font-size: 18px;
  flex-shrink: 0;
}
.smart-chat-intent .icon svg {
  display: block;
}
.smart-chat-intent .chevron {
  margin-left: auto;
  color: #94a3b8;
}

/* Composer */
.smart-chat-composer {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.smart-chat-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.smart-chat-input:focus {
  border-color: #0f766e;
}
.smart-chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #0f766e;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.smart-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* WhatsApp handoff button */
.smart-chat-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 10px;
  font-family: inherit;
}
.smart-chat-wa:hover {
  filter: brightness(1.05);
}

/* Mobile */
@media (max-width: 480px) {
  .smart-chat-widget {
    right: 10px;
    left: 10px;
    bottom: 84px;
    width: auto;
    height: 72vh;
    height: 72dvh; /* iOS dynamic viewport — no overflow */
    max-height: none;
  }
  .smart-chat-fab {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }
}
