/* =============================================
   GoSolar 3D – styles.css
   Dark theme · Mobile-first · Responsive
   ============================================= */

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

:root {
  --bg:         #0f172a;
  --surface:    #1e293b;
  --surface2:   #334155;
  --border:     rgba(255,255,255,0.1);
  --text:       #f1f5f9;
  --text-muted: #94a3b8;
  --accent:     #2563eb;
  --accent-h:   #1d4ed8;
  --cta:        #16a34a;
  --cta-h:      #15803d;
  --danger:     #ef4444;
  --radius:     12px;
  --shadow:     0 4px 24px rgba(0,0,0,0.5);
  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --search-h:   56px;
  --toolbar-w:  64px;
}

html, body { height:100%; width:100%; overflow:hidden; font-family:var(--font); background:var(--bg); color:var(--text); }

#map { position:fixed; inset:0; z-index:0; }

/* ── SEARCH BAR ── */
#search-bar { position:fixed; top:12px; left:50%; transform:translateX(-50%); width:min(480px,calc(100vw - 24px)); z-index:900; filter:drop-shadow(var(--shadow)); }
#search-wrap { display:flex; align-items:center; gap:10px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:0 14px; height:var(--search-h); backdrop-filter:blur(12px); }
#search-input { flex:1; background:none; border:none; outline:none; font-family:var(--font); font-size:15px; color:var(--text); min-width:0; }
#search-input::placeholder { color:var(--text-muted); }
#search-clear { background:none; border:none; cursor:pointer; color:var(--text-muted); font-size:14px; padding:4px; border-radius:4px; line-height:1; transition:color .15s; }
#search-clear:hover { color:var(--text); }

#search-results { list-style:none; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); margin-top:6px; overflow:hidden; max-height:240px; overflow-y:auto; }
#search-results li { padding:12px 16px; font-size:14px; cursor:pointer; border-bottom:1px solid var(--border); line-height:1.4; transition:background .1s; }
#search-results li:last-child { border-bottom:none; }
#search-results li:hover, #search-results li:focus { background:var(--surface2); outline:none; }
#search-results li small { display:block; color:var(--text-muted); font-size:12px; margin-top:2px; }

/* ── TOOLBAR ── */
#toolbar { position:fixed; z-index:800; left:12px; top:50%; transform:translateY(-50%); display:flex; flex-direction:column; align-items:center; gap:4px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:8px; backdrop-filter:blur(12px); filter:drop-shadow(var(--shadow)); }
.tool-btn { display:flex; flex-direction:column; align-items:center; gap:4px; background:none; border:none; cursor:pointer; color:var(--text-muted); padding:10px; border-radius:8px; min-width:48px; min-height:48px; transition:background .15s,color .15s; font-family:var(--font); }
.tool-btn:hover:not(:disabled) { background:var(--surface2); color:var(--text); }
.tool-btn.active { background:var(--accent); color:#fff; }
.tool-btn:disabled { opacity:.35; cursor:not-allowed; }
.tool-btn.btn-cta:not(:disabled) { background:var(--cta); color:#fff; }
.tool-btn.btn-cta:not(:disabled):hover { background:var(--cta-h); }
.tool-label { font-size:10px; font-weight:600; letter-spacing:.2px; white-space:nowrap; }
.tool-divider { width:32px; height:1px; background:var(--border); margin:4px 0; }

/* ── INFO PILL ── */
#info-pill { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); z-index:800; display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border); border-radius:99px; padding:10px 18px; font-size:14px; font-weight:500; color:var(--text); backdrop-filter:blur(12px); filter:drop-shadow(var(--shadow)); white-space:nowrap; max-width:calc(100vw - 24px); overflow:hidden; text-overflow:ellipsis; transition:background .2s; }

/* ── LEAFLET OVERRIDES ── */
.leaflet-control-zoom { border:none !important; box-shadow:none !important; }
.leaflet-control-zoom a { background:var(--surface) !important; color:var(--text) !important; border:1px solid var(--border) !important; border-radius:8px !important; margin-bottom:4px !important; width:34px !important; height:34px !important; line-height:34px !important; font-size:16px !important; }
.leaflet-control-attribution { background:rgba(15,23,42,0.7) !important; color:var(--text-muted) !important; font-size:10px !important; backdrop-filter:blur(4px); }

.hidden { display:none !important; }

/* ── INFO PANEL ── */
#info-panel { position:fixed; z-index:700; right:16px; bottom:24px; width:320px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; backdrop-filter:blur(12px); filter:drop-shadow(var(--shadow)); animation:fadeSlideUp .3s ease; }
@keyframes fadeSlideUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
.ip-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; }
.ip-item { display:flex; flex-direction:column; gap:4px; }
.ip-label { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; font-weight:600; }
.ip-value { font-size:20px; font-weight:800; color:var(--text); line-height:1; font-variant-numeric:tabular-nums; }
.ip-value small { font-size:11px; font-weight:500; color:var(--text-muted); }

/* ── ENERGY BOTTOM SHEET ── */
#energy-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1200;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  max-height: 85vh;
  overflow-y: auto;
  padding: 0 16px 24px;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,1,.28,1);
  overscroll-behavior: contain;
}
#energy-sheet.open { transform: translateY(0); }

@media (min-width: 641px) {
  #energy-sheet { left:50%; transform:translateX(-50%) translateY(100%); width:min(640px,100vw); border-radius:20px 20px 0 0; }
  #energy-sheet.open { transform:translateX(-50%) translateY(0); }
}

.sh-handle { width:40px; height:4px; background:var(--surface2); border-radius:2px; margin:12px auto 8px; }
.sh-hd { display:flex; justify-content:space-between; align-items:center; padding:8px 0 12px; }
.sh-title { font-size:17px; font-weight:700; }
.sh-close { background:var(--surface2); border:none; color:var(--text-muted); font-size:14px; width:32px; height:32px; border-radius:50%; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:background .15s; }
.sh-close:hover { background:var(--surface2); color:var(--text); }

/* Summary row */
.er-sum { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; background:var(--bg); border-radius:10px; padding:12px; margin-bottom:16px; }
.er-si { display:flex; flex-direction:column; gap:3px; }
.er-sl { font-size:10px; color:var(--text-muted); font-weight:600; text-transform:uppercase; }
.er-sv { font-size:18px; font-weight:800; }
.er-sv small { font-size:11px; font-weight:500; color:var(--text-muted); }

.er-lbl { font-size:11px; color:var(--text-muted); font-weight:700; text-transform:uppercase; letter-spacing:.6px; margin-bottom:8px; }

/* Annual banner */
.er-banner { background:linear-gradient(135deg,#1e3a5f,#1e293b); border:1px solid rgba(59,130,246,.3); border-radius:12px; padding:14px; margin-bottom:16px; }
.er-bm { font-size:40px; font-weight:900; color:#60a5fa; line-height:1; }
.er-bu { font-size:20px; font-weight:700; }
.er-bs { font-size:12px; color:var(--text-muted); margin:4px 0 10px; }
.er-bmeta { display:grid; grid-template-columns:1fr 1fr; gap:8px; border-top:1px solid rgba(255,255,255,.06); padding-top:10px; }
.er-ml { font-size:10px; color:var(--text-muted); }
.er-mv { font-size:14px; font-weight:700; }

/* Chart */
.er-cw { background:var(--bg); border-radius:10px; padding:10px; margin-bottom:16px; }
.er-cw canvas { width:100%; display:block; }
.er-leg { display:flex; gap:12px; margin-top:8px; font-size:11px; color:var(--text-muted); }
.er-dot { display:inline-block; width:8px; height:8px; border-radius:2px; margin-right:4px; }

/* Losses */
.er-lr { display:grid; grid-template-columns:72px 1fr 36px; align-items:center; gap:8px; margin-bottom:6px; }
.er-ln { font-size:12px; color:var(--text-muted); }
.er-lt { background:var(--bg); border-radius:4px; height:8px; overflow:hidden; }
.er-lf { height:100%; border-radius:4px; }
.er-lp { font-size:12px; font-weight:700; text-align:right; }
.er-ltot { display:flex; justify-content:space-between; font-size:12px; border-top:1px solid var(--border); margin-top:8px; padding-top:8px; color:var(--text-muted); margin-bottom:16px; }

/* Projection */
.er-proj { display:flex; justify-content:space-between; background:var(--bg); border-radius:10px; padding:14px; }
.er-pl { font-size:11px; color:var(--text-muted); margin-bottom:4px; }
.er-pv { font-size:24px; font-weight:900; color:#34d399; }
.er-pn { font-size:11px; color:var(--text-muted); margin-top:2px; }

/* ── MOBILE ── */
@media (max-width: 640px) {
  #search-bar { top:8px; width:calc(100vw - 16px); }
  #toolbar { left:0; right:0; bottom:0; top:auto; transform:none; border-radius:var(--radius) var(--radius) 0 0; flex-direction:row; justify-content:space-around; padding:8px 4px; padding-bottom:max(8px,env(safe-area-inset-bottom)); width:100%; border-left:none; border-right:none; border-bottom:none; }
  .tool-divider { width:1px; height:32px; margin:0 4px; }
  .tool-btn { min-width:52px; }
  #info-pill { bottom:80px; font-size:13px; padding:8px 14px; }
  #info-panel { bottom:130px; left:8px; right:8px; width:auto; }
}

/* ── EVN SHEET (reuses energy sheet base styles) ── */
#evn-sheet {
  position:fixed; left:0; right:0; bottom:0; z-index:1200;
  background:var(--surface); border-top:1px solid var(--border);
  border-radius:20px 20px 0 0; max-height:85vh; overflow-y:auto;
  padding:0 16px 32px; transform:translateY(100%);
  transition:transform .35s cubic-bezier(.32,1,.28,1);
}
#evn-sheet.open { transform:translateY(0); }
@media (min-width:641px) {
  #evn-sheet { left:50%; transform:translateX(-50%) translateY(100%); width:min(520px,100vw); border-radius:20px 20px 0 0; }
  #evn-sheet.open { transform:translateX(-50%) translateY(0); }
}

.evn-tabs { display:flex; gap:8px; margin-bottom:16px; }
.evn-tab { flex:1; padding:10px; border-radius:8px; border:1px solid var(--border); background:var(--bg); color:var(--text-muted); font-size:14px; font-weight:600; cursor:pointer; transition:all .15s; }
.evn-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }

.evn-form { display:flex; flex-direction:column; gap:12px; }
.evn-field { display:flex; flex-direction:column; gap:6px; }
.evn-label { font-size:12px; color:var(--text-muted); font-weight:600; }
.evn-input { background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:12px 14px; font-size:16px; color:var(--text); font-family:var(--font); outline:none; transition:border .15s; }
.evn-input:focus { border-color:var(--accent); }
.evn-btn { padding:14px; border-radius:10px; border:none; background:var(--accent); color:#fff; font-size:15px; font-weight:700; cursor:pointer; font-family:var(--font); transition:background .15s; margin-top:4px; }
.evn-btn:hover { background:var(--accent-h); }
.evn-btn-cta { background:var(--cta); margin-top:16px; }
.evn-btn-cta:hover { background:var(--cta-h); }

.evn-res-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; margin:16px 0 12px; background:var(--bg); border-radius:10px; padding:12px; }
.evn-ri { display:flex; flex-direction:column; gap:3px; }
.evn-rl { font-size:10px; color:var(--text-muted); font-weight:600; text-transform:uppercase; }
.evn-rv { font-size:18px; font-weight:800; }
.evn-rv small { font-size:11px; font-weight:500; color:var(--text-muted); }

.evn-save-banner { background:linear-gradient(135deg,#14532d,#1e293b); border:1px solid rgba(34,197,94,.3); border-radius:12px; padding:14px; margin-bottom:12px; }
.evn-save-main { font-size:22px; font-weight:900; color:#4ade80; }
.evn-save-sub { font-size:13px; color:var(--text-muted); margin-top:4px; }

.evn-payback { text-align:center; padding:16px; background:var(--bg); border-radius:12px; margin-bottom:4px; }
.evn-pb-label { font-size:12px; color:var(--text-muted); margin-bottom:6px; }
.evn-pb-val { font-size:48px; font-weight:900; color:#60a5fa; line-height:1; }
.evn-pb-unit { font-size:20px; font-weight:700; }
.evn-pb-note { font-size:11px; color:var(--text-muted); margin-top:8px; line-height:1.5; }

/* ── LEAD MODAL ── */
.lm-backdrop { position:fixed; inset:0; z-index:1400; background:rgba(0,0,0,.6); display:flex; align-items:flex-end; justify-content:center; backdrop-filter:blur(4px); }
.lm-box { background:var(--surface); border-radius:20px 20px 0 0; width:min(560px,100vw); max-height:90vh; overflow-y:auto; padding:0 16px 32px; transform:translateY(100%); transition:transform .3s cubic-bezier(.32,1,.28,1); }
.lm-box.open { transform:translateY(0); }
.lm-hd { display:flex; justify-content:space-between; align-items:flex-start; padding:16px 0 12px; }
.lm-title { font-size:18px; font-weight:700; }
.lm-sub { font-size:12px; color:var(--text-muted); margin-top:2px; }

.lm-sys { background:var(--bg); border-radius:10px; padding:12px; margin-bottom:16px; display:flex; flex-direction:column; gap:6px; }
.lm-si { font-size:13px; }
.lm-sk { color:var(--text-muted); font-weight:600; }

.lf-field { display:flex; flex-direction:column; gap:6px; margin-bottom:12px; }
.lf-label { font-size:12px; color:var(--text-muted); font-weight:600; }
.lf-input { background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:12px 14px; font-size:16px; color:var(--text); font-family:var(--font); outline:none; width:100%; transition:border .15s; }
.lf-input:focus { border-color:var(--accent); }
.lf-textarea { min-height:80px; resize:vertical; }
.lf-submit { width:100%; padding:16px; border-radius:12px; border:none; background:var(--cta); color:#fff; font-size:16px; font-weight:700; cursor:pointer; font-family:var(--font); transition:background .15s; margin-top:8px; }
.lf-submit:hover { background:var(--cta-h); }
.lf-submit:disabled { opacity:.6; cursor:not-allowed; }

.lm-success { text-align:center; padding:32px 16px; }
.lm-suc-icon { font-size:48px; margin-bottom:12px; }
.lm-suc-title { font-size:22px; font-weight:800; margin-bottom:8px; }
.lm-suc-sub { font-size:14px; color:var(--text-muted); margin-bottom:20px; }

