/* UK Climate Co‑Benefits Dashboard — simple, modern, dark UI */
:root{
  --font-sans: 'Roboto', system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  --font-label: 'Poppins', system-ui, -apple-system, Segoe UI, Arial, sans-serif;

  --bg: #0b1020;
  --panel: rgba(255,255,255,0.06);
  --panel-solid: #111833;
  --border: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.18);
  --text: #e5e7eb;
  --muted: #a5b4fc;
  --muted2: rgba(229,231,235,0.75);
  --shadow: 0 18px 50px rgba(0,0,0,0.35);
  --shadow2: 0 10px 30px rgba(0,0,0,0.25);
  --grad: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
}

*{box-sizing:border-box}
html, body{height:100%}
body{
  margin:0;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at 15% 50%, rgba(59,130,246,0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(139,92,246,0.08), transparent 25%),
    var(--bg);
  overflow:hidden;
}

/* --- Layout --- */
.container{
  display:flex;
  height:100vh;
  width:100vw;
  overflow:hidden;
}

/* Sidebar */
.sidebar-panel{
  width:320px;
  min-width:320px;
  background: rgba(11, 16, 32, 0.6);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border);
  display:flex;
  flex-direction:column;
  z-index:10;
}

.sidebar-header{
  padding:20px;
  border-bottom:1px solid var(--border);
}
.sidebar-header h1{
  font-family: var(--font-label);
  margin:0;
  font-size:20px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight:700;
  letter-spacing:-0.5px;
}
.sidebar-header p{
  margin:6px 0 0;
  font-size:12px;
  color: var(--muted2);
  line-height:1.4;
}

/* Controls Scroller */
.controls-wrapper{
  flex:1;
  overflow-y:auto;
  padding:20px;
  display:flex;
  flex-direction:column;
  gap:24px;
}

.control-section{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.control-section-title{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:1px;
  color: var(--muted);
  font-weight:600;
  opacity:0.8;
}

/* Callout box */
.callout{
  background: linear-gradient(135deg, rgba(59,130,246,0.1), rgba(139,92,246,0.05));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius:8px;
  padding:12px;
}
.callout-title{
  font-size:13px;
  font-weight:600;
  color:#fff;
  margin-bottom:4px;
}
.callout-text{
  font-size:12px;
  line-height:1.5;
  color: var(--muted2);
}
.callout-text strong{ color:#fff; }

/* Inputs */
.control-group{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.control-group label{
  font-size:12px;
  color: var(--text);
  font-weight:500;
}
.select, .input{
  background: var(--panel);
  border: 1px solid var(--border);
  color: #fff;
  padding:8px 10px;
  border-radius:6px;
  font-family: inherit;
  font-size:13px;
  outline:none;
  transition: border-color 0.2s;
  width:100%;
}
.select:focus, .input:focus{
  border-color: #6366f1;
  background: rgba(255,255,255,0.08);
}
.help{
  font-size:11px;
  color: rgba(255,255,255,0.4);
  line-height:1.3;
}

/* Buttons */
.btn{
  background: var(--panel-solid);
  border:1px solid var(--border);
  color: var(--text);
  padding:8px 14px;
  border-radius:6px;
  font-size:13px;
  cursor:pointer;
  transition: all 0.2s;
  font-weight:500;
}
.btn:hover{
  background: rgba(255,255,255,0.1);
  border-color: var(--border-strong);
}
.btn-secondary{
  font-size:12px;
  padding:6px 12px;
}
.btn-row{
  display:flex; gap:8px;
}

.sidebar-footer{
  margin-top:auto;
  padding-top:20px;
  border-top:1px solid var(--border);
  font-size:11px;
  color: rgba(255,255,255,0.3);
  text-align:center;
}

/* --- Main Charts Area --- */
.charts-area{
  flex:1;
  background: rgba(0,0,0,0.2);
  padding:20px;
  overflow-y:auto;
  position:relative;
}

.dashboard-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 350px 300px; /* Tinggi baris diatur di sini */
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Panel Card */
.chart-panel{
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display:flex;
  flex-direction:column;
  box-shadow: var(--shadow2);
  position: relative;
  overflow: hidden;
}

.chart-title{
  font-family: var(--font-label);
  font-size:14px;
  font-weight:600;
  color:#fff;
}
.chart-subtitle{
  font-size:12px;
  color: var(--muted);
  margin-bottom:12px;
}

/* --- PERBAIKAN UTAMA ADA DI SINI --- */
.svg-container{
  flex:1;
  position:relative;
  width: 100%;
  
  /* PENTING: Memberikan tinggi minimal agar grafik muncul */
  min-height: 250px; 
  height: 100%;
}
/* ----------------------------------- */

/* Grid Layout IDs */
#panel-top-left { grid-column: 1 / 2; grid-row: 1 / 2; }
#panel-top-right { grid-column: 2 / 3; grid-row: 1 / 2; }
#panel-bottom-left { grid-column: 1 / 2; grid-row: 2 / 3; }
#panel-bottom-right { grid-column: 2 / 3; grid-row: 2 / 3; }

/* Responsive */
@media (max-width: 1200px){
  body{overflow:auto}
  .container{flex-direction:column; overflow:auto; height:auto}
  .sidebar-panel{width:100%; min-width:auto}
  .dashboard-grid{grid-template-columns:1fr; min-width:auto; display: flex; flex-direction: column;}
  .charts-area{overflow:visible}
  
  .chart-panel {
      min-height: 400px; /* Tinggi fix untuk mobile */
  }
}

/* Insight Box */
.insight{
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(139,92,246,0.08);
  padding:12px;
  font-size:13px;
  line-height:1.45;
  color: rgba(229,231,235,0.82);
}

/* =========================================
   D3.JS & UI ELEMENTS STYLING
   ========================================= */

/* 1. Dropdown Fix */
select option {
  background-color: #1e293b;
  color: #fff;
}

/* 2. Tooltip Styling */
#tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  padding: 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 9999;
  min-width: 150px;
  opacity: 0;
  transition: opacity 0.15s ease;
  backdrop-filter: blur(4px);
}

/* 3. Brush Styling */
.brush .selection {
  fill: rgba(139, 92, 246, 0.2);
  stroke: rgba(139, 92, 246, 0.6);
  stroke-width: 1px;
}
.brush .handle {
  fill: #a78bfa;
  width: 6px;
  rx: 2;
}

/* 4. Axis Styling */
.domain {
  stroke: rgba(255, 255, 255, 0.15);
}
.tick line {
  stroke: rgba(255, 255, 255, 0.1);
}
.tick text {
  fill: #94a3b8;
  font-family: var(--font-sans);
  font-size: 10px;
}

/* 5. Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #0b1020; 
}
::-webkit-scrollbar-thumb {
  background: #334155; 
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569; 
}