/* Juliana IA · estilo ferramenta operacional AGM
   Base neutra + acento AGM discreto. Mobile-first, layout WhatsApp-like. */

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --border: #e5e5e5;
  --brand-accent: #E63946;
  --user-bubble: #DCF8C6;
  --ia-bubble: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1e1e1e;
    --text: #f2f2f2;
    --text-muted: #9a9a9a;
    --border: #2d2d2d;
    --user-bubble: #056162;
    --ia-bubble: #262626;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  flex-shrink: 0;
}
.brand-cliente { display: flex; align-items: baseline; gap: 6px; font-weight: 500; }
.brand-cliente .marca { letter-spacing: 0.06em; font-weight: 700; }
.brand-cliente .sep { color: var(--text-muted); }
.brand-cliente .unidade { color: var(--text-muted); font-weight: 400; }
.brand-autor { color: var(--text-muted); font-size: 12px; }
.brand-autor strong { color: var(--brand-accent); }
.btn-nova {
  background: transparent;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  transition: all 0.15s;
}
.btn-nova:hover { border-color: var(--brand-accent); color: var(--brand-accent); }

/* Chat */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: var(--shadow);
  animation: msgIn 0.2s ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg.user {
  background: var(--user-bubble);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg.ia {
  background: var(--ia-bubble);
  align-self: flex-start;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 8px;
  display: block;
}
.msg strong { font-weight: 700; }
.msg em { font-style: italic; color: var(--text-muted); }
.msg .typing { color: var(--text-muted); font-style: italic; }
.msg .typing::after {
  content: '…';
  display: inline-block;
  animation: dots 1.4s infinite;
}
@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '…'; }
}

/* Quebra-gelos */
.quebra-gelos {
  display: flex;
  gap: 8px;
  padding: 4px 16px 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.quebra-gelos[hidden] { display: none; }
.qg {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: all 0.15s;
}
.qg:hover { border-color: var(--brand-accent); color: var(--brand-accent); }

/* Preview de imagem antes de enviar */
.preview-imagem {
  padding: 8px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.preview-imagem img { height: 60px; border-radius: 6px; }
.preview-imagem button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 22px;
  padding: 0 4px;
  margin-left: auto;
  line-height: 1;
}
.preview-imagem button:hover { color: var(--brand-accent); }

/* Input bar */
.input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  align-items: flex-end;
  flex-shrink: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.btn-imagem, .btn-enviar {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  height: 42px;
  flex-shrink: 0;
}
.btn-imagem:hover { border-color: var(--brand-accent); }
.btn-enviar {
  background: var(--brand-accent);
  color: white;
  border-color: var(--brand-accent);
  font-weight: 600;
  min-width: 88px;
}
.btn-enviar:disabled { opacity: 0.5; cursor: not-allowed; }
#textInput {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  resize: none;
  max-height: 120px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}
#textInput:focus { outline: none; border-color: var(--brand-accent); }

/* Erro de acesso */
.msg.erro {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  align-self: center;
  text-align: center;
  max-width: 90%;
  font-size: 14px;
}
