/* chat.css — Interface de Chat com contraste correto */

/* ── Chat Screen ── */
#screen-chat {
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #F4F6FA;
}

/* ── Chat Header ── */
.chat-header {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

.chat-header__specialist {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  color: #ffffff;
  min-height: 72px;
}

.chat-header__back {
  background: rgba(255,255,255,0.18);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.chat-header__back:hover { background: rgba(255,255,255,0.28); }

/* Robot avatar in header */
.chat-header__robot {
  width: 52px;
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
  animation: robotFloatSmall 3s ease-in-out infinite;
}
@keyframes robotFloatSmall {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-4px); }
}

.chat-header__info { flex: 1; }

/* Logo no header do chat */
.chat-header__logo {
  height: 58px;
  width: auto;
  opacity: 0.82;
  mix-blend-mode: screen;
  filter: brightness(1.1) drop-shadow(0 0 8px rgba(255,255,255,0.1));
  flex-shrink: 0;
  margin-left: auto;
}

.chat-header__name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.chat-header__domain {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 12px;
  opacity: 0.82;
  font-weight: 400;
}

/* ── Messages Area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
  background: #F4F6FA;
}

/* ── Message ── */
.message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  animation: fadeInUp 220ms ease forwards;
}

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

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

/* Robot avatar in messages */
.message__avatar-img {
  width: 46px;
  height: auto;
  flex-shrink: 0;
  margin-bottom: 4px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.18));
}

/* Fallback emoji avatar */
.message__avatar {
  font-size: 20px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.message__bubble {
  max-width: 72%;
  padding: 14px 18px;
  position: relative;
}

/* User bubble — escuro */
.message__bubble--user {
  background: #1B2A4A;
  color: #FFFFFF;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 2px 8px rgba(27,42,74,0.25);
}

/* Assistant bubble — branco puro com borda colorida sutil */
.message__bubble--assistant {
  background: #FFFFFF;
  color: #1A202C;
  border-radius: 18px 18px 18px 4px;
  border-left: 3px solid var(--bubble-accent, #CBD5E0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.message__content {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.65;
  color: inherit;
}

.message__bubble--assistant .message__content { color: #1A202C; }
.message__bubble--user .message__content       { color: #FFFFFF; }

.message__content p { margin-bottom: 8px; }
.message__content p:last-child { margin-bottom: 0; }
.message__content strong { font-weight: 600; }

.message__time {
  display: block;
  font-size: 10px;
  margin-top: 6px;
  text-align: right;
}
.message__bubble--user .message__time      { color: rgba(255,255,255,0.5); }
.message__bubble--assistant .message__time { color: #94A3B8; }

/* ── Typing Indicator ── */
#typing-indicator {
  display: none;
  align-items: flex-end;
  gap: 10px;
}
#typing-indicator.visible { display: flex; }

.typing-bubble {
  background: #FFFFFF;
  border-radius: 18px 18px 18px 4px;
  border-left: 3px solid #CBD5E0;
  padding: 14px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.typing-dot {
  width: 7px; height: 7px;
  background: #94A3B8;
  border-radius: 50%;
  animation: typing 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(1); opacity: 0.4; }
  40%           { transform: scale(1.3); opacity: 1; }
}

/* ── Transition Banner ── */
#transition-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--transition-color, #1B2A4A);
  color: white;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  animation: slideIn 300ms ease;
  flex-shrink: 0;
}
#transition-banner.visible { display: flex; }

@keyframes slideIn {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ── Input Area ── */
.chat-input-area {
  flex-shrink: 0;
  padding: 14px 20px;
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
}

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #F4F6FA;
  border-radius: 999px;
  padding: 10px 14px 10px 20px;
  border: 1.5px solid #E2E8F0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.chat-form:focus-within {
  border-color: #1B2A4A;
  box-shadow: 0 0 0 3px rgba(27,42,74,0.08);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1A202C;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 22px;
}
.chat-input::placeholder { color: #94A3B8; }
.chat-input:disabled { opacity: 0.5; }

.btn-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #1B2A4A;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: background 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}
.btn-send:hover:not(:disabled) { background: #C9A84C; transform: scale(1.06); }
.btn-send:disabled { opacity: 0.45; cursor: not-allowed; }

.chat-disclaimer {
  text-align: center;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 10.5px;
  color: #94A3B8;
  margin-top: 7px;
}

/* ── Scrollbar ── */
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 4px; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .message__bubble { max-width: 85%; }
  .chat-messages { padding: 16px 14px; gap: 14px; }
  .chat-header__robot { width: 48px; height: 58px; }
}
