/* --- Original Layout Styles (Preserved) --- */
html {
  height: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  margin: 0;
  overflow-y: auto; /* Allow scrolling for smaller screens */
}

header {
  display: flex;
  padding: 20px 32px 0;
  width: 100%;
}

h1 {
  text-align: left;
  color: rgb(29, 29, 29);
  font-size: 24px;
  font-weight: 700;
}

#container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
  width: 95%;
  max-width: 1400px; /* Increased for side-by-side layout */
  min-width: 800px;
}

/* Main content area with side-by-side layout */
#main-content {
  display: flex;
  flex-direction: row;
  width: 100%;
  gap: 20px;
  align-items: flex-start;
}

/* Stream section (left side) */
#stream-section {
  flex: 1;
  min-width: 400px;
  display: flex;
  justify-content: center;
}

/* Chat section (right side) */
#chat-section {
  flex: 1;
  min-width: 400px;
  display: flex;
  flex-direction: column;
  height: 600px; /* Fixed height for chat area */
}

/* Responsive design for smaller screens */
@media (max-width: 1200px) {
  #main-content {
    flex-direction: column;
    gap: 20px;
  }

  #stream-section,
  #chat-section {
    min-width: unset;
    width: 100%;
  }

  #chat-section {
    height: 500px;
  }

  #container {
    width: 95%;
    min-width: 400px;
  }
}

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;
}

#previewName {
  font-size: 15px;
}

#connectionLabel {
  font-weight: lighter;
  font-size: 10px;
  color: green;
}

#video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background-color: #000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

/* --- NEW Chat Area Styles --- */
#chat-area {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

#messages-area {
  flex-grow: 1;
  height: 450px; /* Increased height for better chat experience */
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  max-width: 85%;
  animation: fadeIn 0.3s ease-out;
}

.user-message {
  justify-content: flex-end;
  align-self: flex-end;
}

.agent-message {
  justify-content: flex-start;
  align-self: flex-start;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.user-message .message-bubble {
  background-color: #007bff;
  color: #ffffff;
  border-bottom-right-radius: 5px;
}

.agent-message .message-bubble {
  background-color: #f1f1f1;
  color: #111827;
  border-bottom-left-radius: 5px;
}

.message-text {
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  text-align: left;
}

.message-time {
  font-size: 0.75rem;
  margin-top: 8px;
  text-align: right;
  opacity: 0.8;
}

.user-message .message-time {
  color: rgba(255, 255, 255, 0.7);
}
.agent-message .message-time {
  color: #6b7280;
}

/* --- Typing Indicator --- */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 16px;
}
.typing-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #9ca3af;
  animation: bounce 1.2s infinite ease-in-out;
}
.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.3s;
}

/* --- RESTYLED Input Area --- */
.inputsDiv {
  width: 100%;
  margin-top: 1rem;
  flex-shrink: 0; /* Prevent input area from shrinking */
}

.mainInput {
  width: 100%;
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 8px;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 28px;
}

#textArea {
  flex-grow: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  text-align: left;
  width: 100%;
  background: transparent;
  font-size: 1rem;
  line-height: 1.5;
  padding: 10px;
  max-height: 120px;
}

.roundButton {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #6b7280;
  background-color: #f1f1f1;
}
.roundButton:hover {
  background-color: #e5e7eb;
}

#actionButton {
  background-color: #007bff;
  color: white;
}
#actionButton:hover {
  background-color: #0056b3;
}

/* --- Animations & Other --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

#hidden {
  display: none;
} /* Kept original rule */
