/* SmartFlow IDX - Premium Glassmorphism UI & Dual Theme Engine (v14.0) */

:root {
  --bg-primary: #060a12;
  --bg-card: rgba(15, 23, 42, 0.45);
  --bg-card-hover: rgba(30, 41, 59, 0.55);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --emerald: #10b981;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --crimson: #ef4444;
}

html.light {
  --bg-primary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-subtle: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(6, 10, 18, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.4);
}

/* Primary Glassmorphism Panel */
.glass-panel {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.42), inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

/*KPI Cards with Translucent Gradient & Ambient Hover Glow */
.kpi-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.48) 0%, rgba(15, 23, 42, 0.35) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.35), inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.55), 0 0 20px rgba(16, 185, 129, 0.08);
}
.kpi-card.active-filter {
  border-color: rgba(16, 185, 129, 0.65);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.5), 0 8px 28px -4px rgba(16, 185, 129, 0.22);
}

/* Screener Table Rows: Transparent with Silky Hover */
.stock-row {
  background: transparent;
  transition: background-color 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}
.stock-row:hover {
  background-color: rgba(255, 255, 255, 0.05);
}
.stock-row.selected-row {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.16) 0%, rgba(16, 185, 129, 0.03) 100%);
  border-left: 3px solid #10b981;
}

/* Trigger Badges (Refined Glass & Subtle Glow) */
.badge-markup {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.15);
  transition: all 0.2s ease;
}
.badge-markup:hover {
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.3);
}
.badge-big-accum {
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.35);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.15);
  transition: all 0.2s ease;
}
.badge-big-accum:hover {
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.3);
}
.badge-silent-accum {
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.35);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.12);
  transition: all 0.2s ease;
}
.badge-silent-accum:hover {
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.28);
}
.badge-foreign {
  background: rgba(139, 92, 246, 0.14);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.35);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.12);
  transition: all 0.2s ease;
}
.badge-foreign:hover {
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.28);
}
.badge-dist {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.35);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.14);
  transition: all 0.2s ease;
}
.badge-neutral {
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.dropzone-active {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.08) !important;
}

/* Signal Tracker Glass Tabs (Matching Reference Design) */
.tracker-tab {
  padding: 7px 18px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(19, 28, 49, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
}
.tracker-tab:hover {
  color: #ffffff;
  background: rgba(30, 41, 66, 0.9);
  border-color: rgba(255, 255, 255, 0.18);
}
.tracker-tab.active {
  color: #ffffff;
  background: rgba(30, 41, 66, 0.95);
  border: 1.5px solid rgba(148, 163, 184, 0.65);
  box-shadow: 0 0 18px rgba(148, 163, 184, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.tracker-tab .tab-count {
  display: none;
}
.tracker-tab.active .tab-count {
  display: none;
}

/* ========================================================= */
/* BULLETPROOF LIGHT THEME ENGINE (Comprehensive Overrides)  */
/* ========================================================= */
html.light {
  color-scheme: light;
}

html.light body {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

html.light .ambient-bg-orbs {
  opacity: 0.25 !important;
}

/* 1. Semuanya yang bernuansa gelap (slate-950, slate-900) berganti putih bersih */
html.light .glass-panel,
html.light .modal-box,
html.light [class*="bg-slate-950"],
html.light [class*="bg-slate-900"] {
  background: rgba(255, 255, 255, 0.92) !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06) !important;
}

html.light [class*="bg-slate-800"] {
  background-color: #f8fafc !important;
}

html.light header {
  background: rgba(255, 255, 255, 0.92) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06) !important;
}

/* 2. Semua garis border gelap berganti border halus abu-abu terang */
html.light [class*="border-slate-800"],
html.light [class*="border-slate-700"],
html.light [class*="border-white"],
html.light .divide-slate-800 > :not([hidden]) ~ :not([hidden]),
html.light .divide-slate-800\/70 > :not([hidden]) ~ :not([hidden]),
html.light .divide-white\/5 > :not([hidden]) ~ :not([hidden]) {
  border-color: #e2e8f0 !important;
}

/* 3. Teks putih & abu-abu gelap berganti teks tajam kontras tinggi */
html.light .text-white,
html.light [class*="text-slate-100"],
html.light [class*="text-slate-200"],
html.light [class*="text-slate-300"] {
  color: #0f172a !important;
}

html.light [class*="text-slate-400"] {
  color: #475569 !important;
}

html.light [class*="text-slate-500"] {
  color: #64748b !important;
}

html.light [class*="text-slate-600"] {
  color: #94a3b8 !important;
}

/* 4. Tabel Header & Baris */
html.light thead tr,
html.light th {
  background-color: #f8fafc !important;
  color: #475569 !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html.light tbody tr:hover,
html.light .stock-row:hover {
  background-color: #f1f5f9 !important;
}

html.light .stock-row.selected-row {
  background: #ecfdf5 !important;
  border-left: 3px solid #10b981 !important;
}

/* 5. Input, Select, Search Box */
html.light select,
html.light input[type="text"],
html.light input[type="search"] {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

html.light select:focus,
html.light input:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
}

/* 6. Card & KPI Hover */
html.light .kpi-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

html.light .kpi-card:hover {
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.1) !important;
  border-color: #93c5fd !important;
}

html.light .kpi-card.active-filter {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 1px #10b981, 0 8px 20px -4px rgba(16, 185, 129, 0.15) !important;
}

/* 7. Tracker Tabs */
html.light .tracker-tab {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #64748b !important;
}

html.light .tracker-tab:hover {
  color: #0f172a !important;
  background: #f1f5f9 !important;
}

html.light .tracker-tab.active {
  background: #059669 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
}

/* 8. Tombol Navbar */
html.light #btnResetSample,
html.light #btnOpenGuideModal,
html.light #btnThemeToggle,
html.light a[href*="template?mode=blank"] {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

html.light #btnResetSample:hover,
html.light #btnOpenGuideModal:hover,
html.light #btnThemeToggle:hover,
html.light a[href*="template?mode=blank"]:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

/* 9. Badge Kontras Terang */
html.light .badge-markup {
  background: #ffedd5 !important;
  color: #c2410c !important;
  border-color: #fdba74 !important;
}
html.light .badge-big-accum {
  background: #d1fae5 !important;
  color: #047857 !important;
  border-color: #a7f3d0 !important;
}
html.light .badge-silent-accum {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border-color: #bfdbfe !important;
}
html.light .badge-foreign {
  background: #ede9fe !important;
  color: #6d28d9 !important;
  border-color: #ddd6fe !important;
}
html.light .badge-dist {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fecaca !important;
}
html.light .badge-neutral {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}

/* 10. LIGHT MODE: UBAH SEMUA TEKS & AKSEN KUNING MENJADI ORANYE BERKONTRAS TINGGI */
html.light .text-amber-300,
html.light .text-amber-400,
html.light .text-amber-500,
html.light .text-yellow-300,
html.light .text-yellow-400,
html.light .text-yellow-500,
html.light [class*="text-amber-"],
html.light [class*="text-yellow-"] {
  color: #ea580c !important; /* Orange 600 - tajam, sangat kontras & terbaca jelas di background putih */
}

html.light [class*="bg-amber-500"],
html.light [class*="bg-yellow-500"] {
  background-color: rgba(234, 88, 12, 0.14) !important;
}

html.light [class*="border-amber-"],
html.light [class*="border-yellow-"] {
  border-color: rgba(234, 88, 12, 0.35) !important;
}

html.light .star-btn.text-amber-400,
html.light .star-btn.text-amber-300 {
  color: #ea580c !important;
  filter: drop-shadow(0 0 6px rgba(234, 88, 12, 0.45)) !important;
}

html.light #mobileBottomNav {
  background: rgba(255, 255, 255, 0.95) !important;
  border-top: 1px solid #e2e8f0 !important;
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08) !important;
}

html.light .mobile-nav-btn.text-slate-400 {
  color: #64748b !important;
}


/* =====================================================================
   RESPONSIVE MOBILE ENHANCEMENTS (Fix overlapping & squished tables)
   ===================================================================== */
@media (max-width: 640px) {
  body {
    font-size: 13px;
  }

  table {
    min-width: 680px;
  }

  #trackerTableBody table,
  #trackerSection table {
    min-width: 820px;
  }

  .kpi-card {
    padding: 0.85rem !important;
  }

  #tsWinRate {
    font-size: 11px;
  }

  header {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 0.65rem !important;
    padding-bottom: 0.65rem !important;
  }
}

.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
}

/* Skeleton Loading Placeholder */
@keyframes shimmer {
  0% { opacity: 0.35; }
  50% { opacity: 0.85; }
  100% { opacity: 0.35; }
}
.skeleton,
.skeleton-shimmer {
  animation: shimmer 1.6s infinite ease-in-out;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}

/* Tooltip / Kamus Istilah ⓘ Button */
.tip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  cursor: pointer;
  margin-left: 4px;
  vertical-align: middle;
  transition: all 0.18s ease;
}
.tip-btn:hover {
  background: rgba(56, 189, 248, 0.28);
  border-color: rgba(56, 189, 248, 0.6);
  transform: scale(1.12);
}

/* Risk Disclaimer Banner (Statis di bawah konten, tidak menutupi menu navigasi) */
.fixed-risk-banner {
  position: static !important;
  margin-top: 1.5rem !important;
  margin-bottom: 1.5rem !important;
  border-radius: 1rem !important;
  background: rgba(15, 23, 42, 0.55) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  font-size: 11px !important;
  color: #94a3b8 !important;
  padding: 12px 18px !important;
  text-align: center !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
  max-width: 1200px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
html.light .fixed-risk-banner {
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid #e2e8f0 !important;
  color: #64748b !important;
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.04) !important;
}

