/* ─── SAMI CHAT WIDGET ───────────────────────────────────────────────────── */

#sami-chat {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 999;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}

/* ─── BOTÃO DE ABRIR / FECHAR ─────────────────────────────────────────────── */
.sami-chat-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #252525;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: transform .2s, box-shadow .2s;
  position: relative;
  z-index: 2;
}

.sami-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}

/* Badge de não-lido */
.sami-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e53935;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  line-height: 1;
}

/* ─── JANELA DO CHAT ─────────────────────────────────────────────────────── */
.sami-chat-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 340px;
  max-height: 520px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.sami-chat-window.sami-chat-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ─── HEADER ─────────────────────────────────────────────────────────────── */
.sami-chat-header {
  background: #252525;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sami-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.4);
  flex-shrink: 0;
}

.sami-chat-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sami-chat-header-info {
  flex: 1;
  min-width: 0;
}

.sami-chat-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sami-chat-status {
  font-size: 11px;
  opacity: .85;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sami-chat-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4caf50;
  animation: sami-pulse 1.8s infinite;
}

@keyframes sami-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

.sami-chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color .15s;
  flex-shrink: 0;
}

.sami-chat-close:hover { color: #fff; }

/* ─── ÁREA DE MENSAGENS ──────────────────────────────────────────────────── */
.sami-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  scroll-behavior: smooth;
  background: #f8f9fb;
}

.sami-chat-messages::-webkit-scrollbar { width: 4px; }
.sami-chat-messages::-webkit-scrollbar-track { background: transparent; }
.sami-chat-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* ─── BOLHAS DE MENSAGEM ─────────────────────────────────────────────────── */
.sami-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
  animation: sami-fade-in .2s ease;
}

@keyframes sami-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sami-msg-bot {
  background: #e4e4e4;
  color: #252525;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.sami-msg-user {
  background: #252525;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Indicador de digitação */
.sami-msg-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 10px 14px;
  min-width: 48px;
}

.sami-msg-typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #90a4c8;
  animation: sami-bounce .9s infinite;
}

.sami-msg-typing span:nth-child(2) { animation-delay: .15s; }
.sami-msg-typing span:nth-child(3) { animation-delay: .30s; }

@keyframes sami-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .5; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* ─── OPÇÕES (BOTÕES DE ESCOLHA) ─────────────────────────────────────────── */
.sami-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: flex-start;
  width: 100%;
  animation: sami-fade-in .2s ease;
}

.sami-option-btn {
  background: #fff;
  border: 1.5px solid var(--chat-btn, #1A4592);
  color: var(--chat-btn, #1A4592);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background .15s, color .15s;
  width: fit-content;
  max-width: 100%;
}

.sami-option-btn:hover:not(:disabled) {
  background: var(--chat-btn, #1A4592);
  color: #fff;
}

.sami-option-btn:disabled { cursor: default; opacity: .6; }
.sami-option-btn.sami-option-selected {
  background: var(--chat-btn, #1A4592);
  color: #fff;
  opacity: .75;
}

/* ─── MENSAGEM DE ERRO / VALIDAÇÃO ──────────────────────────────────────── */
.sami-msg-error {
  background: #fff3cd;
  color: #856404;
  align-self: flex-start;
  border: 1px solid #ffc107;
  border-bottom-left-radius: 4px;
  font-size: 12.5px;
}

.sami-msg-error i {
  margin-right: 4px;
}

/* ─── BOTÃO CTA (mensagem_botao) ─────────────────────────────────────────── */
.sami-cta-btn {
  display: inline-block;
  background: var(--chat-btn, #1A4592);
  color: #fff !important;
  text-decoration: none !important;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  align-self: flex-start;
  transition: opacity .15s;
  animation: sami-fade-in .2s ease;
  cursor: pointer;
  border: none;
}

.sami-cta-btn:hover { opacity: .88; }

/* ─── BOTÃO DE AÇÃO (whatsapp / link) ────────────────────────────────────── */
.sami-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--chat-btn, #1A4592);
  color: #fff !important;
  text-decoration: none !important;
  padding: 9px 18px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 500;
  align-self: flex-start;
  transition: opacity .15s;
  animation: sami-fade-in .2s ease;
  cursor: pointer;
}

.sami-action-btn:hover { opacity: .88; }

/* ─── ÁREA DE INPUT ──────────────────────────────────────────────────────── */
.sami-chat-input-area {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
}

.sami-chat-input {
  flex: 1;
  border: 1.5px solid #dde3ef;
  color: #424242 !important;
  border-radius: 22px;
  padding: 8px 14px;
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
  min-width: 0;
  margin-bottom: 0 !important;
}

.sami-chat-input:focus { border-color: #252525; }

.sami-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #252525;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: opacity .15s, transform .15s;
  flex-shrink: 0;
}

.sami-chat-send:hover { opacity: .88; transform: scale(1.06); }

/* ─── FIM DO FLUXO ───────────────────────────────────────────────────────── */
.sami-chat-end {
  font-size: 11px;
  color: #999;
  text-align: center;
  padding: 8px 0 0;
  align-self: center;
}

/* ─── RESPONSIVO ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #sami-chat {
    bottom: 16px;
    right: 15px;
  }

  .sami-chat-window {
    width: calc(100vw - 32px);
    right: 0;
    bottom: 68px;
  }
}
