/* ── Tidal — CSS spesifik (di atas tema.css TemanBelajar) ──
   Memakai CSS vars dari tema.css agar otomatis ikut dark mode.
*/

/* Chat template memakai height:100vh + overflow:hidden — dashboard harus scroll */
body {
  height: auto;
  overflow: auto;
}

/* ── MAIN ── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  flex: 1;
  width: 100%;
}

/* ── HERO (gradient navy + kuning) ── */
.hero {
  text-align: center;
  padding: 2.2rem 1.5rem;
  background: linear-gradient(135deg, #013880 0%, #014a9e 55%, #0157b4 100%);
  color: #fff;
  border-radius: var(--radius);
  max-width: 900px;
  margin: 1rem auto 1.8rem;
  box-shadow: var(--shadow);
  border-bottom: 3px solid var(--accent-yellow);
  position: relative;
}
.hero h1 {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: #fff;
  letter-spacing: -0.01em;
}
.hero-sub {
  font-size: 0.95rem;
  opacity: 0.88;
  line-height: 1.6;
  max-width: 620px;
  margin: 0 auto;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin-top: 1.2rem; }
.hero-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.1rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.82rem; text-decoration: none;
  background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.2);
  transition: all 0.2s; cursor: pointer;
}
.hero-btn:hover { background: rgba(255,255,255,0.25); transform: translateY(-2px); }
.hero-btn-primary { background: var(--accent-yellow); color: #162030; border-color: transparent; }
.hero-btn-primary:hover { background: #e6aa00; box-shadow: 0 4px 12px rgba(255,189,7,0.3); }

/* ── CARDS ── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-main);
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  line-height: 1.4;
}
.card h2 small { font-weight: 400; color: var(--text-muted); font-size: 0.75rem; }

/* ── STATS GRID ── */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin-bottom: 1.4rem; }
.stat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.2rem; text-align: center;
  transition: all 0.2s;
}
.stat-box:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(1,56,128,0.08); border-color: var(--primary); }
.stat-box .val { font-size: 1.5rem; font-weight: 700; color: var(--primary); display: block; }
.stat-box .label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.stat-box .subval { font-size: 0.7rem; color: var(--text-muted); opacity: 0.7; margin-top: 0.1rem; }

/* ── TABS ── */
.tab-group { display: flex; gap: 0; margin-bottom: 1.4rem; border-bottom: 2px solid var(--border-color); overflow-x: auto; }
.tab {
  padding: 0.7rem 1.2rem; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; border: none; background: none; color: var(--text-muted);
  border-bottom: 3px solid transparent; transition: all 0.15s;
  text-decoration: none; display: flex; align-items: center; gap: 0.4rem;
  white-space: nowrap;
}
.tab:hover { color: var(--text-main); background: var(--primary-light); }
.tab.active {
  color: var(--primary); border-bottom-color: var(--accent-yellow);
  background: var(--primary-light);
}

/* ── FILTER BUTTONS ── */
.filters { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.5rem 1rem; border-radius: var(--radius-sm);
  border: none; font-size: 0.82rem; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: var(--bg-secondary); color: var(--primary); border: 1.5px solid var(--border-color); }
.btn-outline:hover { border-color: var(--primary); background: var(--primary-light); }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { background: var(--primary-light); color: var(--text-main); font-weight: 600; padding: 0.6rem; text-align: left; position: sticky; top: 0; font-size: 0.75rem; }
td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
tr:hover td { background: var(--primary-light); }
tr.spring td { background: #fff9e0; }
tr.neap td { background: #e8f8f5; }
tr.pred-row td { background: #eaf2f8; color: var(--text-main); }
.history-table th { border-bottom: 2px solid var(--primary); }
[data-theme="dark"] tr.spring td { background: rgba(255,189,7,0.08); }
[data-theme="dark"] tr.neap td { background: rgba(30,132,73,0.12); }
[data-theme="dark"] tr.pred-row td { background: rgba(1,56,128,0.25); }

/* ── BADGES ── */
.badge { display: inline-block; padding: 1px 8px; border-radius: 8px; font-size: 0.65rem; font-weight: 700; }
.badge-spring { background: var(--accent-yellow); color: #162030; }
.badge-neap { background: #d5f5e3; color: #1e8449; }
.badge-pred { background: #d6eaf8; color: #1a5276; }
.card h2 .badge-pred { background: var(--accent-yellow); color: #162030; font-size: 0.65rem; padding: 2px 8px; border-radius: 8px; font-weight: 700; }

/* ── CHART ── */
.chart-wrap { position: relative; height: 360px; margin-top: 0.3rem; }

/* ── LOADING / ERROR ── */
#loading { text-align: center; padding: 4rem; color: var(--text-muted); }
#loading .spinner {
  width: 40px; height: 40px; border: 4px solid var(--border-color);
  border-top-color: var(--accent-yellow); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
#error { display: none; text-align: center; padding: 3rem; color: #e74c3c; }

/* ── FOOTER ── */
footer {
  background: linear-gradient(135deg, #013880 0%, #014a9e 55%, #0157b4 100%);
  color: #fff; text-align: center; padding: 1.1rem 1rem;
  font-size: 0.8rem; margin-top: auto; border-top: 3px solid var(--accent-yellow);
}
footer p { margin: 0; color: #fff; }

/* ── HEADER LOCATION (dalam visitor-badge tidal) ── */
#header-location { font-weight: 600; }

/* ── MOBILE ── */
@media (max-width: 640px) {
  main { padding: 1rem; }
  .hero { padding: 1.7rem 1rem; }
  .hero h1 { font-size: 1.3rem; }
  .grid { gap: 0.5rem; }
  .tab { padding: 0.5rem 0.8rem; font-size: 0.8rem; }
  .stat-box .val { font-size: 1.2rem; }
  .header h1 { font-size: 1rem; }
  .header h1 small { font-size: 0.65rem; }
}

/* ── TAB TRANSITION ── */
[id^="tab-"]:not([id$="-link"]) { transition: opacity 0.15s ease; }
