/* Modernized look for #mySidebar — additive overrides scoped to the sidebar so
   the existing markup, IDs, click handlers, and the partial-collapse mechanism
   (#toggler-btn → .sidebar-hide) all continue to work. Loaded AFTER styles.css. */

:root {
  --rev-sb-bg: #1b1f2a;
  --rev-sb-bg2: #232838;
  --rev-sb-accent: #4A90E2;
  --rev-sb-accent-2: #00C896;
  --rev-sb-text: #eaecef;
  --rev-sb-muted: #9aa3b2;
  --rev-sb-border: rgba(255,255,255,0.08);
  --rev-sb-radius: 10px;
}

/* Container ------------------------------------------------------------- */
#mySidebar.sidebar {
  width: 260px;
  height: calc(100vh - 50px);
  background: linear-gradient(180deg, var(--rev-sb-bg) 0%, var(--rev-sb-bg2) 100%) !important;
  padding: 16px 14px !important;
  overflow-y: auto;
  box-shadow: 2px 0 12px rgba(0,0,0,0.18);
  font-family: 'Roboto', 'Lato', sans-serif;
}
#mySidebar.sidebar::-webkit-scrollbar { width: 6px; }
#mySidebar.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 6px; }

/* Section spacing ------------------------------------------------------- */
#mySidebar.sidebar .country-section,
#mySidebar.sidebar .district-section,
#mySidebar.sidebar .show-section,
#mySidebar.sidebar .statistics-section,
#mySidebar.sidebar .basemap-section {
  position: static !important;
  top: auto !important;
  margin-bottom: 12px !important;
  padding: 0 !important;
}

/* Section headers (the menu-1 / menu-2 row) ----------------------------- */
#mySidebar.sidebar .menu-1,
#mySidebar.sidebar .menu-2 {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  padding: 6px 4px 8px !important;
  margin-bottom: 6px !important;
  border-bottom: 1px solid var(--rev-sb-border) !important;
  position: static !important;
  bottom: auto !important;
}
/* Section title text */
#mySidebar.sidebar .menu-1 > a,
#mySidebar.sidebar .menu-2 > a {
  position: static !important;
  inset: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase !important;
  color: var(--rev-sb-muted) !important;
  flex: 1 1 auto !important;
  text-decoration: none !important;
}
/* Section icon — svg images and font-awesome glyphs both normalized */
#mySidebar.sidebar .menu-1 img,
#mySidebar.sidebar .menu-2 img {
  width: 18px !important;
  height: 18px !important;
  position: static !important;
  inset: auto !important;
  filter: invert(100%) opacity(0.85) !important;
  margin: 0 !important;
}
#mySidebar.sidebar .menu-1 i,
#mySidebar.sidebar .menu-2 i {
  color: var(--rev-sb-accent) !important;
  font-size: 16px !important;
  width: 18px !important;
  text-align: center !important;
  filter: none !important;
}

/* Forms wrapping the selects ------------------------------------------- */
#mySidebar.sidebar form {
  margin: 0 !important;
  padding: 0 4px !important;
  position: static !important;
  bottom: auto !important;
}
#mySidebar.sidebar center {
  text-align: left !important;
  display: block !important;
}

/* Selects --------------------------------------------------------------- */
#mySidebar.sidebar select {
  width: 100% !important;
  height: 36px !important;
  padding: 6px 10px !important;
  border-radius: var(--rev-sb-radius) !important;
  border: 1px solid var(--rev-sb-border) !important;
  background: rgba(255,255,255,0.04) !important;
  color: var(--rev-sb-text) !important;
  outline: none !important;
  font-size: 13px !important;
  position: static !important;
  bottom: auto !important;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--rev-sb-muted) 50%),
                    linear-gradient(135deg, var(--rev-sb-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
#mySidebar.sidebar select option { background: var(--rev-sb-bg); color: var(--rev-sb-text); }
#mySidebar.sidebar select:focus {
  border-color: var(--rev-sb-accent) !important;
  box-shadow: 0 0 0 2px rgba(74,144,226,0.25);
}

/* Show-section checkboxes ---------------------------------------------- */
#mySidebar.sidebar .show-fields {
  position: static !important;
  bottom: auto !important;
  display: flex !important;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
}
#mySidebar.sidebar .show-fields label.show-text,
#mySidebar.sidebar .show-text {
  width: 100% !important;
  height: auto !important;
  background: rgba(255,255,255,0.03) !important;
  color: var(--rev-sb-text) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 7px 10px !important;
  margin: 0 !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  cursor: pointer;
  transition: background 0.15s ease;
}
#mySidebar.sidebar .show-fields label.show-text:hover,
#mySidebar.sidebar .show-text:hover {
  background: rgba(74,144,226,0.12) !important;
}
#mySidebar.sidebar .show-fields input[type="checkbox"] {
  accent-color: var(--rev-sb-accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Login section -------------------------------------------------------- */
#mySidebar.sidebar .login {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: static !important;
  bottom: auto !important;
  padding: 8px 14px !important;
  border-radius: var(--rev-sb-radius) !important;
  font-size: 13px !important;
  text-transform: none !important;
  letter-spacing: 0.3px;
  text-decoration: none;
}
#mySidebar.sidebar #login-btn { flex: 1 1 auto; }
#mySidebar.sidebar #toggler-btn {
  color: var(--rev-sb-text) !important;
  filter: none !important;
  font-size: 18px !important;
  padding: 6px 8px !important;
  margin-left: auto !important;
  cursor: pointer;
  position: static !important;
}

/* Contact us button --------------------------------------------------- */
#mySidebar.sidebar #contactButton {
  display: inline-flex !important;
  width: auto !important;
  font-size: 13px !important;
  padding: 8px 16px !important;
  margin-top: 12px !important;
  background-color: rgba(255,255,255,0.08) !important;
}
#mySidebar.sidebar #contactButton:hover { background-color: rgba(74,144,226,0.20) !important; }

/* Login popup ---------------------------------------------------------- */
#mySidebar.sidebar #login-popup-box { margin-top: 8px; }

/* Mobile toggle FAB + drawer behaviour --------------------------------- */
#sidebar-toggle-mobile {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
  background: var(--rev-sb-bg);
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.30);
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
}
#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1040;
}
@media (max-width: 768px) {
  #sidebar-toggle-mobile { display: inline-flex; }
  #mySidebar.sidebar {
    transform: translateX(-110%);
    width: 86% !important;
    max-width: 320px;
    z-index: 1050;
    transition: transform 0.3s ease;
  }
  #mySidebar.sidebar.sidebar-open { transform: translateX(0); }
  body.sidebar-mobile-open #sidebar-backdrop { display: block; }
}
