/* --- Retro Terminal Chat Styles --- */
.chat-window-terminal {
  background: #0d0d0d;
  color: #00ff41;
  font-family: "Menlo", "Monaco", "Courier New", monospace;
  border: 2px solid rgba(0, 255, 65, 0.5);
  border-radius: 12px;
  text-shadow: 0 0 3px rgba(0, 255, 65, 0.4);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
  height: 750px;
  display: flex;
  flex-direction: column;
}

.chat-log-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem;
}
.chat-log {
    padding: 1rem;
}


.chat-window-terminal .chat-message {
  background: none;
  border: none;
  margin: 0;
  padding: 0;
}

/* --- THIS IS THE ALIGNMENT FIX --- */
.chat-window-terminal .chat-message p,
.chat-window-terminal .chat-bot-message p {
  margin-bottom: 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
  /* Use flexbox to stack the sender and message vertically */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.chat-window-terminal .chat-message strong {
  color: #98ffb2;
  /* The strong tag will now be a flex item, appearing on its own line */
}

.chat-bot-message {
  text-align: center;
  font-style: italic;
  color: rgba(0, 255, 65, 0.6);
  padding: 0.5rem 0;
}

/* Consolidated input area styles */
.user-input-terminal,
.chat-input-area {
  padding: 1rem;
  border-top: 1px solid rgba(0, 255, 65, 0.2);
}

.user-input-terminal textarea,
.chat-input-area .form-control {
  background-color: #0d0d0d !important;
  color: #00ff41 !important;
  font-family: "Menlo", "Monaco", "Courier New", monospace !important;
  border: 1px solid #00ff41 !important;
  caret-color: #00ff41;
}

.user-input-terminal textarea::placeholder {
  color: rgba(0, 255, 65, 0.4) !important;
}

.user-input-terminal .btn-primary {
  background-color: #00ff41;
  color: #0d0d0d;
  border: none;
}
.user-input-terminal .btn-primary:hover {
  background-color: #98ffb2;
}

/* Typing Indicator Animation */
.chat-window-terminal .typing-indicator {
  background: none;
}
.chat-window-terminal .typing-indicator .typing-dots span {
  background-color: #00ff41;
  animation: pulse 1.4s infinite ease-in-out;
}
.chat-window-terminal .typing-indicator .typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.chat-window-terminal .typing-indicator .typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@media (max-width: 768px) {
  .chat-window-terminal {
    height: 450px; /* Larger on mobile vs 300px on desktop */
    min-height: 450px;
  }
}

/* Auto-expanding terminal */
.chat-window-terminal {
  height: 300px; /* Desktop default */
  min-height: 300px;
  max-height: 80vh; /* Prevent it from taking full screen */
  transition: height 0.3s ease;
}

/* When terminal has more content, allow expansion */
.chat-window-terminal.expanded {
  height: auto;
  min-height: 400px;
}

/* Ensure messages wrap properly on mobile */
@media (max-width: 768px) {
  .chat-message {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}
