/**
 * statistics.css — Tata Letak & Komponen Kalkulator Statistik Bantukerjain.com
 * Standar Anti-AI-Slop: Task-first above the fold, zero nested card hell,
 * palet tenang kontras tinggi, tabular-nums, touch target >= 44px, zero overflow-x.
 */

.stats-page [hidden] {
  display: none !important;
}

.stats-page .wrap {
  max-width: 1180px;
  padding: 0 12px;
}

@media (min-width: 640px) {
  .stats-page .wrap {
    padding: 0 16px;
  }
}

.stats-page .breadcrumb {
  padding: 4px 0 0;
  font-size: 0.76rem;
}

.stats-page .hero {
  padding: 2px 0 10px;
}

.stats-page .hero h1 {
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 2px;
}

.stats-page .hero .lead {
  font-size: 0.86rem;
  line-height: 1.4;
  color: #475569;
  margin: 0;
}

/* ===== Mode Tabs ===== */
.stats-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.stats-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.stats-tab-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.stats-tab-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

/* ===== Task-First 2-Column Workspace ===== */
.stats-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 22px;
}

@media (min-width: 960px) {
  .stats-workspace {
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
    gap: 18px;
  }
}

.stats-input-pane,
.stats-result-pane {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  min-width: 0;
}

@media (min-width: 960px) {
  .stats-result-pane {
    position: sticky;
    top: 76px;
  }
}

.stats-field-label {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.stats-field-hint {
  font-size: 0.82rem;
  color: #475569;
  margin: 0 0 8px;
  line-height: 1.45;
}

.stats-textarea {
  width: 100%;
  min-height: 140px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  resize: vertical;
}

.stats-textarea:focus {
  outline: none;
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.stats-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.stats-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid #2563eb;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
}

.stats-btn-primary:hover {
  background: #1d4ed8;
}

.stats-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.stats-btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.stats-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.stats-preset-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.stats-preset-chip:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #0f172a;
}

/* ===== Prediction Input ===== */
.stats-predict-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.stats-predict-box label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #0f172a;
}

.stats-predict-input {
  width: 120px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.stats-predict-result {
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #2563eb;
  font-variant-numeric: tabular-nums;
}

/* ===== Result Panel ===== */
.stats-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.stats-result-head h2 {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.stats-error-box {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-left: 3px solid #dc2626;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 12px;
}

.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

@media (min-width: 540px) {
  .stats-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.stats-kpi {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  min-width: 0;
}

.stats-kpi-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 2px;
}

.stats-kpi-val {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 1.08rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.stats-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.stats-detail-table th,
.stats-detail-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

.stats-detail-table th {
  color: #475569;
  font-weight: 600;
  width: 44%;
}

.stats-detail-table td {
  color: #0f172a;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.stats-sorted-box {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  font-size: 0.84rem;
  color: #475569;
}

.stats-sorted-vals {
  margin-top: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  color: #0f172a;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

/* ===== Scatter Plot Canvas ===== */
.stats-reg-hero {
  border-left: 3px solid #2563eb;
  padding: 4px 0 4px 12px;
  margin-bottom: 12px;
}

.stats-reg-eq {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.stats-reg-sub {
  font-size: 0.86rem;
  color: #475569;
  margin-top: 2px;
}

.stats-canvas-wrap {
  position: relative;
  width: 100%;
  margin-top: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #ffffff;
}

.stats-scatter-canvas {
  display: block;
  width: 100%;
  height: 300px;
}

.stats-canvas-tooltip {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #0f172a;
  color: #ffffff;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ===== Below-the-Fold Theory, Formulas & FAQ ===== */
.stats-guide-section {
  padding: 18px 0;
  border-top: 1px solid #e2e8f0;
}

.stats-guide-section h2 {
  font-size: 1.12rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 8px;
}

.stats-guide-section p {
  font-size: 0.92rem;
  line-height: 1.7;
  color: #334155;
  max-width: 80ch;
  margin: 0 0 12px;
}

.stats-formula-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin: 12px 0;
}

@media (min-width: 768px) {
  .stats-formula-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stats-formula-item {
  border-left: 3px solid #2563eb;
  padding: 6px 0 6px 14px;
}

.stats-formula-item h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 4px;
}

.stats-formula-code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  margin: 0 0 4px;
  word-break: break-word;
}

.stats-ref-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #334155;
}

@media print {
  .no-print,
  .b2b-sponsor-slot,
  .feedback-strip,
  .stats-tab-bar,
  .stats-action-row,
  .stats-preset-row {
    display: none !important;
  }

  .stats-workspace {
    display: block;
  }

  .stats-result-pane {
    position: static;
    border: 1px solid #cbd5e1;
  }
}
