/* ===============================
   VARIÁVEIS DE TEMA
================================= */
:root {
  --bg:#f7f8fa;
  --panel:#ffffff;
  --bubble-bot:#f0f1f3;
  --bubble-user:#c44b04;
  --accent:#c44b04;
  --text:#222222;
  --muted:#666666;
  --border:#d8d8d8;
  --online:#3bc23b;
}

/* ===============================
   BASE
================================= */
*{box-sizing:border-box;}
body{
  font-family:"Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
  margin:0;
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
  padding:16px;
}

/* ===============================
   CONTAINER PRINCIPAL
================================= */
.chat-container{
  width:100%;
  max-width:480px;
  height:min(88vh, 820px);
  background:var(--panel);
  border-radius:20px;
  box-shadow:0 6px 25px rgba(0,0,0,.08);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  border:1px solid var(--border);
}

/* ===============================
   CABEÇALHO
================================= */
.header{
  display:flex;
  align-items:center;
  gap:12px;
  padding:16px 18px;
  border-bottom:1px solid var(--border);
  background:linear-gradient(to right, #ffffff 70%, rgba(196,75,4,0.06));
}
.avatar{
  width:40px;
  height:40px;
  border-radius:50%;
  background:url('assets/agente-intellih.jpg') center/cover no-repeat;
  border:2px solid var(--accent);
  box-shadow:0 0 8px rgba(196, 75, 4, 0.25);
  flex:0 0 auto;
  transition:box-shadow 0.3s ease, transform 0.3s ease;
}
.avatar:hover{
  box-shadow:0 0 12px rgba(196, 75, 4, 0.35);
  transform:scale(1.05);
}
.title{
  display:flex;
  flex-direction:column;
  justify-content:center;
}
.title h1{
  font-size:1rem;
  margin:0;
  font-weight:600;
  display:flex;
  align-items:center;
  gap:6px;
}
.status-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--online);
  box-shadow:0 0 6px rgba(59,194,59,0.7);
  animation:pulse 1.5s infinite;
}
@keyframes pulse{
  0%,100%{opacity:0.8;transform:scale(1);}
  50%{opacity:1;transform:scale(1.3);}
}
.title p{
  margin:0;
  color:var(--muted);
  font-size:.85rem;
}

/* ===============================
   ÁREA DE MENSAGENS
================================= */
.chat-box{
  flex:1;
  overflow:auto;
  padding:20px 18px;
  background:var(--bg);
  scroll-behavior:smooth;
}
.message{
  display:flex;
  gap:10px;
  margin-bottom:14px;
  opacity:0;
  transform:translateY(10px);
  animation:fadeSlideIn 0.4s ease forwards;
}
.message .bubble{
  padding:12px 14px;
  border-radius:14px;
  max-width:80%;
  line-height:1.45;
  font-size:.95rem;
  box-shadow:0 2px 6px rgba(0,0,0,0.05);
}
.message.bot .bubble{
  background:var(--bubble-bot);
  color:var(--text);
  border:1px solid var(--border);
}
.message.user{justify-content:flex-end;}
.message.user .bubble{
  background:var(--bubble-user);
  color:#fff;
  border:none;
}

/* ===============================
   BOTÕES E CAMPOS
================================= */
.buttons{
  display:grid;
  gap:8px;
  margin-top:6px;
}
button{
  background:var(--accent);
  color:#fff;
  border:none;
  border-radius:12px;
  padding:12px 14px;
  cursor:pointer;
  font-size:.95rem;
  font-weight:500;
  transition:transform .06s ease, opacity .2s ease;
}
button:hover{opacity:0.9;}
button:active{transform:scale(.98);}
input[type="text"], input[type="email"]{
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  outline:none;
  margin:8px 0 6px;
  font-size:.95rem;
}

/* ===============================
   RODAPÉ
================================= */
.footer{
  background:#fff;
  padding:10px;
  text-align:center;
  color:var(--muted);
  font-size:.85rem;
  border-top:1px solid var(--border);
}

/* ===============================
   EFEITO DE DIGITAÇÃO (3 PONTINHOS)
================================= */
.typing span{
  display:inline-block;
  width:6px;
  height:6px;
  background:var(--accent);
  border-radius:50%;
  margin:0 2px;
  animation:blink 1.2s infinite;
}
.typing span:nth-child(2){animation-delay:0.2s;}
.typing span:nth-child(3){animation-delay:0.4s;}
@keyframes blink{
  0%,80%,100%{opacity:0;transform:scale(0.8);}
  40%{opacity:1;transform:scale(1);}
}

/* ===============================
   ANIMAÇÃO DE ENTRADA SUAVE
================================= */
@keyframes fadeSlideIn{
  to{
    opacity:1;
    transform:translateY(0);
  }
}

/* ===============================
   SCROLLBAR ESTILIZADA
================================= */
.chat-box::-webkit-scrollbar{
  width:6px;
}
.chat-box::-webkit-scrollbar-thumb{
  background-color:#c44b04;
  border-radius:3px;
}
.chat-box::-webkit-scrollbar-track{
  background:#f0f0f0;
}

/* ===============================
   SELO FIXO INTELLIH (fade-in + responsivo + dark mode)
================================= */
.intellih-badge {
  position: fixed;
  bottom: 12px;
  right: 12px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  z-index: 9999;

  /* Animação de entrada */
  opacity: 0;
  transform: translateY(10px);
  animation: fadeBadge 1s ease 2s forwards;
}
.intellih-badge img {
  height: 20px;
  width: auto;
  filter: grayscale(20%);
}
.intellih-badge a {
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.intellih-badge:hover {
  background: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.intellih-badge strong {
  color: var(--accent);
}
@keyframes fadeBadge {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===============================
   RESPONSIVIDADE DO SELO
================================= */
@media (max-width: 640px) {
  .intellih-badge {
    right: 50%;
    transform: translateX(50%) translateY(10px);
    bottom: 10px;
    padding: 8px 12px;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    animation: fadeBadgeMobile 1s ease 2s forwards;
  }
  .intellih-badge img {
    height: 18px;
  }
}
@keyframes fadeBadgeMobile {
  to {
    opacity: 1;
    transform: translateX(50%) translateY(0);
  }
}

/* ===============================
   MODO ESCURO AUTOMÁTICO
================================= */
@media (prefers-color-scheme: dark) {
  body {
    background: #111;
    color: #f2f2f2;
  }
  .chat-container {
    background: #1a1a1a;
    border-color: #333;
  }
  .header {
    background: linear-gradient(to right, #1a1a1a 70%, rgba(196,75,4,0.15));
    border-color: #333;
  }
  .message.bot .bubble {
    background: #2a2a2a;
    border-color: #444;
    color: #e8e8e8;
  }
  .message.user .bubble {
    background: var(--accent);
    color: #fff;
  }
  .footer {
    background: #1a1a1a;
    color: #aaa;
    border-top: 1px solid #333;
  }
  .intellih-badge {
    background: rgba(20,20,20,0.85);
    border-color: #333;
    color: #f2f2f2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  }
  .intellih-badge a {
    color: #f2f2f2;
  }
  .intellih-badge strong {
    color: var(--accent);
  }
  .intellih-badge img {
    filter: brightness(180%) grayscale(10%);
  }
  .intellih-badge:hover {
    background: rgba(35,35,35,0.9);
  }
}
