/* ERDI Biogas Database – theme */
:root {
  --primary: #0f766e;
  --primary-600: #0d9488;
  --primary-900: #134e4a;
  --accent: #84cc16;
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f4f7f6;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Prompt', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }
h1, h2 { color: var(--ink); margin: 0; line-height: 1.3; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); font-size: 13px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; font-size: 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: 0 4px 12px rgba(15, 118, 110, .3);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-weight: 600; font-size: 16px; }
.brand-text small { color: var(--muted); font-size: 12px; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a { color: var(--text); padding: 8px 14px; border-radius: 10px; font-size: 14px; transition: background .15s; }
.topnav a:hover { background: #f1f5f9; color: var(--ink); }
.topnav .lang { border: 1px solid var(--line); font-weight: 600; margin-left: 6px; }

/* Hero */
.hero {
  position: relative; color: #fff; padding: 44px 0 0;
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(132, 204, 22, .35), transparent 60%),
    linear-gradient(135deg, var(--primary-900) 0%, var(--primary) 60%, var(--primary-600) 100%);
}
.hero h1 { color: #fff; font-size: clamp(26px, 3.4vw, 38px); font-weight: 600; }
.hero .lead { margin: 6px 0 28px; color: rgba(255, 255, 255, .85); font-size: 16px; }
.hero-sm { padding: 28px 0 84px; }
.hero-sm + .container { padding-top: 0; }
.hero-sm .lead { margin-bottom: 0; }
.back { display: inline-block; color: rgba(255, 255, 255, .85); font-size: 14px; margin-bottom: 10px; }
.back:hover { color: #fff; }

/* Stats */
.stats, .kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stats { position: relative; top: 44px; }
.kpis { margin-top: -60px; margin-bottom: 20px; position: relative; }
.stat {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); color: var(--text);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.stat:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(15, 23, 42, .1); }
.stat-icon { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; }
.c1 { background: #ccfbf1; color: #0f766e; }
.c2 { background: #fef3c7; color: #b45309; }
.c3 { background: #e0f2fe; color: #0369a1; }
.c4 { background: #ecfccb; color: #4d7c0f; }
.stat-value { font-size: 24px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.stat-value small { font-size: 13px; font-weight: 400; color: var(--muted); }
.stat-label { font-size: 13px; color: var(--muted); }
.hero + .container { padding-top: 68px; }
.hero-sm + .container { padding-top: 0; }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 17px; font-weight: 600; }
.card-head h2 i { color: var(--primary); margin-right: 6px; }
.badge { background: #ccfbf1; color: var(--primary); font-weight: 600; font-size: 13px; padding: 2px 10px; border-radius: 999px; }

/* Filter */
.filter { display: grid; grid-template-columns: 1fr 1fr auto; gap: 16px; align-items: end; padding: 20px; overflow: visible; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.field label i { color: var(--primary); }
.field select { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font: inherit; }
.select2-container--default .select2-selection--single { height: 44px; border: 1px solid var(--line); border-radius: 10px; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 42px; padding-left: 14px; color: var(--ink); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 42px; right: 8px; }
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--single { border-color: var(--primary-600); box-shadow: 0 0 0 3px rgba(13, 148, 136, .15); }
.select2-dropdown { border-color: var(--line); border-radius: 10px; overflow: hidden; font-family: 'Prompt', sans-serif; }
.select2-results__option--highlighted[aria-selected] { background: var(--primary) !important; }
.select2-search__field { border-radius: 8px; }
.actions { display: flex; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); color: #fff; box-shadow: 0 6px 16px rgba(15, 118, 110, .3); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: #f8fafc; }

/* Map */
#map { width: 100%; height: 640px; }
.legend { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.farm { background: #16a34a; }
.dot.factory { background: #0ea5e9; }
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .2); }
.leaflet-popup-content { font-family: 'Prompt', sans-serif; font-size: 13px; min-width: 220px; margin: 14px 16px; }
.pop-title a { font-size: 15px; font-weight: 600; color: var(--ink); }
.pop-title a:hover { color: var(--primary); }
.pop-sub { color: var(--muted); margin-bottom: 8px; }
.pop-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px dashed var(--line); }
.pop-row b { color: var(--primary); font-weight: 600; }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .3px;
  background: #f8fafc; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f0fdfa; }
.table td a { font-weight: 500; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 40px !important; }

/* Detail */
.detail-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: start; }
.photo img { display: block; width: 100%; height: auto; }
.photo-empty { height: 320px; display: grid; place-items: center; font-size: 48px; color: #cbd5e1; background: #f8fafc; }
.info { margin: 0; padding: 8px 20px 12px; }
.info > div { display: grid; grid-template-columns: 200px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.info > div:last-child { border-bottom: 0; }
.info dt { color: var(--muted); font-size: 13.5px; }
.info dt i { width: 18px; color: var(--primary); }
.info dd { margin: 0; color: var(--ink); font-weight: 500; }
.empty-state { text-align: center; padding: 60px 20px; margin-top: 30px; }
.empty-state i { font-size: 44px; color: #cbd5e1; }
.empty-state h2 { margin: 12px 0 20px; font-size: 20px; }

/* Footer */
.footer { margin-top: 40px; background: var(--ink); color: #cbd5e1; padding: 28px 0; font-size: 14px; }
.footer strong { color: #fff; font-weight: 500; }
.footer a { color: var(--accent); }
.footer .muted { color: #94a3b8; margin-top: 4px; }

/* Responsive */
@media (max-width: 991px) {
  .stats, .kpis { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .brand-text small, .topnav a:not(.lang) span { display: none; }
  .topnav a { padding: 8px 10px; }
  .stats, .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
  .stat-value { font-size: 19px; }
  .filter { grid-template-columns: 1fr; }
  .actions .btn { flex: 1; }
  #map { height: 70vh; }
  .info > div { grid-template-columns: 1fr; gap: 2px; }
}
