/* ---------- Reset / base ---------- */
body {
  font-family: Arial, sans-serif;
  background-color: #f4f4f9;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}
/* --- STYLE TOMBOL FEEDBACK (GEMINI STYLE) --- */

/* Container: Berjejer ke samping */
.feedback-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* Pastikan rata kiri */
  gap: 8px;
  margin-top: 5px;
  margin-bottom: 15px; /* Tambah jarak ke chat berikutnya */
  padding-left: 2px;
  opacity: 1; /* Ubah ke 1 agar muncul langsung saat dirender HTML */
  animation: fadeIn 0.5s forwards;
}

/* Tombol: Hapus kotak, buat transparan & bulat */
.feedback-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #5f6368; /* Warna abu-abu default */
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

/* Hover Effect */
.feedback-btn:hover {
  background-color: #f1f3f4;
  color: #202124;
}

.feedback-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor; /* Penting: agar warna mengikuti text color */
  display: block;
}

/* Status Aktif (Warna berubah saat diklik) */
.feedback-btn.active-like {
  color: #1e8e3e !important; /* Hijau */
}
.feedback-btn.active-dislike {
  color: #d93025 !important; /* Merah */
}

/* Tambahkan ini untuk animasi fade in */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Aturan sederhana & aman untuk spasi paragraf di bubble bot */
#chatBox .entry .bubble.bot .welcome p {
  margin: -20px 0;        /* spasi antar paragraf - ubah jadi 4px jika mau lebih rapat */
  line-height: 0;    /* jangan negatif */
  color: #1f2933;
}

/* hilangkan spasi ekstra di awal/akhir */
#chatBox .entry .bubble.bot .welcome p:first-child {
  margin-top: -70px;
}
#chatBox .entry .bubble.bot .welcome p:last-child {
  margin-bottom: -80px;
}

/* jika ingin tampak sebagai daftar, sebaiknya gunakan <ul><li> - tapi ini opsional */


/* ---------- Container ---------- */
.chat-container {
  width: 90%;
  max-width: 900px;
  height: 95vh;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  flex-grow: 0;
  box-sizing: border-box;
}

/* ---------- Header / nav ---------- */
.chat-header {
  background-color: #01416F;
  color: white;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chat-header .chat-logo {
  position: absolute;
  left: 10px;
  bottom: 60px;
  height: 45px;
}

.chat-nav {
  margin-top: 5px;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

.chat-nav a {
  color: white;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.chat-nav a:hover {
  opacity: 0.6;
}

.chat-nav a.nav-active {
  opacity: 0.6;
}

.buttonlogout a {
  color: white;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.buttonlogout a:hover {
  opacity: 0.6;
}

/* ---------- Sections ---------- */
.section {
  display: none;
}

.section.active {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* hide contents of non-active sections strongly */
.section:not(.active) .chat-box,
.section:not(.active) #toggleReasoningBtn,
.section:not(.active) .chat-input {
  display: none !important;
}

/* ---------- Chat box ---------- */
/* IMPORTANT: remove line-height:0 which caused overlapping lines.
   Use normal line-height here so all children render naturally. */
.chat-box {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background-color: #f7f8fa;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  line-height: normal;
  /* <- changed */
  box-sizing: border-box;
}

/* small spacing improvements for entries */
.chat-box .entry {
  margin-bottom: 10px;
}

/* Toggle reasoning button */
#toggleReasoningBtn {
  display: inline-block;
  margin: 10px 20px;
  padding: 8px 12px;
  background-color: #01416F;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  align-self: flex-start;
  flex-shrink: 0;
}

/* ---------- Message bubbles ---------- */
.entry {
  margin-bottom: 15px;
  animation: fadeIn 0.3s forwards;
}

.entry.user {
  text-align: right;
}

.bubble {
  display: block;
  padding: 10px;
  border-radius: 8px;
  max-width: 80%;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeIn 1s forwards;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.3 !important;
  /* ensure readable line-height */
  box-sizing: border-box;
}

.bubble.user {
  display: inline-block;
  max-width: 50%;
  background-color: #008DD5;
  color: white;
  margin-left: auto;
  text-align: right;
  height: auto;
  border-radius: 8px;
}

.bubble.bot {
  background-color: #e0e0e0;
  color: #000;
  text-align: left;
}

/* paragraphs inside bubble */
.bubble p {
  margin: 4px 0;
  line-height: 1.45 !important;
}

/* ---------- Lists inside bubbles (main fix area) ---------- */
/* Container UL/OL: ensure bullets outside, spacing controlled */
.bubble ul,
.bubble ol {
  margin: 6px 0 6px 20px !important;
  padding-left: 18px !important;
  line-height: 1.45 !important;
  list-style-position: outside !important;
  box-sizing: border-box;
  white-space: normal !important;
}

/* LI styling to prevent overlap and ensure wrapping */
.bubble li {
  display: list-item !important;
  margin: 0.35rem 0 !important;
  padding-left: 0.25rem !important;
  line-height: 1.45 !important;
  min-height: 1.2em !important;
  /* ensure at least one line height */
  white-space: normal !important;
  /* allow wrapping */
  overflow-wrap: anywhere !important;
  /* aggressive wrap for long tokens */
  word-break: break-word !important;
  /* fallback */
  vertical-align: top !important;
  box-sizing: border-box;
}

/* Ensure inline elements inside li inherit readable line-height */
.bubble li * {
  line-height: inherit !important;
  white-space: normal !important;
}

/* typing bubble keep pre-wrap */
.bubble.typing {
  white-space: pre-wrap;
  overflow: hidden;
  border-right: 2px solid #008DD5;
}

/* fade animation */
@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Chat input ---------- */
.chat-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

#adminSection {
  padding: 20px;
  overflow-y: auto;
  background-color: #f9f9f9;
  flex: 1;
  margin-top: -550px;
}

#tentangSection {
  overflow-y: auto;
  background-color: #f9f9f9;
  flex: 1;
  margin-top: -550px;
}

.about-text {
  text-indent: 30px;
}

.title,
.sub-title {
  text-align: center;
  width: 100%;
  margin-top: 10px;
  margin-bottom: 10px;
  color: #333;
}

.sub-title {
  margin-top: -10px;
}

.about-text {
  margin-left: 10px;
  margin-right: 10px;
}

.dev-panel {
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #fafafa;
  flex-wrap: wrap;
  margin-right: 15px;
  margin-left: 15px;
  margin-bottom: 15px;
}

/* Foto akan menyesuaikan ukuran gambar sebenarnya dengan batas maksimum */
.dev-photo {
  margin-top: 7px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  background: #fff;
  flex-shrink: 0;

  /* Tambahkan margin kiri, atas, dan bawah */

  /* Maksimal ukuran agar tidak terlalu besar, tapi tetap menyesuaikan proporsi gambar */
  max-width: 150px;
  max-height: 150px;
  margin-bottom: 10px;
  margin-left: -10px;
}

/* Gambar mengikuti proporsi asli dan menyesuaikan ukuran */
.dev-photo img {
  width: auto;
  height: auto;
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
  border-radius: 6px;
  margin-left: 300px;
  margin-top: 2px;
}

.about-text {
  flex: 1;
  color: #333;
  line-height: 1.6;
  margin-top: 10px;
  text-align: justify; /* ✅ ubah jadi justify */
  padding-left: 10px;
  padding-right: 10px;
}

/* Deskripsi agar sejajar rapi dengan foto */
.dev-desc {
  flex: 1;
  line-height: 1.3; 
  text-align: justify;
  margin-left: 200px;
}


#panduanSection {
  overflow-y: auto;
  background-color: #f9f9f9;
  flex: 1;
  margin-top: -550px;
}

.chat-input {
  display: flex;
  padding: 15px;
  background-color: #fff;
  border-top: 1px solid #ddd;
  flex-shrink: 0;
}

#chatForm {
  width: 100%;
  display: flex;
  gap: 35px;
  align-items: flex-start;
}

.input-left {
  flex: 1;
}

.input-left textarea {
  width: 100%;
  height: 80px;
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #ccc;
  resize: none;
}

.input-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100px;
}

.input-right select,
.input-right button {
  width: 100%;
  font-size: 16px;
  padding: 10px;
  border-radius: 8px;
}

.input-right select {
  border: 1px solid #ccc;
}

.input-right button {
  background-color: #01416F;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
}

/* spinner */
.spinner {
  border: 2px solid #f3f3f3;
  border-top: 2px solid #008DD5;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  animation: spin 1s linear infinite;
  display: none;
  vertical-align: middle;
  margin-left: 5px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Upload / Admin table ---------- */
.upload_form {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.upload_form input[type="file"] {
  flex-grow: 1;
}

.upload_form button {
  padding: 8px 16px;
  background-color: #01416F;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.upload_form button:hover {
  background-color: #008DD5;
}

#adminSection input[type="text"] {
  width: 100%;
  padding: 8px;
  margin-bottom: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

#fileTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

#fileTable th,
#fileTable td {
  border: 1px solid #ccc;
  padding: 8px;
  text-align: left;
}

.btn-green {
  background-color: #01416F;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 5px;
  font-size: 13px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.btn-green:hover {
  background-color: #008DD5;
}

.border-data {
  margin-top: 20px;
  border: 1px solid #ccc;
  padding: 15px;
  border-radius: 8px;
}

#searchInput {
  box-sizing: border-box;
  width: 100%;
  padding: 8px;
  margin: 0 0 12px 0;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.scrollable-table {
  max-height: 370px;
  overflow-y: auto;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.scrollable-table thead th {
  position: sticky;
  top: 0;
  background-color: #f4f4f4;
  z-index: 2;
  border-bottom: 1px solid #ccc;
  text-align: left;
  padding: 8px;
}

.scrollable-table tbody td {
  background-color: white;
  padding: 8px;
}

.scrollable-table table {
  width: 100%;
  border-collapse: collapse;
}

/* Reasoning bubble style */
.bubble.reasoning {
  filter: brightness(90%);
  opacity: 0.8 !important;
  background-color: #f0f8ff;
  border-left: 4px solid #008DD5;
}

.bubble.bot a {
    color: #01416F;       /* Biru langit yang soft (bukan biru standar yang tajam) */
    text-decoration: none; /* Menghilangkan garis bawah (underline) */
    font-weight: 500;      /* Sedikit lebih tebal agar terbaca sebagai link */
    transition: color 0.2s ease; /* Transisi halus saat warna berubah */
}

/* 2. Saat Mouse Diarahkan (Hover) */
.bubble.bot a:hover {
    color: #7ec2f3;        /* Sedikit lebih terang/cyan saat disentuh */
    text-decoration: none;
}

/* small tweaks */
#llmModel {
  font-size: 11px;
}

.panduan-content {
  margin-left: 50px;
  margin-right: 50px;
}

.chat-section #toggleReasoningBtn {
  display: inline-block !important;
  position: sticky;
  bottom: 80px;
  left: 20px;
  z-index: 10;
}

.dev-desc {
  line-height: 30px;
  margin-top: -10px;
}