/* ============================================================
   As Digitais — Chat Web (Lara)  ·  Tema híbrido
   Layout estilo WhatsApp + paleta cyan/preto da As Digitais
   ============================================================ */
:root {
  --bg: #0a0c10;
  --chat-bg: #0e1116;
  --header: #11151c;
  --bot-bubble: #1b212b;
  --user-bubble: #114d5c;
  --user-bubble2: #0d3b47;
  --text: #eef2f6;
  --text2: rgba(238, 242, 246, 0.6);
  --text3: rgba(238, 242, 246, 0.4);
  --cyan: #00d4ff;
  --cyan-dim: #0aa9cc;
  --border: rgba(255, 255, 255, 0.07);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex; justify-content: center;
}

/* phone frame */
.phone {
  width: 100%; max-width: 460px; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--chat-bg);
  position: relative; overflow: hidden;
}

/* glow de fundo */
.phone::before {
  content: ''; position: absolute; top: -10%; left: -20%;
  width: 80%; height: 40%;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.12) 0%, transparent 70%);
  filter: blur(60px); pointer-events: none; z-index: 0;
}

/* ======= HEADER ======= */
.chat-header {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
}
.chat-header .back { color: var(--text2); font-size: 22px; text-decoration: none; line-height: 1; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  object-fit: cover; background: #1b212b;
  border: 1.5px solid var(--cyan);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.35);
}
.head-meta { flex: 1; min-width: 0; }
.head-name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.head-sub { font-size: 12px; color: var(--cyan); display: flex; align-items: center; gap: 5px; }
.head-sub::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: #25d366; box-shadow: 0 0 6px #25d366;
}
.head-actions { display: flex; align-items: center; gap: 8px; }
.head-btn {
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.28);
  color: var(--text); font-size: 12.5px; font-weight: 600;
  padding: 7px 11px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; line-height: 1;
  transition: background 0.15s;
}
.head-btn:hover, .head-btn:active { background: rgba(0, 212, 255, 0.16); }
.head-btn-icon { padding: 7px 9px; font-size: 14px; }
.head-btn[hidden] { display: none; }

/* ======= MENSAGENS ======= */
.messages {
  flex: 1; overflow-y: auto;
  padding: 18px 14px 8px;
  display: flex; flex-direction: column; gap: 8px;
  position: relative; z-index: 1;
  scroll-behavior: smooth;
}
.row { display: flex; }
.row.bot { justify-content: flex-start; }
.row.user { justify-content: flex-end; }

.bubble {
  max-width: 82%;
  padding: 9px 13px 7px;
  border-radius: 16px;
  font-size: 14.5px; line-height: 1.45;
  position: relative;
  word-wrap: break-word; white-space: normal;
  animation: pop 0.28s var(--ease) both;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.row.bot .bubble { background: var(--bot-bubble); border-bottom-left-radius: 5px; }
.row.user .bubble {
  background: linear-gradient(135deg, var(--user-bubble) 0%, var(--user-bubble2) 100%);
  border-bottom-right-radius: 5px;
}
.bubble strong { font-weight: 700; color: #fff; }
.bubble .time {
  display: block; text-align: right;
  font-size: 10px; color: var(--text3); margin-top: 3px;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }

/* digitando */
.typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text2);
  animation: blink 1.3s infinite both;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ======= CARD DE PERFIL ======= */
.profile-card { width: 82%; padding: 12px; }
.pc-head { display: flex; align-items: center; gap: 10px; }
.pc-pic { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--cyan); }
.pc-name { font-weight: 700; font-size: 14px; }
.pc-user { font-size: 12px; color: var(--cyan); }
.pc-stat { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; }

/* ======= CARD PIX ======= */
.pix-card { width: 82%; padding: 14px; text-align: center; }
.pix-title { font-weight: 700; color: var(--cyan); margin-bottom: 10px; }
.pix-qr {
  width: 150px; height: 150px; margin: 0 auto 10px; display: block;
  border-radius: 10px; background: #fff; object-fit: contain; padding: 6px;
}
.pix-qr-fallback {
  display: flex; align-items: center; justify-content: center;
  color: #0a0c10; font-weight: 800; font-size: 18px; line-height: 1.2;
}
.pix-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; text-align: left; }
.pix-code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; word-break: break-all; text-align: left;
  background: rgba(0, 0, 0, 0.35); padding: 8px; border-radius: 8px;
  margin: 4px 0 10px; color: var(--text2); max-height: 70px; overflow-y: auto;
}
.pix-copy {
  width: 100%; padding: 11px;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--cyan-dim) 100%);
  color: #001820; font-weight: 700; font-size: 14px;
  border: none; border-radius: 12px; cursor: pointer;
}

/* ======= CONTROLES (botões / input) ======= */
.controls {
  position: relative; z-index: 2;
  padding: 10px 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid var(--border);
  background: var(--header);
}
.choice-btn {
  width: 100%; padding: 13px 16px;
  background: rgba(0, 212, 255, 0.06);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: var(--text); font-size: 14.5px; font-weight: 600;
  border-radius: 14px; cursor: pointer; text-align: center;
  transition: transform 0.2s var(--ease), background 0.2s, box-shadow 0.2s;
  animation: pop 0.25s var(--ease) both;
}
.choice-btn:hover, .choice-btn:active {
  background: rgba(0, 212, 255, 0.14);
  box-shadow: 0 0 0 1px var(--cyan), 0 6px 20px rgba(0, 212, 255, 0.2);
  transform: translateY(-1px);
}

/* botão com título + descrição (ex.: upsell de engajamento) */
.choice-btn.choice-rich {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 14px; line-height: 1.3;
}
.choice-btn.choice-rich .choice-title { font-size: 14.5px; font-weight: 700; }
.choice-btn.choice-rich .choice-sub {
  font-size: 11.5px; font-weight: 500; color: var(--text2);
}

.input-bar { display: flex; gap: 8px; align-items: center; }
.input-field {
  flex: 1; padding: 13px 16px;
  background: var(--chat-bg); border: 1px solid var(--border);
  color: var(--text); font-size: 15px; border-radius: 22px; outline: none;
}
.input-field:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.15); }
.input-send {
  width: 46px; height: 46px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--cyan-dim) 100%);
  color: #001820; border: none; border-radius: 50%; cursor: pointer;
  font-size: 17px; display: flex; align-items: center; justify-content: center;
}

.rating-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.rating-btn {
  aspect-ratio: 1; border-radius: 11px;
  background: rgba(0, 212, 255, 0.06); border: 1px solid rgba(0, 212, 255, 0.25);
  color: var(--text); font-weight: 700; font-size: 15px; cursor: pointer;
}
.rating-btn:hover { background: rgba(0, 212, 255, 0.16); box-shadow: 0 0 0 1px var(--cyan); }

.restart-btn {
  width: 100%; padding: 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border);
  color: var(--text2); font-size: 13px; border-radius: 12px; cursor: pointer;
}

/* scrollbar discreta */
.messages::-webkit-scrollbar, .pix-code::-webkit-scrollbar { width: 5px; }
.messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }

/* botão secundário (‹ Voltar / Ver todos) — mais discreto que as opções principais */
.choice-btn.choice-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text2);
  font-weight: 500;
}
.choice-btn.choice-secondary:hover, .choice-btn.choice-secondary:active {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  color: var(--text);
}

/* ======= DESKTOP: moldura de "device" centralizada ======= */
@media (min-width: 600px) {
  body {
    align-items: center;
    padding: 24px;
    background:
      radial-gradient(60% 50% at 50% 30%, rgba(0, 212, 255, 0.10), transparent 70%),
      var(--bg);
  }
  .phone {
    height: min(880px, calc(100dvh - 48px));
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
      0 30px 90px rgba(0, 0, 0, 0.7),
      0 0 60px rgba(0, 212, 255, 0.06),
      inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  }
}
