:root {
  --bg-color: #ffffff;
  --chat-bg-user: #ffffff;
  --chat-bg-bot: #f7f7f8;
  --text-primary: #343541;
  --border-color: #d9d9e3;
  --input-shadow: 0 0 15px rgba(0,0,0,0.1);
}

body {
  background-color: var(--bg-color);
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Layout Utama --- */

.main-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* --- Area Chat (Scrollable) --- */

#chat-box {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-bottom: 150px;
  width: 100%;
}

#chat-box::-webkit-scrollbar {
  width: 8px;
}

#chat-box::-webkit-scrollbar-track {
  background: transparent;
}

#chat-box::-webkit-scrollbar-thumb {
  background-color: #cdcdcd;
  border-radius: 4px;
}

/* --- Baris Pesan --- */

.message-row {
  width: 100%;
  padding: 24px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex;
  justify-content: center;
}

.message-row.bot {
  background-color: var(--chat-bg-bot);
}

.message-row.user {
  background-color: var(--bg-color);
}

/* Konten Pesan */

.message-inner {
  width: 100%;
  max-width: 768px;
  display: flex;
  gap: 20px;
  padding: 0 20px;
}

.avatar-col {
  flex-shrink: 0;
  width: 36px;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
}

.text-col {
  flex-grow: 1;
  min-width: 0;
  line-height: 1.6;
  font-size: 16px;
  padding-top: 2px;
  word-wrap: break-word;
}

/* Styling konten HTML di dalam chat */

.text-col strong {
  font-weight: 600;
}

.text-col a {
  color: #10a37f;
  text-decoration: none;
}

.text-col a:hover {
  text-decoration: underline;
}

.text-col p {
  margin-bottom: 0.8rem;
}

.text-col pre {
  background: #eee;
  padding: 10px;
  border-radius: 5px;
  overflow-x: auto;
}

/* Container Lampiran Media (Gambar/Video) */

.media-attachment-container {
  margin-top: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.media-card {
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  max-width: 100%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.img-preview {
  display: block;
  max-width: 100%;
  max-height: 350px;
  object-fit: contain;
}

.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 16/9;
  background: #000;
}

.video-wrapper iframe, .video-wrapper video {
  width: 100%;
  height: 100%;
}

/* --- Input Area --- */

.input-area-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #ffffff 20%);
  padding: 20px 10px 30px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.input-container {
  width: 100%;
  max-width: 768px;
  position: relative;
  box-shadow: var(--input-shadow);
  border-radius: 12px;
  background: white;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 4px;
}

#userInput {
  border: none;
  box-shadow: none;
  resize: none;
  padding: 12px 45px 12px 16px;
  height: 52px;
  width: 100%;
  font-size: 16px;
  outline: none;
  border-radius: 12px;
}

#sendButton {
  position: absolute;
  right: 10px;
  bottom: 8px;
  background: transparent;
  border: none;
  color: #acacbe;
  padding: 5px;
  border-radius: 6px;
  transition: all 0.2s;
}

#sendButton:hover {
  background-color: #ececf1;
  color: #10a37f;
}

#sendButton:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Keyword Chips */

.keyword-wrapper {
  max-width: 768px;
  width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  margin-bottom: 10px;
  padding: 0 10px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.keyword-wrapper::-webkit-scrollbar {
  display: none;
}

.status-bar {
  font-size: 12px;
  text-align: center;
  color: #8e8ea0;
  margin-bottom: 5px;
}

/* Typing Indicator */

.typing-indicator span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: #b1b1b1;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
  margin: 0 2px;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

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

@media (max-width: 576px) {
  .message-row {
    padding: 16px 0;
  }
}

@media (max-width: 576px) {
  .message-inner {
    padding: 0 16px;
    gap: 12px;
  }
}

@media (max-width: 576px) {
  .chat-avatar {
    width: 30px;
    height: 30px;
  }
}

