/* ============================================================
   chat.css — Estilos do chat Assistente Virtual SINDSUPER/RN
   Componentes: shell, header, mensagens, botões, inputs, cards.
   ============================================================ */

/* ---- Chat Shell (container principal) ---- */
.chat-shell {
  width: 100%;
  height: min(94vh, 860px);
  background: #fff;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.10);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ---- Hero / Banner no topo ---- */
.hero {
  background: #073b36;
  height: 132px;
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7,94,84,.05), rgba(7,94,84,.55));
  pointer-events: none;
}

/* ---- Header do Chat ---- */
.chat-header {
  background: linear-gradient(135deg, var(--wa-header) 0%, var(--wa-header2) 100%);
  color: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.avatar,
.avatar-fallback {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 2px solid rgba(255,255,255,.75);
  background: #fff;
  object-fit: cover;
  box-shadow: 0 3px 12px rgba(0,0,0,.20);
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--yellow);
  color: #073b36;
  font-weight: 900;
}

.chat-title {
  min-width: 0;
  line-height: 1.1;
  flex: 1;
}

.chat-title h1 {
  font-size: .96rem;
  margin: 0;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-title small {
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: .92;
  font-size: .76rem;
  margin-top: 3px;
}

.online-dot {
  width: 7px;
  height: 7px;
  background: var(--wa-green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(37,211,102,.16);
  animation: pulse 2s infinite;
}

.header-icons {
  display: flex;
  gap: 12px;
  opacity: .95;
  font-size: 1rem;
}

/* Botão de reset no header */
.header-reset-btn {
  background: none;
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .85rem;
  transition: background .2s;
}

.header-reset-btn:hover {
  background: rgba(255,255,255,.15);
}

/* ---- Corpo do Chat (área de mensagens) ---- */
.chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 12px 10px;
  background-color: var(--wa-light);
  background-image:
    radial-gradient(circle at 14px 18px, rgba(17,27,33,.045) 1.2px, transparent 1.2px),
    radial-gradient(circle at 54px 58px, rgba(17,27,33,.035) 1.1px, transparent 1.1px),
    linear-gradient(rgba(239,234,226,.86), rgba(239,234,226,.86));
  background-size: 72px 72px, 86px 86px, 100% 100%;
  scroll-behavior: smooth;
}

/* ---- Mensagens ---- */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin: 0 0 8px;
  animation: fadeIn .22s ease-out;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-row.bot {
  justify-content: flex-start;
}

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.9);
  background: var(--yellow);
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
}

/* Balão de mensagem */
.bubble {
  max-width: 82%;
  padding: 9px 11px 7px;
  border-radius: 9px;
  line-height: 1.42;
  font-size: .94rem;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
  box-shadow: 0 1px .5px rgba(11,20,26,.13);
}

.bot .bubble {
  background: var(--wa-bot);
  border-top-left-radius: 2px;
}

.user .bubble {
  background: var(--wa-user);
  border-top-right-radius: 2px;
  color: #111b21;
}

.bubble strong {
  font-weight: 900;
}

.bubble p {
  margin: 0 0 8px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble .msg-time {
  display: block;
  text-align: right;
  color: #667781;
  font-size: .66rem;
  margin-top: 4px;
  line-height: 1;
}

/* ---- Botões de Escolha ---- */
.choice-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin: 8px 0 14px 36px;
  width: calc(100% - 36px);
  max-width: calc(100% - 36px);
  animation: slideUp .2s ease-out;
}

.choice-btn {
  border: 0;
  border-radius: 18px;
  padding: 12px 15px;
  background: #fff;
  color: #075e54;
  font-weight: 900;
  font-size: .91rem;
  text-align: left;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  white-space: normal;
  text-transform: uppercase;
  letter-spacing: .02em;
  box-shadow: 0 1px .5px rgba(11,20,26,.13);
  cursor: pointer;
  transition: .14s transform, .14s background, .14s color, .14s box-shadow;
  border-left: 4px solid var(--wa-green);
}

.choice-btn:hover,
.choice-btn:focus-visible {
  transform: translateY(-1px);
  background: #f2fff7;
  color: #064d44;
  box-shadow: 0 3px 12px rgba(37,211,102,.12);
}

.choice-btn:active {
  transform: translateY(0);
}

.choice-btn.red   { border-left-color: var(--danger); color: #b4232c; background: #fff5f5; }
.choice-btn.green { border-left-color: var(--wa-green); color: #075e54; background: #f3fff7; }
.choice-btn.gold  { border-left-color: var(--yellow);  color: #7a4d00; background: #fff9e6; }
.choice-btn.gray  { border-left-color: #94a3b8;        color: #334155; background: #f8fafc; }

/* ---- Indicador de Digitando ---- */
.typing {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 18px;
}

.typing span {
  width: 6px;
  height: 6px;
  background: #8aa1c5;
  border-radius: 50%;
  display: inline-block;
  animation: typing 1s infinite ease-in-out;
}

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

/* ---- Área de Input ---- */
.input-area {
  flex: 0 0 auto;
  background: #f0f2f5;
  padding: 10px 10px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(17,27,33,.08);
}

.input-area.is-hidden {
  display: none;
}

.input-group-chat {
  display: flex;
  gap: 7px;
  align-items: flex-end;
}

.input-group-chat input,
.input-group-chat textarea {
  flex: 1;
  width: 100%;
  border: 0;
  border-radius: 22px;
  padding: 12px 15px;
  font-size: .96rem;
  outline: none;
  background: #fff;
  min-height: 52px;
  box-shadow: inset 0 0 0 1px rgba(17,27,33,.08);
  transition: box-shadow .2s;
}

.input-group-chat textarea {
  resize: none;
  height: 78px;
  border-radius: 18px;
}

.input-group-chat input:focus,
.input-group-chat textarea:focus {
  box-shadow: inset 0 0 0 2px rgba(18,140,126,.24);
}

.send-btn {
  border: 0;
  background: var(--wa-green);
  color: #083b2d;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  min-width: 52px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(37,211,102,.24);
  cursor: pointer;
  transition: background .2s, transform .1s;
}

.send-btn:hover  { background: #1fc45b; }
.send-btn:active { transform: scale(.95); }
.send-btn:disabled { opacity: .5; cursor: not-allowed; }

.send-label { display: none; }

.small-note {
  font-size: .70rem;
  color: #667781;
  margin: 5px 6px 0;
}

/* ---- Indicador de Progresso (formulários) ---- */
.progress-steps {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 4px 0 10px 36px;
  font-size: .75rem;
  color: #667781;
}

.progress-steps .step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background .3s;
}

.progress-steps .step-dot.done  { background: var(--wa-green); }
.progress-steps .step-dot.active { background: var(--wa-header2); box-shadow: 0 0 0 3px rgba(18,140,126,.2); }

/* ---- GIF Box ---- */
.gif-box {
  margin: 3px 0 8px;
  border-radius: 12px;
  overflow: hidden;
  background: #dfe5e7;
  border: 1px solid rgba(17,27,33,.08);
  max-width: 245px;
  box-shadow: 0 1px .5px rgba(11,20,26,.08);
}

.gif-box img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
}

/* ---- Banner Local ---- */
.local-banner {
  margin: 5px 0 10px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(17,27,33,.08);
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  background: #111b21;
}

.local-banner img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
}

/* ---- Mini Card (conteúdo destacado) ---- */
.mini-card {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 12px;
  margin: 6px 0;
  white-space: normal;
}

.mini-card h3 {
  font-size: 1rem;
  margin: 0 0 8px;
  font-weight: 900;
  color: #075e54;
}

.mini-card ul {
  margin: 0;
  padding-left: 18px;
}

.mini-card li {
  margin: 4px 0;
}

.mini-card .tag {
  display: inline-block;
  background: #e7f7ee;
  color: #075e54;
  border-radius: 999px;
  padding: 3px 9px;
  font-weight: 900;
  font-size: .78rem;
  margin: 2px 4px 6px 0;
}

/* ---- Timeline ---- */
.timeline {
  border-left: 3px solid #25d366;
  padding-left: 12px;
}

.timeline b {
  color: #075e54;
}

.timeline div {
  margin: 0 0 10px;
}

/* ---- Google Maps ---- */
.map-box {
  margin: 8px 0 10px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(17,27,33,.12);
  background: #e5e7eb;
  box-shadow: 0 2px 12px rgba(0,0,0,.10);
}

.map-box iframe {
  display: block;
  width: 100%;
  height: 210px;
  border: 0;
}

/* ---- Links de Ação ---- */
.link-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 4px;
}

.chat-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  text-decoration: none;
  border-radius: 16px;
  padding: 11px 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .02em;
  background: #e7f7ee;
  color: #075e54;
  border: 1px solid rgba(7,94,84,.15);
  transition: background .2s, color .2s;
}

.chat-link-btn:hover {
  background: #d9f5e5;
  color: #064d44;
}

.chat-link-btn.call {
  background: #fff9e6;
  color: #7a4d00;
  border-color: rgba(122,77,0,.16);
}

/* ---- Link "Voltar" estilizado ---- */
.choice-link-under {
  padding-top: 2px;
  text-align: center;
}

.choice-link-under a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 900;
  color: #075e54;
  background: #e7f7ee;
  border: 1px solid rgba(7,94,84,.12);
  padding: 10px 14px;
  border-radius: 999px;
  text-transform: uppercase;
  font-size: .79rem;
  letter-spacing: .02em;
  transition: background .2s, color .2s;
}

.choice-link-under a:hover {
  background: #d9f5e5;
  color: #064d44;
}

/* ============================================================
   RESPONSIVO — Mobile-First para telas ≤ 720px
   ============================================================ */
@media (max-width: 720px) {
  html, body {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .page-wrap {
    padding: 0;
    display: block;
    min-height: 100dvh;
    height: 100dvh;
  }

  .chat-shell {
    border-radius: 0;
    min-height: 100dvh;
    height: 100dvh;
    max-height: 100dvh;
  }

  .hero {
    height: 116px;
  }

  .chat-header {
    padding: 9px 10px;
  }

  .chat-body {
    padding-bottom: 18px;
  }

  .bubble {
    max-width: 85%;
    font-size: .93rem;
  }

  .choice-wrap {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    align-items: stretch;
  }

  .header-icons {
    display: none;
  }

  .input-area {
    padding: 11px 12px calc(34px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 18px rgba(11,20,26,.08);
  }

  .input-group-chat input,
  .input-group-chat textarea {
    min-height: 58px;
    font-size: 1rem;
    padding: 15px 16px;
    border-radius: 26px;
  }

  .input-group-chat textarea {
    height: 92px;
    border-radius: 20px;
  }

  .send-btn {
    width: 58px;
    height: 58px;
    min-width: 58px;
    font-size: 1.08rem;
  }

  .map-box iframe {
    height: 190px;
  }
}
