@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #0b0f1a;
    --panel: #121829;
    --panel-2: #0f1524;
    --accent: #6c63ff;
    --accent-2: #00e5ff;
    --text: #e6e9f5;
    --muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --shadow: 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
    color: var(--text);
    background: radial-gradient(1200px 700px at 20% 10%, #16203a 0%, transparent 60%),
               radial-gradient(900px 500px at 90% 10%, #111a33 0%, transparent 60%),
               var(--bg);
    overflow: hidden;
}

.background-layers .blob {
    position: fixed;
    filter: blur(40px);
    opacity: .35;
    z-index: 0;
    animation: float 12s ease-in-out infinite;
}
.background-layers .b1 { background: var(--accent); width: 320px; height: 320px; top: -60px; left: -60px; border-radius: 50%; }
.background-layers .b2 { background: var(--accent-2); width: 280px; height: 280px; bottom: -80px; right: -40px; border-radius: 50%; animation-delay: 1.2s; }
.background-layers .b3 { background: #22d3ee; width: 220px; height: 220px; bottom: 20%; left: -70px; border-radius: 50%; animation-delay: 2.4s; }
.background-layers .grid { position: fixed; inset: 0; background-image: linear-gradient(transparent 95%, rgba(255,255,255,.04) 95%), linear-gradient(90deg, transparent 95%, rgba(255,255,255,.04) 95%); background-size: 22px 22px; opacity: .2; }

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(20px) translateX(10px); }
}

.chat-container {
    position: relative;
    z-index: 1;
    width: min(920px, 96vw);
    height: min(90vh, 900px);
    margin: 4vh auto 0;
    background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(6px);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(180deg, #161e34, #0f1524);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 44px; height: 44px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-radius: 12px; color: #fff; box-shadow: 0 6px 20px rgba(108,99,255,.35); }
.brand-text h1 { font-size: 16px; margin: 0; letter-spacing: .2px; }
.brand-text p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.header-actions { display: flex; gap: 10px; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 10px; background: #151b2e; color: var(--text); cursor: pointer; display: grid; place-items: center; transition: transform .15s ease, background .2s ease, box-shadow .2s; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); text-decoration: none; }
.icon-button:hover { transform: translateY(-1px); background: #1a223a; box-shadow: 0 10px 20px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255,255,255,.12); }
.icon-button:focus { outline: none; text-decoration: none; }

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: radial-gradient(800px 400px at 30% 0%, rgba(108,99,255,.12), transparent 60%);
}

.chat-cta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    background: linear-gradient(180deg, #0f1526, #0b1224);
}
.chat-cta .left { display: flex; flex-direction: column; gap: 2px; }
.chat-cta h4 { margin: 0; font-weight: 600; }
.chat-cta p { margin: 0; color: var(--muted); font-size: 13px; }
.chat-cta .btn-whatsapp-pill { text-decoration: none; display: inline-flex; align-items: center; gap: 12px; padding: 14px 22px; border-radius: 999px; background: linear-gradient(135deg, #25D366, #128C7E); color: #fff; box-shadow: 0 12px 30px rgba(18,140,126,.35), inset 0 0 0 2px rgba(255,255,255,.18), 0 0 0 5px rgba(37,211,102,.15); text-transform: uppercase; font-weight: 700; letter-spacing: .4px; }
.chat-cta .btn-whatsapp-pill:hover { filter: brightness(1.05); transform: translateY(-1px); transition: transform .15s ease, filter .2s ease; }
.chat-cta .btn-whatsapp-pill i { width: 18px; }

.message { display: flex; align-items: flex-start; gap: 12px; flex-direction: column; }
.message.system { align-items: flex-end; }
.message > .row { display: flex; align-items: flex-start; gap: 12px; width: 100%; }
.message.system > .row { flex-direction: row-reverse; }
.message .avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #1a2442; color: #cbd5e1; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.message.user .avatar { background: #1f2a4d; color: #93c5fd; }

.bubble {
    background: linear-gradient(180deg, #1b233d, #141b31);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    position: relative;
    width: min(640px, 80%);
    min-height: 56px;
    display: inline-block;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.message.user .bubble { background: linear-gradient(180deg, #1a243f, #10182e); border-color: rgba(99,102,241,.35); }
.bubble .meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.bubble .author { font-weight: 600; color: #e2e8f0; }
.bubble .time { font-size: 12px; color: var(--muted); }
.bubble p { margin: 0; line-height: 1.5; color: #e6e9f5; }

.button-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; padding-left: 50px; }
.message.system .button-row { justify-content: flex-end; padding-left: 0; padding-right: 50px; }
.msg-button { display: inline-flex; align-items: center; gap: 8px; border: 0; padding: 8px 10px; border-radius: 10px; cursor: pointer; color: #e2e8f0; background: #0f1526; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); transition: transform .12s ease, background .2s ease, box-shadow .2s ease; text-decoration: none; }
.msg-button:hover { transform: translateY(-1px); background: #121a30; box-shadow: 0 8px 18px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255,255,255,.14); }
.msg-button[data-action="like"] { background: rgba(16,185,129,.12); box-shadow: inset 0 0 0 1px rgba(16,185,129,.35); }
.msg-button[data-action="dislike"] { background: rgba(239,68,68,.12); box-shadow: inset 0 0 0 1px rgba(239,68,68,.35); }
.msg-button[data-action="link"] { background: rgba(59,130,246,.12); box-shadow: inset 0 0 0 1px rgba(59,130,246,.35); }
.msg-button i { width: 16px; }

/* remover sublinhado também em hover/focus */
.msg-button:hover, .msg-button:focus { text-decoration: none; }

/* Footer */
.chat-footer {
    width: min(920px, 96vw);
    margin: 16px auto 32px;
    padding: 16px 18px;
    background: linear-gradient(180deg, #0f1526, #0b1224);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 18px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.chat-footer .left { display: flex; flex-direction: column; gap: 4px; }
.chat-footer h4 { margin: 0; font-weight: 600; }
.chat-footer p { margin: 0; color: var(--muted); font-size: 13px; }
.chat-footer .cta {
    display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #fff; padding: 10px 14px; border-radius: 12px; box-shadow: 0 10px 20px rgba(18,140,126,.35);
}
.chat-footer .cta i { width: 16px; }

/* Responsividade */
@media (max-width: 900px) {
    .chat-container { width: 100vw; margin: 0; height: 100svh; height: 100dvh; border-radius: 0; border-left: 0; border-right: 0; }
    .button-row { padding-left: 46px; }
    .bubble { width: calc(100% - 80px); }
    .chat-cta { flex-direction: column; gap: 10px; align-items: flex-start; }
}

.input-area {
    display: flex;
    gap: 10px;
    padding: 14px;
    background: linear-gradient(180deg, #0f1526, #0b1224);
    border-top: 1px solid rgba(255,255,255,.06);
}
.input-wrapper { position: relative; flex: 1; }
.input-icon { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: var(--muted); }
#userInput { width: 100%; padding: 14px 44px 14px 38px; border-radius: 12px; background: #0e1528; border: 1px solid rgba(255,255,255,.08); color: var(--text); outline: none; transition: border-color .2s, box-shadow .2s; }
#userInput:focus { border-color: rgba(108,99,255,.6); box-shadow: 0 0 0 3px rgba(108,99,255,.15); }

.send-button { width: 46px; border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; cursor: pointer; transition: transform .12s ease, filter .2s ease; box-shadow: 0 10px 22px rgba(108,99,255,.35); }
.send-button:hover { transform: translateY(-1px); filter: brightness(1.05); }

.fade-in { animation: fadeIn .25s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Typewriter effect for system messages */
.typing { position: relative; padding-right: 4px; }
.typing::after { content: ""; display: inline-block; width: 10px; height: 1em; border-right: 2px solid rgba(255,255,255,.75); animation: caretBlink 1s steps(1,end) infinite; transform: translateY(2px); }
@keyframes caretBlink { 50% { opacity: 0; } }

/* Scrollbar suave */
.chat-box::-webkit-scrollbar { width: 10px; }
.chat-box::-webkit-scrollbar-thumb { background: #1b2442; border-radius: 10px; border: 2px solid #0f1526; }
.chat-box::-webkit-scrollbar-track { background: transparent; }

/* Tema claro opcional */
.light {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --panel-2: #f9fafb;
    --text: #0f172a;
    --muted: #64748b;
}
.light body { color: var(--text); }

/* Animação de Digitando Melhorada */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 18px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  animation: typingPulse 2s ease-in-out infinite;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  animation: typingDot 1.4s ease-in-out infinite both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typingDot {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes typingPulse {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  }
  50% {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  }
}

.typing-text {
  color: white;
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}

/* Estilos para Markdown */
.message .bubble p {
  line-height: 1.6;
  margin: 0;
}

/* Títulos */
.message .bubble h1,
.message .bubble h2,
.message .bubble h3,
.message .bubble h4,
.message .bubble h5,
.message .bubble h6 {
  margin: 16px 0 8px 0;
  font-weight: 600;
  color: inherit;
}

.message .bubble h1 { font-size: 1.5em; }
.message .bubble h2 { font-size: 1.3em; }
.message .bubble h3 { font-size: 1.1em; }

/* Listas */
.message .bubble ul,
.message .bubble ol {
  margin: 8px 0;
  padding-left: 20px;
}

.message .bubble li {
  margin: 4px 0;
  line-height: 1.5;
}

/* Código inline */
.message .bubble code {
  background: rgba(102, 126, 234, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: #667eea;
}

/* Blocos de código */
.message .bubble pre {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  overflow-x: auto;
}

.message .bubble pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Links */
.message .bubble a {
  color: #667eea;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.message .bubble a:hover {
  border-bottom-color: #667eea;
}

/* Citações */
.message .bubble blockquote {
  border-left: 4px solid #667eea;
  margin: 12px 0;
  padding-left: 16px;
  font-style: italic;
  color: #6c757d;
}

/* Tabelas */
.message .bubble table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
}

.message .bubble th,
.message .bubble td {
  border: 1px solid #dee2e6;
  padding: 8px 12px;
  text-align: left;
}

.message .bubble th {
  background: #f8f9fa;
  font-weight: 600;
}

/* Destaques especiais */
.message .bubble .highlight {
  background: linear-gradient(120deg, #a8edea 0%, #fed6e3 100%);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Emojis */
.message .bubble .emoji {
  font-size: 1.2em;
  vertical-align: middle;
}

/* Botões dinâmicos melhorados */
.button-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.msg-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.msg-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.msg-button[data-action="like"] {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.msg-button[data-action="like"]:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.msg-button[data-action="dislike"] {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.msg-button[data-action="dislike"]:hover {
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.msg-button[data-action="link"] {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.msg-button[data-action="link"]:hover {
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.msg-button i {
  font-size: 14px;
}

/* Responsividade para botões */
@media (max-width: 480px) {
  .button-row {
    flex-direction: column;
  }
  
  .msg-button {
    justify-content: center;
  }
}

/* Modal de Confirmação */
.confirm-modal {
    border: none;
    border-radius: 16px;
    padding: 0;
    background: transparent;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    width: 400px;
}

.confirm-modal::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    text-align: center;
    color: white;
}

.modal-header i {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
    color: #ffd700;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px 20px;
    text-align: center;
    color: #e0e0e0;
}

.modal-body p {
    margin: 0 0 12px 0;
    line-height: 1.5;
    font-size: 14px;
}

.modal-body p:last-child {
    margin-bottom: 0;
    font-weight: 500;
    color: #ffffff;
}

.modal-footer {
    padding: 20px;
    display: flex;
    gap: 12px;
    justify-content: center;
    background: rgba(0, 0, 0, 0.1);
}

.btn-cancel, .btn-confirm {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-cancel {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-cancel:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

.btn-confirm {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-confirm:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Animação do modal */
.confirm-modal[open] {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsividade do modal */
@media (max-width: 480px) {
    .confirm-modal {
        width: 95vw;
        margin: 20px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .btn-cancel, .btn-confirm {
        justify-content: center;
    }
}

/* Indicador de nova mensagem */
.new-message-indicator {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: linear-gradient(135deg, #10b981, #22c55e);
    color: white;
    padding: 12px 16px;
    border-radius: 25px;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.new-message-indicator:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.4);
}

.new-message-indicator i {
    font-size: 16px;
    animation: bounce 2s infinite;
}

.new-message-indicator span {
    white-space: nowrap;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Melhorias no scroll do chat */
#chatBox {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 185, 129, 0.3) transparent;
}

#chatBox::-webkit-scrollbar {
    width: 8px;
}

#chatBox::-webkit-scrollbar-track {
    background: transparent;
}

#chatBox::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.3);
    border-radius: 4px;
    transition: background 0.3s ease;
}

#chatBox::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.5);
}

/* Garantir que o scroll seja suave em todos os navegadores */
#chatBox {
    -webkit-overflow-scrolling: touch;
    overflow-anchor: auto;
}

/* Animação de fade-in para mensagens */
.message.fade-in {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Notificação de Política de Privacidade */
.privacy-notice {
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 152, 0, 0.1));
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 12px;
    border-left: 4px solid #ffc107;
}

.privacy-notice h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #ff6f00;
    display: flex;
    align-items: center;
    gap: 6px;
}

.privacy-notice p {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #666;
}

.privacy-notice a {
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.privacy-notice a:hover {
    color: #1565c0;
    text-decoration: underline;
}


