/* style.css — SunlitMap
   Layout: Sidebar kiri fixed + Peta kanan full height
   ============================================================ */

/* ── Reset & Base ────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  height: 100vh; display: flex; overflow: hidden;
  background: #1a1a2e;
}

.main { display: flex; width: 100%; height: 100vh; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: 360px; flex-shrink: 0;
  background: #fff; border-right: 1px solid #e5e5e5;
  display: flex; flex-direction: column;
  overflow: hidden; z-index: 10;
}

.sidebar-logo {
  padding: 12px 16px; flex-shrink: 0;
  border-bottom: 1px solid #f0f0f0;
  background: #fff; display: flex; align-items: center;
}

.sidebar-logo-img { height: 36px; width: auto; object-fit: contain; display: block; }

.sidebar-header {
  padding: 11px 16px; flex-shrink: 0;
  border-bottom: 1px solid #e5e5e5; background: #fafafa;
}
.sidebar-header h2    { font-size: 13px; font-weight: 600; color: #1a1a1a; }
.sidebar-header p     { font-size: 11px; color: #999; margin-top: 2px; }
.sidebar-header:empty { display: none; }

.sidebar-body { flex: 1; overflow-y: auto; padding: 14px; }

/* ── Hero Title (state awal) ─────────────────────────────── */
.guide-hero { padding: 16px 4px 12px; margin-bottom: 4px; }

.guide-hero-title {
  font-size: 32px; font-weight: 800;
  line-height: 1.2; letter-spacing: -0.8px;
  color: #111; text-align: left;
}

/* ── Peta ────────────────────────────────────────────────── */
#mapWrap { flex: 1; position: relative; background: #1a1a2e; overflow: hidden; }
#map     { width: 100%; height: 100%; }

.leaflet-container   { background: #1a1a2e !important; }
.leaflet-control-zoom { display: none !important; }

/* Cursor crosshair saat mode menggambar */
#mapWrap.drawing #map,
#mapWrap.drawing .leaflet-container { cursor: crosshair !important; }

/* ── Search Bar ──────────────────────────────────────────── */
.map-search {
  position: absolute; top: 14px; left: 14px;
  z-index: 500; width: 340px;
}

.search-input-wrap { position: relative; display: flex; align-items: center; }

.search-icon-svg {
  position: absolute; left: 10px; z-index: 1;
  width: 14px; height: 14px; color: #999;
  pointer-events: none; transition: color .2s;
}

#searchInput {
  width: 100%; padding: 9px 12px 9px 32px;
  border: none; border-radius: 8px; font-size: 13px;
  outline: none; color: #1a1a1a;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
  transition: box-shadow .2s;
}
#searchInput::placeholder { color: #bbb; }
#searchInput:focus { box-shadow: 0 2px 16px rgba(245,158,11,0.3); background: #fff; }
.search-input-wrap:focus-within .search-icon-svg { color: #f59e0b; }

/* ── Pills Lokasi ────────────────────────────────────────── */
#pillsWrap {
  position: absolute; top: 14px; left: 362px; right: 14px;
  z-index: 500; display: flex; gap: 6px;
}

.loc-pill {
  width: calc(25% - 4.5px); display: flex; align-items: center;
  padding: 7px 10px 7px 14px; border-radius: 8px; cursor: pointer;
  background: rgba(107,114,128,0.88);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
  transition: background .18s, transform .12s;
  user-select: none; white-space: nowrap;
}
.loc-pill:hover  { transform: translateY(-1px); }
.loc-pill.active { background: rgba(245,158,11,0.92); }
.loc-pill.disabled {
  cursor: wait;
  opacity: 0.65;
  pointer-events: none;
}

.loc-pill-coord {
  flex: 1; text-align: center;
  font-size: 12px; font-weight: 600; color: #fff; line-height: 1;
}

.loc-pill-x {
  font-size: 11px; color: rgba(255,255,255,0.7);
  flex-shrink: 0; margin-left: 4px;
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background .15s, color .15s;
}
.loc-pill-x:hover { background: rgba(255,255,255,0.25); color: #fff; }

/* ── Zoom Buttons ────────────────────────────────────────── */
.map-zoom {
  position: absolute; bottom: 28px; right: 10px;
  z-index: 500; display: flex; flex-direction: column; gap: 2px;
}

.zoom-btn {
  width: 30px; height: 30px; border: none; border-radius: 6px;
  background: rgba(255,255,255,0.95);
  font-size: 17px; color: #444; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transition: background .15s, opacity .2s;
  line-height: 1; user-select: none;
}
.zoom-btn:hover:not(:disabled) { background: #fff; color: #1a1a1a; }
.zoom-btn:disabled { opacity: 0.3; cursor: not-allowed; box-shadow: none; }

/* ── Toolbar ─────────────────────────────────────────────── */
.map-toolbar {
  position: absolute; bottom: 28px;
  left: 50%; transform: translateX(-50%);
  z-index: 500; display: flex; gap: 8px; align-items: center;
}

/* ── Tombol Aksi ─────────────────────────────────────────── */
.draw-btn {
  background: #2563eb; color: #fff; border: none;
  padding: 10px 22px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; letter-spacing: 0.01em;
  transition: background .15s, transform .1s;
}
.draw-btn:hover        { background: #1d4ed8; }
.draw-btn:active       { transform: scale(.97); }
.draw-btn.cancel       { background: #6b7280; }
.draw-btn.cancel:hover { background: #4b5563; }
.draw-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.draw-btn:disabled:hover {
  background: #2563eb;
}
.draw-btn.cancel:disabled:hover {
  background: #6b7280;
}

.btn-pdf, .btn-reset {
  width: 100%; padding: 10px; border: none; border-radius: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s;
}
.btn-pdf {
  background: #dc2626; color: #fff; border: 1px solid #dc2626;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.btn-pdf:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-pdf svg   { width: 15px; height: 15px; flex-shrink: 0; }
.btn-reset       { background: #1a1a1a; color: #fff; }
.btn-reset:hover { background: #333; }

.action-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

/* ── Guide Steps ─────────────────────────────────────────── */
.guide-wrap { padding: 6px 4px 4px; }

.guide-step      { display: flex; gap: 14px; min-height: 72px; }
.guide-step-last { min-height: auto; }

.guide-left { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 28px; }

.guide-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: #f59e0b; color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; z-index: 1;
}

.guide-line { width: 2px; flex: 1; background: #f0f0f0; margin: 4px 0; min-height: 20px; }

.guide-right          { padding-top: 4px; padding-bottom: 16px; flex: 1; }
.guide-step-last .guide-right { padding-bottom: 4px; }
.guide-title          { font-size: 13px; font-weight: 600; color: #1a1a1a; margin-bottom: 4px; line-height: 1.3; }
.guide-desc           { font-size: 11.5px; color: #777; line-height: 1.6; }
.guide-desc strong    { color: #f59e0b; font-weight: 600; }

/* ── Skeleton Loading ────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton-wrap { padding: 4px 0; display: flex; flex-direction: column; }

/* Semua elemen skeleton berbagi animasi shimmer yang sama */
.skel-coord, .skel-section-label, .skel-card, .skel-card-tall,
.skel-bar, .skel-month-bar, .skel-trow {
  background: linear-gradient(90deg, #ececec 25%, #f5f5f5 50%, #ececec 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}

.skel-coord         { height: 52px; margin-bottom: 14px; }
.skel-section-label { height: 10px; width: 40%; margin: 12px 0 8px; }
.skel-metric-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 4px; }
.skel-card          { height: 72px; }
.skel-card-tall     { height: 88px; }
.skel-bar           { height: 28px; margin: 8px 0 4px; }
.skel-monthly       { display: flex; gap: 4px; align-items: flex-end; height: 64px; margin-bottom: 4px; }
.skel-month-bar     { flex: 1; border-radius: 3px; }
.skel-table         { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.skel-trow          { height: 20px; }

/* Variasi tinggi batang bulanan agar terlihat natural */
.skel-month-bar:nth-child(1)  { height: 70%; }
.skel-month-bar:nth-child(2)  { height: 65%; }
.skel-month-bar:nth-child(3)  { height: 80%; }
.skel-month-bar:nth-child(4)  { height: 90%; }
.skel-month-bar:nth-child(5)  { height: 100%; }
.skel-month-bar:nth-child(6)  { height: 95%; }
.skel-month-bar:nth-child(7)  { height: 100%; }
.skel-month-bar:nth-child(8)  { height: 95%; }
.skel-month-bar:nth-child(9)  { height: 85%; }
.skel-month-bar:nth-child(10) { height: 75%; }
.skel-month-bar:nth-child(11) { height: 65%; }
.skel-month-bar:nth-child(12) { height: 60%; }

.skel-eco-stack { display: flex; flex-direction: column; gap: 7px; }
.skel-eco-card  {
  height: 58px; border-radius: 9px;
  background: linear-gradient(90deg, #ececec 25%, #f5f5f5 50%, #ececec 75%);
  background-size: 800px 100%; animation: shimmer 1.4s infinite linear;
}

/* ── Koordinat Block ─────────────────────────────────────── */
.coord-block {
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px;
}
.coord-label {
  font-size: 10px; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 5px;
}
.coord-value { font-size: 13px; font-weight: 600; color: #1e293b; font-family: monospace; }

/* ── Error Box ───────────────────────────────────────────── */
.error-box {
  background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 10px; padding: 18px; text-align: center; margin-top: 16px;
}
.error-icon  { font-size: 28px; margin-bottom: 8px; }
.error-title { font-size: 13px; font-weight: 600; color: #b91c1c; margin-bottom: 6px; }
.error-msg   { font-size: 11px; color: #ef4444; margin-bottom: 10px; word-break: break-word; }
.error-tips  {
  font-size: 11px; color: #666; text-align: left; line-height: 1.7;
  background: #fff; border-radius: 6px; padding: 10px;
}

/* ── Komponen Hasil Analisis ─────────────────────────────── */
.section-label {
  font-size: 10px; font-weight: 600; color: #aaa;
  text-transform: uppercase; letter-spacing: .08em; margin: 12px 0 7px;
}

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }

.card        { background: #fafafa; border: 1px solid #e5e5e5; border-radius: 9px; padding: 10px; }
.card.yellow { background: #fffbeb; border-color: #fcd34d; }
.card.blue   { background: #eff6ff; border-color: #bfdbfe; }
.card.green  { background: #f0fdf4; border-color: #bbf7d0; }
.card.purple { background: #faf5ff; border-color: #e9d5ff; }

.card-label { font-size: 9.5px; color: #888; margin-bottom: 3px; }
.card-val   { font-size: 18px; font-weight: 600; color: #1a1a1a; line-height: 1.2; }
.card-unit  { font-size: 9.5px; color: #aaa; margin-top: 2px; }

.card.yellow .card-val { color: #92400e; }
.card.blue   .card-val { color: #1e40af; }
.card.green  .card-val { color: #166534; }
.card.purple .card-val { color: #6b21a8; }

.badge {
  display: inline-block; font-size: 9.5px; font-weight: 600;
  padding: 2px 7px; border-radius: 99px; margin-top: 3px;
}

/* ── Chart Irradiance Bulanan ────────────────────────────── */
.monthly { display: flex; gap: 2px; align-items: flex-end; height: 56px; margin-top: 8px; }
.m-wrap  { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.m-bar   { width: 100%; background: #fbbf24; border-radius: 2px 2px 0 0; min-height: 3px; }
.m-lbl   { font-size: 7px; color: #bbb; }

/* ── Tabel Data ──────────────────────────────────────────── */
.table-card {
  background: #fafafa; border: 1px solid #e5e5e5;
  border-radius: 9px; padding: 3px 11px; margin-bottom: 7px;
}
.trow {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid #f0f0f0; gap: 6px;
}
.trow:last-child { border-bottom: none; }
.tkey { font-size: 11px; color: #666; }
.tval { font-size: 11px; font-weight: 500; color: #1a1a1a; text-align: right; }

/* ── Estimasi Ekonomi Stack ──────────────────────────────── */
.eco-stack { display: flex; flex-direction: column; gap: 7px; }

.eco-card {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 9px; padding: 10px 14px;
}
.eco-label {
  font-size: 10px; font-weight: 600; color: #4d7c5f;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px;
}
.eco-val { font-size: 17px; font-weight: 700; color: #166534; word-break: break-word; line-height: 1.3; }

/* Varian investasi — biru */
.eco-card-invest { background: #eff6ff; border-color: #bfdbfe; }
.eco-card-invest .eco-label { color: #1e40af; }
.eco-val.invest { color: #1e40af; }
.eco-card-total { background: #dbeafe; border-color: #93c5fd; }

@media (max-width: 1024px) {
  .sidebar { width: 320px; }
  .map-search { width: 300px; }
  #pillsWrap {
    left: 322px;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .loc-pill {
    min-width: 170px;
    width: auto;
    flex: 0 0 auto;
  }
}

@media (max-width: 820px) {
  body { overflow: auto; }
  .main {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }
  .sidebar {
    width: 100%;
    max-height: 44vh;
    border-right: none;
    border-bottom: 1px solid #e5e5e5;
  }
  #mapWrap { min-height: 56vh; }
  .map-search {
    left: 14px;
    right: 14px;
    width: auto;
  }
  #pillsWrap {
    top: 66px;
    left: 14px;
    right: 14px;
    overflow-x: auto;
  }
  .map-toolbar {
    left: 14px;
    right: 14px;
    transform: none;
    justify-content: center;
  }
  .metric-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .sidebar-body { padding: 12px; }
  .guide-hero-title { font-size: 26px; }
  .card-val { font-size: 16px; }
  .coord-value, .tkey, .tval { font-size: 10.5px; }
}