/* Crachá — Clara Concierge Widget (Paleta Direção A · Padrão Mercado Profissional) */
.clara-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px 8px 8px;
  background: var(--ink, #0F172A);
  border: 2px solid var(--yellow, #FFC107);
  border-radius: 999px;
  color: #FFFFFF;
  font-family: var(--display, 'Bricolage Grotesque', sans-serif);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28), 0 2px 6px rgba(15, 23, 42, 0.16);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background 0.15s ease;
}
.clara-fab:hover {
  transform: translateY(-2px);
  background: var(--teal-deep, #0B4F5C);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.34);
}
.clara-fab-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.clara-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--teal, #0F766E);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  border: 2px solid var(--yellow, #FFC107);
  object-fit: cover;
  flex-shrink: 0;
}
.clara-fab-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22C55E;
  border: 2px solid var(--ink, #0F172A);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.35);
}
.clara-fab-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
}
.clara-fab-label strong {
  font-size: 14px;
  font-weight: 800;
  color: #FFFFFF;
}
.clara-fab-label small {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--yellow, #FFC107);
}

/* Janela de Chat Profissional */
.clara-widget {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: min(396px, calc(100vw - 32px));
  height: min(580px, calc(100vh - 120px));
  background: var(--paper, #F8FAFC);
  border: 2px solid var(--ink, #0F172A);
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  font-family: var(--display, 'Bricolage Grotesque', sans-serif);
  animation: claraWidgetIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes claraWidgetIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.clara-widget[hidden] {
  display: none !important;
}
.clara-head {
  background: var(--ink, #0F172A);
  border-bottom: 3px solid var(--yellow, #FFC107);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #FFFFFF;
}
.clara-head-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.clara-head-title {
  font-weight: 800;
  font-size: 16px;
  color: #FFFFFF;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 6px;
}
.clara-head-online {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22C55E;
  display: inline-block;
}
.clara-head-sub {
  font-size: 12px;
  color: var(--yellow, #FFC107);
  font-weight: 600;
  margin-top: 2px;
}
.clara-close {
  background: rgba(255, 255, 255, 0.12) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.28) !important;
  border-radius: 50% !important;
  width: 36px !important;
  height: 36px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  color: #FFFFFF !important;
  transition: all 0.15s ease !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
  padding: 0 !important;
}
.clara-close svg {
  display: block !important;
  color: #FFFFFF !important;
  stroke: #FFFFFF !important;
  transition: stroke 0.15s ease !important;
}
.clara-close:hover {
  background: #C8372D !important;
  border-color: #C8372D !important;
  color: #FFFFFF !important;
  transform: scale(1.06) !important;
}
.clara-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #EFEAE2;
  background-image: radial-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 0);
  background-size: 18px 18px;
}
.clara-msg {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.48;
  word-break: break-word;
  position: relative;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.clara-msg.bot {
  align-self: flex-start;
  background: #FFFFFF;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-top-left-radius: 4px;
  color: var(--ink, #0F172A);
  font-family: var(--display, 'Bricolage Grotesque', sans-serif);
}
.clara-msg.bot .clara-p {
  margin-bottom: 8px;
}
.clara-msg.bot .clara-p:last-child {
  margin-bottom: 0;
}
.clara-msg.bot .clara-bullet {
  padding-left: 4px;
  margin: 5px 0;
  display: block;
  line-height: 1.42;
}
.clara-msg.bot strong {
  color: var(--ink, #0F172A);
  font-weight: 700;
}
.clara-msg.bot .clara-link-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--yellow, #FFC107);
  border: 1.5px solid var(--ink, #0F172A);
  border-radius: 999px;
  color: var(--ink, #0F172A);
  font-family: var(--display, 'Bricolage Grotesque', sans-serif);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  padding: 7px 14px;
  margin: 6px 0 2px;
  box-shadow: 0 2px 0 var(--ink, #0F172A);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.clara-msg.bot .clara-link-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--ink, #0F172A);
}
.clara-msg.user {
  align-self: flex-end;
  background: #D9FDD3;
  color: #111B21;
  border: 1px solid rgba(17, 27, 33, 0.08);
  border-top-right-radius: 4px;
  font-weight: 500;
}
.clara-msg.operator {
  align-self: flex-start;
  background: #FFFCEB;
  border: 1.5px solid var(--ink, #0F172A);
  color: var(--ink, #0F172A);
  box-shadow: 2px 2px 0 var(--ink, #0F172A);
}
.clara-operator-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--teal, #0F766E);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Balão de "Digitando..." estilo WhatsApp */
.clara-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
}
.clara-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.clara-typing-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal, #0F766E);
  display: inline-block;
  animation: claraDotBounce 1.3s infinite ease-in-out;
}
.clara-typing-dots i:nth-child(2) {
  animation-delay: 0.18s;
}
.clara-typing-dots i:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes claraDotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.clara-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.clara-chip {
  background: #FFFFFF;
  border: 1.5px solid var(--teal, #0F766E);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--teal, #0F766E);
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: left;
}
.clara-chip:hover {
  background: var(--salvia, #E6F4F1);
  color: var(--ink, #0F172A);
}
.clara-gate {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FFFFFF;
  border: 1.5px solid var(--line, #D6DFE6);
  border-radius: 16px;
  margin: auto 0;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}
.clara-gate h3 {
  font-size: 16.5px;
  font-weight: 800;
  color: var(--ink, #0F172A);
  margin: 0;
}
.clara-gate p {
  font-size: 13.5px;
  color: var(--ink-2, #334155);
  margin: 0;
  line-height: 1.45;
}
.clara-gate input, .clara-gate select {
  height: 46px;
  padding: 10px 14px;
  border: 1.5px solid var(--line, #CBD5E1);
  border-radius: 12px;
  font-size: 14.5px;
  font-family: inherit;
  background: var(--paper, #F8FAFC);
  color: var(--ink, #0F172A);
}
.clara-gate input:focus {
  border-color: var(--teal, #0F766E);
  background: #FFFFFF;
  outline: none;
}
.clara-gate-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-2, #475569);
  line-height: 1.35;
}
.clara-foot {
  padding: 10px 12px;
  background: #F0F2F5;
  border-top: 1px solid var(--line, #D6DFE6);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.clara-foot textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #CBD5E1;
  border-radius: 20px;
  font-size: 14.5px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 110px;
  line-height: 1.4;
  background: #FFFFFF;
  color: var(--ink, #0F172A);
  box-sizing: border-box;
}
.clara-foot textarea:focus {
  border-color: var(--teal, #0F766E);
  outline: none;
}
.clara-btn-send {
  background: var(--yellow, #FFC107);
  border: 2px solid var(--ink, #0F172A);
  border-radius: 999px;
  padding: 0 18px;
  height: 44px;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--ink, #0F172A);
  transition: transform 0.12s ease, background 0.12s ease;
}
.clara-btn-send:hover {
  background: #ffc91a;
  transform: translateY(-1px);
}
.clara-handoff-banner {
  background: #E5F6ED;
  border: 1.5px solid #0F4D2C;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #0F4D2C;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.clara-handoff-btn {
  background: #25D366;
  color: #0F172A;
  border: 1.5px solid var(--ink, #0F172A);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  text-align: center;
  display: inline-block;
}

/* Balão Proativo de Provocação Contextual (Speech Bubble Alinhado ao Ícone da Clara) */
.clara-teaser {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: max-content;
  max-width: min(300px, calc(100vw - 32px));
  background: #FFFFFF;
  border: 2px solid var(--ink, #0F172A);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
  font-family: var(--display, 'Bricolage Grotesque', sans-serif);
  font-size: 13.5px;
  line-height: 1.42;
  color: var(--ink, #0F172A);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: claraTeaserIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.clara-teaser:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.26);
}
.clara-teaser::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 22px;
  width: 13px;
  height: 13px;
  background: #FFFFFF;
  border-right: 2px solid var(--ink, #0F172A);
  border-bottom: 2px solid var(--ink, #0F172A);
  transform: rotate(45deg);
}
.clara-teaser-body {
  flex: 1;
}
.clara-teaser-body strong {
  display: block;
  font-size: 12px;
  color: var(--teal, #0F766E);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.clara-teaser-close {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink, #0F172A);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.clara-teaser-close:hover {
  background: #C8372D;
  border-color: #C8372D;
  color: #FFFFFF;
}

@keyframes claraTeaserIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsividade Mobile — Botão Circular 58x58px Perfeito + Balão Alinhado ao Centro do Ícone */
@media (max-width: 720px) {
  .clara-fab {
    bottom: 16px;
    right: 16px;
    width: 58px;
    height: 58px;
    padding: 0;
    gap: 0;
    border-radius: 50%;
    justify-content: center;
  }
  .clara-fab-label,
  .clara-fab > span {
    display: none !important;
  }
  .clara-fab-avatar-wrap,
  .clara-fab .clara-avatar {
    width: 46px;
    height: 46px;
  }
  .clara-teaser {
    bottom: 84px;
    right: 16px;
    left: auto;
    max-width: min(288px, calc(100vw - 32px));
  }
  .clara-teaser::after {
    right: 21px;
  }
  /* Quando a página tem a barra inferior fixa (.mbar), ambos sobem exatamente 64px juntos */
  body:has(.mbar) .clara-fab,
  body.has-mbar .clara-fab {
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  }
  body:has(.mbar) .clara-teaser,
  body.has-mbar .clara-teaser {
    bottom: calc(142px + env(safe-area-inset-bottom, 0px));
  }
  .clara-widget {
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 85vh !important;
    max-height: 85vh !important;
    border-radius: 22px 22px 0 0 !important;
    border-bottom: none !important;
    border-left: none !important;
    border-right: none !important;
    box-shadow: 0 -10px 36px rgba(15, 23, 42, 0.32) !important;
  }
  body:has(.clara-fab) {
    padding-bottom: clamp(88px, 13vh, 132px);
  }
  body:has(.clara-fab):has(.mbar) {
    padding-bottom: clamp(152px, 22vh, 208px);
  }
}
