/* =========================
   HELP / FAQ MODAL + CHAT
   ========================= */

/* Overlay */
.help-faq-modal{
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2560;
  visibility: hidden;
  opacity: 0;
  transition: visibility 0s, opacity 0.3s ease;
}
.help-faq-modal.open{
  visibility: visible;
  opacity: 1;
}

/* Modal content (default center) */
.help-faq-content{
  font-size: 14px;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0,0,0,0.3);
  width: min(520px, calc(100vw - 2rem));
  height: min(86vh, 760px);
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@supports (height: 100dvh){
  .help-faq-content{
    height: min(86dvh, 760px);
    max-height: calc(100dvh - 2rem);
  }
}
p {margin: 0 0.35rem 0.5rem 1rem;}
.help-faq-content :is(h2, h3){font-size: 1.15em;}

/* Header */
.help-faq-header{
  background: linear-gradient(135deg, #3f51b5, #5c6bc0);
  color: #fff;
  padding: 0.25rem 0.65rem 0.25rem 0.8rem;
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1.35rem;
  user-select: none;
  align-items: center;
  min-height: 50px;
  cursor: default;
}

/* Collapse: sembunyikan FAQ saja */
#help-faq-modal .help-faq-content.faq-collapsed .help-faq-body .faq-section{
  display: none !important;
}

/* Judul */
.help-faq-header .help-title{
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  line-height: 1;
  margin-left: 0.4rem;
}

/* Header right */
.chat-header-right{
  margin-bottom: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.125rem 0 1rem;
}

/* Header buttons */
.help-faq-header button{
  background: rgba(255,255,255,0.85);
  color: #1a237e;
  border: 1px solid rgba(255,255,255,0.35);
  width: 1.75rem;
  height: 1.5rem;
  padding: 0;
  border-radius: 10px;
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.help-faq-header button:hover{
  background: rgba(255,255,255,0.95);
}

/* Admin toggle (pill) */
.help-faq-header #call-admin-toggle{
  background: linear-gradient(135deg, #00bcd4, #26c6da);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  height: 1.75rem;
  width: 1.75rem; /* fixed: sebelumnya '1.75' */
}
.help-faq-header #call-admin-toggle:hover{ filter: brightness(1.05); }

/* Body */
.help-faq-body{
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* FAQ */
.faq-section{ margin-left: margin-bottom: 0.5rem; }
.faq-section h2{
  margin-bottom: 0.5rem;
  background: #d7f2f0;
  border: 1px solid #b9d2e5;
  border-radius: 0.6rem;
  padding: 0.4rem 1rem;
}
.faq-section ul{ margin: 0 0.35rem 0.5rem 2rem; }

/* Title card before chat */
.chat-intro-card{
  background: #d7f2f0;
  border: 1px solid #b9d2e5;
  border-radius: 0.6rem;
  padding: 0.4rem 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* Chat container */
.chatbot-container-modal{
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid #b9d2e5;
  border-radius: 0.6rem;
  overflow: visible;
  margin-top: 0.25rem;
  min-height: 0;
}
.chatbot-container-modal.is-dragover{
  outline: 2px dashed #90caf9;
  outline-offset: 4px;
}

/* Messages */
.chatbot-messages{
  flex: 1;
  padding: 0.625rem;
  border-radius: 0.6rem 0.6rem 0 0;
  overflow-y: auto;
  background-color: #e3f2fd;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chatbot-message{
  margin-bottom: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.9375rem;
  max-width: 100%;
  word-wrap: break-word;
}
#chatbot-messages .chatbot-message img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100px;
  border-radius: 10px;
  object-fit: contain;
}
.chatbot-message.user{
  background-color: #dcf8c6;
  align-self: flex-end;
  margin-left: auto;
}
.chatbot-message.bot{
  background-color: #f1f0f0;
  align-self: flex-start;
  margin-right: auto;
  border-radius: 0.6rem;
}

a.chat-action.chip{
  border: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #6a1b9a;         /* ungu natural */
  text-decoration: underline;
}
a.chat-action.chip:hover{
  color: #4a148c;
}

/* Input */
.chatbot-input{
  padding: 0;
  border-top: 1px solid #eee;
  background-color: #f9f9f9;
}
.chatbot-input.chatbot-input--stack{
  display: flex;
  margin-top: 0.625px;
  padding: 0.625rem 0.625rem 0.5rem;
  border-radius: 0 0 0.6rem 0.6rem;
  background-color: #e3f2fd;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}
.chat-input-row{ display: flex; width: 100%; }

.chatbot-input textarea#chatbot-input-field {
  width: 100%;
  max-width: calc(100% - 0rem);
  flex: 1 1 auto;
  border: 0.75px solid #42a5f5;
  border-radius: 0.6rem;
  padding: 0.55rem 0.75rem;
  resize: vertical;     /* ✅ Bisa drag tinggi manual */
  overflow-y: auto;     /* ✅ SCROLL VISIBLE! */
  line-height: 1.35;
  font: inherit;
  max-height: 16rem;    /* ↑ 256px - cukup untuk data Excel */
  outline: none;
  transition: height 0.2s ease-out;
}

/* Smooth scrollbar */
#chatbot-input-field::-webkit-scrollbar {
  width: 6px;
}
#chatbot-input-field::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.chat-icon-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.input-left-tools,
.input-right-tools{
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Icon button */
.chat-icon-btn{
  margin-top: 0;
  border-radius: 999px;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid rgba(26,35,126,.18);
  box-shadow: 0 4px 10px rgba(26,35,126,.10);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.chat-icon-btn:hover{
  background: #dbe6ff;
  box-shadow: 0 6px 14px rgba(26,35,126,.16);
  transform: translateY(-1px);
}
.chat-icon-btn.active{
  background: linear-gradient(135deg, #9b52df, #2a73d3);
  color: #fff;
  box-shadow: 0 10px 18px rgba(26,35,126,.30);
}

button#chat-send-btn {
  background: linear-gradient(135deg, #9b52df, #2a73d3);
  box-shadow: 0 8px 18px rgba(63,81,181,.35);
  padding: 0.4rem 0.7rem;
  color: #fff;
  border: none;
}

/* Floating menus */
.chat-floating-menu{
  position: absolute;
  background: #fff;
  border-radius: 0.6rem;
  box-shadow: 0 0.5rem 1.25rem rgba(0,0,0,0.18);
  border: 1px solid #b9d2e5;
  padding: 0.4rem;
  z-index: 2005;
  display: none;
}
.chat-floating-menu.open{ display: block; }

/* Menu layout constraints */
#call-admin-menu, #mode-menu, #model-menu{
  width: max-content;
  max-width: min(80vw, 22rem);
}
#call-admin-menu{
  top: calc(100% + 0.35rem);
  right: 4.5rem;
  min-width: 6rem;
}

/* Bottom menus */
.chat-floating-menu-bottom,
.chat-floating-menu-bottom-left{
  bottom: calc(100% + 0.5rem);
  left: 0;
  min-width: 6rem;
}

/* WA submenu */
#call-admin-menu .menu-item-has-sub{ position: relative; }
#call-admin-menu .menu-item-has-sub::after{
  content:"";
  position:absolute;
  top: 0;
  left: 100%;
  width: 14px;
  height: 100%;
}
#call-admin-menu .menu-item-has-sub:hover .chat-floating-submenu,
#call-admin-menu .menu-item-has-sub:focus-within .chat-floating-submenu{
  display: block;
}
#call-admin-menu .chat-floating-submenu{
  position: absolute;
  top: 0;
  left: calc(100% + 0.25rem);
  display: none;
  min-width: 5rem;
  padding: 0.25rem;
  z-index: 2010;
  background: #fbf6f5;
  border: 1px solid #e8d0ce;
  box-shadow: 0 0.6rem 1.6rem rgba(0,0,0,0.18);
  border-radius: 0.6rem;
}
#call-admin-menu .chat-floating-submenu button{
  background: #f2e3e2;
  color: #00695c;
}
#call-admin-menu .chat-floating-submenu button:hover{
  background: #faccc8;
}

/* Menu buttons */
.chat-floating-menu button {
  width: 100%;
  height: 1.6rem;
  border: 0;
  background: #e8f1ff;
  color: #0d47a1;
  text-align: left;
  padding: 0.1rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.05rem;
  margin-bottom: 0.35rem;
}
.chat-floating-menu button:last-child{ margin-bottom: 0; }
.chat-floating-menu button:hover{ background: #d6e8ff; }
.chat-floating-menu button .label{
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-floating-menu button .check{
  width: 1.2rem;
  text-align: right;
  opacity: 0;
  font-weight: 800;
  color: #0d47a1;
}
.chat-floating-menu button.is-active{
  background: linear-gradient(135deg, #3f51b5, #5c6bc0);
  color: #fff;
  box-shadow: 0 10px 18px rgba(63,81,181,.28);
}
.chat-floating-menu button.is-active .label,
.chat-floating-menu button.is-active .check{
  color: #fff;
}
.chat-floating-menu button.is-active .check{
  opacity: 1;
}

/* Resize handle */
.help-resize-handle{
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
  opacity: .55;
  border-right: 2px solid rgba(0,0,0,.28);
  border-bottom: 2px solid rgba(0,0,0,.28);
}

/* ---------- Minimize / Maximize ---------- */
/* Minimize: pill */
.help-faq-content.is-minimized{
  left: auto !important;
  top: 1rem !important;
  right: 1rem !important;
  bottom: auto !important;
  transform: none !important;

  border-radius: 999px !important;

  /* pilih satu: pill lebar adaptif */
  width: max-content !important;
  max-width: calc(100vw - 1rem) !important;

  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}
.help-faq-content.is-minimized .help-faq-body{ display: none; }
.help-faq-content.is-minimized .help-title{
  max-width: 38vw !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.help-faq-content.is-minimized .help-resize-handle{ display: none !important; }

/* overlay click-through saat minimize */
.help-faq-modal.is-minimized-overlay{
  background-color: transparent !important;
  pointer-events: none;
}
.help-faq-modal.is-minimized-overlay .help-faq-content{
  pointer-events: auto;
  box-shadow: 0 0.5rem 1.25rem rgba(0,0,0,0.22);
}

/* tombol header saat minimized */
.help-faq-content.is-minimized #help-min-btn,
.help-faq-content.is-minimized #help-max-btn,
.help-faq-content.is-minimized .close-btn{
  width: 1.5rem !important;
  height: 1.5rem !important;
  font-size: 1rem !important;
}
.help-faq-content.is-minimized #call-admin-toggle{
  height: 1.65rem !important;
  padding: 0.2rem 0.6rem !important;
}
.help-faq-content.is-minimized .help-faq-header{
  border-radius: 999px !important;
  padding: 0.25rem 0.45rem 0.25rem 1rem !important;
  font-size: 0.85rem !important;
  gap: 0.5rem !important;
  min-height: 35px;
}

/* Maximize */
.help-faq-content.is-maximized{
  position: fixed !important;
  inset: 0 !important;
  transform: none !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
}

/* SARC CHAT PERFECT FORMATTING */
.chatbot-message.bot {
  line-height: 1.5 !important;
  padding: 2.5px 12px !important;
  margin-bottom: 0;
}

.chatbot-message.bot p {
  margin: 8px 0 !important;
  text-align: left !important;
}

.chatbot-message.bot strong,
.chatbot-message.bot b {
  font-weight: 700 !important;
  color: #1e40af !important;
}

.chatbot-message.bot ul {
    padding-left: 1.25rem !important;
    line-height: 1.3;
}

.chatbot-message.bot li {
  margin: 4px 0 !important;
  text-align: left !important;
}

/* LLM Response: Proper spacing */
.chat-gap {
  height: 8px !important;
  margin: 6px 0 !important;
}

/* Stat card (bot) - Gabungan lengkap */
.chatbot-message.bot .stat-card {
  line-height: 1.4 !important;
  padding: 0.25rem 0 0.25rem 0; 
  margin: 8px 0 !important;
  width: 100%;
}

.chatbot-message.bot .stat-title {
  font-weight: 800;
  margin: 0 0 0.35rem 0;
}

.chatbot-message.bot .stat-card p {
  margin: 0.2rem 0;
  line-height: 1.3;
}

.chatbot-message.bot .stat-card p b {
  display: inline-block;
  margin-bottom: 0.15rem;
}

.chatbot-message.bot .stat-links {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-top: 0.25rem;
  border-top: 1px solid #e5e7eb;
}

/* link action (Buka tool / Baca materi) tetap default underline */
.chatbot-message.bot .stat-links a.chat-action{
  text-decoration: underline;
}

/* styling khusus hotline saja: jangan ganggu .chat-action */
.chatbot-message.bot .stat-links a:not(.chat-action){
  text-decoration: none;
  display: inline-flex;
  gap: .35rem;
  align-items: center;
}

.chatbot-message.bot .stat-links a:not(.chat-action) .link-text{
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}

.chatbot-message.bot .stat-list {
  margin: 0.25rem 0 0.25rem 1.25rem;
}

/* Fine-tune list (opsional) */
.chatbot-message.bot .stat-card ol, 
.chatbot-message.bot .stat-card ul {
  margin: 0 !important;
  padding-left: 1.25rem;
}

.chatbot-message.bot .stat-card li {
  margin: 0.15rem 0;
  padding-left: 0.2rem;
}

.stat-links .sources-list a{
  word-break: break-word;     /* URL panjang tidak bikin layout melebar */
  overflow-wrap: anywhere;
}

.chatbot-message.bot .math-inline {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cite-sup {
  font-size: 0.75em;
  font-weight: bold;
  color: #1976d2;
}

/* IEEE: jangan pakai padding/marker default list */
.chatbot-message.bot .stat-links .sources-list{
  margin: 4px 0 0 0;
  padding-left: 1.25rem;
  list-style-position: outside;
}

/* IEEE: rapikan item biar sejajar */
.chatbot-message.bot .stat-links .sources-list li {
  padding-left: 0 !important;
  margin: 4px 0 !important;
}

/* IEEE: kecilkan jarak nomor → teks */
.chatbot-message.bot .stat-links .sources-list .ref-num{
  width: auto !important;           /* jangan fixed width */
  white-space: nowrap !important;   /* kunci: [10] tidak boleh split */
  margin-right: 0.4em !important; /* gap kontrol (angka → teks) */
  text-align: right !important;
  display: inline-block;
  font-weight: 500;
  color: #1a73e8;
}
.chatbot-message.bot .stat-links .sources-list:has(.ref-num){
  padding-left: 0.25rem !important;
  list-style: none !important;
}

.chatbot-message.bot .stat-links .sources-list a{
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* APA/MLA (ol) & Off/Raw: bikin indent nyaman */
.chatbot-message.bot .stat-links ol.sources-list{
  padding-left: 1.25rem !important;  /* tambah indent */
  margin: 0 !important;
}

.chatbot-message.bot .stat-links ol.sources-list li{
  padding-left: 0.15rem !important; 
}

.chatbot-message.bot .stat-table-wrap {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 8px 0;
}

.chatbot-message.bot table.stat-table {
  width: auto;
  min-width: 0;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  font-size: 12.5px;
  table-layout: auto;
}

.chatbot-message.bot table.stat-table th,
.chatbot-message.bot table.stat-table td {
  border: 1px solid #e5e7eb;
  padding: 6px 10px;
  vertical-align: top;
  white-space: nowrap;
}

/* 🔥 OVERRIDE NUMERIK - RATA KANAN + MONOSPACE */
.chatbot-message.bot table.stat-table tbody td:not(:first-child) {
  text-align: right !important;
  font-family: 'Courier New', 'Consolas', monospace !important;
}

/* Header tengah */
.chatbot-message.bot table.stat-table th {
  background: #eef2ff;
  font-weight: 700;
  text-align: center;
}

/* Kolom pertama (label) kiri + background */
.chatbot-message.bot table.stat-table tbody td:first-child {
  text-align: left !important;
  font-weight: 600;
  background: #f8fafc;
}

/* Image styling */
.chatbot-messages .chatbot-message img {
  display: block !important;
  width: 100% !important;
  max-width: 320px !important;
  height: auto !important;
  max-height: 200px !important;
  border-radius: 12px !important;
  margin: 8px 0 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.loading-dots {
  padding: 16px 20px;
  text-align: center;
  opacity: .75;
  font-style: italic;
  position: relative;
}

/* bikin lingkaran muter */
.loading-dots::after{
  content:"";
  display:inline-block;
  width:14px;
  height:14px;
  margin-left:10px;
  vertical-align:middle;
  border:2px solid rgba(0,0,0,.25);
  border-top-color: rgba(0,0,0,.6);
  border-radius:50%;
  animation:loadingSpin .8s linear infinite;
}

@keyframes loadingSpin{
  to{ transform: rotate(360deg); }
}

/* Admin menu consistent padding */
#call-admin-menu {
  padding: 5px !important;
}

.chat-input-row{
  display: flex;
  flex-direction: column; /* ini kuncinya: preview di atas textarea */
  width: 100%;
}

.chat-attach-preview{
  width: 100%;
  display: flex;
  flex-wrap: wrap;
}

.chat-attach-preview:empty{ display:none; }

/* optional biar rapi seperti kartu */
.chat-attach-preview .attach-item{
  width: fit-content;
}

/* container preview */
#chat-attach-preview{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

/* card */
.attach-item{
  display:flex;
  align-items:center;
  gap:10px;
  max-width: 100%;          /* penting di mobile */
  padding:8px 10px;
  border:1px dashed #9bb;
  border-radius:12px;
  background:#f7fbff;
  font-size: 12px;
  box-sizing: border-box;
}

/* thumbnail kecil (ini yang paling penting) */
.attach-thumb{
  width:auto;
  max-width: 240px;
  height:auto;
  max-height:48px;
  object-fit:cover;
  border-radius:10px;
  flex: 0 0 48px;
}

/* teks jangan memaksa melebar */
.attach-meta{
  min-width: 0;             /* biar boleh mengecil */
  max-width: 220px;         /* sesuaikan kebutuhan */
  font-size: 12px;
}
.attach-name{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* tombol X simpel (override style button global) */
.attach-remove{
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;

  width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 50%;

  color: #444;
  font-size: 18px;
  cursor: pointer;
}

.attach-remove:hover{
  background: rgba(0,0,0,.08) !important;
  color: #111;
}

.attach-item{ position: relative; padding-right: 26px; }
.attach-remove{ position:absolute; top:1px; right:1px; }

.attach-file-icon {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

.attach-file-icon.csv, .attach-file-icon.data { background: #dbeafe; color: #1e40af; }
.attach-file-icon.code { background: #fef3c7; color: #b45309; }
.attach-file-icon.doc { background: #f3e8ff; color: #7c3aed; }
.attach-file-icon.text { background: #ecfdf5; color: #059669; }

.attach-type {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}

.attach-item.warn {
  background: #fef2f2;
  border: 2px solid #fecaca;
  color: #dc2626;
}

/* python-css */

/* Plotly internal - override JS responsive */
.js-plotly-plot .plotly .plot-container,
.js-plotly-plot .svg-container {
  max-width: 380px !important;
  width: 380px !important;
} 

/* Table */
.stats-table {
  border-collapse: collapse;
  width: 100%;
}
.stats-header-row {
  background: #e5e7eb;
}
.stats-th {
  padding: 0.5rem;
  border: 1px solid #d1d5db;
}
.stats-body-row {
  background: #f9fafb;
}
.stats-td {
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  text-align: right;
}
.stats-label {
  font-weight: bold;
  text-align: left;
}
.stats-table-wrapper {
  overflow-x: auto;
  margin: 1rem 0;
}
.stats-table-wrapper.small {
  font-size: 0.9rem;
}

/* Cards & badges – asumsi class stat-card, stat-badge, stat-title, stat-subtitle */
.stat-card.error {
  /* tambahkan styling error khusus jika perlu */
}

.stat-badge {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: inline-block;
  color: #620adf;
}

.stat-badge span.normal {
  font-weight: 400;
  color: #2d5a2d;
}

.chatbot-message.bot .stat-card.python-pro h4,
.chatbot-message.bot .stat-card.python-pro .stats-section h4,
.chatbot-message.bot .stat-card.python-pro .tests-section h4 {
  margin: 10px 0 !important;
  font-size: 14px !important;
  color: #2d5a2d !important;
  font-weight: 700 !important;
  padding: 0px 0 !important;
}
.ml-section {
  margin-bottom: 20px;
}
.formula {
  margin: 0 0 20px 6px;
  color: #620adf;
}
.stat-title {
  /* styling title */	
}
.stat-subtitle {
  /* styling subtitle */
}

/* Plot containers */
.plot-scatter {
  height: 400px;
}
.plot-hist {
  height: 300px;
}

/* 🔥 PYTHON TABS - CLEAN LAYOUT NO OVERLAP (UPDATED 4 TABS + INLINE FILTERS) */
.python-tabs { 
  position: relative; width: 100%; margin: 16px 0; 
  border-radius: 12px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  background: white; isolation: isolate;
}
.tabs-header {
  display: flex;
  position: relative;
  background: #b2f3de;
  border-bottom: 1px solid #bdc8de;
  width: 100%;
}
.tab-group { flex: 1; position: relative; }
.tab-btn { 
  width: 100%; padding: 8px 2px; border: none; background: none; 
  cursor: pointer; font-size: 13px; font-weight: 500; color: #64748b; 
  transition: all 0.2s ease; position: relative;
}
.tab-btn:hover { background: #f1f5f9; color: #1e40af; }
.tab-btn.active { 
  background: #eaf8f4; color: #1d4ed8; font-weight: 600;
  box-shadow: 0 2px 4px rgba(59,130,246,0.2);
}

.tab-indicator { 
  position: absolute; bottom: 0; left: 0; height: 1px; 
  background: linear-gradient(40deg, #951ceb, #eb2f96);
  width: 33.333%; transition: left 0.3s cubic-bezier(0.4,0,0.2,1);
  border-radius: 0 0 3px 3px;
}

/* 🔥 INLINE FILTERS - TABLE / CHART / ANALYSIS */
.table-filters, .chart-filters, .analysis-filters {
  display: flex; flex-wrap: wrap; gap: 2px;
  margin-bottom: 24px; padding: 0; border-bottom: 1px solid #f3f4f6;
  font-size: 12px; background: rgb(248 238 255);
}
.table-filters label, .chart-filters label, .analysis-filters label {
  cursor: pointer; display: flex; align-items: center;
  padding: 4px; border-radius: 6px; transition: all 0.15s ease;
}
.table-filters label:hover, .chart-filters label:hover, .analysis-filters label:hover {
  background: #f1f5f9; color: #1d4ed8;
}
.table-filters input, .chart-filters input, .analysis-filters input {
  margin-right: 6px; accent-color: #3b82f6;
}

/* 🔥 FORMAT ICON - PANEL FORMAT */
.table-format-btn {
  position: absolute; top: 12px; right: 16px;
  border: none; background: transparent; cursor: pointer;
  font-size: 16px; color: #64748b; padding: 6px;
  border-radius: 6px; transition: all 0.2s ease;
}
.table-format-btn:hover {
  background: #f1f5f9; color: #1d4ed8; transform: scale(1.05);
}

/* PANELS - CLEAN */
.tabs-body { background: white; border-radius: 0 0 12px 12px; overflow: hidden; }
.tab-panel { display: none; max-width: 100%; padding: 16px; background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); }
.tab-panel.active { display: block; }
.tab-panel:nth-child(2) { background: linear-gradient(135deg, #ecfdf5 0%, #bbf7d0 100%); }
.tab-panel:nth-child(3) { background: linear-gradient(135deg, rgba(255,255,255,.7) 0%, #e3f2fd 100%); }
.tab-panel:nth-child(4) { background: linear-gradient(135deg, #fdf4ff 0%, #f3e8ff 100%); }

/* CHART SPECIFIC */
.chart-panels {
  display: block; /* Bukan grid! */
  width: 100%;
}
div#python-1771768065880-box {
    margin: 6px 0;
}
.chart-ph {
  width: 100%; 
  min-height: 350px; /* Fixed tinggi chart */
  max-width: 100%; 
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  display: none; /* Sembunyikan semua awal */
  margin: 6px 0;
}
.chart-ph.active {
  display: flex !important; /* Hanya 1 active */
}

/* COMPACT TABLE */
.stats-table-wrapper.compact .stat-table { font-size: 0.85rem; }
.stats-table-wrapper.compact .stat-table td, .stats-table-wrapper.compact .stat-table th { padding: 6px 8px; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .tab-btn { padding: 8px 2px; font-size: 0.9em; font-weight: 600;}
  .table-filters, .chart-filters, .analysis-filters { display: flex; width: fit-content; gap: 4px; }
  .tab-panel { padding: 20px 16px; width: 100%; }
  .table-format-btn { top: 8px; right: 12px; font-size: 15px; }
  .table-format-menu { min-width: 160px; right: 12px; }
  table.stat-table { font-size: 0.8em !important; }
}

/* DARK MODE */
@media (prefers-color-scheme: dark) {
  .python-tabs { background: #1e293b; box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
  .tabs-header { background: #334155; border-color: #475569; }
  .tab-btn { color: #cbd5e1; }
  .tab-btn:hover { background: #475569; }
  .tab-btn.active { background: #0f172a; color: #60a5fa; }
  
  .table-filters label:hover, .chart-filters label:hover, .analysis-filters label:hover {
    background: #475569; color: #60a5fa;
  }
  .table-format-btn { color: #cbd5e1; }
  .table-format-btn:hover { background: #475569; color: #60a5fa; }
  .tab-panel { background: #0f172a; }
}

/* Gear Hover - Dynamic Position */
input[type="checkbox"], input[type="radio"] {
  position: relative;
}
.gear-group {
  position: relative;
  margin-left: 6px;
  width:12%;
  padding: 4px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-bottom: 1px solid #bdc8de;
}
button.gear-btn {
  background: #e3f2fd;
  align-items: center;
  width: 100%;
  padding: 3.5px;
}
button.gear-btn:hover{background: #c7f4f5;}
.gear-container {
  top: 100%;
  right: 0;
  width: fit-content;
  min-width: 135px;  
  pointer-events: none;
  z-index: 1;  
  
  position: absolute !important;  
  transform: translateY(8px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;  
}
.gear-menu {
  background: white;
  border: 1px solid #20b082;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s;
  pointer-events: auto;
}
.gear-group.active .gear-menu {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0);
}
.gear-btn.active {
  background: #f0f9ff;
  border-radius: 2px;
}
.gear-group.active .gear-container {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(8px);
}
