:root {
  --bg: #070b14;
  --panel: rgba(19, 26, 43, 0.72);
  --panel-border: rgba(120, 150, 220, 0.16);
  --text: #e8eefc;
  --muted: #8ea0c4;
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.12);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --accent: #7c8cff;
  --gold: #fbbf24;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 40px;
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px 400px at 15% 0%, rgba(124, 140, 255, 0.18), transparent 60%),
    radial-gradient(700px 500px at 85% 10%, rgba(52, 211, 153, 0.12), transparent 60%),
    radial-gradient(500px 500px at 50% 100%, rgba(251, 191, 36, 0.08), transparent 60%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px 32px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(7, 11, 20, 0.75);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 14px; }

.logo {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  font-size: 24px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  color: #060a12;
  font-weight: 800;
  box-shadow: 0 0 30px rgba(124, 140, 255, 0.4);
}

h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; display: flex; align-items: center; gap: 10px; }
.tagline { font-size: 12.5px; color: var(--muted); }

.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 1px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--red-dim); color: var(--red);
  border: 1px solid rgba(248,113,113,.35);
}
.live-badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.75); }
}

.controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.countdown {
  display: flex; flex-direction: column; align-items: flex-end;
  line-height: 1.2;
}
.countdown-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.countdown-value { font-size: 16px; font-weight: 700; color: var(--accent); }

.switch {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.switch input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

.btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(135deg, var(--accent), #5b6bff);
  color: #fff;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(124, 140, 255, 0.35); }
.btn:active { transform: translateY(0); }

main { max-width: 1280px; margin: 0 auto; padding: 28px 32px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(10px);
}
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.stat-value { font-size: 24px; font-weight: 800; }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  backdrop-filter: blur(10px);
}

.filter-group { display: flex; flex-direction: column; gap: 7px; }
.filter-group label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.filter-group.interval select { padding: 8px 10px; font-size: 13px; }

select, input[type="text"] {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(7, 11, 20, 0.8);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease;
}
select:focus, input[type="text"]:focus { border-color: var(--accent); }

.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 20px;
  backdrop-filter: blur(10px);
  transition: transform .18s ease, border-color .18s ease;
  animation: fadeUp .4s ease both;
}
.card:hover { transform: translateY(-3px); border-color: rgba(124, 140, 255, 0.45); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Kilatan singkat saat harga berubah setelah update */
.flash-up { animation: flashUp .9s ease; }
.flash-down { animation: flashDown .9s ease; }
@keyframes flashUp { 0% { background: rgba(52,211,153,.22); } 100% { background: transparent; } }
@keyframes flashDown { 0% { background: rgba(248,113,113,.22); } 100% { background: transparent; } }

.card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.coin-img { width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,0.05); }
.coin-name { font-weight: 700; font-size: 16px; }
.coin-sym { font-size: 12px; color: var(--muted); text-transform: uppercase; }

.score-badge {
  margin-left: auto;
  text-align: center;
  padding: 6px 12px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 18px;
  min-width: 58px;
}
.score-high { background: var(--green-dim); color: var(--green); border: 1px solid rgba(52,211,153,.4); }
.score-mid  { background: rgba(251,191,36,.12); color: var(--gold); border: 1px solid rgba(251,191,36,.35); }
.score-low  { background: var(--red-dim); color: var(--red); border: 1px solid rgba(248,113,113,.3); }
.score-sub { font-size: 9px; letter-spacing: .5px; opacity: .8; display: block; }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.metric {
  background: rgba(7, 11, 20, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 11px;
  transition: background .3s ease;
}
.metric-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.metric-value { font-size: 14.5px; font-weight: 700; margin-top: 3px; }

.pos { color: var(--green); }
.neg { color: var(--red); }

.reasons { display: flex; flex-wrap: wrap; gap: 7px; }
.reason {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(124, 140, 255, 0.12);
  border: 1px solid rgba(124, 140, 255, 0.25);
  color: #b9c2ff;
}
.reason.warn { background: var(--red-dim); border-color: rgba(248,113,113,.3); color: #ffb4b4; }
.reason.ok { background: var(--green-dim); border-color: rgba(52,211,153,.3); color: #8ef0c4; }

/* Bar Fundamental & Teknis */
.scorebars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.scorebar { display: grid; grid-template-columns: 84px 1fr 30px; align-items: center; gap: 10px; }
.scorebar-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.scorebar-track {
  height: 8px; border-radius: 999px; overflow: hidden;
  background: rgba(7, 11, 20, 0.85);
  border: 1px solid var(--panel-border);
}
.scorebar-fill { height: 100%; border-radius: 999px; transition: width .5s ease; }
.scorebar-fill.fund { background: linear-gradient(90deg, var(--gold), var(--green)); }
.scorebar-fill.tech { background: linear-gradient(90deg, var(--accent), #4a5bff); }
.scorebar-val { font-size: 12.5px; font-weight: 700; text-align: right; font-family: 'JetBrains Mono', monospace; }

.reason-group { margin-bottom: 10px; }
.reason-group:last-child { margin-bottom: 0; }
.reason-title {
  display: block; font-size: 10px; letter-spacing: .7px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}

.valid-switch { font-size: 12.5px; color: var(--text); }

.alert-tag.valid {
  background: linear-gradient(135deg, var(--green), #10b981);
  color: #04160e;
  box-shadow: 0 4px 14px rgba(52,211,153,.45);
}
.alert-tag.unverified {
  background: rgba(251,191,36,.16);
  border: 1px solid rgba(251,191,36,.45);
  color: var(--gold);
  box-shadow: none;
}

.alert-tag {
  position: absolute;
  top: -9px; right: 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), #f59e0b);
  color: #1a1200;
  box-shadow: 0 4px 14px rgba(251,191,36,.4);
}

.loading { grid-column: 1 / -1; text-align: center; padding: 80px 20px; color: var(--muted); }
.spinner {
  width: 44px; height: 44px;
  margin: 0 auto 18px;
  border: 3px solid rgba(124,140,255,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 15px; }

.mono { font-family: 'JetBrains Mono', monospace; font-size: 15px !important; }

footer {
  max-width: 1280px;
  margin: 48px auto 0;
  padding: 22px 32px;
  border-top: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  line-height: 1.7;
}
footer strong { color: var(--gold); }

@media (max-width: 640px) {
  .topbar, main { padding-left: 18px; padding-right: 18px; }
  .feed { grid-template-columns: 1fr; }
  .controls { width: 100%; justify-content: space-between; }
  .countdown { align-items: flex-start; }
}

/* ---------------- Tab pasar (Kripto / Saham AS / Saham IDX) ---------------- */

.market-tabs {
  display: flex;
  gap: 6px;
  padding: 0 24px;
  margin: 18px auto 0;
  max-width: 1280px;
  flex-wrap: wrap;
}

.market-tab {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(19, 26, 43, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

.market-tab:hover {
  color: var(--text);
  border-color: rgba(124, 140, 255, 0.45);
  transform: translateY(-1px);
}

.market-tab.active {
  color: #0b1020;
  background: linear-gradient(135deg, var(--accent), #9d7cff);
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(124, 140, 255, 0.35);
}

@media (max-width: 640px) {
  .market-tabs { padding: 0 16px; }
  .market-tab { flex: 1; padding: 8px 10px; font-size: 12px; }
}
