/* Hábila — visual da Escola CondoHábil: fundo escuro, destaque âmbar */
:root {
  --fundo: #0b0d12;
  --fundo-2: #12151d;
  --superficie: rgba(255, 255, 255, 0.04);
  --superficie-forte: rgba(255, 255, 255, 0.07);
  --borda: rgba(255, 255, 255, 0.1);
  --borda-forte: rgba(255, 255, 255, 0.18);
  --texto: #f3f4f6;
  --texto-suave: #a1a7b3;
  --texto-fraco: #6b7280;
  --ambar: #fbbf24;
  --ambar-2: #f59e0b;
  --ambar-suave: rgba(251, 191, 36, 0.14);
  --sobre-ambar: #111827;
  --erro: #f87171;
  --ok: #4ade80;
  --raio: 14px;
  --sombra: 0 20px 60px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--texto);
  background:
    radial-gradient(1000px 520px at 50% -10%, rgba(251, 191, 36, 0.16), transparent 60%),
    radial-gradient(800px 400px at 100% 100%, rgba(245, 158, 11, 0.06), transparent 60%),
    var(--fundo);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ambar); outline-offset: 2px; }

/* ---------- carregando ---------- */
.carregando { min-height: 100vh; display: grid; place-items: center; }
.pontos { display: inline-flex; gap: 6px; }
.pontos i {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ambar);
  animation: pulo 1.2s infinite ease-in-out;
}
.pontos i:nth-child(2) { animation-delay: 0.15s; }
.pontos i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulo { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

/* ---------- entrada ---------- */
.entrada {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 16px;
  gap: 24px;
}
.marca { text-align: center; }
.marca-icone { display: block; margin: 0 auto; border-radius: 50%; box-shadow: 0 14px 48px rgba(251, 191, 36, 0.35); }
.marca-nome { margin: 14px 0 4px; font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.marca-nome span, .lateral-topo strong span { color: var(--ambar); }
.marca-frase { margin: 0; color: var(--texto-suave); }

.cartao {
  width: 100%; max-width: 400px;
  padding: 24px;
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: 20px;
  box-shadow: var(--sombra);
  backdrop-filter: blur(16px);
  display: flex; flex-direction: column; gap: 16px;
}
.cartao h2 { margin: 0; font-size: 19px; }
.cartao-dica { margin: 0; color: var(--texto-suave); font-size: 14px; }

.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > span { font-size: 13px; font-weight: 500; color: var(--texto-suave); }
.entrada-texto {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  height: 48px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--borda);
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.entrada-texto:focus-within { border-color: var(--ambar); box-shadow: 0 0 0 3px var(--ambar-suave); }
.entrada-texto svg { width: 18px; height: 18px; color: var(--texto-fraco); flex: none; }
.entrada-texto input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; }
.entrada-texto input::placeholder { color: var(--texto-fraco); }
.mostrar-senha { border: 0; background: none; padding: 4px; display: grid; color: var(--texto-fraco); }
.mostrar-senha:hover { color: var(--texto); }

.botao {
  height: 48px;
  border: 0; border-radius: 12px;
  background: linear-gradient(135deg, #fcd34d, var(--ambar-2));
  color: var(--sobre-ambar);
  font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter 0.15s, opacity 0.15s, transform 0.05s;
}
.botao:hover:not(:disabled) { filter: brightness(1.06); }
.botao:active:not(:disabled) { transform: translateY(1px); }
.botao:disabled { opacity: 0.45; cursor: not-allowed; }
.botao-secundario {
  background: var(--superficie-forte); color: var(--texto);
  border: 1px solid var(--borda); height: 42px;
}

.aviso { margin: 0; font-size: 14px; min-height: 0; }
.aviso:empty { display: none; }
.aviso.erro { color: var(--erro); }
.aviso.ok { color: var(--ok); }

.links { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.links button {
  border: 0; background: none; color: var(--texto-suave); font-size: 14px; padding: 4px 8px;
}
.links button:hover { color: var(--ambar); }

/* ---------- app (conversa) ---------- */
.app { height: 100vh; height: 100dvh; display: flex; }

.lateral {
  width: 280px; flex: none;
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px;
  background: rgba(10, 12, 17, 0.85);
  border-right: 1px solid var(--borda);
}
.lateral-topo { display: flex; align-items: center; gap: 10px; font-size: 18px; }
.lateral-topo img { border-radius: 50%; object-fit: cover; }
.lateral-topo .icone-botao { margin-left: auto; }
.lateral-titulo { margin: 8px 0 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--texto-fraco); }
.lista-conversas { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.lista-conversas button {
  width: 100%; text-align: left;
  border: 0; background: none; border-radius: 10px;
  padding: 9px 10px; font-size: 14px; color: var(--texto-suave);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lista-conversas button:hover { background: var(--superficie-forte); color: var(--texto); }
.lista-conversas button[aria-current="true"] { background: var(--ambar-suave); color: var(--texto); }
.lista-vazia { color: var(--texto-fraco); font-size: 13px; padding: 6px 10px; }
.lateral-rodape { border-top: 1px solid var(--borda); padding-top: 12px; display: flex; align-items: center; gap: 8px; }
.email-usuario { flex: 1; min-width: 0; font-size: 13px; color: var(--texto-suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-sair { border: 0; background: none; color: var(--texto-suave); font-size: 13px; }
.link-sair:hover { color: var(--erro); }

.conversa { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conversa-topo {
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 20px;
  border-bottom: 1px solid var(--borda);
}
.conversa-topo h1 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selo { margin-left: auto; font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--ambar-suave); color: var(--ambar); }
.icone-botao {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--borda); background: var(--superficie); display: grid; place-items: center;
}

.mensagens { flex: 1; overflow-y: auto; padding: 24px 20px; display: flex; flex-direction: column; gap: 18px; }
.mensagens > * { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }

.boas-vindas { margin: auto; text-align: center; padding: 24px 0; }
.boas-vindas img { border-radius: 50%; box-shadow: 0 12px 40px rgba(251, 191, 36, 0.3); }
.boas-vindas h2 { margin: 16px 0 6px; font-size: 22px; }
.boas-vindas p { margin: 0 auto; color: var(--texto-suave); max-width: 420px; }
.sugestoes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.sugestoes button {
  border: 1px solid var(--borda); background: var(--superficie); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; color: var(--texto-suave);
}
.sugestoes button:hover { border-color: var(--ambar); color: var(--texto); }

.msg { display: flex; gap: 12px; }
.msg-usuario { justify-content: flex-end; }
.msg-usuario .balao {
  background: var(--superficie-forte); border: 1px solid var(--borda);
  border-radius: 16px 16px 4px 16px; padding: 10px 14px; max-width: 85%;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-habila .avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; margin-top: 2px; }
.msg-habila .balao { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.balao p { margin: 0 0 10px; }
.balao p:last-child, .balao ul:last-child, .balao ol:last-child { margin-bottom: 0; }
.balao ul, .balao ol { margin: 0 0 10px; padding-left: 22px; }
.balao li { margin: 3px 0; }
.balao strong { color: #fff; }
.balao code { background: rgba(255, 255, 255, 0.08); padding: 1px 5px; border-radius: 5px; font-size: 0.92em; }
.balao a { color: var(--ambar); }
.balao .titulo-md { font-weight: 700; margin-top: 4px; }
.balao.erro { color: var(--erro); }
.digitando { display: inline-flex; padding: 8px 0; }

.compositor {
  display: flex; align-items: flex-end; gap: 10px;
  width: calc(100% - 32px); max-width: 760px; margin: 0 auto;
  padding: 10px 10px 10px 16px;
  background: var(--superficie-forte);
  border: 1px solid var(--borda-forte);
  border-radius: 18px;
}
.compositor:focus-within { border-color: var(--ambar); box-shadow: 0 0 0 3px var(--ambar-suave); }
.compositor textarea {
  flex: 1; border: 0; background: none; outline: none; resize: none;
  max-height: 200px; padding: 8px 0; line-height: 1.5;
}
.compositor textarea::placeholder { color: var(--texto-fraco); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.botao-enviar {
  width: 40px; height: 40px; flex: none; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, #fcd34d, var(--ambar-2)); color: var(--sobre-ambar);
  display: grid; place-items: center;
}
.botao-enviar svg { width: 20px; height: 20px; }
.botao-enviar:disabled { opacity: 0.35; cursor: not-allowed; }
.rodape-aviso { margin: 8px 16px 14px; text-align: center; font-size: 12px; color: var(--texto-fraco); }

/* ---------- áudio ---------- */
.botao-microfone {
  height: 40px; min-width: 40px; flex: none; border: 1px solid var(--borda); border-radius: 12px;
  background: var(--superficie); color: var(--texto-suave);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 10px;
}
.botao-microfone:hover:not(:disabled) { color: var(--ambar); border-color: var(--ambar); }
.botao-microfone:disabled { opacity: 0.35; cursor: not-allowed; }
.botao-microfone svg { width: 20px; height: 20px; }
.botao-microfone .icone-parar, .botao-microfone .tempo-gravacao { display: none; }
.botao-microfone.gravando { background: rgba(248, 113, 113, 0.15); border-color: var(--erro); color: var(--erro); }
.botao-microfone.gravando .icone-mic { display: none; }
.botao-microfone.gravando .icone-parar, .botao-microfone.gravando .tempo-gravacao { display: inline; }
.botao-microfone.gravando .icone-parar { animation: pulsar 1.2s infinite ease-in-out; }
.tempo-gravacao { font-size: 13px; font-variant-numeric: tabular-nums; }
.botao-microfone.ouvindo { color: var(--ambar); }
@keyframes pulsar { 50% { opacity: 0.35; } }

.so-celular { display: none; }
.fundo-lateral { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 9; }

@media (max-width: 820px) {
  .so-celular { display: grid; }
  .lateral {
    position: fixed; inset: 0 auto 0 0; z-index: 10; width: min(300px, 86vw);
    transform: translateX(-100%); transition: transform 0.2s ease;
    background: var(--fundo-2);
  }
  .lateral.aberta { transform: none; }
  .conversa-topo { padding: 0 16px; }
  .mensagens { padding: 18px 16px; }
  .msg-usuario .balao { max-width: 92%; }
  .compositor { gap: 8px; padding-left: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
