/* ═══════════════════════════════════════════════════════════════
   ResearchSim — Design System
   style.css · Digunakan bersama oleh semua modul
   Berdasarkan sampling-metodologi-v2.html
   ═══════════════════════════════════════════════════════════════ */

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── DESIGN TOKENS ─── */
:root {

  /* Warna dasar — Light Mode */
  --bg:       #F4F1EC;
  --bg2:      #EDE9E1;
  --bg3:      #E5E0D6;
  --surface:  #FDFCF9;
  --surface2: #F7F5F0;

  /* Tinta */
  --ink:  #1C1A15;
  --ink2: #5C5849;
  --ink3: #9A9486;

  /* Garis */
  --rule:  rgba(28,26,21,0.10);
  --rule2: rgba(28,26,21,0.18);

  /* Warna semantik */
  --blue:     #1A5FBF;
  --blue-l:   #E6EEFA;
  --blue-m:   #4D8EE8;
  --green:    #2A6E28;
  --green-l:  #E6F2E6;
  --amber:    #8A4B0A;
  --amber-l:  #FBF0E3;
  --red:      #C93535;
  --red-l:    #FDEAEA;
  --purple:   #5A2EA6;
  --purple-l: #F0EAFB;
  --teal:     #0A5E5E;
  --teal-l:   #E0F4F4;

  /* Warna grup/strata (untuk visualisasi sampling) */
  --c1:    #2563EB;
  --c2:    #16A34A;
  --c3:    #D97706;
  --c-sel: #C93535;

  /* Tipografi */
  --serif: 'Instrument Serif', Georgia, serif;
  --sans:  'DM Sans', system-ui, sans-serif;
  --mono:  'DM Mono', 'Courier New', monospace;

  /* Bentuk & bayangan */
  --r:      10px;
  --r2:     6px;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.04);

  /* Progress step colors — digunakan M0 shell */
  --step-done:   var(--green);
  --step-active: var(--blue);
  --step-locked: var(--ink3);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #18160F;
    --bg2:      #211F17;
    --bg3:      #2A271E;
    --surface:  #242118;
    --surface2: #2E2B21;
    --ink:      #EDE8DF;
    --ink2:     #9A9485;
    --ink3:     #5E5A50;
    --rule:     rgba(255,255,255,0.08);
    --rule2:    rgba(255,255,255,0.14);
    --blue:     #5B9EF0;
    --blue-l:   #0F2040;
    --blue-m:   #3B78D0;
    --green:    #5DB85A;
    --green-l:  #0E2410;
    --amber:    #E8A830;
    --amber-l:  #2A1A04;
    --red:      #F06060;
    --red-l:    #2A0C0C;
    --purple:   #A07EE8;
    --purple-l: #1E1030;
    --teal:     #3DB8B8;
    --teal-l:   #052020;
    --c1:    #5B9EF0;
    --c2:    #5DB85A;
    --c3:    #E8A830;
    --c-sel: #F06060;
  }
}

/* ─── BASE ─── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ─── TIPOGRAFI ─── */
h1 { font-family: var(--serif); font-size: 28px; line-height: 1.2; font-weight: 400; }
h2 { font-family: var(--serif); font-size: 22px; line-height: 1.25; font-weight: 400; }
h3 { font-size: 15px; font-weight: 600; }
p  { color: var(--ink2); line-height: 1.75; }

.eyebrow {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink3);
  text-transform: uppercase;
  letter-spacing: .10em;
}

/* ─── LAYOUT ─── */
.page-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 28px 20px 100px;
}

/* ─── HEADER GLOBAL ─── */
/* Digunakan oleh semua modul — sticky navigation bar */
.rs-header {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow);
}

.rs-header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
}

.rs-wordmark {
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}

.rs-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink3);
  flex: 1;
}

.rs-breadcrumb span { color: var(--ink2); }

/* Progress bar tipis di bawah header */
.rs-progress-bar {
  height: 2px;
  background: var(--bg3);
  position: relative;
}

.rs-progress-fill {
  height: 100%;
  background: var(--blue);
  transition: width 0.4s ease;
}

/* ─── CARDS ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.card-sm {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r2);
  padding: 14px 16px;
  margin-bottom: 10px;
}

/* Card dengan border warna di kiri */
.card-accent {
  border-left: 3px solid var(--blue);
}
.card-accent.green  { border-left-color: var(--green); }
.card-accent.amber  { border-left-color: var(--amber); }
.card-accent.red    { border-left-color: var(--red); }
.card-accent.purple { border-left-color: var(--purple); }

/* ─── WELCOME / HERO BANNER ─── */
.hero-banner {
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r);
  padding: 24px 26px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.2;
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 14px;
  opacity: .70;
  line-height: 1.7;
  margin-bottom: 18px;
  color: inherit;
}

/* ─── TOMBOL ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  font-size: 13px;
  border-radius: var(--r2);
  cursor: pointer;
  border: 1px solid var(--rule2);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { background: var(--surface2); }

.btn-primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn-primary:hover { opacity: .85; }

.btn-blue {
  background: var(--blue-l);
  color: var(--blue);
  border-color: rgba(26,95,191,.25);
}
.btn-blue:hover { opacity: .85; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink2);
}
.btn-ghost:hover { background: var(--bg2); }

.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ─── BADGES ─── */
.badge {
  display: inline-block;
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 99px;
  font-weight: 600;
  letter-spacing: .04em;
}

.badge-blue   { background: var(--blue-l);   color: var(--blue);   }
.badge-green  { background: var(--green-l);  color: var(--green);  }
.badge-amber  { background: var(--amber-l);  color: var(--amber);  }
.badge-red    { background: var(--red-l);    color: var(--red);    }
.badge-purple { background: var(--purple-l); color: var(--purple); }
.badge-teal   { background: var(--teal-l);   color: var(--teal);   }
.badge-ink    { background: var(--bg3);      color: var(--ink2);   }

/* ─── CALLOUT / INFO BOX ─── */
.callout {
  background: var(--blue-l);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--r2) var(--r2) 0;
  padding: 13px 16px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--blue);
  margin: 12px 0;
}

.callout.green  { background: var(--green-l);  border-color: var(--green);  color: var(--green);  }
.callout.amber  { background: var(--amber-l);  border-color: var(--amber);  color: var(--amber);  }
.callout.red    { background: var(--red-l);    border-color: var(--red);    color: var(--red);    }
.callout.purple { background: var(--purple-l); border-color: var(--purple); color: var(--purple); }
.callout.neutral { background: var(--bg2); border-color: var(--rule2); color: var(--ink2); }

.callout strong { color: inherit; }

/* ─── FORM ELEMENTS ─── */
.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  margin-bottom: 6px;
  letter-spacing: .02em;
}

.field input[type="text"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 9px 13px;
  border-radius: var(--r2);
  border: 1px solid var(--rule2);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--blue);
}

.field textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

input[type="range"] {
  flex: 1;
  accent-color: var(--ink);
  cursor: pointer;
}

/* ─── TABEL ─── */
.table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink3);
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule2);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  line-height: 1.55;
  color: var(--ink2);
}

.table tr:last-child td { border-bottom: none; }
.table td:first-child { font-weight: 500; color: var(--ink); }

/* ─── CHOICE GRID ─── */
/* Grid kartu pilihan (paradigma, metode, dll) */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.choice-card {
  background: var(--surface);
  border: 1.5px solid var(--rule);
  border-radius: var(--r);
  padding: 16px 18px;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
  font-family: var(--sans);
  width: 100%;
}

.choice-card:hover {
  border-color: var(--rule2);
  background: var(--surface2);
}

.choice-card.selected {
  border-color: var(--blue);
  background: var(--blue-l);
}

.choice-card.selected .choice-title { color: var(--blue); }

.choice-icon { font-size: 22px; margin-bottom: 8px; display: block; }
.choice-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; color: var(--ink); }
.choice-desc  { font-size: 12px; color: var(--ink2); line-height: 1.5; }

/* ─── STEP FLOW ─── */
/* List langkah-langkah yang dapat di-expand */
.step-flow { display: flex; flex-direction: column; }

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  user-select: none;
  transition: opacity .15s;
}

.step-item:last-child { border-bottom: none; }
.step-item:hover { opacity: .8; }

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--rule2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--surface2);
  color: var(--ink2);
  transition: all .2s;
  font-family: var(--mono);
}

.step-item.active .step-num {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.step-item.done .step-num {
  background: var(--green-l);
  color: var(--green);
  border-color: var(--green);
}

.step-body { flex: 1; }
.step-title { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.step-sub   { font-size: 12px; color: var(--ink2); }

.step-expand {
  display: none;
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.75;
  margin-top: 10px;
  background: var(--bg2);
  border-radius: var(--r2);
  padding: 13px 16px;
  border-left: 3px solid var(--rule2);
}

.step-expand.open { display: block; }

/* ─── STAT CARDS ─── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}

.stat-val {
  font-size: 26px;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--ink);
  line-height: 1;
}

.stat-sub {
  font-size: 11px;
  color: var(--ink3);
  margin-top: 4px;
}

/* ─── CANVAS & VISUALISASI ─── */
.vis-canvas {
  width: 100%;
  display: block;
  border-radius: var(--r2);
  border: 1px solid var(--rule);
  background: var(--surface2);
}

/* ─── SCENARIO TABS ─── */
.scenario-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.stab {
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--rule2);
  background: var(--surface2);
  color: var(--ink2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--sans);
}

.stab:hover { color: var(--ink); border-color: var(--rule2); }
.stab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ─── NAV TABS (dalam modul) ─── */
.tab-nav {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
}

.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--ink2);
  white-space: nowrap;
  font-family: var(--sans);
  transition: color .2s, border-color .2s;
}

.tab-btn.active   { color: var(--ink); border-bottom-color: var(--ink); }
.tab-btn:hover:not(.active) { color: var(--ink); }

/* ─── ANIMASI ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}

@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.5); opacity: .5; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: none; }
}

.anim-fade  { animation: fadeIn .35s ease; }
.anim-slide { animation: slideIn .3s ease; }

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s ease-in-out infinite;
}

/* ─── FOOTER ─── */
.rs-footer {
  text-align: center;
  padding: 48px 0 20px;
  font-size: 11px;
  color: var(--ink3);
  font-family: var(--mono);
}

/* ─── UTILITY ─── */
.hidden  { display: none !important; }
.mt-sm   { margin-top: 8px; }
.mt-md   { margin-top: 16px; }
.mt-lg   { margin-top: 28px; }
.mb-sm   { margin-bottom: 8px; }
.mb-md   { margin-bottom: 16px; }
.flex    { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-sm  { gap: 8px; }
.gap-md  { gap: 14px; }
.gap-lg  { gap: 20px; }
.flex-1  { flex: 1; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--ink2); }
.mono    { font-family: var(--mono); }
.wrap    { flex-wrap: wrap; }

/* ─── RESPONSIF ─── */
@media (max-width: 540px) {
  .choice-grid { grid-template-columns: 1fr; }
  .stat-row    { grid-template-columns: 1fr 1fr; }
  .page-wrap   { padding: 18px 14px 80px; }
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
}
