/* ═══════════════════════════════════════════════════════
   Halaman Analisis Risiko — risiko.html
═══════════════════════════════════════════════════════ */

.risiko-page { background: #f0f2f5; }

/* Header */
.risiko-header {
  background: linear-gradient(135deg, #1e1b4b 0%, #7c3aed 100%) !important;
}
.back-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,0.15); color: white;
  text-decoration: none; flex-shrink: 0;
  transition: background 0.18s;
}
.back-btn:hover { background: rgba(255,255,255,0.28); }
.header-left { display: flex; align-items: center; gap: 12px; }

.btn-run {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.35);
  color: white; padding: 7px 16px; border-radius: 8px;
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: background 0.18s; white-space: nowrap;
}
.btn-run:hover { background: rgba(255,255,255,0.3); }

@media (max-width: 768px) {
  .risiko-header {
    height: auto !important;
    padding: 8px 12px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 5px !important;
  }
  .risiko-header .header-left {
    gap: 8px;
  }
  .risiko-header .header-left h1 {
    font-size: 0.85rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .risiko-header .header-right {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    justify-content: flex-start !important;
    overflow: visible !important;
    width: 100%;
  }
  .risiko-main { padding: 12px 10px 80px; }
}

/* Main */
.risiko-main { width: 100%; padding: 16px 20px 32px; }

/* Disclaimer */
.disclaimer-bar {
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; padding: 10px 16px;
  font-size: 0.78rem; color: #92400e; line-height: 1.6;
  margin-bottom: 16px;
}

/* State screens */
.state-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  padding: 60px 24px; gap: 14px;
  background: white; border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
.state-icon { font-size: 3.5rem; }
.state-screen h2 { font-size: 1.2rem; color: #1a3c6e; font-weight: 700; }
.state-screen p  { font-size: 0.88rem; color: #6b7280; max-width: 480px; line-height: 1.6; }

/* Indikator preview */
.indikator-preview {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px; width: 100%; max-width: 600px; margin: 4px 0;
}
.ind-item {
  display: flex; align-items: center; gap: 8px;
  background: #f9fafb; border-radius: 8px; padding: 8px 12px;
  font-size: 0.8rem; color: #374151; font-weight: 500;
  border: 1px solid #f3f4f6;
}
.ind-kode {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}

/* Run button big */
.btn-run-big {
  display: inline-flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #1e1b4b, #7c3aed);
  color: white; padding: 14px 32px; border-radius: 12px;
  font-size: 1rem; font-weight: 700; cursor: pointer; border: none;
  box-shadow: 0 4px 16px rgba(124,58,237,0.35);
  transition: transform 0.18s, box-shadow 0.18s;
}
.btn-run-big:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(124,58,237,0.45); }

/* Loading */
.loading-ring {
  width: 56px; height: 56px;
  border: 4px solid #e5e7eb;
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-steps {
  display: flex; flex-direction: column; gap: 8px;
  width: 100%; max-width: 320px;
}
.lstep {
  padding: 8px 14px; border-radius: 8px;
  font-size: 0.82rem; color: #9ca3af;
  background: #f9fafb; border: 1px solid #f3f4f6;
  transition: all 0.3s;
}
.lstep.active {
  color: #7c3aed; background: #f5f3ff;
  border-color: #c4b5fd; font-weight: 600;
}

/* Summary bar */
.risk-summary-bar {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 14px;
}
.risk-sum-card {
  background: white; border-radius: 10px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  border-left: 4px solid #e5e7eb;
}
.risk-sum-all    { border-left-color: #6366f1; }
.risk-sum-tinggi { border-left-color: #dc2626; }
.risk-sum-sedang { border-left-color: #d97706; }
.risk-sum-rendah { border-left-color: #16a34a; }
.risk-sum-icon  { font-size: 1.8rem; flex-shrink: 0; }
.risk-sum-label { font-size: 0.68rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.risk-sum-val   { font-size: 1.5rem; font-weight: 700; color: #1a3c6e; }
.risk-sum-sub   { font-size: 0.65rem; color: #9ca3af; margin-top: 1px; }

/* Charts */
.risiko-charts {
  display: grid; grid-template-columns: 2fr 1fr;
  gap: 14px; margin-bottom: 14px;
}

/* Risk badges */
.risk-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.5px;
}
.risk-badge.risk-tinggi { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.risk-badge.risk-sedang { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.risk-badge.risk-rendah { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* Indikator tags */
.risk-ind-tag {
  display: inline-block; padding: 2px 7px; border-radius: 6px;
  font-size: 0.68rem; font-weight: 700; cursor: help; margin: 1px;
}

/* Filter buttons */
.risk-filter-btn {
  padding: 5px 14px; border: 1px solid #d1d5db;
  background: white; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s; color: #374151;
}
.risk-filter-btn:hover  { background: #f3f4f6; }
.risk-filter-btn.active { background: #1e1b4b; color: white; border-color: #1e1b4b; }

/* Detail modal */
.risk-detail-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.risk-detail-item {
  background: #fafafa; border-radius: 8px; padding: 12px 14px;
  border-left: 4px solid #e5e7eb;
}
.risk-detail-kode { font-size: 0.82rem; font-weight: 700; margin-bottom: 4px; }
.risk-detail-desc { font-size: 0.78rem; color: #374151; line-height: 1.5; }
.risk-disclaimer  {
  background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; padding: 12px 14px;
  font-size: 0.78rem; color: #92400e; line-height: 1.6;
}

/* Mobile */
@media (max-width: 768px) {
  .risiko-main { padding: 10px 10px 24px; }
  .risk-summary-bar { grid-template-columns: 1fr 1fr; gap: 8px; }
  .risk-sum-val { font-size: 1.1rem; }
  .risiko-charts { grid-template-columns: 1fr; }
  .indikator-preview { grid-template-columns: 1fr; }
  #risk-search { width: 140px; }
}
@media (max-width: 360px) {
  .risk-summary-bar { grid-template-columns: 1fr 1fr; }
}

/* ── Toggle view buttons ── */
.view-toggle {
  display: flex;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
}
.view-btn {
  padding: 6px 10px;
  background: white;
  border: none;
  cursor: pointer;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.view-btn:hover  { background: #f3f4f6; color: #374151; }
.view-btn.active { background: #1e1b4b; color: white; }
.view-btn + .view-btn { border-left: 1px solid #d1d5db; }

/* ── Cards grid ── */
.risk-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 14px;
}

.risk-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.risk-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.rc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  background: #fafafa;
  border-bottom: 1px solid #f3f4f6;
}
.rc-skor { font-size: 0.68rem; color: #9ca3af; font-weight: 600; }

.rc-nama {
  padding: 10px 14px 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1a3c6e;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rc-pagu {
  padding: 2px 14px 8px;
  font-size: 1.05rem;
  font-weight: 800;
}

.rc-info {
  padding: 0 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rc-row { display: flex; gap: 6px; font-size: 0.74rem; }
.rc-lbl { color: #9ca3af; min-width: 80px; flex-shrink: 0; }
.rc-val { color: #374151; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rc-tags {
  padding: 6px 14px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ── List popup rows ── */
.lp-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: background 0.12s;
  border-radius: 8px;
  margin-bottom: 4px;
}
.lp-row:hover { background: #f5f3ff; }

.lp-rank {
  font-size: 1rem;
  font-weight: 800;
  min-width: 28px;
  text-align: center;
  flex-shrink: 0;
  padding-top: 2px;
}
.lp-body { flex: 1; min-width: 0; }
.lp-nama {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1a3c6e;
  margin-bottom: 3px;
  line-height: 1.4;
}
.lp-meta {
  font-size: 0.74rem;
  color: #6b7280;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-bottom: 3px;
}
.lp-pagu { font-weight: 700; }
.lp-sep  { color: #d1d5db; }
.lp-satker {
  font-size: 0.72rem;
  color: #9ca3af;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lp-tags { display: flex; flex-wrap: wrap; gap: 3px; }

/* Mobile */
@media (max-width: 768px) {
  .risk-cards-grid { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .rc-lbl { min-width: 70px; }
}
