/* Chat Interface Styles */

.chat-page-container {
  padding: 1rem 2rem;
  min-height: calc(100vh - var(--nav-height) - 140px);
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
}

#chat-container {
  flex: 1;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  background: var(--surface-white);
  border-radius: 1.5rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(226, 232, 240, 0.8);
  height: 650px;
  max-height: 75vh;
}

#chat-history {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.message {
  padding: 0.8rem 1.4rem;
  border-radius: 1.25rem;
  max-width: 75%;
  line-height: 1.6;
  font-size: 0.95rem;
  animation: slideUp 0.3s ease-out;
}

.user-message {
  background: linear-gradient(135deg, var(--primary-color), #3b82f6);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 0.25rem;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.bot-message {
  background-color: #f1f5f9;
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 0.25rem;
}

.bot-message p {
  margin: 0.4rem 0;
}
.bot-message ul,
.bot-message ol {
  margin: 0.4rem 0 0.4rem 1.2rem;
  padding: 0;
}
.bot-message li {
  margin: 0.2rem 0;
}
.bot-message a {
  color: var(--primary-color);
  text-decoration: underline;
}
.bot-message code {
  background: rgba(15, 23, 42, 0.08);
  border-radius: 6px;
  padding: 0.1rem 0.3rem;
  font-size: 0.85em;
  font-family: monospace;
}
.bot-message pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

#input-area {
  padding: 1.5rem;
  background: white;
  border-top: 1px solid #f1f5f9;
  display: flex;
  gap: 12px;
}

#user-input {
  flex: 1;
  padding: 0.9rem 1.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  outline: none;
  font-size: 0.95rem;
  transition: all 0.2s;
  background-color: #f8fafc;
}
#user-input:focus {
  border-color: var(--primary-color);
  background-color: white;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.chat-redirect-toast {
  position: fixed;
  top: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: #fef3c7;
  color: #92400e;
  border: 1px solid rgba(234, 179, 8, 0.5);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  z-index: 1200;
}

.chat-indexing-banner {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid rgba(234, 179, 8, 0.5);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-indexing-banner.indexing {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
}
.chat-indexing-banner.needs-indexing {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-color: rgba(239, 68, 68, 0.3);
}
.chat-indexing-banner-icon {
  font-size: 1.5rem;
}
.chat-indexing-banner-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.chat-indexing-banner-message {
  font-size: 0.85rem;
  color: #78350f;
}
.chat-indexing-banner.needs-indexing .chat-indexing-banner-message {
  color: #991b1b;
}
.chat-indexing-banner a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}
/* Skeleton / Typing Indicator */
.typing-indicator {
  padding: 0.8rem 1.4rem;
  background-color: #f1f5f9;
  border-radius: 1.25rem;
  border-bottom-left-radius: 0.25rem;
  align-self: flex-start;
  display: flex;
  gap: 4px;
  animation: slideUp 0.3s ease-out;
  margin-bottom: 0.5rem;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

@media (max-width: 768px) {
  .chat-page-container {
    padding: 0.75rem 1rem;
    min-height: calc(100dvh - var(--nav-height) - 80px);
  }

  #chat-container {
    height: calc(100dvh - var(--nav-height) - 120px);
    max-height: none;
    border-radius: 1rem;
  }

  #chat-history {
    padding: 1.25rem 1rem;
    gap: 1rem;
  }

  .message {
    max-width: 85%;
    padding: 0.7rem 1.1rem;
    font-size: 0.9rem;
  }

  #input-area {
    padding: 1rem;
    gap: 8px;
  }

  #user-input {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .message {
    max-width: 90%;
  }

  .chat-indexing-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
  }
}
