/* =========================================
   WP Reference Map - FINAL STYLE V2.0
   ========================================= */
.refmap-wrapper {
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    position: relative;
    overflow: visible !important;
    box-sizing: border-box !important;
    font-family: sans-serif !important;
}
.refmap-wrapper * { box-sizing: border-box !important; }

/* TOOLBAR (Työpöytä - EI MUUTOKSIA) */
.refmap-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 15px !important;
    padding: 20px 20px 35px 20px !important;
    margin-bottom: 0 !important;
    min-height: auto !important;
    position: relative;
    z-index: 1001;
}
.refmap-toolbar br, .refmap-toolbar p { display: none !important; }

/* HAKU (Työpöytä - EI MUUTOKSIA) */
.refmap-search-box {
    flex: 1 1 250px !important; margin: 0 !important; position: relative !important; height: 50px !important;
}
#refmap-search-input {
    width: 100% !important; height: 100% !important; padding: 0 15px !important; margin: 0 !important;
    border: 1px solid #ccc !important; border-radius: 4px !important; font-size: 16px !important;
    background: #fff !important; color: #333 !important; box-shadow: none !important;
}
#refmap-search-input:focus { border-color: #005eb8 !important; box-shadow: 0 0 0 3px rgba(0, 94, 184, 0.1) !important; }

/* LASKURI (Työpöytä - EI MUUTOKSIA) */
#refmap-counter {
    position: absolute !important; top: 100% !important; left: 2px !important; margin-top: 6px !important;
    font-size: 12px !important; color: #666 !important; font-weight: 500 !important; line-height: normal !important;
    white-space: nowrap !important; pointer-events: none;
}

/* SUODATUSNAPPI (Työpöytä - EI MUUTOKSIA) */
.refmap-filter-container {
    flex: 0 0 auto !important; margin: 0 !important; height: 50px !important; display: flex !important; align-items: center !important;
}
#refmap-filter-toggle-btn {
    height: 100% !important; margin: 0 !important; padding: 0 25px !important;
    display: flex !important; align-items: center !important; justify-content: center !important; gap: 10px !important;
    background: #fff !important; border: 1px solid #ccc !important; border-radius: 4px !important;
    color: #444 !important; font-size: 15px !important; font-weight: 600 !important; cursor: pointer !important; text-transform: none !important; white-space: nowrap !important;
}
#refmap-filter-toggle-btn svg { width: 20px !important; height: 20px !important; display: block !important; }
#refmap-filter-toggle-btn:hover { background: #f1f1f1 !important; border-color: #bbb !important; }
#refmap-filter-toggle-btn.active { background: #e7f1ff !important; border-color: #005eb8 !important; color: #005eb8 !important; }

/* DROPDOWN (Työpöytä - EI MUUTOKSIA) */
.refmap-dropdown-menu {
    display: none; position: absolute !important; top: 60px !important; right: 0 !important; z-index: 99999 !important;
    width: 300px !important; padding: 15px !important; background: #fff !important; border: 1px solid #ddd !important;
    border-radius: 6px !important; box-shadow: 0 10px 40px rgba(0,0,0,0.15) !important;
}
.refmap-dropdown-menu.show { display: block !important; }
.refmap-checkbox-item {
    display: flex !important; align-items: center !important; padding: 8px 0 !important; margin: 0 !important;
    font-size: 15px !important; color: #333 !important; cursor: pointer !important;
}
.refmap-checkbox-item input { margin-right: 12px !important; width: 20px !important; height: 20px !important; accent-color: #005eb8; }

/* KARTTA (Työpöytä - EI MUUTOKSIA) */
#refmap-container { width: 100%; min-height: 550px; background: #e5e5e5; z-index: 1; }
.refmap-custom-marker div { width: 100%; height: 100%; border-radius: 50%; border: 2px solid white; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.marker-cluster div { width: 30px; height: 30px; margin-left: 5px; margin-top: 5px; text-align: center; border-radius: 50%; color: #fff; display: flex; justify-content: center; align-items: center; font-weight: bold; font-size: 12px; }
.marker-cluster { background-clip: padding-box; border-radius: 20px; }
#refmap-locate-btn {
    position: absolute; top: 20px; right: 20px; z-index: 900; background: #fff; border: 2px solid rgba(0,0,0,0.15);
    border-radius: 4px; width: 44px; height: 44px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: #333; padding: 0; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* =========================================
   MOBIILINÄKYMÄ (KORJATTU)
   ========================================= */
@media (max-width: 768px) {
    /* Työkalupalkki: Allekkain ja väliä elementtien väliin */
    .refmap-toolbar { 
        flex-direction: column !important; 
        align-items: stretch !important; 
        padding: 15px !important; /* Tasainen reuna */
        gap: 25px !important; /* TÄRKEÄ: Tekee tilaa laskurille hakukentän ja napin väliin */
    }
    
    /* Hakukenttä vie koko leveyden */
    .refmap-search-box { 
        width: 100% !important; 
        flex: 0 0 auto !important;
    }
    
    /* Napin kontti vie koko leveyden ja sallii valikon aueta nätisti */
    .refmap-filter-container { 
        width: 100% !important; 
        flex: 0 0 auto !important;
        position: static !important; /* Helpottaa valikon asemointia mobiilissa */
    }
    
    /* Nappi koko leveydelle, teksti vasemmalle ja nuoli oikealle */
    #refmap-filter-toggle-btn { 
        width: 100% !important; 
        justify-content: space-between !important; 
    }
    
    /* Pudotusvalikko: Aukeaa koko ruudun levyiseksi napin alle */
    .refmap-dropdown-menu { 
        width: calc(100% - 30px) !important; /* 100% miinus paddingit */
        left: 15px !important; 
        right: 15px !important; 
        top: auto !important; 
        margin-top: 5px !important; 
    }
    
    /* Kartan oma paikannusnappi ei jää työkalupalkin alle */
    #refmap-locate-btn { 
        top: 15px !important; 
    }
}
.leaflet-control-attribution { display: none !important; }