/* =============================================
   interactive.css — Dark mode, animasi, notifikasi, fenomena
   ============================================= */

/* ============ DARK MODE ============ */
body.dark {
  background: #0f172a;
}
body.dark .sidebar {
  background: #020617;
  border-right: 1px solid #1e293b;
}
body.dark .sidebar .logo-sub,
body.dark .sidebar .nav-label { color: #334155; }
body.dark .nav-item { color: #64748b; }
body.dark .nav-item:hover,
body.dark .nav-item.active { background: #1e293b; color: #e2e8f0; }
body.dark .divider { border-color: #1e293b; }

body.dark .card,
body.dark .tbl-wrap,
body.dark .upload-panel,
body.dark .g-card,
body.dark .g-controls,
body.dark .cmp-top-panel,
body.dark .compare-card,
body.dark .sel-card { background: #1e293b; border-color: #334155; color: #e2e8f0; }

body.dark .card .lbl,
body.dark .card .hint,
body.dark .g-stat .gs-lbl,
body.dark .g-stat .gs-sub { color: #64748b; }
body.dark .card .val,
body.dark .g-stat .gs-val { color: #f1f5f9; }

body.dark thead th { background: #0f172a; color: #94a3b8; border-bottom-color: #334155; }
body.dark tbody td { color: #cbd5e1; border-bottom-color: #1e293b; }
body.dark tbody tr:hover { background: #0f172a; }
body.dark .controls { background: #0f172a; border-bottom-color: #334155; }
body.dark .controls input,
body.dark .controls select,
body.dark .g-controls select,
body.dark .g-controls input { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark .pgn { background: #0f172a; border-top-color: #334155; }
body.dark .pgn button { background: #1e293b; border-color: #334155; color: #94a3b8; }
body.dark .pgn button:hover { background: #334155; }
body.dark .pgn button.act { background: #2563eb; border-color: #2563eb; color: white; }
body.dark .sec-title { color: #f1f5f9; }
body.dark .tbl-indo .controls,
body.dark .tbl-indo thead { background: #0d1b3e; }
body.dark .tbl-alfa .controls,
body.dark .tbl-alfa thead { background: #2d0a0a; }
body.dark .tbl-indo .pgn { background: #0d1b3e; }
body.dark .tbl-alfa .pgn { background: #2d0a0a; }
body.dark .store-hero-indo { box-shadow: 0 8px 32px rgba(37,99,235,0.5); }
body.dark .store-hero-alfa { box-shadow: 0 8px 32px rgba(220,38,38,0.5); }
body.dark .lnk { background: #1e293b; border-color: #334155; color: #93c5fd; }
body.dark .empty-box { color: #475569; }
body.dark .g-empty { color: #475569; }
body.dark .cc-row .cc-lbl { color: #64748b; }
body.dark .cc-row .cc-val { color: #f1f5f9; }
body.dark .upload-slot .slot-label { color: #64748b; }
body.dark .file-btn { background: #0f172a; border-color: #334155; }
body.dark .file-btn span { color: #64748b; }
body.dark .file-btn.loaded { background: #052e16; border-color: #16a34a; }
body.dark .file-btn.loaded span { color: #4ade80; }
body.dark .cmp-result-panel { background: #1e293b; border-color: #334155; }
body.dark .result-box { background: #0f172a; border-color: #334155; }
body.dark .trend-tbl { background: #1e293b; border-color: #334155; }
body.dark .news-card { background: #1e293b; border-color: #334155; }
body.dark .news-headline { color: #f1f5f9; }
body.dark .news-date { color: #64748b; }
body.dark .badge-gray { background: #334155; color: #94a3b8; }

/* Dark toggle button */
.dark-toggle {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.dark-toggle:hover { 
  background: rgba(255, 255, 255, 0.15);
}

body.dark .dark-toggle { 
  background: rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
}

body.dark .dark-toggle:hover { 
  background: rgba(255, 255, 255, 0.2);
}

/* ============ LOADING OVERLAY ============ */
.load-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.load-overlay.show {
  opacity: 1;
  pointer-events: all;
}
.load-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.load-text {
  color: white;
  font-size: 13px;
  font-weight: 500;
}
.load-bar-wrap {
  width: 200px;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
}
.load-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ ANIMASI CARD MASUK ============ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-in {
  animation: fadeSlideUp 0.35s ease both;
}
.anim-in:nth-child(1) { animation-delay: 0.0s; }
.anim-in:nth-child(2) { animation-delay: 0.05s; }
.anim-in:nth-child(3) { animation-delay: 0.1s; }
.anim-in:nth-child(4) { animation-delay: 0.15s; }

/* ============ ANIMASI BARIS TABEL ============ */
@keyframes fadeRow {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
tbody.animated tr {
  animation: fadeRow 0.22s ease both;
}
tbody.animated tr:nth-child(1)  { animation-delay: 0.00s; }
tbody.animated tr:nth-child(2)  { animation-delay: 0.02s; }
tbody.animated tr:nth-child(3)  { animation-delay: 0.04s; }
tbody.animated tr:nth-child(4)  { animation-delay: 0.06s; }
tbody.animated tr:nth-child(5)  { animation-delay: 0.08s; }
tbody.animated tr:nth-child(6)  { animation-delay: 0.10s; }
tbody.animated tr:nth-child(7)  { animation-delay: 0.12s; }
tbody.animated tr:nth-child(8)  { animation-delay: 0.14s; }
tbody.animated tr:nth-child(9)  { animation-delay: 0.16s; }
tbody.animated tr:nth-child(10) { animation-delay: 0.18s; }

/* ============ SMOOTH FILTER TRANSITION ============ */
.tbl-wrap, .g-card, .compare-card {
  transition: opacity 0.18s ease;
}
.filtering {
  opacity: 0.4;
  pointer-events: none;
}

/* ============ NOTIFIKASI ALERT ============ */
#alert-panel {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}
.alert-toast {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-left: 4px solid #ef4444;
  animation: slideInRight 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.alert-toast:hover { transform: translateX(-4px); box-shadow: 0 10px 40px rgba(0,0,0,0.22); }
.alert-toast.alert-warn  { border-left-color: #f59e0b; }
.alert-toast.alert-good  { border-left-color: #22c55e; }
.alert-toast.alert-info  { border-left-color: #3b82f6; }
.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-size: 12px; font-weight: 700; color: #1e293b; margin-bottom: 2px; }
.alert-msg   { font-size: 11px; color: #64748b; line-height: 1.5; }
.alert-close { font-size: 14px; color: #94a3b8; cursor: pointer; padding: 0 2px; flex-shrink: 0; }
.alert-close:hover { color: #475569; }
.alert-toast.removing { animation: slideOutRight 0.25s ease both; }
@keyframes slideInRight  { from { opacity:0; transform: translateX(60px); } to { opacity:1; transform: translateX(0); } }
@keyframes slideOutRight { from { opacity:1; transform: translateX(0); }   to { opacity:0; transform: translateX(60px); } }

body.dark .alert-toast { background: #1e293b; }
body.dark .alert-title { color: #f1f5f9; }

/* ============ FENOMENA CARDS REDESIGN ============ */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 14px;
}
.news-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s, box-shadow 0.18s;
  cursor: default;
  position: relative;
  overflow: hidden;
  animation: fadeSlideUp 0.35s ease both;
}
.news-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.news-card:nth-child(3n+2)::before { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.news-card:nth-child(3n+3)::before { background: linear-gradient(90deg, #16a34a, #4ade80); }
.news-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.1);
}
.news-num {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 10px;
  color: #cbd5e1;
  font-weight: 600;
}
.news-headline {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.5;
  padding-right: 24px;
}
.news-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.news-date {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}
.news-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 3px 10px;
  border-radius: 20px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.news-link:hover { background: #dbeafe; color: #1d4ed8; }
.news-link::after { content: ' ↗'; font-size: 10px; }

/* Fenomena search highlight */
.news-card.hidden-by-filter { display: none; }
.news-card.highlight-match { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }

/* fenomena controls */
.fenomena-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}
.fenomena-controls input {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  background: white;
  width: 220px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fenomena-controls input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.fenomena-sort {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 12px;
  background: white;
}

/* ============ COMPARE HIGHLIGHT SELISIH ============ */
.diff-high {
  background: linear-gradient(90deg, rgba(254,226,226,0.6), transparent) !important;
}
.diff-low {
  background: linear-gradient(90deg, rgba(220,252,231,0.6), transparent) !important;
}
.diff-pill {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 700;
  margin-left: 4px;
  vertical-align: middle;
}
.diff-pill-up { background: #fee2e2; color: #b91c1c; }
.diff-pill-dn { background: #dcfce7; color: #15803d; }

/* ============ STAT NUMBER COUNTER ANIM ============ */
.count-anim {
  transition: all 0.05s;
}

/* ============ GRAFIK TOOLTIP CUSTOM ============ */
.chart-tooltip-custom {
  background: #1e293b !important;
  border-radius: 8px !important;
  color: #f1f5f9 !important;
  font-size: 11px !important;
  padding: 8px 12px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important;
}
