/* 
 * Guia Turístico Dores do Rio Preto
 * Estilo Premium do Módulo de Autoatendimento (Chatbot)
 */

.autoatendimento-modal {
  position: fixed;
  inset: var(--totem-safe-area-top, 0px) var(--totem-safe-area-right, 0px) var(--totem-safe-area-bottom, 0px) var(--totem-safe-area-left, 0px);
  z-index: 50;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms cubic-bezier(0.215, 0.61, 0.355, 1);
}

.autoatendimento-modal[hidden] {
  display: none !important;
}

.autoatendimento-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.autoatendimento-modal.is-closing {
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
}

.autoatendimento-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 18, 43, 0.48);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.autoatendimento-modal__panel {
  position: relative;
  width: min(95vw, 920px);
  height: min(94dvh, 1100px);
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 24px 64px rgba(0, 8, 36, 0.36);
  background: #ffffff;
  display: grid;
  grid-template-rows: auto 1fr;
  transform: translate3d(0, 0, 0);
}

.autoatendimento-modal__header {
  min-height: 72px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #0a4fd8 0%, #0639a0 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.autoatendimento-modal__header strong {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.autoatendimento-modal__close {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease;
}

.autoatendimento-modal__close:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.02);
}

.autoatendimento-modal__chat-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #f8fbfd 0%, #edf3f8 100%);
}

.autoatendimento-chat__messages {
  flex: 1;
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.autoatendimento-chat__messages::-webkit-scrollbar {
  width: 6px;
}

.autoatendimento-chat__messages::-webkit-scrollbar-track {
  background: transparent;
}

.autoatendimento-chat__messages::-webkit-scrollbar-thumb {
  background: rgba(0, 36, 120, 0.12);
  border-radius: 999px;
}

.autoatendimento-chat__messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 36, 120, 0.24);
}

/* Chat Row Wrapper */
.autoatendimento-chat__row {
  display: flex;
  gap: 12px;
  width: 100%;
  align-items: flex-start;
}
.autoatendimento-chat__row--bot {
  justify-content: flex-start;
}
.autoatendimento-chat__row--user {
  justify-content: flex-end;
}

/* Avatar Styling - 3D flutuante, sem recorte circular */
.autoatendimento-chat__avatar {
  width: 64px;
  height: 64px;
  border-radius: 0;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
  /* Animação de flutuação suave */
  animation: avatarFloat 3s ease-in-out infinite;
  filter: drop-shadow(0 6px 12px rgba(0, 36, 120, 0.18));
}

@keyframes avatarFloat {
  0%   { transform: translateY(0px); }
  50%  { transform: translateY(-7px); }
  100% { transform: translateY(0px); }
}

/* Chat Bubbles */
.autoatendimento-chat__bubble {
  max-width: 78%;
  padding: 14px 18px;
  font-size: 1rem;
  line-height: 1.44;
  box-shadow: 0 4px 14px rgba(0, 8, 48, 0.04);
  word-wrap: break-word;
  word-break: break-word;
}

.autoatendimento-chat__bubble--bot {
  background: #ffffff;
  color: #1e293b;
  border-radius: 20px 20px 20px 4px;
  border: 1px solid rgba(0, 36, 120, 0.05);
}

.autoatendimento-chat__bubble--user {
  background: linear-gradient(135deg, #075fe8 0%, #0548be 100%);
  color: #ffffff;
  border-radius: 20px 20px 4px 20px;
  box-shadow: 0 6px 20px rgba(7, 95, 232, 0.2);
}

/* Typing Indicator */
.autoatendimento-chat__bubble--typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 18px;
  min-height: 44px;
}

.autoatendimento-chat__bubble--typing .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #075fe8;
  opacity: 0.65;
  display: inline-block;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.autoatendimento-chat__bubble--typing .dot:nth-child(1) {
  animation-delay: -0.32s;
}

.autoatendimento-chat__bubble--typing .dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.6) translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.15) translateY(-5px);
    opacity: 1;
  }
}

/* Chat Input Form */
.autoatendimento-chat__input-area {
  padding: 16px 20px;
  background: #ffffff;
  border-top: 1px solid rgba(0, 36, 120, 0.06);
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.02);
}

.autoatendimento-chat__input-area input {
  flex: 1;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 24px;
  border: 1.5px solid rgba(0, 36, 120, 0.12);
  background: #f8fafc;
  color: #1e293b;
  font-family: inherit;
  font-size: 0.96rem;
  outline: none;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.autoatendimento-chat__input-area input:focus {
  border-color: #075fe8;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(7, 95, 232, 0.14);
}

.autoatendimento-chat__input-area button {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, #075fe8 0%, #0548be 100%);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(7, 95, 232, 0.24);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.autoatendimento-chat__input-area button:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 20px rgba(7, 95, 232, 0.32);
}

.autoatendimento-chat__input-area button:active {
  transform: translateY(0) scale(0.98);
}

.autoatendimento-chat__input-area button .material-symbols-outlined {
  font-size: 20px;
  line-height: 1;
}

.autoatendimento-chat__keyboard-shell {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px);
  transition: max-height 280ms ease, opacity 220ms ease, transform 220ms ease, padding 220ms ease;
  background: #ffffff;
  border-top: 1px solid rgba(0, 36, 120, 0.06);
  padding: 0 12px;
}

.autoatendimento-chat__keyboard-shell.is-visible {
  max-height: 340px;
  opacity: 1;
  transform: translateY(0);
  padding: 10px 12px 12px;
}

.autoatendimento-chat__keyboard-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.autoatendimento-chat__keyboard-hide-btn {
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(0, 36, 120, 0.14);
  background: #eef4fa;
  color: #0b2f73;
  padding: 0 12px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.autoatendimento-chat__keyboard-hide-btn .material-symbols-outlined {
  font-size: 18px;
}

.autoatendimento-chat__virtual-keyboard {
  position: relative;
  overflow: visible;
  background: #eef4fa;
  border-radius: 18px;
  padding: 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 36, 120, 0.06);
}

.autoatendimento-chat__keyboard-row {
  display: grid;
  grid-template-columns: repeat(var(--key-count, 10), minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.autoatendimento-chat__keyboard-row:last-child {
  margin-bottom: 0;
}

.autoatendimento-chat__key {
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(0, 36, 120, 0.08);
  color: #0f172a;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(0, 36, 120, 0.08);
  font-size: 1rem;
  font-weight: 600;
  touch-action: manipulation;
}

.autoatendimento-chat__key:active {
  transform: scale(0.98);
}

.autoatendimento-chat__key.is-pressed {
  background: #e8f0ff;
}

.autoatendimento-chat__key--space {
  grid-column: span 1;
}

.autoatendimento-chat__key--bksp,
.autoatendimento-chat__key--enter,
.autoatendimento-chat__key--shift,
.autoatendimento-chat__key--mode,
.autoatendimento-chat__key.is-active {
  background: #e3ecfb;
}

.autoatendimento-chat__accent-menu {
  position: absolute;
  z-index: 5;
  display: flex;
  gap: 6px;
  background: #0f2f6b;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 10px 24px rgba(7, 23, 59, 0.35);
}

.autoatendimento-chat__accent-option {
  min-width: 34px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: #ffffff;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 700;
}

/* Responsiveness */
@media (max-width: 600px) {
  .autoatendimento-modal__panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }

  .autoatendimento-chat__keyboard-shell.is-visible {
    max-height: 360px;
    padding: 8px 10px 10px;
  }

  .autoatendimento-chat__key {
    height: 44px;
    font-size: 0.95rem;
  }

  .autoatendimento-chat__keyboard-row {
    gap: 6px;
    margin-bottom: 6px;
  }
}

/* Sugestões de Respostas Rápidas (Pílulas) */
.autoatendimento-chat__suggestions {
  padding: 10px 20px;
  background: #ffffff;
  border-top: 1px solid rgba(0, 36, 120, 0.04);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  /* Transição suave de visibilidade */
  max-height: 200px;
  overflow: hidden;
  opacity: 1;
  transition: max-height 400ms ease, opacity 300ms ease, padding 300ms ease;
}

/* Classe para esconder as pílulas após início da conversa */
.autoatendimento-chat__suggestions.is-hidden {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top-color: transparent;
  pointer-events: none;
}

.autoatendimento-chat__pill {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(7, 95, 232, 0.15);
  background: rgba(7, 95, 232, 0.04);
  color: #0639a0;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 180ms cubic-bezier(0.215, 0.61, 0.355, 1);
  user-select: none;
}

.autoatendimento-chat__pill:hover {
  background: linear-gradient(135deg, #075fe8 0%, #0548be 100%);
  color: #ffffff;
  border-color: transparent;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(7, 95, 232, 0.2);
}

.autoatendimento-chat__pill:active {
  transform: translateY(0);
  box-shadow: none;
}
