.rekha-chat-container {
  display: flex;
  flex-direction: column;
  background-color: var(--rekha-bg);
  height: 90vh;
  max-height: 850px;
  overflow: hidden;
}
.rekha-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.header-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 40px; /* Disesuaikan agar lebih proporsional */
  height: 40px; /* Disesuaikan agar lebih proporsional */
  display: flex; /* Membantu alignment */
  align-items: center; /* Membantu alignment */
  justify-content: center; /* Membantu alignment */
}
.header-logo img { /* Mengganti selector dari svg ke img */
  width: 100%;
  height: 100%;
  object-fit: contain; /* Memastikan gambar pas tanpa terpotong */
}

.header-title h2 {
  font-size: 1.1rem;
  margin: 0;
  line-height: 1.2;
  font-weight: 600;
}
.header-title p {
  font-size: 0.8rem;
  color: var(--text-secondary-color);
  margin: 0;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.header-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-secondary-color);
  transition: color 0.2s ease, transform 0.2s ease;
  border-radius: 50%;
}
.header-button:hover {
  color: var(--primary-color);
  background-color: #f0f0f0;
}
.header-button:active {
  transform: scale(0.9);
}
.header-button svg {
  width: 20px;
  height: 20px;
}

.token-info {
  display: flex;
  background-color: #fff;
  flex-shrink: 0;
  border-bottom: 1px solid #e9e9e9;
}
.token-info-item {
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.3;
}
.token-info-item:first-child {
  flex: 1;
  border-right: 1px solid #e9e9e9;
}
.token-info-item:last-child {
  flex: 2;
}
.token-info-item strong {
  font-weight: 600;
}
.token-info-item span {
  font-weight: 400;
}

.chat-room {
  flex: 1;
  overflow-y: auto;
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.chat-bubble {
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 18px;
  margin-bottom: 5px;
  position: relative;
  word-wrap: break-word;
  line-height: 1.5;
}
.bubble-container {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
  /* DITAMBAHKAN: Animasi untuk bubble baru */
  animation: fadeInUp 0.4s ease-in-out;
}
.bubble-container.user {
  align-items: flex-end;
}
.bubble-container.bot {
  align-items: flex-start;
}
.chat-bubble.user {
  background-color: var(--user-bubble-bg);
  color: var(--user-bubble-text);
  border-bottom-right-radius: 4px;
}
.chat-bubble.bot {
  background-color: var(--bot-bubble-bg);
  color: var(--bot-bubble-text);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}
.chat-bubble.typing span {
  animation: blink 1.4s infinite both;
}
.chat-bubble.typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.chat-bubble.typing span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes blink {
  0% {
    opacity: 0.2;
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0.2;
  }
}

.bubble-meta {
  font-size: 0.7rem;
  color: var(--text-secondary-color);
  margin-top: 4px;
  padding: 0 5px;
}

/* --- FORMATTING DALAM CHAT BUBBLE --- */
.chat-bubble strong {
  font-weight: 700;
}
.chat-bubble em {
  font-style: italic;
}
.chat-bubble a {
  color: #0056b3;
  text-decoration: underline;
}
.chat-bubble a:hover {
  color: #003d7e;
}
.chat-bubble ul,
.chat-bubble ol {
  padding-left: 20px;
  margin: 10px 0;
}
.chat-bubble li {
  margin-bottom: 5px;
}
.chat-bubble hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 15px 0;
}
.chat-bubble p {
  margin: 10px 0;
}

.open-table-btn {
  background-color: var(--primary-color);
  color: white;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  margin-top: 15px;
  display: inline-block;
  transition: background-color 0.2s, transform 0.1s ease;
  width: 100%;
}
.open-table-btn:hover {
  background-color: var(--primary-hover-color);
}
.open-table-btn:active {
  transform: scale(0.98);
}

.chat-footer {
  display: flex;
  align-items: center;
  padding: 10px;
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}
.chat-input-wrapper {
  flex-grow: 1;
  position: relative;
}
#chat-input {
  width: 100%;
  border: 1.5px solid var(--border-color);
  border-radius: 25px;
  padding: 12px 20px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 0.2s ease;
}
#chat-input:focus {
  outline: none;
  border-color: var(--primary-color);
}
#send-button {
  background-color: var(--primary-color);
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  margin-left: 10px;
  cursor: pointer;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, transform 0.2s ease;
  flex-shrink: 0;
  margin-bottom: 5px;
}
#send-button:hover {
  background-color: var(--primary-hover-color);
  transform: scale(1.05);
}
#send-button:active {
  transform: scale(0.95);
}
#send-button:disabled {
  background-color: var(--disabled-bg);
  cursor: not-allowed;
  transform: scale(1);
}
#send-button svg {
  width: 24px;
  height: 24px;
}

/* --- THINKING BUBBLE STYLES --- */
.chat-bubble.thinking {
  font-style: italic;
  color: var(--text-secondary-color);
  animation: pulse 1.8s infinite ease-in-out;
}

@keyframes pulse {
  0% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.7;
  }
}

/* DITAMBAHKAN: Animasi untuk bubble chat */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- DITAMBAHKAN: STYLING UNTUK WELCOME MESSAGE --- */
.welcome-message {
  background-color: #fffbeb; /* Cream kuning muda */
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  animation: fadeInUp 0.5s ease-in-out;
}
.welcome-message h4 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.3rem;
  text-align: center;
  color: #92400e;
}
.welcome-message ul {
  padding-left: 20px;
  margin: 0 0 20px 0;
  text-align: left;
  list-style-type: '✓  ';
}
.welcome-message ul li {
  margin-bottom: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #374151;
}
.welcome-message ul li b {
  color: #111827;
}
.welcome-message .welcome-note {
  font-size: 0.75rem;
  color: rgba(0, 0, 0, 0.4);
  margin-top: 20px;
  margin-bottom: 0;
  text-align: center;
  line-height: 1.4;
}
.template-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}
.template-btn {
  border: none;
  border-radius: 15px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.template-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.template-btn:nth-child(1) { background-color: #e0f2fe; color: #0c4a6e; }
.template-btn:nth-child(2) { background-color: #dcfce7; color: #166534; }
.template-btn:nth-child(3) { background-color: #fef3c7; color: #92400e; }
.template-btn:nth-child(4) { background-color: #fee2e2; color: #991b1b; }
.template-btn:nth-child(5) { background-color: #f3e8ff; color: #6b21a8; }


@media (max-width: 520px) {
  .rekha-auth-container {
    overflow-y: auto;
    flex-grow: 1;
    flex: 1;
  }
  .rekha-chat-container {
    height: var(--app-height, 100dvh);
    max-height: none;
    border-radius: 0;
  }
}
