/* Gouri Insights — Reliable Partner (Mobile UX & Fat-Finger Optimized) */

:root {
  --bg: #0a0f18;
  --glass-bg: rgba(15, 23, 42, 0.95); 
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-highlight: rgba(255, 255, 255, 0.15);
  --text: #ffffff; 
  --text-muted: #cbd5e1; 
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.35);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.15);
  --warn: #fbbf24;
  --header-h: 52px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--text);
}

.app-header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
  z-index: 1100; display: flex; align-items: center; padding: 0 1rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(15, 23, 42, 0.85) 100%);
  border-bottom: 1px solid var(--glass-border); backdrop-filter: blur(14px); pointer-events: none;
}
.app-header .brand { pointer-events: auto; }
.brand { display: flex; flex-direction: column; gap: 0.1rem; }
.brand__name { font-weight: 700; font-size: 1rem; letter-spacing: 0.02em; }
.brand__tag { font-size: 0.72rem; color: var(--text-muted); }

.map {
  position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; z-index: 1;
}

/* Glass control panel — Desktop */
.glass-panel {
  position: fixed; top: calc(var(--header-h) + 12px); right: 12px;
  z-index: 1000; width: min(320px, calc(100vw - 24px)); max-height: calc(100vh - var(--header-h) - 24px);
  overflow-y: auto; padding: 1.1rem 1.15rem; background: var(--glass-bg);
  border: 1px solid var(--glass-border); border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  backdrop-filter: blur(18px) saturate(140%);
}

.glass-panel__title {
  margin: 0 0 0.35rem; font-size: 1rem; font-weight: 600; letter-spacing: 0.02em;
}

.glass-panel__hint {
  margin: 0 0 1rem; font-size: 0.78rem; line-height: 1.45; color: var(--text-muted);
}

.field {
  display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem;
}
.field__label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); font-weight: 600;
}
.field__input {
  width: 100%; padding: 0.55rem 0.65rem; font-size: 0.95rem; font-weight: 500;
  color: var(--text); background: var(--glass-highlight); border: 1px solid var(--glass-border);
  border-radius: 10px; outline: none; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field__input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.field__microcopy { font-size: 0.68rem; color: var(--text-muted); font-style: italic; margin-top: -0.15rem; }

/* ==========================================
   UPGRADED SEARCH BAR (FAT FINGER UI)
   ========================================== */
.leaflet-control-geocoder {
  background: rgba(15, 23, 42, 0.98) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 10px !important;
  min-width: 280px !important; /* Wider on desktop */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5) !important;
}

.leaflet-control-geocoder-form input {
  color: var(--text) !important;
  font-size: 16px !important; /* Prevents iPhone auto-zoom */
  padding: 12px 14px !important; /* Taller and easier to tap */
  width: 100% !important;
}

.leaflet-control-geocoder-icon {
  width: 40px !important; /* Bigger icon button */
  height: 40px !important;
}

.leaflet-control-geocoder-alternatives {
  background: rgba(15, 23, 42, 0.98) !important;
  border-radius: 0 0 10px 10px !important;
}

.leaflet-control-geocoder-alternatives a {
  color: var(--text) !important;
  padding: 10px !important; /* Taller results to tap easily */
  font-size: 15px !important;
}

/* Freemium Blur Classes */
.locked-value { filter: blur(5px); opacity: 0.6; user-select: none; font-family: monospace; }
.locked-badge {
  font-size: 0.65rem; background-color: #f59e0b; color: #fff; padding: 2px 6px;
  border-radius: 4px; margin-left: 6px; vertical-align: middle; text-transform: uppercase; letter-spacing: 0.05em;
}

/* ==========================================
   POPUP FIX (DARK MODE & SCROLLING)
   ========================================== */
.leaflet-popup.solar-report-popup .leaflet-popup-content-wrapper {
  padding: 0; overflow: hidden; border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.4); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8);
  background: rgba(15, 23, 42, 0.98); 
}

.leaflet-popup.solar-report-popup .leaflet-popup-content {
  margin: 0; min-width: 260px; max-width: min(320px, 86vw);
}

.leaflet-popup.solar-report-popup .leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.98); 
}

.solar-report { font-family: "Segoe UI", system-ui, -apple-system, sans-serif; color: #e2e8f0; }
.solar-report__head {
  padding: 0.85rem 1rem; background: linear-gradient(135deg, rgba(56, 189, 248, 0.3), rgba(52, 211, 153, 0.2));
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
}
.solar-report__brand { margin: 0; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: #cbd5e1; }
.solar-report__title { margin: 0.2rem 0 0; font-size: 1.05rem; font-weight: 700; color: #ffffff; }
.solar-report__body { padding: 0.65rem 0; }
.solar-report__row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem;
  padding: 0.45rem 1rem; border-bottom: 1px solid rgba(51, 65, 85, 0.9);
}
.solar-report__row:last-child { border-bottom: none; }
.solar-report__k { font-size: 0.78rem; color: #cbd5e1; flex-shrink: 0; }
.solar-report__v { font-size: 0.88rem; font-weight: 600; text-align: right; color: #ffffff; }
.solar-report__v--capacity { color: #38bdf8; }
.solar-report__row--savings {
  margin: 0.35rem 0.65rem 0.5rem; padding: 0.65rem 0.75rem; border-radius: 10px;
  background: var(--success-bg); border: 1px solid rgba(52, 211, 153, 0.5);
}
.solar-report__row--savings .solar-report__k { color: #6ee7b7; font-weight: 600; }
.solar-report__v--savings { color: var(--success) !important; font-weight: 800 !important; font-size: 1.1rem !important; }
.solar-report__foot {
  padding: 0.5rem 1rem 0.85rem; font-size: 0.7rem; color: #94a3b8; line-height: 1.4; text-align: center;
  border-top: 1px solid rgba(51, 65, 85, 0.9);
}

/* ==========================================
   MOBILE SMART DRAWER UX
   ========================================== */
@media (max-width: 600px) {
  .glass-panel {
    top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-height: 55vh;
    border-radius: 20px 20px 0 0; border-bottom: none; border-left: none; border-right: none;
    padding: 1rem; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.9);
    background: rgba(15, 23, 42, 0.98);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .glass-panel.minimized {
    transform: translateY(calc(100% - 60px));
  }

  .glass-panel__title {
    cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 15px;
  }
  
  .glass-panel__title::after {
    content: "▼ Minimize"; font-size: 0.7rem; color: #ffffff;
    background: #0ea5e9; padding: 4px 10px; border-radius: 12px;
    text-transform: uppercase; letter-spacing: 0.05em; font-weight: bold;
  }

  .glass-panel.minimized .glass-panel__title::after {
    content: "▲ Expand"; background: #f59e0b;
  }

  /* Properly sized search bar for mobile */
  .leaflet-control-geocoder {
    min-width: 250px !important;
    max-width: 75vw !important; 
  }

  .leaflet-popup.solar-report-popup .leaflet-popup-content {
    max-height: 45vh; overflow-y: auto !important; -webkit-overflow-scrolling: touch; 
  }

  .solar-report__row { padding: 0.35rem 0.75rem; }
  .leaflet-bottom { bottom: 65px !important; }
}
