/* ============================================================================
   NevusTools Trading — INDIKATOR RISET REAL TIME (realtime.css)
   LED status live/offline + "terakhir diperbarui" + hitung mundur.
   Mengikuti tema gelap/terang situs (atribut data-theme pada <html>).
   ========================================================================== */

.nvt-rt {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(340px, calc(100vw - 32px));
  padding: 9px 10px 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--rt-line, #22303f);
  background: var(--rt-bg, rgba(17, 24, 35, 0.94));
  color: var(--rt-txt, #e6edf3);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity .18s ease, transform .18s ease;
}

/* Tema gelap (bawaan situs) */
html[data-theme="dark"], html:not([data-theme]) {
  --rt-bg: rgba(17, 24, 35, .94);
  --rt-line: #22303f;
  --rt-txt: #e6edf3;
  --rt-muted: #8b9bb0;
  --rt-panel: #161f2d;
}
/* Tema terang */
html[data-theme="light"] {
  --rt-bg: rgba(255, 255, 255, .95);
  --rt-line: #d6dde6;
  --rt-txt: #16202c;
  --rt-muted: #5c6b7d;
  --rt-panel: #eef2f7;
}

.nvt-rt-hide { display: none !important; }

/* ---------------- LED ---------------- */
.nvt-rt-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  background: #7d8ea3;
  box-shadow: 0 0 0 0 rgba(125, 142, 163, .6);
  animation: nvtRtPulse 1.8s infinite;
}
.nvt-rt-live   .nvt-rt-dot { background: #2ecc8f; box-shadow: 0 0 0 0 rgba(46, 204, 143, .65); }
.nvt-rt-partial .nvt-rt-dot { background: #e0b64a; box-shadow: 0 0 0 0 rgba(224, 182, 74, .65); }
.nvt-rt-stale  .nvt-rt-dot { background: #e0b64a; box-shadow: 0 0 0 0 rgba(224, 182, 74, .65); }
.nvt-rt-offline .nvt-rt-dot { background: #ff5c6c; box-shadow: 0 0 0 0 rgba(255, 92, 108, .65); animation: none; }
.nvt-rt-running .nvt-rt-dot { background: #4aa3e0; box-shadow: 0 0 0 0 rgba(74, 163, 224, .65); }

@keyframes nvtRtPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, .35); }
  70%  { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

/* ---------------- Teks ---------------- */
.nvt-rt-mid { min-width: 0; flex: 1 1 auto; }
.nvt-rt-label {
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nvt-rt-live .nvt-rt-label { color: #2ecc8f; }
.nvt-rt-partial .nvt-rt-label,
.nvt-rt-stale .nvt-rt-label { color: #e0b64a; }
.nvt-rt-offline .nvt-rt-label { color: #ff5c6c; }
.nvt-rt-running .nvt-rt-label { color: #4aa3e0; }

.nvt-rt-meta,
.nvt-rt-sub {
  color: var(--rt-muted, #8b9bb0);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.nvt-rt-sub { margin-top: 1px; }

/* ---------------- Tombol ---------------- */
.nvt-rt-btn,
.nvt-rt-x {
  flex: none;
  border: 1px solid var(--rt-line, #22303f);
  background: var(--rt-panel, #161f2d);
  color: var(--rt-txt, #e6edf3);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 5px 7px;
  transition: background .15s ease, color .15s ease, opacity .15s ease;
}
.nvt-rt-btn:hover,
.nvt-rt-x:hover { color: #e0b64a; border-color: #4a3c17; }
.nvt-rt-btn:disabled { opacity: .45; cursor: default; }
.nvt-rt-btn:disabled::after { content: ""; }
.nvt-rt-running .nvt-rt-btn { opacity: .55; }
.nvt-rt-x { font-size: 14px; padding: 4px 6px; }

/* ---------------- Mobile ---------------- */
@media (max-width: 560px) {
  .nvt-rt {
    left: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
    padding: 8px 9px 8px 10px;
    gap: 8px;
  }
  .nvt-rt-meta { display: none; }
  .nvt-rt-sub { font-size: 10px; }
  .nvt-rt-label { font-size: 11px; }
}

/* Hindari menutupi tombol chatbot di layar sangat kecil */
@media (max-width: 380px) {
  .nvt-rt-sub { display: none; }
}

/* Hormati preferensi pengguna yang tidak ingin animasi */
@media (prefers-reduced-motion: reduce) {
  .nvt-rt-dot { animation: none !important; }
  .nvt-rt { transition: none; }
}

/* Saat dicetak, indikator tidak perlu ikut */
@media print {
  .nvt-rt { display: none !important; }
}
