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

body {
  font-family: 'Segoe UI', sans-serif;
  background: #f0f2f5;
}

/* ── Widget flutuante ── */
#chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

#chat-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #4f46e5;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(79,70,229,0.4);
  transition: transform 0.2s;
}
#chat-toggle:hover { transform: scale(1.08); }
#chat-toggle svg { width: 26px; height: 26px; fill: #fff; }

#chat-box {
  width: 360px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s, transform 0.2s;
}
#chat-box.hidden { opacity: 0; pointer-events: none; transform: translateY(16px); }

/* Header */
#chat-header {
  background: #4f46e5;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#chat-header .avatar {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
#chat-header .info h3 { font-size: 15px; font-weight: 600; }
#chat-header .info span { font-size: 12px; opacity: 0.8; }

/* Mensagens */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.msg.bot {
  background: #f1f0ff;
  color: #1e1b4b;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg.user {
  background: #4f46e5;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg.typing { opacity: 0.6; font-style: italic; }

.sources {
  font-size: 11px;
  color: #6b7280;
  margin-top: 4px;
  padding-left: 4px;
}

/* Input */
#chat-input-area {
  padding: 12px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 8px;
}
#chat-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
#chat-input:focus { border-color: #4f46e5; }

#send-btn {
  width: 40px; height: 40px;
  background: #4f46e5;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
#send-btn:hover { background: #4338ca; }
#send-btn svg { width: 18px; height: 18px; fill: #fff; }

/* ── Página de Upload ── */
.upload-page {
  max-width: 680px;
  margin: 48px auto;
  padding: 0 16px;
}
.upload-page h1 { font-size: 24px; color: #1e1b4b; margin-bottom: 8px; }
.upload-page p { color: #6b7280; margin-bottom: 32px; }

.upload-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  margin-bottom: 24px;
}

.drop-zone {
  border: 2px dashed #c7d2fe;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  color: #6b7280;
}
.drop-zone:hover, .drop-zone.dragover {
  background: #eef2ff;
  border-color: #4f46e5;
}
.drop-zone .icon { font-size: 40px; margin-bottom: 12px; }
.drop-zone p { font-size: 14px; }
.drop-zone strong { color: #4f46e5; }

#file-input { display: none; }

.upload-btn {
  margin-top: 20px;
  width: 100%;
  padding: 12px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}
.upload-btn:hover { background: #4338ca; }
.upload-btn:disabled { background: #a5b4fc; cursor: not-allowed; }

#upload-status {
  margin-top: 16px;
  font-size: 14px;
  min-height: 20px;
}
.status-ok { color: #16a34a; }
.status-err { color: #dc2626; }

.doc-list { list-style: none; }
.doc-list li {
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 8px;
}
.doc-list li:last-child { border-bottom: none; }
