/* --- 1. GRUNDLÄGGANDE (Tar bort vit ram) --- */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

#map {
    height: 100dvh;
    width: 100%;
    position: relative;
    display: block;
}

/* --- 2. GEMENSAM STIL FÖR ALLA KNAPPAR (44px) --- */
.custom-map-btn, 
.leaflet-control-zoom-in, 
.leaflet-control-zoom-out {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    background: white !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2) !important;
    font-size: 20px !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: #333 !important;
    text-decoration: none !important;
}

/* --- 3. VÄNSTERPANEL (ALLA KONTROLLER SAMLADE) --- */
#map-controls-wrapper {
    position: fixed;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px; /* EXAKT samma gap mellan alla block */
}

/* Ta bort eventuella gamla marginaler som förstör gapet */
.leaflet-control-zoom, #search-wrapper, .custom-map-btn {
    margin: 0 !important; 
}

#search-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

/* --- 4. ZOOM-KONTROLLER (FLYTER NU IN I WRAPPERN) --- */
.leaflet-control-zoom {
    position: relative !important; /* Inte längre fixed, så den följer wrappern */
    left: 0 !important;
    top: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Ta bort Leaflets fula standard-boxar */
.leaflet-bar {
    border: none !important;
    box-shadow: none !important;
}

/* --- 5. SÖKFÄLTET --- */
#search-bar-container {
    position: relative; /* Viktigt för att listan ska hamna rätt */
    width: 0;
    opacity: 0;
    transition: all 0.3s ease;
    /* Vi tar bort overflow: hidden härifrån för att inte klippa listan */
}

#search-wrapper.active #search-bar-container {
    width: 220px;
    opacity: 1;
}

#search-results {
    position: absolute;
    top: 100%; /* Precis under sökfältet */
    left: 0;
    width: 100%;
    background: white; /* Ingen mer genomskinlighet */
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001; /* Se till att den ligger överst */
    display: none; /* Visas via JS */
}

.search-item {
    padding: 10px 15px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    background: white;
}

.search-item:hover {
    background: #f0f0f0;
}

#map-search {
    width: 100%;
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid #ccc;
    font-size: 16px;
    outline: none;
    background: white;
}

/* --- 6. POSITIONERINGS-KNAPP (TOP CENTER) --- */
.location-btn {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: white;
    padding: 10px 20px;
    border-radius: 25px;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    font-weight: bold;
    cursor: pointer;
}

/* --- 7. INRAPPORTERING --- */
/* Hårkorset mitt på skärmen */
#map-crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
	transform: translate(-50%, -50%); /* Detta centrerar krysset perfekt */
    width: 30px;
    height: 30px;
    z-index: 9999 !important;
    pointer-events: none;
    display: none;
}

#map-crosshair::before {
    content: '';
    position: absolute;
    top: 50%; 
    width: 100%; 
    height: 2px;
    background: red;
}

#map-crosshair::after {
    content: '';
    position: absolute;
    left: 50%; 
    height: 100%; 
    width: 2px;
    background: red;
}

/* Den yttre behållaren som håller allt på plats */
#bottom-controls-wrapper {
    position: fixed;
    bottom: 10px;
    left: 10px;
    z-index: 2000;
	display: flex;
    flex-direction: column; 
    gap: 8px;
	pointer-events: none;
	width: fit-content;
}

/* Inre behållare för inrapportering */
#report-wrapper {
    display: flex;
    flex-direction: row-reverse; /* Staplar flygplanet ovanpå brevet */
    gap: 10px;
    align-items: center;
}

/* Skicka-knappen (Flygplanet) - Dold som standard */
#send-report-btn {
    opacity: 0;
    transform: scale(0) translateY(40px); /* Startar lite lägre och osynlig */
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background-color: white;
    border: 10px solid #ff0000;
    display: flex; /* För att centrera SVG:n */
    align-items: center;
    justify-content: center;
}

/* När vi lägger till .active via JS */
#report-wrapper.active #send-report-btn {
    opacity: 1;
    transform: scale(1) translateY(0); /* Poppar upp till sin plats */
    pointer-events: auto;
}

/* Visuell feedback på brevknappen när den är i "avbryt-läge" */
#report-wrapper.active #report-toggle-btn {
    background-color: #ffcccc;
    border-color: #ff4444;
}

/* Aktivera klick igen för de faktiska knapp-behållarna och knapparna */
.bottom-control-container, 
.custom-map-btn {
    pointer-events: auto;
}

/* Justering för väder-ikonen så den inte ser gigantisk ut */
#weather-toggle-btn svg {
    width: 33px;
    height: 33px;
    /* Om termometern ser konstig ut, justera viewBox i HTML eller här */
}

#weather-toggle-btn.active {
    background-color: #e3f2fd;
    border: 2px solid #2196F3;
    stroke: #f3b021;
	stroke-width: 0.85;
}