/* Chat Conversacional Maximizar Vendas - Estilo WhatsApp */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #090e11; color: #e9edef; display: flex; align-items: center;
  justify-content: center; height: 100vh; height: 100dvh; -webkit-font-smoothing: antialiased;
}

:root {
  --frame-bg: #111b21; --header-bg: #202c33; --chat-bg: #0b141a;
  --bubble-in: #005c4b; --bubble-out: #202c33; --text-primary: #e9edef;
  --text-secondary: #8696a0; --text-bubble-in: #e9edef; --text-bubble-out: #e9edef;
  --text-input: #e9edef; --input-bg: #202c33; --input-bar-bg: #202c33;
  --border-input: #2d3b45; --accent: #00a884; --accent-hover: #06cf9c;
  --shadow: 0 1px 1px rgba(0,0,0,0.4); --scrollbar: #374045; --typing-dot: #8696a0;
  --gold: #c9a84c; --navy: #0a1628;
}

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

@media (min-width: 768px) {
  .chat-frame { width: 420px; height: min(700px, calc(100vh - 20px)); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,0.5); max-width: 420px; max-height: min(700px, calc(100vh - 20px)); }
}

.chat-header {
  display: flex; align-items: center; padding: 10px 12px;
  background: var(--header-bg); flex-shrink: 0; gap: 10px; min-height: 56px;
}
.chat-header .back-btn {
  background: none; border: none; color: var(--text-secondary);
  font-size: 22px; cursor: pointer; padding: 4px; display: flex; align-items: center;
}
.chat-header .back-btn:hover { opacity: 0.7; }
.chat-header .avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  background: linear-gradient(135deg,var(--gold),var(--accent));
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  color: white; font-size: 18px;
}
.chat-header .info { flex: 1; min-width: 0; }
.chat-header .info h2 { font-size: 16px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.chat-header .info p { font-size: 12px; color: var(--accent); line-height: 1.2; }
.chat-header .header-actions { display: flex; gap: 6px; align-items: center; }
.chat-header .header-actions .gold-btn {
  background: var(--gold); border: none; color: var(--navy); font-size: 12px;
  font-weight: 700; cursor: pointer; padding: 6px 14px; border-radius: 20px;
  transition: all 0.2s; text-decoration: none; letter-spacing: .5px;
}
.chat-header .header-actions .gold-btn:hover { transform: scale(1.05); }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 14px 8px; background: var(--chat-bg);
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300" opacity="0.03"><circle cx="50" cy="50" r="2" fill="%23fff"/><circle cx="150" cy="30" r="1.5" fill="%23fff"/><circle cx="250" cy="80" r="2" fill="%23fff"/><circle cx="80" cy="180" r="1.5" fill="%23fff"/><circle cx="200" cy="200" r="2" fill="%23fff"/><circle cx="30" cy="130" r="1" fill="%23fff"/><circle cx="270" cy="150" r="1.5" fill="%23fff"/><circle cx="120" cy="260" r="2" fill="%23fff"/><circle cx="220" cy="100" r="1" fill="%23fff"/></svg>');
  background-repeat: repeat; scroll-behavior: smooth; display: flex; flex-direction: column;
}
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

.message { display: flex; flex-direction: column; margin-bottom: 3px; animation: msgIn 0.25s ease; max-width: 100%; }
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.message.bot { align-items: flex-start; }
.message.user { align-items: flex-end; }
.bubble { max-width: 88%; padding: 6px 10px 5px; border-radius: 8px; font-size: 14.2px; line-height: 1.45; position: relative; word-wrap: break-word; box-shadow: var(--shadow); }
.message.bot .bubble { background: var(--bubble-in); color: var(--text-bubble-in); border-top-left-radius: 3px; }
.message.user .bubble { background: var(--bubble-out); color: var(--text-bubble-out); border-top-right-radius: 3px; }
.bubble .msg-time { display: flex; justify-content: flex-end; align-items: center; gap: 3px; font-size: 11px; color: var(--text-secondary); margin-top: 1px; opacity: 0.7; line-height: 1; }
.bubble .msg-time .check { font-size: 14px; color: #53bdeb; }
.bubble strong { color: #fff; }

.typing-indicator { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 3px; animation: msgIn 0.25s ease; align-self: flex-start; }
.typing-indicator .typing-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg,var(--gold),var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: white; font-weight: 600; margin-top: 2px;
}
.typing-bubble { background: var(--bubble-in); padding: 10px 14px; border-radius: 8px; border-top-left-radius: 3px; display: flex; gap: 4px; align-items: center; }
.typing-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--typing-dot); animation: typingBounce 1.4s infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,60%,100%{transform:translateY(0);opacity:.4} 30%{transform:translateY(-6px);opacity:1} }

.input-bar { display: flex; align-items: flex-end; gap: 6px; padding: 6px 10px 8px; background: var(--input-bar-bg); flex-shrink: 0; }
.input-bar input, .input-bar select, .input-bar textarea {
  flex:1; padding:9px 12px; border-radius:8px; border:1px solid var(--border-input);
  background:var(--input-bg); color:var(--text-input); font-size:15px;
  font-family:'Inter',sans-serif; outline:none; transition:border-color .2s;
  resize:none; min-height:40px; max-height:100px;
}
.input-bar input:focus, .input-bar select:focus, .input-bar textarea:focus { border-color: var(--accent); }
.input-bar input::placeholder, .input-bar textarea::placeholder { color: var(--text-secondary); opacity: 0.7; }
.send-btn { width:40px; height:40px; border-radius:50%; border:none; background:var(--accent); color:white; font-size:18px; cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:all .2s; }
.send-btn:hover { background:var(--accent-hover); }
.send-btn:disabled { background:#2a3942; color:#54656f; cursor:not-allowed; }

.yesno-group { display: flex; gap: 10px; width: 100%; max-width: 320px; justify-content: center; padding: 8px 0; margin: 0 auto; }
.yesno-btn { flex: 1; max-width: 140px; padding: 12px 16px; border: none; border-radius: 24px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: 'Inter', sans-serif; }
.yesno-btn:hover { transform: scale(1.05); }
.yesno-btn:active { transform: scale(0.95); }
.yesno-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.yes-btn { background: #00a884; color: #fff; }
.yes-btn:hover { background: #06cf9a; }
.no-btn { background: #ef4444; color: #fff; }
.no-btn:hover { background: #f87171; }

.final-screen { text-align: center; padding: 40px 20px; }
.final-screen .final-icon { font-size: 64px; margin-bottom: 16px; }
.final-screen h3 { font-size: 20px; margin-bottom: 12px; color: var(--text-primary); }
.final-screen p { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 24px; }
.final-screen .summary-card {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px; padding: 16px; margin: 16px auto; max-width: 380px; text-align: left;
}
.final-screen .summary-card .pillar-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
.final-screen .summary-card .pillar-row:last-child { border-bottom: none; }
.final-screen .summary-card .pillar-badge {
  background: var(--accent); color: #fff; border-radius: 20px;
  padding: 2px 10px; font-size: 12px; font-weight: 600;
}
.btn-final { display: inline-block; padding: 14px 32px; background: var(--gold); color: var(--navy); border: none; border-radius: 24px; font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none; transition: all 0.2s; letter-spacing: .5px; text-transform: uppercase; }
.btn-final:hover { background: #dbb84c; transform: scale(1.03); }

@media (max-width: 767px) {
  body { height: 100dvh; }
  .chat-frame { border-radius: 0; }
  .yesno-btn { max-width: none; flex: 1; }
}
