/*<!--
  _   _ _ _    _                                  
 | \ | (_) | _| | __ _ ___                        
 |  \| | | |/ / |/ _` / __|                       
 | |\  | |   <| | (_| \__ \                       
 |_| \_|_|_|\_\_|\__,_|___/         _             
 \ \   / /_ _  ___| | _____ _ __ __| | __ _  __ _ 
  \ \ / / _` |/ __| |/ / _ \ '__/ _` |/ _` |/ _` |
   \ V / (_| | (__|   <  __/ | | (_| | (_| | (_| |
    \_/ \__,_|\___|_|\_\___|_|  \__,_|\__,_|\__, |
                                            |___/ 
-->*/

/* Hämtar teckensnitt */
/* @import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@400&display=swap');*/

html, body, #map {
	font-family: "Ubuntu", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	height: 100%;
	margin: 0;
	padding: 0;
}

#map, .leaflet-container {
	background: #a8d0ff; /* havsfärg */
}

/* attribution */
.leaflet-bottom.leaflet-right {
	bottom: 10px;
	right: 10px;
}

.leaflet-control-attribution {
	border-radius: 10px;
}

#csv-input {
	display: none;
}

/* sikte i mitten */


.magnifier {
	height: 30px;
	width: auto;
	padding: 0px;
}
/* Sökfunktionen */

#search-wrapper {
	position: absolute;
    top: 190px;         /* Avstånd från topp */
    left: 20px;       /* Justera så den inte krockar med stat-select/reset */	
	/*transform: translateX(-50%);*/
	z-index: 9999;
	padding: 0px;
	border-radius: 15px;
}

#search-wrapper.open #search-box {
	display: block;
}

#search-toggle {
	padding: 0;
	background: white;
	cursor: pointer;
	border-radius: 50%;
	box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
	border: none; /* om du inte vill ha ram */
}

#search-box {
	display: none;
	margin-top: 10px;
	text-align: center;
	font-family: Ubuntu, sans-serif;
}

#search-input {
	padding: 6px;
	width: 200px;
	border-radius: 5px;
	border: 1px solid #ccc;
	font-family: Ubuntu, sans-serif;	
	font-size: 16px;
}

#suggestions {
	margin: 5px 0 0;
	padding: 0;
	list-style: none;
	background: white;
	border: 1px solid #ccc;
	max-height: 200px;
	overflow-y: auto;
}

#suggestions li {
	padding: 6px;
	cursor: pointer;
}

#suggestions li:hover {
	background: #eee;
}

#country-popup {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.4);
	z-index: 10000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

#country-popup .popup-stat {
  margin: 6px 0 10px;
  padding: 8px 10px;
  background: #f6f8fa;
  border: 1px solid #e2e6ea;
  border-radius: 6px;
}
#country-popup .popup-stat-title {
  font-size: 12px;
  color: #666;
  margin-bottom: 2px;
}
#country-popup .popup-stat-value {
  font-size: 16px;
  font-weight: 600;
}

.popup-content {
	background: white;
	max-width: 400px;
	width: 90%;
	max-height: 80vh;
	overflow-y: auto;
	border-radius: 10px;
	padding: 20px;
	font-family: Ubuntu, sans-serif;
	box-shadow: 0 0 10px rgba(0,0,0,0.5);
	position: relative;
}

.popup-content h2 {
	margin-top: 0;
	margin-bottom: 12px;
	font-size: 1.3em;
}

.popup-content table {
	width: 100%;
	border-collapse: collapse;
}

.popup-content td {
	padding: 6px 8px;
	vertical-align: top;
}

.popup-content td:first-child {
	font-weight: 400;
	white-space: nowrap;
}

.popup-content a {
	color: #b60000;
	text-decoration: none;
}

.popup-close {
	position: absolute;
	top: 10px;
	right: 12px;
	background: none;
	border: none;
	color: #b60000;
	font-size: 22px;
	cursor: pointer;
}

#legend { 
	display:none;
	position:absolute;
	bottom:20px;
	left:20px;
	z-index:1000;
	background:#fff;
	border:1px solid #ccc;
	border-radius:4px;
	padding:8px 10px;
	font:12px/1.2 system-ui;
}
#legend-swatches {
	display:flex;
	gap:4px;
}
#legend-range {
	margin-top:6px;
	display:flex;
	justify-content:space-between;
}

#reset-map {
	position: absolute;
	top: 70px;
	left: 20px;
	z-index: 1000;
	font-size: 14px;
	padding: 4px 8px;
	background: white;
	cursor: pointer;
	border-radius: 50%;
	box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
	border: none; /* om du inte vill ha ram */
}

/* Startläge: göm legend */
#legend.is-hidden {
	display: none;
}

#controls {
	width: 300px;
}

#stat-select {
	position:absolute;
	width: 300px;
	height: 30px;
	top:20px;
	left:20px;
	z-index:1000;
	font-family: Ubuntu, sans-serif;
	font-size:16px;
	color: #b60000;
	padding: 5px 10px;
	box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);

	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-color: #fff; /* behövs ofta när man tar bort appearance */
	border: 1px solid #ccc;
	border-radius: 15px;	
}

option {
	font-family: Ubuntu, sans-serif;
}
img.graph-icon {
	width: 15px;
	height: 15px;
	object-fit: contain;
}

#toggle-capitals {
  position: absolute;
  top: 130px;
  left: 20px;
  z-index: 1000;
  background: #fff;
  /*border: 1px solid #ccc;*/
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); 
}

/* Centralt kartmeddelande */
#map-center-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  pointer-events: none;    /* blockera inte klick på kartan */
  z-index: 1100;           /* över UI-knapparna (som ligger ~1000) */
  opacity: 0;
  transition: opacity 150ms ease;
  white-space: nowrap;
}

#map-center-message.is-visible {
  opacity: 1;
}

/* === LABELS (konsoliderat) === */

/* Baslager för etiketter (behåll som du har idag) */
.leaflet-label-layer { z-index: 700; pointer-events: none; }

/* Vanliga landetiketter – enkel, mjuk halo (som förr) */
.country-label {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: normal;
  word-break: normal;       /* fallback */
  overflow-wrap: break-word;    /* standardiserat */
  pointer-events: auto;
  background: transparent;
  border: 0;
  box-shadow: none;

  color: #fff;
  font-weight: 400;
  line-height: 1.1;
  text-align: center;

  text-shadow:
    0 0 2px rgba(0,0,0,0.85),
    0 0 4px rgba(0,0,0,0.45);
}

/* Specialområden: behåll din tidigare stil (svart text med vit kant, lätt italics) */
.country-label.label-special {
  color: black;
  text-shadow:
      1px 1px 0 #fff,
     -1px 1px 0 #fff,
      1px -1px 0 #fff,
     -1px -1px 0 #fff;
  padding: 2px 4px;
  border-radius: 3px;
  font-style: italic;
  font-family: Ubuntu, sans-serif;
}