*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #000;
  --surface: #1c1c1c;
  --border: rgba(255, 255, 255, 0.1);
  --text: #fff;
  --text-dim: rgba(255, 255, 255, 0.36);
  --text-ai: rgba(255, 255, 255, 0.8);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 680px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ── Header ── */
#header {
  padding: 22px 28px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#logo {
  display: flex;
  align-items: center;
  flex: 1;
}

#logo-img {
  height: 13px;
  width: auto;
  display: block;
  opacity: 0.9;
}

#header-by {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.2);
  text-transform: lowercase;
  flex: 1;
  text-align: center;
  white-space: nowrap;
}

#header-by span {
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}

#status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.4;
}

#status-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#reset-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  display: none;
}

#reset-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
}

#reset-btn.visible { display: block; }

/* ── Chat area ── */
#chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  scrollbar-width: none;
}

#chat-area::-webkit-scrollbar { display: none; }

.msg {
  display: flex;
  gap: 14px;
  animation: fadeUp 0.22s ease;
}

.msg.user { flex-direction: row-reverse; }

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

/* ── Avatares ── */
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-top: 3px;
}

.avatar.ai {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.avatar.user-av {
  background: #fff;
  color: #000;
}

/* ── Balões ── */
.bubble {
  max-width: 78%;
  padding: 13px 17px;
  font-size: 14px;
  line-height: 1.72;
}

.bubble.ai {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px 14px 14px 14px;
  color: var(--text-ai);
}

.bubble.user {
  background: #fff;
  color: #000;
  border-radius: 14px 2px 14px 14px;
  font-weight: 500;
}

.bubble strong { color: #fff; }
.bubble.user strong { color: #000; }

/* ── Typing indicator ── */
#typing {
  display: none;
  gap: 14px;
  align-items: flex-end;
  padding: 0 28px 14px;
  flex-shrink: 0;
}

#typing.visible { display: flex; }

.typing-dots {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px 14px 14px 14px;
  padding: 13px 17px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  animation: bounce 1.2s infinite;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.2; }
  30%            { transform: translateY(-4px); opacity: 1; }
}

/* ── Input ── */
#input-area {
  padding: 16px 28px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-shrink: 0;
}

#user-input {
  flex: 1;
  background: #161616;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s;
  min-height: 46px;
  max-height: 120px;
}

#user-input::placeholder { color: var(--text-dim); }
#user-input:focus { border-color: rgba(255, 255, 255, 0.22); }

#send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, transform 0.1s;
  flex-shrink: 0;
}

#send-btn:hover  { opacity: 0.88; }
#send-btn:active { transform: scale(0.92); }

#send-btn:disabled {
  background: rgba(255, 255, 255, 0.1);
  cursor: not-allowed;
}

#send-btn svg { width: 15px; height: 15px; fill: #000; }
#send-btn:disabled svg { fill: rgba(255, 255, 255, 0.2); }

/* ── Responsividade mobile ── */
@media (max-width: 480px) {
  #header-by { display: none; }
}

/* ── Botão PDF ── */
#pdf-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 12px 0 4px;
  animation: fadeUp 0.3s ease;
}

#pdf-hint {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

#pdf-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 13px 26px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

#pdf-btn:hover  { opacity: 0.85; }
#pdf-btn:active { transform: scale(0.97); }

@keyframes spin {
  to { transform: rotate(360deg); }
}

#pdf-btn svg {
  width: 16px;
  height: 16px;
  stroke: #000;
  flex-shrink: 0;
}

#pdf-btn svg.spin {
  animation: spin 0.9s linear infinite;
}

/* ── Watermark ── */
#watermark {
  text-align: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.1);
  padding: 4px 0 8px;
  letter-spacing: 0.14em;
  flex-shrink: 0;
}
