/* ============================================================
   PETA PERUU — Stylesheet Utama
   Dr.dr. Budi Siswanto, Sp.OG. | Perpustakaan Digital ABBA
   ============================================================ */

:root {
  --primary:   #1a3a5c;
  --secondary: #c0392b;
  --accent:    #f39c12;
  --success:   #27ae60;
  --info:      #2980b9;
  --light:     #ecf0f1;
  --dark:      #2c3e50;
  --white:     #ffffff;
  --border:    #dee2e6;
  --shadow:    0 2px 12px rgba(0,0,0,0.10);
  --radius:    8px;
  --font:      'Segoe UI', 'Arial', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: #f4f6f9;
  color: var(--dark);
  font-size: 15px;
  line-height: 1.65;
}

/* ---- HEADER ---- */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, #2e4f7a 100%);
  color: var(--white);
  padding: 0;
  box-shadow: 0 3px 20px rgba(0,0,0,0.25);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.header-top {
  display: flex;
  align-items: center;
  padding: 14px 28px;
  gap: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.header-logo {
  font-size: 2rem;
  line-height: 1;
}
.header-text h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.header-text p {
  font-size: 0.78rem;
  opacity: 0.8;
  margin-top: 2px;
}
.header-badge {
  margin-left: auto;
  background: var(--secondary);
  color: var(--white);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* ---- NAVBAR ---- */
.app-nav {
  display: flex;
  background: rgba(0,0,0,0.2);
}
.app-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 11px 22px;
  font-size: 0.88rem;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.app-nav a:hover, .app-nav a.active {
  color: var(--white);
  border-bottom-color: var(--accent);
  background: rgba(255,255,255,0.08);
}

/* ---- LAYOUT ---- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px;
}

/* ---- MOTIVASI BOX ---- */
.motivasi-box {
  background: linear-gradient(135deg, var(--primary) 0%, #2e4f7a 100%);
  color: var(--white);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 24px;
  margin-bottom: 24px;
  font-style: italic;
  font-size: 1.0rem;
  position: relative;
}
.motivasi-box::before {
  content: '\201C';
  font-size: 4rem;
  color: rgba(255,255,255,0.15);
  position: absolute;
  top: -8px; left: 12px;
  line-height: 1;
  font-family: Georgia, serif;
}
.motivasi-box p { position: relative; z-index: 1; }
.motivasi-box cite {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-size: 0.82rem;
  opacity: 0.8;
}

/* ---- STATS CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  text-align: center;
  border-top: 4px solid var(--primary);
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card .num {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.stat-card .label {
  font-size: 0.8rem;
  color: #666;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-card.danger .num  { color: var(--secondary); }
.stat-card.danger       { border-top-color: var(--secondary); }
.stat-card.warning .num { color: var(--accent); }
.stat-card.warning      { border-top-color: var(--accent); }
.stat-card.success .num { color: var(--success); }
.stat-card.success      { border-top-color: var(--success); }

/* ---- CLUSTER GRID ---- */
.cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.cluster-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
}
.cluster-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}
.cluster-card-head {
  padding: 16px 20px;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 12px;
}
.cluster-card-head .icon { font-size: 1.8rem; }
.cluster-card-head h3 { font-size: 0.95rem; font-weight: 700; }
.cluster-card-body { padding: 14px 20px; }
.cluster-card-body .count {
  font-size: 0.85rem;
  color: #666;
}
.cluster-card-body ul {
  margin-top: 8px;
  padding-left: 0;
  list-style: none;
}
.cluster-card-body ul li {
  font-size: 0.82rem;
  color: #444;
  padding: 3px 0;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cluster-card-body ul li::before {
  content: '▶';
  font-size: 0.6rem;
  color: var(--accent);
  flex-shrink: 0;
}

/* ---- PETA / DIAGRAM ---- */
.peta-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 28px;
  overflow-x: auto;
}
.peta-wrap h2 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#peta-svg { width: 100%; height: auto; min-height: 420px; }

/* ---- FILTER & SEARCH ---- */
.filter-bar {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.filter-bar label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--primary);
}
.filter-bar select,
.filter-bar input {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  background: #fafbfc;
}
.filter-bar select:focus,
.filter-bar input:focus {
  border-color: var(--primary);
}

/* ---- DETAIL CARD ---- */
.detail-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}
.detail-card-head {
  background: linear-gradient(135deg, var(--primary), #2e4f7a);
  color: var(--white);
  padding: 18px 24px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.detail-card-head .cluster-badge {
  background: rgba(255,255,255,0.2);
  border-radius: 50px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.detail-card-head h2 { font-size: 1.0rem; line-height: 1.4; }
.detail-card-head .singkatan {
  font-size: 0.82rem;
  opacity: 0.8;
  margin-top: 4px;
}
.detail-card-body { padding: 0; }

/* ---- PASAL ACCORDION ---- */
.pasal-item {
  border-bottom: 1px solid var(--border);
}
.pasal-item:last-child { border-bottom: none; }
.pasal-toggle {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 14px 24px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.2s;
}
.pasal-toggle:hover { background: #f8f9fa; }
.pasal-toggle .arrow { transition: transform 0.3s; font-size: 0.8rem; }
.pasal-toggle.open .arrow { transform: rotate(180deg); }
.pasal-content {
  display: none;
  padding: 0 24px 20px;
}
.pasal-content.open { display: block; }
.pasal-bunyi {
  background: #f8f9fa;
  border-left: 3px solid var(--info);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  font-style: italic;
  font-size: 0.88rem;
  color: #444;
  margin-bottom: 14px;
  quotes: "\201C" "\201D";
}
.pasal-bunyi::before { content: open-quote; }
.pasal-bunyi::after  { content: close-quote; }

.masalah-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.masalah-box {
  border-radius: 6px;
  padding: 12px 14px;
}
.masalah-box.red    { background: #fdf0f0; border-left: 3px solid #e74c3c; }
.masalah-box.orange { background: #fef9f0; border-left: 3px solid var(--accent); }
.masalah-box.purple { background: #f8f0fd; border-left: 3px solid #8e44ad; }
.masalah-box h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  opacity: 0.7;
}
.masalah-box p { font-size: 0.88rem; }

/* ---- SOLUSI PANEL ---- */
.solusi-panel {
  background: linear-gradient(135deg, #e8f8f0, #d5f5e3);
  border: 1.5px solid #27ae60;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 14px;
}
.solusi-panel h4 {
  color: #1a7a42;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.solusi-panel .jenis-badge {
  display: inline-block;
  background: #27ae60;
  color: var(--white);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.solusi-panel p { font-size: 0.88rem; color: #2c5e3a; }

/* ---- PRIORITAS BADGE ---- */
.prioritas-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--white);
}
.p-sangat-tinggi { background: #c0392b; }
.p-tinggi        { background: #e67e22; }
.p-sedang        { background: #f39c12; color: #333; }
.p-rendah        { background: #27ae60; }

/* ---- MATRIKS TABLE ---- */
.matrix-wrap {
  overflow-x: auto;
  margin-bottom: 28px;
}
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
}
.matrix-table th {
  background: var(--primary);
  color: var(--white);
  padding: 12px 14px;
  text-align: left;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.matrix-table td {
  padding: 11px 14px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.matrix-table tr:nth-child(even) td { background: #f9fafb; }
.matrix-table tr:hover td { background: #e8f0f8; }

/* ---- REKOMENDASI ---- */
.rekomendasi-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 22px;
  border-left: 5px solid var(--primary);
}
.rekomendasi-card h3 {
  color: var(--primary);
  font-size: 1.05rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rekomendasi-card ol, .rekomendasi-card ul {
  padding-left: 20px;
}
.rekomendasi-card li { margin-bottom: 8px; font-size: 0.9rem; }
.rekomendasi-card.danger { border-left-color: var(--secondary); }
.rekomendasi-card.danger h3 { color: var(--secondary); }
.rekomendasi-card.success { border-left-color: var(--success); }
.rekomendasi-card.success h3 { color: #1a7a42; }

/* ---- SECTION HEADING ---- */
.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
}
.section-heading h2 {
  font-size: 1.15rem;
  color: var(--primary);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.section-heading .line {
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, var(--primary), transparent);
}

/* ---- FOOTER ---- */
.app-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.8);
  text-align: center;
  padding: 20px;
  font-size: 0.82rem;
  margin-top: 40px;
}
.app-footer strong { color: var(--white); }

/* ---- SEARCH HIGHLIGHT ---- */
.highlight { background: #fff176; border-radius: 2px; }

/* ---- TOOLTIP ---- */
.tooltip-wrap { position: relative; cursor: help; }
.tooltip-text {
  display: none;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: var(--white);
  font-size: 0.78rem;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 999;
  max-width: 280px;
  white-space: normal;
  text-align: center;
}
.tooltip-wrap:hover .tooltip-text { display: block; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .header-top { flex-wrap: wrap; padding: 12px 16px; }
  .header-badge { margin-left: 0; }
  .app-nav { overflow-x: auto; }
  .app-nav a { padding: 10px 14px; font-size: 0.82rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .cluster-grid { grid-template-columns: 1fr; }
  .masalah-row { grid-template-columns: 1fr; }
  .container { padding: 16px 12px; }
  .detail-card-head { flex-direction: column; }
  .filter-bar { flex-direction: column; align-items: flex-start; }
}

/* ---- PRINT ---- */
@media print {
  .app-header, .app-nav, .filter-bar, .app-footer { display: none; }
  .detail-card-body { display: block !important; }
  .pasal-content { display: block !important; }
  body { background: var(--white); }
}
