/* --- CSS LENGKAP --- */
html,
body {
  margin: 0;
  padding: 0;
  font-family: "Inter", Arial, sans-serif;
  background: #f7f7fc;
  height: 100%;
  min-height: 100%;
}

.chatgpt-main {
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Sticky Header (MODIFIED) ===== */
.chatgpt-header {
  background: #fff;
  box-shadow: 0 2px 6px 0 rgba(30, 129, 254, 0.06);
  height: 68px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* BARU: Kontainer untuk menengahkan konten header */
.header-main-container {
  width: 100%;
  max-width: 720px; /* Samakan dengan lebar chat */
  margin: 0 auto; /* Atur ke tengah */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px; /* Beri sedikit padding horizontal */
}

/* Konten header kiri */
.chatgpt-header-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Kontainer untuk logo kanan */
.header-logos-right {
  display: flex;
  align-items: center;
  gap: 15px; /* Jarak antar logo */
}

/* Styling untuk logo kanan */
.header-logo {
  height: 40px; /* Sesuaikan tinggi logo */
  width: auto;
}

.chatgpt-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #e6f0fa;
}

.chatgpt-title {
  font-size: 1.23rem;
  font-weight: 700;
  color: #581b98;
  letter-spacing: 0.01em;
}

/* ===== Chat Area (FULL HEIGHT) ===== */
.chatgpt-chat {
  flex: 1 1 0%;
  min-height: 0;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #f7f7fc;
}

.chatgpt-messages,
#chatbox__messages {
  flex: 1 1 0%;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: #f7f7fc;
  padding: 24px 0 16px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100%;
}

/* ===== BUBBLE STYLE ===== */
.chatgpt-bubble {
  max-width: 82%;
  margin-left: 0;
  margin-right: auto;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 1.07rem;
  line-height: 1.52;
  box-shadow: 0 2px 8px 0 rgba(50, 88, 130, 0.07);
  word-break: break-word;
  background: #fff;
  opacity: 0;
  animation: fadeInUp 0.32s cubic-bezier(0.39, 0.575, 0.565, 1) forwards;
  transition: box-shadow 0.2s;
}
.chatgpt-bubble.user {
  align-self: flex-end;
  background: #581b98;
  color: #fff;
  margin-left: auto;
  margin-right: 0;
}
.chatgpt-bubble.bot {
  align-self: flex-start;
  background: #fff;
  color: #1a2641;
  margin-right: auto;
  margin-left: 0;
}
.chatgpt-bubble.user:hover,
.chatgpt-bubble.bot:hover {
  box-shadow: 0 2px 18px 0 rgba(50, 88, 130, 0.18);
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== FOOTER & INPUT ===== */
.chatgpt-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 24px;
  background: #f6f7fb;
  border-top: 1px solid #e5e7eb;
  position: sticky;
  bottom: 0;
  z-index: 99;
}

.chatgpt-footer input[type="text"] {
  flex: 1;
  padding: 12px 18px;
  border: 1px solid #d0d7e2;
  border-radius: 24px;
  font-size: 1rem;
  background: #fff;
  outline: none;
  transition: border 0.17s;
}
.chatgpt-footer input[type="text"]:focus {
  border: 1.5px solid #581b98;
}
.chatgpt-send {
  background: linear-gradient(90deg, #581b98, #9c1de7 80%);
  border: none;
  color: #fff;
  padding: 8px 16px;
  border-radius: 22px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background 0.15s;
  outline: none;
}
.chatgpt-send:hover {
  background: linear-gradient(90deg, #581b98, #581b98 100%);
}

/* ===== TYPING INDICATOR ===== */
.typing-indicator {
  display: inline-block;
  margin-left: 10px;
  height: 16px;
  vertical-align: middle;
}
.typing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #b8b8b8;
  border-radius: 50%;
  margin-right: 3px;
  animation: typingBlink 1.3s infinite;
}
.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes typingBlink {
  0%,
  80%,
  100% {
    opacity: 0.3;
  }
  40% {
    opacity: 1;
  }
}

/* ===== SCROLLBAR CUSTOM ===== */
.chatgpt-messages::-webkit-scrollbar {
  width: 6px;
  background: transparent;
}
.chatgpt-messages::-webkit-scrollbar-thumb {
  background: #e3eaf1;
  border-radius: 6px;
}

/* ===== INFO POPUP STYLE ===== */
.info-popup {
  position: relative;
  background-color: #e6f0fa;
  border: 1px solid #b4d3f3;
  border-radius: 8px;
  padding: 12px 40px 12px 18px;
  margin: 0 24px 10px 24px;
  font-size: 0.9rem;
  color: #1a2641;
  transition: opacity 0.3s, transform 0.3s;
}
.info-popup p {
  margin: 0;
  line-height: 1.5;
}
.info-popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #888;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}
.info-popup-close:hover {
  color: #333;
}
.info-popup.hidden {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 800px) {
  .header-main-container, /* Samakan layout header dan chat */
        .chatgpt-chat {
    max-width: 99vw;
    padding-left: 2vw;
    padding-right: 2vw;
  }
  .chatgpt-main {
    min-height: 98vh;
  }
  .info-popup {
    margin-left: 0;
    margin-right: 0;
  }
}
@media (max-width: 540px) {
  .chatgpt-header {
    height: 58px;
  }
  .chatgpt-logo {
    width: 28px;
    height: 28px;
  }
  .chatgpt-title {
    font-size: 1rem;
  }
  .chatgpt-footer {
    padding: 10px 6px;
  }
  .chatgpt-messages {
    padding: 10px 0 12px 0;
  }
  .chatgpt-chat {
    min-height: 320px;
  }
  /* Sembunyikan logo kanan di layar kecil jika perlu */
  .header-logos-right {
    display: none;
  }
}
