/* ==========================================================================
   WEST JAVA SHARIA BANKING MARKET POTENTIAL MAPPING
   Design tokens: Deep Emerald/Teal base + Luminous Gold accent
   Typeface: Manrope (display) / Inter (body) / JetBrains Mono (data)
   ========================================================================== */

:root {
  /* --- Color tokens --- */
  --bg-deep:        #041613;
  --bg-mid:         #0A2E27;
  --bg-teal:        #0F3D36;
  --accent-gold:        #C9A227;
  --accent-gold-bright: #E8C766;
  --accent-teal:        #14B8A6;
  --accent-teal-bright: #2DD4BF;

  --text-primary: #EAF3EF;
  --text-muted:   #9FB8B2;
  --text-faint:   #6E8B84;

  --glass-bg:        rgba(255, 255, 255, 0.045);
  --glass-bg-strong:  rgba(255, 255, 255, 0.07);
  --glass-border:     rgba(232, 199, 102, 0.18);
  --glass-border-soft: rgba(45, 212, 191, 0.16);
  --shadow-soft: 0 8px 32px rgba(2, 10, 8, 0.45);
  --shadow-lift: 0 16px 48px rgba(2, 10, 8, 0.55);

  /* --- Type --- */
  --font-display: 'Manrope', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* --- Layout --- */
  --header-h: 84px;
  --map-width: 65%;
  --sidebar-width: 35%;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background:
    radial-gradient(circle at 15% 10%, rgba(45, 212, 191, 0.10), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(201, 162, 39, 0.10), transparent 45%),
    linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-mid) 55%, var(--bg-teal) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Signature background motif: faint topographic contour rings */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    repeating-radial-gradient(circle at 78% 22%,
      rgba(232, 199, 102, 0.05) 0px,
      rgba(232, 199, 102, 0.05) 1px,
      transparent 1px,
      transparent 34px);
  opacity: 0.6;
}

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; }

button { font-family: var(--font-body); cursor: pointer; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(232, 199, 102, 0.28);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(232, 199, 102, 0.5); }

/* ==========================================================================
   APP SHELL
   ========================================================================== */

.app-shell {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.app-header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  background: rgba(6, 24, 20, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 30%, var(--accent-gold-bright), var(--accent-gold) 70%);
  color: var(--bg-deep);
  font-size: 20px;
  box-shadow: 0 0 0 1px rgba(232, 199, 102, 0.3), 0 4px 16px rgba(201, 162, 39, 0.35);
}

.brand-text { min-width: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-teal-bright);
  margin-bottom: 2px;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-title span {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-gold-bright);
}

.brand-subtitle {
  display: none; /* shown from tablet-up, see media query */
}

.header-credit {
  flex-shrink: 0;
  text-align: right;
}

.credit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid var(--glass-border-soft);
  color: var(--accent-teal-bright);
  margin-bottom: 4px;
}

.credit-name {
  font-size: 12.5px;
  color: var(--text-primary);
}

.credit-name strong { color: var(--accent-gold-bright); font-weight: 700; }

.credit-role {
  font-size: 11px;
  color: var(--text-faint);
}

/* ==========================================================================
   BODY: MAP + SIDEBAR (Split Screen Desktop)
   ========================================================================== */

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ---- Map Panel ---- */

.map-panel {
  position: relative;
  width: var(--map-width);
  height: 100%;
  border-right: 1px solid var(--glass-border);
}

#map {
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
}

/* Leaflet base tile dimming so the gold/teal UI stays dominant */
.leaflet-container {
  font-family: var(--font-body);
  background: var(--bg-deep);
}

.leaflet-popup-content-wrapper {
  background: rgba(10, 46, 39, 0.92);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

.leaflet-popup-tip { background: rgba(10, 46, 39, 0.92); }

.map-legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: rgba(6, 24, 20, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, var(--accent-teal-bright));
  display: inline-block;
  box-shadow: 0 0 6px var(--dot, var(--accent-teal-bright));
}

.legend-dot:not(:first-child) { margin-left: 10px; }

/* ---- Sidebar Panel ---- */

.sidebar-panel {
  width: var(--sidebar-width);
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 26px 22px 40px;
  background: rgba(8, 32, 27, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  scroll-behavior: smooth;
}

.sidebar-state { display: none; }
.sidebar-state.is-active { display: block; animation: fadeSlideIn 0.35s ease; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Sidebar Default / Placeholder State ---- */

#sidebar-default {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px 8px;
}

.placeholder-icon {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--accent-gold-bright);
  background: radial-gradient(circle at 30% 30%, rgba(232, 199, 102, 0.18), rgba(45, 212, 191, 0.06));
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  margin-bottom: 20px;
}

#sidebar-default h2 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.placeholder-text {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 300px;
  margin-bottom: 26px;
}

.placeholder-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 26px;
}

.stat-item {
  flex: 1;
  padding: 14px 10px;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-soft);
}

.stat-number {
  display: block;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-teal-bright);
  margin-bottom: 3px;
}

.stat-label {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.placeholder-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-faint);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px dashed var(--glass-border);
}

.placeholder-hint i { color: var(--accent-gold-bright); }

/* ---- Sidebar Data State ---- */

.btn-back {
  display: none; /* only shown on mobile, see media query */
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  margin-bottom: 14px;
  padding: 6px 0;
}

.btn-back:hover { color: var(--accent-gold-bright); }

.district-header {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--glass-border);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.badge-kabupaten {
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid var(--glass-border-soft);
  color: var(--accent-teal-bright);
}

.badge-tipologi {
  background: rgba(232, 199, 102, 0.1);
  border: 1px solid var(--glass-border);
  color: var(--accent-gold-bright);
  margin-left: 8px;
}

.district-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
}

/* ---- Analysis Blocks ---- */

.analysis-block {
  margin-bottom: 26px;
  padding: 18px;
  border-radius: 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border-soft);
  box-shadow: var(--shadow-soft);
}

.analysis-block h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.analysis-block h3 i { color: var(--accent-gold-bright); font-size: 13px; }

/* ---- Ekosistem Progress Bars ---- */

.ekosistem-item { margin-bottom: 14px; }
.ekosistem-item:last-child { margin-bottom: 0; }

.ekosistem-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.ekosistem-label span:first-child { display: flex; align-items: center; gap: 7px; }
.ekosistem-label i { width: 14px; text-align: center; color: var(--accent-teal-bright); }

.ekosistem-percent {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-gold-bright);
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-teal) 0%, var(--accent-teal-bright) 60%, var(--accent-gold-bright) 100%);
  box-shadow: 0 0 8px rgba(45, 212, 191, 0.5);
  transition: width 0.6s ease;
}

/* ---- Product Match Rating ---- */

.product-match-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.product-match-item:last-child { border-bottom: none; padding-bottom: 0; }

.product-match-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(232, 199, 102, 0.1);
  border: 1px solid var(--glass-border);
  color: var(--accent-gold-bright);
  font-size: 14px;
}

.product-match-info { flex: 1; min-width: 0; }

.product-match-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-match-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  margin-top: 6px;
  overflow: hidden;
}

.product-match-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-teal-bright), var(--accent-gold-bright));
}

.product-match-rate {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-teal-bright);
}

/* ---- Strategi Sales Pitching ---- */

.strategi-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
}

/* ---- CTA Button ---- */

.btn-cta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  border: none;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--bg-deep);
  background: linear-gradient(120deg, var(--accent-gold-bright), var(--accent-gold) 55%, var(--accent-teal-bright));
  box-shadow: 0 10px 28px rgba(201, 162, 39, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(201, 162, 39, 0.42);
}

.btn-cta:active { transform: translateY(0); }

/* ==========================================================================
   RESPONSIVE — TABLET (subtitle appears)
   ========================================================================== */

@media (min-width: 640px) {
  .brand-subtitle {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    max-width: 480px;
    white-space: normal;
  }
}

/* ==========================================================================
   RESPONSIVE — MOBILE (Stacked Layout)
   ========================================================================== */

@media (max-width: 768px) {

  html, body { overflow-y: auto; }

  .app-shell { height: auto; min-height: 100vh; }

  .app-header {
    height: auto;
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .brand-title { font-size: 15px; white-space: normal; }
  .brand-title span { font-size: 11.5px; }
  .brand-subtitle { display: none; }

  .header-credit { text-align: left; }

  .app-body {
    flex-direction: column;
    height: auto;
  }

  .map-panel {
    width: 100%;
    height: 45vh;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
  }

  .sidebar-panel {
    width: 100%;
    height: auto;
    max-height: none;
    overflow-y: visible;
    padding: 22px 18px 60px;
  }

  #sidebar-default { min-height: 50vh; }

  .btn-back { display: flex; }

  .district-header h2 { font-size: 19px; }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .sidebar-state.is-active { animation: none; }
  .btn-cta { transition: none; }
  .progress-fill { transition: none; }
}
