/* ═══════════════════════════════════════════════════════════
   style.css  —  Base, Variables & Layout
   ShapeFile Converter | bumixa.com
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────── */
:root {
  --navbar-h:     52px;
  --footer-h:     36px;
  --panel-w:      340px;

  /* Colors */
  --bg:           #0b1622;
  --navbar-bg:    #0d1f30;
  --panel-bg:     #111e2d;
  --panel-bg2:    #152536;
  --surface:      #152536;
  --surface-2:    #1a2e42;
  --border:       #1e3347;
  --border-light: #1a2d3e;

  --primary:      #00b4d8;
  --primary-h:    #0096b4;
  --primary-glow: rgba(0,180,216,.15);
  --accent:       #00e5cc;

  --success:      #22c55e;
  --success-bg:   rgba(34,197,94,.1);
  --warning:      #f59e0b;
  --warning-bg:   rgba(245,158,11,.1);
  --danger:       #ef4444;
  --danger-bg:    rgba(239,68,68,.1);
  --info-bg:      rgba(56,189,248,.1);

  --text:         #d8eaf5;
  --text-muted:   #5a7d9a;
  --text-dim:     #3d5f7a;

  --radius:       8px;
  --radius-sm:    5px;
  --radius-lg:    12px;
  --shadow:       0 2px 12px rgba(0,0,0,.4);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.55);
  --transition:   .16s ease;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════
   NAVBAR
══════════════════════════════════════════════════════════ */
.navbar {
  height: var(--navbar-h);
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 300;
  box-shadow: 0 1px 12px rgba(0,0,0,.3);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.navbar-logo    { font-size: 1.4rem; line-height: 1; }
.navbar-title   { font-size: .92rem; font-weight: 700; color: var(--text); letter-spacing: .02em; line-height: 1.2; }
.navbar-sub     { font-size: .65rem; color: var(--text-muted); }

.navbar-center  { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; }

.navbar-end {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.badge-secure {
  background: rgba(0,229,204,.1);
  border: 1px solid rgba(0,229,204,.22);
  color: var(--accent);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Navbar status chip */
.navbar-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.navbar-stat .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   APP SHELL  (fills remaining height between navbar & footer)
══════════════════════════════════════════════════════════ */
.app-shell {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* ══════════════════════════════════════════════════════════
   MAP
══════════════════════════════════════════════════════════ */
.map-container {
  flex: 1;
  position: relative;
  min-width: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: #0a1828;
}

/* Map toolbar — floating top-right over map */
.map-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 410;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Basemap toggle button (single) ─────────────────────── */
.basemap-toggle-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(13,27,42,.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 11px;
  box-shadow: var(--shadow);
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.basemap-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}
/* Active satellite mode — subtle highlight */
.basemap-toggle-btn.is-satellite {
  border-color: rgba(0,229,204,.4);
  color: var(--accent);
}
.basemap-toggle-icon { font-size: .95rem; }
.basemap-toggle-label { letter-spacing: .02em; }

/* Map empty state overlay */
.map-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11,22,34,.72);
  backdrop-filter: blur(4px);
  z-index: 400;
  pointer-events: auto;
}
.map-empty.hidden { display: none; }
.map-empty-inner  { text-align: center; }
.map-empty-icon   { font-size: 3.5rem; margin-bottom: 14px; opacity: .6; }
.map-empty-title  { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.map-empty-sub    { font-size: .84rem; color: var(--text-muted); margin-bottom: 20px; }

/* ══════════════════════════════════════════════════════════
   SIDE PANEL (floating left)
══════════════════════════════════════════════════════════ */
.side-panel {
  width: var(--panel-w);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(0,0,0,.35);
  flex-shrink: 0;
  transition: transform var(--transition), width var(--transition);
  z-index: 420;
  overflow: hidden;
}
.side-panel.hidden {
  transform: translateX(-100%);
  width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-bg2);
  flex-shrink: 0;
}
.panel-header-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .02em;
}
.panel-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .85rem;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color var(--transition), background var(--transition);
}
.panel-close-btn:hover { color: var(--danger); background: var(--danger-bg); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
/* custom scrollbar */
.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.panel-body::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── FAB (floating action button — opens panel) ── */
.panel-fab {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 430;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,180,216,.4);
  display: none;
  align-items: center;
  justify-content: center;
  transition: filter var(--transition), box-shadow var(--transition);
}
.panel-fab:hover { filter: brightness(1.15); box-shadow: 0 6px 24px rgba(0,180,216,.5); }
.panel-fab.visible { display: flex; }

/* ══════════════════════════════════════════════════════════
   MODAL (About)
══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  display: none;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-bg2);
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: .85rem;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px 18px; }
.modal-app-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.modal-desc {
  font-size: .83rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}
.about-features {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}
.about-feature { font-size: .82rem; color: var(--text-muted); }
.about-libs { display: flex; gap: 7px; flex-wrap: wrap; }
.lib-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 9px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--primary);
}

/* ══════════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════════ */
.app-footer {
  height: var(--footer-h);
  background: var(--navbar-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  gap: 4px;
}
.app-footer a { color: var(--primary); }
.footer-ip { font-family: 'Courier New', monospace; color: var(--text-dim); }

/* ══════════════════════════════════════════════════════════
   LEAFLET OVERRIDES
══════════════════════════════════════════════════════════ */
.leaflet-popup-content-wrapper {
  background: var(--panel-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
}
.leaflet-popup-tip { background: var(--panel-bg) !important; }
.leaflet-control-zoom a {
  background: rgba(13,27,42,.9) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  backdrop-filter: blur(6px);
}
.leaflet-control-zoom a:hover { background: var(--surface-2) !important; }
.leaflet-control-attribution {
  background: rgba(11,22,34,.75) !important;
  color: var(--text-muted) !important;
  font-size: .62rem !important;
  backdrop-filter: blur(4px);
}
.leaflet-control-attribution a { color: var(--primary) !important; }
