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

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #f0f2f7;
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
}

/* ─── Layout ─────────────────────────────── */
.page {
  display: flex;
  width: 100%;
  max-width: 900px;
  height: 90vh;
  max-height: 700px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
  min-width: 0;
}

/* ─── Sidebar / Perfil ───────────────────── */
.profile {
  width: 270px;
  min-width: 270px;
  background: #1a1f2e;
  color: #fff;
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  overflow-y: auto;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f8ef7, #7c5af7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.profile-name {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.profile-role {
  font-size: 13px;
  color: #a0aec0;
  font-weight: 500;
}

.profile-location {
  font-size: 12px;
  color: #718096;
}

.profile-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.link-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
  text-align: left;
}

.link-btn:hover { opacity: 0.85; transform: translateX(2px); }

.link-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.link-btn.linkedin { background: #0a66c2; color: #fff; }
.link-btn.email    { background: #2d3748; color: #e2e8f0; word-break: break-all; }
.link-btn.github   { background: #2d3748; color: #e2e8f0; }

.profile-bio {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid #2d3748;
  width: 100%;
}

.profile-bio p {
  font-size: 12px;
  color: #718096;
  line-height: 1.7;
  text-align: left;
}

/* ─── Chat ───────────────────────────────── */
.chat-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #edf2f7;
  background: #fff;
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f8ef7, #7c5af7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.chat-header-name {
  font-size: 15px;
  font-weight: 600;
  color: #1a202c;
  display: block;
}

.chat-header-status {
  font-size: 11px;
  color: #48bb78;
  font-weight: 500;
}

#chat-box {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ─── Mensagens ──────────────────────────── */
.message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  animation: fadeUp 0.2s ease;
}

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

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f8ef7, #7c5af7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.msg-bubble {
  max-width: 72%;
  min-width: 0;
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-line;
}

/* Bot */
.message.bot .msg-bubble {
  background: #f4f6fb;
  color: #2d3748;
  border-bottom-left-radius: 4px;
}

/* User */
.message.user {
  flex-direction: row-reverse;
}

.message.user .msg-bubble {
  background: linear-gradient(135deg, #4f8ef7, #7c5af7);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* ─── Typing indicator ───────────────────── */
.typing-indicator {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 20px 10px;
}

.typing-dots {
  display: flex;
  gap: 5px;
  background: #f4f6fb;
  padding: 12px 16px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: #a0aec0;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

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

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}

/* ─── Input ──────────────────────────────── */
.input-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #edf2f7;
  background: #fff;
  flex-shrink: 0;
  min-width: 0;
}

#user-input {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 24px;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  color: #2d3748;
  background: #f8faff;
  transition: border-color 0.2s;
}

#user-input:focus { border-color: #4f8ef7; background: #fff; }

#send-btn {
  width: 42px;
  height: 42px;
  border: none;
  background: linear-gradient(135deg, #4f8ef7, #7c5af7);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.2s;
}

#send-btn svg { width: 16px; height: 16px; }
#send-btn:hover { transform: scale(1.08); }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ─── Scrollbar ──────────────────────────── */
#chat-box::-webkit-scrollbar { width: 4px; }
#chat-box::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

/* ─── Responsivo: menu continua ao lado ──── */
@media (max-width: 768px) {
  html, body {
    height: 100dvh;
    overflow: hidden;
  }

  body {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }

  .page {
    flex-direction: row;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }

  .profile {
    flex: 0 0 168px;
    width: 168px;
    min-width: 0;
    max-width: 168px;
    padding: 20px 12px;
    padding-top: max(20px, env(safe-area-inset-top));
    gap: 8px;
    overflow-x: hidden;
  }

  .avatar {
    width: 52px;
    height: 52px;
    font-size: 18px;
  }

  .profile-name { font-size: 14px; }
  .profile-role { font-size: 12px; }
  .profile-location { font-size: 11px; }
  .profile-bio { margin-top: 8px; padding-top: 12px; }
  .profile-bio p { font-size: 11px; line-height: 1.6; }

  .chat-header { min-width: 0; }
  .msg-bubble { max-width: 80%; }
  #user-input { font-size: 16px; }
  .input-area {
    padding: 12px 14px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .profile {
    flex: 0 0 64px;
    width: 64px;
    max-width: 64px;
    padding: 14px 6px;
    padding-top: max(14px, env(safe-area-inset-top));
    gap: 8px;
  }

  .avatar {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }

  .profile-name {
    font-size: 10px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .profile-role,
  .profile-location,
  .profile-bio { display: none; }

  .profile-links { margin-top: 2px; gap: 6px; }

  .link-btn {
    justify-content: center;
    padding: 8px;
    min-height: 36px;
  }

  .link-btn:hover { transform: none; }
  .link-label { display: none; }

  .chat-header { padding: 10px 12px; }
  .chat-header-avatar { width: 32px; height: 32px; font-size: 11px; }
  #chat-box { padding: 10px 12px; }
  .typing-indicator { padding: 0 12px 8px; }
  .msg-bubble { max-width: 85%; font-size: 13px; padding: 9px 12px; }
  .input-area { padding: 10px 12px; gap: 8px; }
  #send-btn { width: 40px; height: 40px; }
}
