/* ===== Base Layout ===== */
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: Inter, Arial, sans-serif;
  overflow: hidden;
}
#map {
  height: 100%;
}
#map { background: #eaeaea; }

/* ===== Sidebar Panel ===== */
#sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 100%;
  padding: 16px;
  background: #fff;
  overflow-y: auto;
  box-shadow: -4px 0 8px rgba(0, 0, 0, 0.25);
  transform: translateX(100%);
  transition: transform .35s ease;
  z-index: 1001;
}
#sidebar:not(.closed) {
  transform: translateX(0);
}
#sidebar h2 {
  text-align: center;
  margin: 0 0 14px;
  font-size: 20px;
}
section {
  margin-bottom: 22px;
}
section h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}
label {
  display: block;
  margin: 6px 0 2px;
  font-size: 13px;
}

/* ===== Select2 Overrides ===== */
.select2-container {
  width: 100% !important;
}
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  background: #fff !important;
  color: #000 !important;
  border: 1px solid #ccc !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #000 !important;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #888 !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background: #e6e6e6 !important;
  color: #000 !important;
}

/* ===== Fix for Select2 dropdown ===== */
.select2-dropdown {
  background-color: #fff !important;
}
.select2-results {
  background-color: #fff !important;
  color: #000 !important;
}
.select2-results__option {
  background: #fff !important;
  color: #000 !important;
}
.select2-selection__placeholder {
  color: #999 !important;
}

/* ===== Small Buttons ===== */
.mini {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid #888;
  border-radius: 3px;
  background: #f5f5f5;
  cursor: pointer;
  margin-top: 6px;
}
.mini:hover {
  background: #e7e7e7;
}

/* ===== Apply / Export Buttons ===== */
.actions {
  text-align: center;
  margin-top: 8px;
}
.actions button {
  padding: 6px 14px;
  margin: 4px;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}
#apply {
  background: #28a745;
  color: #fff;
}
#apply:hover {
  background: #218838;
}
#export {
  background: #17a2b8;
  color: #fff;
}
#export:hover {
  background: #117a8b;
}

/* ===== Filters Toggle Button ===== */
#togglePanelBtn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1002;
  background: #0068ff;
  color: #fff;
  padding: 6px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: right .25s;
}
#togglePanelBtn:hover {
  background: #0052d6;
}
body.panel-open #togglePanelBtn {
  right: 320px;
}

/* ===== Leaflet Popup Content ===== */
.leaflet-popup-content {
  font-family: Inter, Arial, sans-serif;
  font-size: 14px;
}

/* ===== Force white background in Select2 dropdown ===== */
.select2-container--default .select2-dropdown {
  background-color: #fff !important;
  border: 1px solid #ccc !important;
}
.select2-container--default .select2-results {
  background-color: #fff !important;
  color: #000 !important;
}
.select2-container--default .select2-results__option {
  background-color: #fff !important;
  color: #000 !important;
  padding: 6px 12px !important;
}
.select2-container--default .select2-results__option--highlighted {
  background-color: #f0f0f0 !important;
  color: #000 !important;
}
.select2-container--open .select2-dropdown,
.select2-container--open .select2-dropdown .select2-results {
  background-color: #fff !important;
}
.select2-container--default .select2-selection__placeholder {
  color: #999 !important;
}
.select2-results__option {
  background: #fff !important;
  color: #000 !important;
}
.select2-selection__rendered {
  color: #000 !important;
}
.select2-selection__placeholder {
  color: #888 !important;
}

/* ===== Indicator Panels Styling ===== */
.indicator-panel {
  border: 1px solid #ccc;
  background: #f9f9f9;
  padding: 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* Section dividers and spacing */
#sidebar section {
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}
#sidebar section:last-child {
  border-bottom: none;
}

/* Tooltip (popup) table styling */
.country-tooltip {
  background: #fff;
  border: 1px solid #aaa;
  color: #000;
  opacity: 0.95;
}
.country-tooltip table {
  border-collapse: collapse;
}
.country-tooltip th, .country-tooltip td {
  border: 1px solid #ccc;
  padding: 2px 5px;
}
.country-tooltip th {
  background: #f0f0f0;
  font-weight: 600;
}
.country-tooltip td:first-child {
  font-weight: 600;
}
/* ===== Checkbox indicators for Select2 multi‑select results ===== */
.select2-results__option {
  display: flex !important;            /* icon and text aligned */
  align-items: flex-start !important;  /* icon at top if text wraps */
  gap: 8px !important;                 /* space between icon and text */
  padding: 6px 12px !important;        /* uniform padding */
  line-height: 1.35 !important;        /* comfortable line spacing */
  white-space: normal !important;      /* allow long names to wrap */
}
.select2-results__option::before {
  content: "☐";                        /* empty checkbox */
  flex: 0 0 18px;                      /* fixed icon column width */
  font-size: 16px;                     /* readable icon size */
  color: #6c6c6c;                      /* subtle grey */
  text-align: center;
}
.select2-results__option[aria-selected="true"]::before {
  content: "☑";                        /* checked checkbox */
  color: #007bff;                      /* accent colour */
}

/* ===== Selected “pill” (choice) styling & close “×” ===== */
.select2-selection__choice {
  display: inline-flex !important;
  align-items: center;
  position: relative;
  padding: 2px 26px 2px 6px !important;  /* room for × on the right */
  margin: 2px 4px 2px 0 !important;
  font-size: 13px !important;
  line-height: 1.25 !important;
  max-width: 100%;
  overflow: visible !important;
}
.select2-selection__choice__remove {
  position: absolute !important;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: bold;
  color: #555;
  cursor: pointer;
  display: contents !important;
  line-height: 16px !important;
  text-align: center !important;
}
.select2-selection__choice__remove:hover {
  color: #000;
}

/* ===== Clear icon for Select2 single-select ===== */
.select2-container--default .select2-selection--single {
  position: relative !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-right: 36px !important;      /* increased space for clear icon */
}
.select2-selection__clear {
  position: absolute !important;
  top: 50% !important;
  right: 8px !important;
  transform: translateY(-50%) !important;
  width: 16px !important;
  height: 16px !important;
  line-height: 16px !important;
  font-size: 14px !important;
  color: #555 !important;
  cursor: pointer !important;
  z-index: 1000 !important;
}

/* Accordion: скрыть всё кроме countrySection */
.section-content { display: none; }
#countrySection .section-content { display: block; }

/* Курсор для кликабельных заголовков */
#sidebar h3 { cursor: pointer; user-select: none; }