/* Zipp AI – estilo global do chat */

/* Fonte principal – similar ao "feeling" do ChatGPT */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #ffffff;
  --card-bg: #ffffff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --primary: #f97316;
  --border-soft: #e5e7eb;
  /* Header mais forte (estilo "da direita") */
  --header-bg: #ffe9d9;
  /* peach/laranja claro mais visível */
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* impede scroll da página — igual ao GPT */
  letter-spacing: 0.015em;
}

/* HEADER */
header {
  position: relative;
  padding: 0.55rem 1.25rem 0.35rem;
  /* menor altura */
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--header-bg);
  /* sombra um pouco mais marcante */
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

.header-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}

/* Botão do menu (☰) em um "pill" próprio – um pouco menor */
.menu-btn {
  background: #fff7ed;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-main);
  padding: 0.18rem 0.65rem 0.22rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-btn:hover {
  background: #fff1e0;
}

/* Link "Novo chat" no header, sempre visível */
.header-new-chat {
  border: none;
  background: transparent;
  padding: 0.2rem 0.4rem;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--primary);
  letter-spacing: 0.03em;
}

.header-new-chat:hover {
  background: rgba(249, 115, 22, 0.08);
}

.brand-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* garante o recorte circular do avatar */
}

.brand-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  /* preenche mantendo proporção */
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-size: 1.15rem;
}

.brand-text span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* BANNER SUPERIOR (FORA DA ÁREA DO CHAT) */
.banner-top {
  padding: 0.15rem 1.25rem 0.4rem;
  flex-shrink: 0;
  background: var(--bg);
}

.banner-box {
  margin: 0 auto;
  max-width: 970px;
  min-height: 60px;
  border-radius: 12px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem;
}

/* SIDEBAR */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  z-index: 10;
}

.sidebar {
  position: fixed;
  top: 0;
  left: -260px;
  width: 260px;
  height: 100vh;
  background: #ffffff;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  transition: left 0.25s ease;
  z-index: 11;
  display: flex;
  flex-direction: column;
}

.sidebar.open {
  left: 0;
}

.new-chat-link {
  border: none;
  background: transparent;
  padding: 0.35rem 0.25rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-main);
  flex-shrink: 0;
}

.new-chat-link:hover {
  background: #f3f4f6;
}

.sidebar-section-title {
  margin-top: 1rem;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  border-top: 1px solid var(--border-soft);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

/* REMOVER SCROLLBAR DO HISTÓRICO */
.chat-list {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chat-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.chat-item {
  padding: 0.45rem 0.25rem;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.95rem;
  color: var(--text-main);
}

.chat-item:hover {
  background: #f3f4f6;
}

/* MAIN */
main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 1rem;
  min-height: 0;
}

.shell {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ÁREA ROLÁVEL DO CHAT (APENAS AQUI TEM SCROLL) */
#messagesContainer {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-top: 1.75rem;
  padding-bottom: 1rem;
  min-height: 0;
  overflow-anchor: none;
  /* Impede rolagem automática indesejada ao adicionar conteúdo */
}

/* REMOVER SCROLLBAR – IGUAL CHATGPT */
#messagesContainer {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#messagesContainer::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body:not(.chat-started) #messagesContainer {
  justify-content: center;
}

.hero {
  text-align: center;
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

body.chat-started .hero {
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  letter-spacing: 0.03em;
}

.chat-area {
  width: 100%;
  margin-top: 1.75rem;
  display: none;
  flex-shrink: 0;
}

/* Estrutura das mensagens */
.chat-message {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}

.chat-message-user {
  justify-content: flex-end;
}

.chat-message-ai {
  justify-content: flex-start;
}

.chat-bubble {
  padding: 0.55rem 0.9rem;
  border-radius: 0.9rem;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  max-width: 100%;
  border: none;
}

/* usuário pode manter quebras de linha do textarea */
.chat-bubble.user {
  background: #fff7ed;
  white-space: pre-wrap;
}

/* IA com card mais "clean" */
.chat-bubble.ai {
  background: #ffffff;
  white-space: normal;
  box-shadow: none;
  border: none;
  padding: 0;
}

/* Conteúdo tipográfico das mensagens – estilo "ChatGPT" */
.chat-message-content p {
  margin: 0 0 1rem;
  line-height: 1.6;
  font-size: 0.98rem;
  color: #111827;
}

.chat-message-content p:last-child {
  margin-bottom: 0;
}

.chat-message-content strong {
  font-weight: 600;
  color: #000;
}

.chat-message-content h1,
.chat-message-content h2,
.chat-message-content h3 {
  font-weight: 700;
  margin: 1.4rem 0 0.6rem;
  color: #111827;
}

.chat-message-content h1 {
  font-size: 1.4rem;
}

.chat-message-content h2 {
  font-size: 1.25rem;
}

.chat-message-content h3 {
  font-size: 1.1rem;
}

.chat-message-content ul,
.chat-message-content ol {
  margin: 0 0 1rem 1.2rem;
  line-height: 1.7;
  padding-left: 1.1rem;
}

.chat-message-content li {
  margin-bottom: 0.35rem;
}

.chat-message-content blockquote {
  border-left: 4px solid #f97316;
  margin: 1.2rem 0;
  padding: 0.6rem 1rem;
  background: #fff7ed;
  border-radius: 6px;
  color: #444;
}

.chat-message-content code {
  background: #f3f4f6;
  padding: 2px 5px;
  flex-shrink: 0;
  background: var(--bg);
}

.prompt-card {
  margin: 0 auto;
  max-width: 720px;
  background: var(--card-bg);
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 0.35rem 0.4rem 0.35rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.prompt-input {
  flex: 1;
}

.prompt-input textarea {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  min-height: 24px;
  max-height: 144px;
  /* Aprox. 6 linhas */
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-main);
  letter-spacing: 0.03em;
  line-height: 1.5;
}

.send-btn {
  border: none;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: 0.15s;
}

.send-btn:hover {
  filter: brightness(0.95);
  transform: translateY(-0.5px);
}

.short-hint {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Divider com fade – estilo moderno */
.chat-message-content hr {
  border: none;
  height: 1px;
  margin: 1.8rem 0;
  background: linear-gradient(to right,
      transparent,
      rgba(0, 0, 0, 0.12),
      transparent);
}

/* "Títulos" que vêm como <p><strong>Texto</strong></p> */
.chat-message-content p>strong:only-child {
  display: block;
  position: relative;
  margin: 1.8rem 0 0.6rem;
  /* espaço antes/depois do título */
  padding-top: 1rem;
  /* espaço entre a linha e o texto */
}

/* Linha com fade antes desses títulos */
.chat-message-content p>strong:only-child::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(to right,
      transparent,
      rgba(0, 0, 0, 0.12),
      transparent);
}

/* Não mostra a linha se for o primeiro parágrafo da resposta */
.chat-message-content p:first-child>strong:only-child::before {
  display: none;
}

/* ================================
   1) Títulos de seção (p > strong)
   — estilo ChatGPT
================================ */

/* Base dos títulos */
.chat-message-content p>strong:only-child {
  display: block;
  position: relative;
  margin: 2rem 0 0.75rem;
  /* espaço similar ao GPT */
  padding-top: 1.1rem;
  /* espaço entre a linha e o texto */
  font-size: 1.32rem;
  /* tamanho muito próximo ao h2 do GPT */
  font-weight: 700;
  color: #111827;
  letter-spacing: 0.015em;
  line-height: 1.25;
}

/* Divider com fade antes do título */
.chat-message-content p>strong:only-child::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(to right,
      transparent,
      rgba(0, 0, 0, 0.12),
      transparent);
}

/* Não mostra o divisor no primeiro bloco da resposta */
.chat-message-content p:first-child>strong:only-child::before {
  display: none;
}



/* ================================
   2) <hr> estilizado (quando o modelo gera "---")
================================ */

.chat-message-content hr {
  border: none;
  height: 1px;
  margin: 2rem 0;
  background: linear-gradient(to right,
      transparent,
      rgba(0, 0, 0, 0.12),
      transparent);
}

/* ================================
   DESKTOP: Força textarea começar com 1 linha
================================ */
@media (min-width: 768px) {
  .prompt-input textarea {
    height: 24px;
    /* Força altura inicial de 1 linha no desktop */
  }
}

footer {
  padding: 0.75rem 1.25rem 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}