html, body {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
}

#map {
    width: 100%;
    height: 100%;
}

.fahrtrichtung-icon,
.anschlussstellen-marker {
    background: transparent;
    border: none;
}

.rastanlagen-marker, .bauwerk-marker { background: transparent; border: none; }

#suchpanel {
    position: absolute;
    top: 12px;
    left: 58px;
    z-index: 1200;
    width: 210px;
    padding: 10px;
    background: rgba(255,255,255,.96);
    border-radius: 7px;
    box-shadow: 0 2px 8px rgba(0,0,0,.28);
}

.such-titel {
    font-weight: 700;
    margin-bottom: 7px;
}

#suchpanel select,
#suchpanel input,
#suchpanel button {
    box-sizing: border-box;
    width: 100%;
    height: 34px;
    margin-bottom: 6px;
    border: 1px solid #aaa;
    border-radius: 4px;
    padding: 5px 7px;
    font-size: 14px;
}

#suchpanel button {
    border: 0;
    background: #0057b8;
    color: white;
    font-weight: 700;
    cursor: pointer;
}

#suchpanel button:hover {
    background: #00458f;
}

#suchStatus {
    display: none;
    margin-top: 3px;
    padding: 6px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.35;
}

.suchtreffer-icon {
    background: transparent;
    border: none;
}

@media (max-width: 600px) {
    #suchpanel {
        left: 48px;
        right: 10px;
        width: auto;
    }
}

/* ============================================================
   V6 – EINSATZFENSTER
   ============================================================ */

#einsatzfenster {
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translate(-50%, calc(100% + 40px));
    z-index: 1300;
    box-sizing: border-box;
    width: min(820px, calc(100vw - 28px));
    padding: 12px 46px 12px 14px;
    background: rgba(255,255,255,.97);
    border: 1px solid rgba(0,0,0,.16);
    border-radius: 10px;
    box-shadow: 0 5px 22px rgba(0,0,0,.28);
    opacity: 0;
    pointer-events: none;
    transition: transform .22s ease, opacity .22s ease;
}

#einsatzfenster.offen {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}

#einsatzSchliessen {
    position: absolute;
    right: 10px;
    top: 8px;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    font-size: 25px;
    line-height: 28px;
    cursor: pointer;
}

#einsatzSchliessen:hover {
    background: #eee;
}

#einsatzKopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

#einsatzTitel {
    font-size: 17px;
    font-weight: 800;
}

#einsatzUntertitel {
    margin-top: 2px;
    font-size: 13px;
    color: #555;
}

#einsatzDetailsButton {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 0;
    border-radius: 5px;
    background: #0057b8;
    color: white;
    font-weight: 700;
    cursor: pointer;
}

#einsatzKurzinfo {
    margin-top: 9px;
    font-size: 13px;
    line-height: 1.4;
}

#einsatzDetails {
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

#einsatzfenster.details-offen #einsatzDetails {
    display: block;
}

.einsatz-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
}

.einsatz-box {
    padding: 8px 9px;
    background: #f5f7f9;
    border-radius: 6px;
    font-size: 13px;
}

.einsatz-label {
    display: block;
    margin-bottom: 3px;
    color: #666;
    font-size: 11px;
}

@media (max-width: 650px) {
    #einsatzfenster {
        bottom: 7px;
        width: calc(100vw - 14px);
        max-height: 52vh;
        overflow-y: auto;
    }

    #einsatzKopf {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .einsatz-grid {
        grid-template-columns: 1fr;
    }
}

#trefferEntfernenButton {
    background: #fff !important;
    color: #444 !important;
    border: 1px solid #bbb !important;
}

#trefferEntfernenButton:hover {
    background: #f1f1f1 !important;
}

#map.klickmodus {
    cursor: crosshair;
}

.poi-marker { background:transparent; border:none; }
.poi-thw {
    min-width:26px;height:19px;padding:0 2px;
    display:flex;align-items:center;justify-content:center;
    background:#003399;color:#fff;border:2px solid #fff;
    border-radius:3px;box-shadow:0 1px 4px rgba(0,0,0,.55);
    font:800 9px Arial,sans-serif;letter-spacing:.3px;
}
.poi-fire {
    width:24px;height:24px;display:flex;align-items:center;justify-content:center;
    font-size:18px;filter:drop-shadow(0 1px 2px rgba(0,0,0,.45));
}
.poi-police {
    width:10px;height:10px;border-radius:50%;
    background:#0759c7;border:2px solid white;
    box-shadow:0 1px 4px rgba(0,0,0,.55);
}

.poi-rettung{
 width:22px;height:22px;border-radius:5px;
 background:#fff;color:#d71920;border:2px solid #d71920;
 box-shadow:0 1px 5px rgba(0,0,0,.55);
 display:flex;align-items:center;justify-content:center;
 font:bold 19px/22px Arial,sans-serif;
}


/* ============================================================
   V13.3 – MOBILE / TABLET / BARRIEREFREIHEIT
   ============================================================ */
:root{
  --touch:44px;
  --panel-radius:12px;
}
html,body,#map{width:100%;height:100%;margin:0}
body{
  -webkit-text-size-adjust:100%;
  touch-action:manipulation;
}
button,select,input,a,.leaflet-control-layers-toggle,.leaflet-control-zoom a{
  min-height:var(--touch);
}
button,select,input{
  font-size:16px; /* verhindert Auto-Zoom von iOS bei Formfeldern */
}
button,a,input,select{
  outline-offset:3px;
}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,
.leaflet-control a:focus-visible{
  outline:3px solid #111;
}
.leaflet-control-zoom a{
  width:44px!important;height:44px!important;line-height:44px!important;
  font-size:24px!important;
}
.leaflet-control-layers-toggle{
  width:48px!important;height:48px!important;background-size:26px 26px!important;
}
.leaflet-control-layers-expanded{
  font-size:16px;line-height:1.5;
  max-height:min(70vh,520px);overflow:auto;
  padding:12px 14px;
}
.leaflet-control-layers label{
  min-height:38px;display:flex;align-items:center;gap:7px;
}
.leaflet-control-layers input{min-width:22px;min-height:22px}
.leaflet-popup-content{font-size:15px;line-height:1.45}
.leaflet-tooltip{font-size:14px;line-height:1.35;padding:6px 8px}
.poi-marker{touch-action:manipulation}

/* vorhandene Formulare und Einsatzpanel robust responsiv machen */
#searchPanel,#suche,.search-panel,.searchbox{
  max-width:calc(100vw - 24px);
}
#einsatzDetails,#einsatzPanel,.einsatz-panel,.einsatzfenster{
  box-sizing:border-box;
}
#einsatzMapsLink{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:44px;padding:0 14px;
}

/* Tablet */
@media (max-width: 900px){
  .leaflet-control-layers-expanded{max-width:min(360px,calc(100vw - 24px))}
}

/* Smartphone */
@media (max-width: 600px){
  :root{--touch:48px}
  .leaflet-control-container{font-size:16px}
  .leaflet-top.leaflet-left{top:6px;left:6px}
  .leaflet-top.leaflet-right{top:6px;right:6px}
  .leaflet-bottom.leaflet-right{right:6px;bottom:6px}

  #searchPanel,#suche,.search-panel,.searchbox{
    width:calc(100vw - 24px)!important;
    max-width:none!important;
  }

  #einsatzPanel,.einsatz-panel,.einsatzfenster{
    position:fixed!important;
    left:8px!important;right:8px!important;bottom:8px!important;
    width:auto!important;max-width:none!important;
    max-height:42vh!important;overflow:auto!important;
    border-radius:14px!important;
    padding-bottom:max(10px,env(safe-area-inset-bottom))!important;
  }
  #einsatzDetails{font-size:15px;line-height:1.45}
  .leaflet-control-layers-expanded{
    max-width:calc(100vw - 24px);max-height:62vh;
  }
}

/* Sehr schmale Geräte */
@media (max-width: 390px){
  .leaflet-tooltip{font-size:13px}
  .leaflet-control-layers-expanded{font-size:15px}
}

/* Betriebssystem-Einstellung: weniger Bewegung */
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    scroll-behavior:auto!important;
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    transition-duration:.01ms!important;
  }
}

/* bessere Erkennbarkeit bei erhöhtem Kontrast */
@media (prefers-contrast: more){
  .leaflet-control,.leaflet-popup-content-wrapper{
    border:2px solid #000;
  }
}

/* ============================================================
   V13.4 – einklappbare Kilometersuche + GPS-Standort
   ============================================================ */
.such-kopf{display:flex;align-items:center;justify-content:space-between;gap:8px}
.such-kopf .such-titel{margin-bottom:7px}
#suchToggle{
  width:44px!important;min-width:44px!important;height:44px!important;
  margin:-5px -3px 4px 0!important;padding:0!important;
  border-radius:8px!important;font-size:22px!important;
}
#suchpanel.eingeklappt{width:auto;padding:7px}
#suchpanel.eingeklappt .such-titel{margin:0;white-space:nowrap}
#suchpanel.eingeklappt #suchInhalt{display:none}
#suchpanel.eingeklappt #suchToggle{margin:0!important}
#standortButton{background:#176b3a!important}
#standortButton:hover{background:#10552d!important}
#standortButton.aktiv{background:#9a3412!important}
#standortStatus{
  display:none;margin:3px 0 6px;padding:7px;border-radius:5px;
  background:#eef7f1;color:#173b27;font-size:12px;line-height:1.4
}
.gps-marker{background:transparent;border:0}
.gps-punkt{
  width:20px;height:20px;border-radius:50%;background:#1677ff;
  border:4px solid #fff;box-shadow:0 0 0 3px rgba(22,119,255,.25),0 2px 8px rgba(0,0,0,.45)
}
@media (max-width:600px){
  #suchpanel.eingeklappt{
    left:60px!important;right:auto!important;width:auto!important;max-width:calc(100vw - 130px)!important
  }
  #suchpanel.eingeklappt .such-titel{font-size:14px}
}

/* V13.5 – Einsatztools */
#toolsButton{
 position:absolute;z-index:1100;right:12px;top:74px;
 min-width:96px;padding:0 12px;border:0;border-radius:9px;
 background:#20262d;color:#fff;font-weight:700;box-shadow:0 2px 8px #0004
}
#toolsPanel{
 position:absolute;z-index:1200;right:12px;top:126px;width:min(430px,calc(100vw - 24px));
 max-height:calc(100vh - 145px);overflow:auto;box-sizing:border-box;
 background:#fff;border:1px solid #777;border-radius:12px;padding:12px;
 box-shadow:0 5px 24px #0005;color:#171717
}
.toolsKopf{display:flex;justify-content:space-between;align-items:center;font-size:18px}
#toolsClose{width:44px;min-width:44px;padding:0;font-size:24px}
.toolTabs{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:9px 0}
.toolTab{background:#e9edf1;color:#111;border:1px solid #aeb6bf;border-radius:7px}
.toolTab.aktiv{background:#24394f;color:#fff}
.toolPane{display:none}.toolPane.aktiv{display:block}
.toolRow{display:flex;gap:7px;align-items:stretch;margin:7px 0}
.toolRow input{flex:1;min-width:0}
.toolOutput{margin:8px 0;padding:9px;background:#f2f4f6;border-radius:7px;line-height:1.45;overflow-wrap:anywhere}
.toolHint{font-size:14px}
.alphabetGrid{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;margin-top:8px}
.alphabetGrid div{padding:5px;border-bottom:1px solid #ddd;font-size:13px}
#einsatzNotizen{box-sizing:border-box;width:100%;font:16px/1.4 sans-serif;resize:vertical}
.tool-map-crosshair{cursor:crosshair!important}
.precision-good{color:#12652b}.precision-medium{color:#8a4b00}.precision-poor{color:#9d1c1c}
@media(max-width:600px){
 #toolsButton{top:68px;right:7px}
 #toolsPanel{position:fixed;left:7px;right:7px;top:auto;bottom:7px;width:auto;max-height:72vh;
 padding-bottom:max(12px,env(safe-area-inset-bottom))}
 .alphabetGrid{grid-template-columns:repeat(2,1fr)}
 .toolRow{flex-wrap:wrap}.toolRow input{flex-basis:100%}
}

.legal-nav{position:fixed;z-index:900;left:8px;bottom:8px;display:flex;gap:10px;align-items:center;flex-wrap:wrap;
background:rgba(255,255,255,.94);padding:6px 9px;border-radius:6px;font:12px/1.25 system-ui,sans-serif;box-shadow:0 1px 5px rgba(0,0,0,.18)}
.legal-nav a{color:#064f91;text-decoration:underline}.legal-nav span{color:#4b5563}
@media(max-width:700px){.legal-nav{right:8px;bottom:max(6px,env(safe-area-inset-bottom));font-size:11px}.legal-nav span{display:none}}
