html, body { height: 100%; margin: 0; overflow: hidden; }
.tfx-map-page { position: fixed; inset: 70px 0 0; background: #e7e3d8; }
#tfx-main-map { width: 100%; height: 100%; }
.tfx-map-search {
    position: absolute; z-index: 1100; top: 12px; left: 10px; width: min(430px, calc(100% - 72px));
    font-family: 'Open Sans', Arial, sans-serif;
}
.tfx-map-search-form { display: flex; box-shadow: 0 2px 9px rgba(0,0,0,.3); border-radius: 5px; overflow: hidden; background: #fff; }
.tfx-map-search input { min-width: 0; flex: 1; height: 42px; padding: 0 14px; border: 0; outline: 0; font-size: 15px; }
.tfx-map-search button { width: 46px; border: 0; background: #fff; color: #315f8f; cursor: pointer; }
.tfx-map-search button:hover, .tfx-map-search button:focus-visible { background: #f0f4f8; }
.tfx-map-search input[aria-busy="true"] + button { position: relative; cursor: wait; }
.tfx-map-search input[aria-busy="true"] + button svg { visibility: hidden; }
.tfx-map-search input[aria-busy="true"] + button::after {
    content: ''; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px;
    margin: -9px 0 0 -9px; box-sizing: border-box; border: 2px solid #b8c9da;
    border-top-color: #315f8f; border-radius: 50%; animation: tfx-search-spin .7s linear infinite;
}
.tfx-map-results { display: none; margin: 5px 0 0; padding: 5px 0; list-style: none; background: #fff; border-radius: 5px; box-shadow: 0 2px 9px rgba(0,0,0,.3); max-height: 55vh; overflow-y: auto; }
.tfx-map-results.open { display: block; }
.tfx-map-results button { display: block; width: 100%; padding: 9px 13px; border: 0; background: #fff; text-align: left; color: #333; line-height: 1.35; cursor: pointer; }
.tfx-map-results button:hover, .tfx-map-results button:focus-visible { background: #eef4fa; }
.tfx-location-control {
    background: #fff; border-radius: 5px; box-shadow: 0 1px 5px rgba(0,0,0,.4);
    font-family: 'Open Sans', Arial, sans-serif;
}
.tfx-location-control button {
    display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px;
    border: 0; background: transparent; color: #315f8f;
    font: 600 13px/1 'Open Sans', Arial, sans-serif; white-space: nowrap; cursor: pointer;
}
.tfx-location-control button:hover, .tfx-location-control button:focus-visible { background: #f4f4f4; }
.tfx-location-control svg { display: block; width: 20px; height: 20px; flex-shrink: 0; }
.tfx-location-control.is-loading svg { animation: tfx-location-pulse 1s ease-in-out infinite; }
.tfx-location-marker { width: 18px; height: 18px; border: 3px solid #fff; border-radius: 50%; background: #2679d8; box-shadow: 0 0 0 2px #2679d8, 0 2px 6px rgba(0,0,0,.4); }
.tfx-map-status {
    position: absolute; z-index: 1200; left: 50%; bottom: 28px; transform: translateX(-50%);
    max-width: min(520px, calc(100% - 32px)); padding: 10px 15px; border-radius: 5px;
    background: rgba(38, 54, 69, .92); color: #fff; font: 14px/1.35 'Open Sans', Arial, sans-serif;
    box-shadow: 0 2px 9px rgba(0,0,0,.3); text-align: center;
}
.tfx-map-status.is-error { background: rgba(156, 45, 45, .94); }
.hillshade-blend { mix-blend-mode: multiply; filter: contrast(115%); }
.contours-only { filter: contrast(130%) brightness(105%) saturate(140%) hue-rotate(340deg) sepia(20%); mix-blend-mode: multiply; }
@keyframes tfx-location-pulse { 50% { opacity: .35; } }
@keyframes tfx-search-spin { to { transform: rotate(360deg); } }
@media (max-width: 1100px) {
    .tfx-map-search { left: 10px; width: calc(100% - 22px); }
    .tfx-map-status { bottom: 22px; }
}

/* Zoom sitzt jetzt oben rechts (siehe tourenfex-map.js) - links bleiben nur noch Kartenebenen/
   Tour-planen/Standort uebrig, die sonst mit der Suchleiste (oben, position:absolute) kollidieren
   wuerden. Um den Abstand zur Suchleiste (top:12px + 42px Hoehe) nach unten geschoben. */
.leaflet-top.leaflet-left { top: 64px; }

/* ── Layers panel (Webcams/Wetterstationen/Hangneigung/Skipisten) ─ */
.tfx-layers-panel {
    background: #fff; border-radius: 5px; box-shadow: 0 1px 5px rgba(0,0,0,.4);
    padding: 9px 12px; font-family: 'Open Sans', Arial, sans-serif; color: #333;
    min-width: 168px;
}
.tfx-layers-panel h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #888; }
.tfx-layers-panel label { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 13px; cursor: pointer; white-space: nowrap; }
.tfx-layers-panel input[type="checkbox"] { margin: 0; }
@media (max-width: 680px) {
    .tfx-layers-panel h4.tfx-layers-toggle {
        cursor: pointer; display: flex; align-items: center; gap: 5px; margin: 0;
    }
    .tfx-layers-panel h4.tfx-layers-toggle::after { content: '▸'; margin-left: auto; font-size: 10px; }
    .tfx-layers-panel.is-open h4.tfx-layers-toggle { margin-bottom: 6px; }
    .tfx-layers-panel.is-open h4.tfx-layers-toggle::after { content: '▾'; }
    .tfx-layers-panel .tfx-layers-body { display: none; }
    .tfx-layers-panel.is-open .tfx-layers-body { display: block; }
}

/* ── Plan toggle button (links, unter den Kartenebenen) ──────────── */
.tfx-plan-toggle {
    display: flex; align-items: center; gap: 7px;
    height: 42px; padding: 0 15px; border: 0; border-radius: 5px;
    background: #315f8f; color: #fff;
    font: 600 14px/1 'Open Sans', Arial, sans-serif;
    cursor: pointer; box-shadow: 0 2px 9px rgba(0,0,0,.28); white-space: nowrap;
}
.tfx-plan-toggle:hover, .tfx-plan-toggle:focus-visible { background: #264b72; }
.tfx-plan-toggle.active { background: #1d3a58; }
.tfx-plan-toggle[hidden] { display: none; }
.tfx-plan-toggle svg { flex-shrink: 0; }

/* ── Planner panel ─────────────────────────────────────────────── */
.tfx-planner-panel[hidden] { display: none !important; }
.tfx-planner-panel {
    position: absolute; z-index: 1050; top: 0; left: 0; bottom: 0; width: 310px;
    background: #fff; overflow: hidden; box-shadow: 3px 0 14px rgba(0,0,0,.18);
    display: flex; flex-direction: column; font-family: 'Open Sans', Arial, sans-serif;
}
.tfx-map-page.planner-open { padding-left: 310px; }
.tfx-map-page.planner-open .tfx-map-search { left: 320px; width: min(400px, calc(100% - 380px)); }

.tfx-pp-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px; height: 54px; flex-shrink: 0;
    background: #315f8f; color: #fff; border-bottom: 1px solid #264b72;
}
.tfx-pp-head strong { font-size: 15px; }
.tfx-pp-head button {
    width: 30px; height: 30px; border: 0; border-radius: 50%;
    background: rgba(255,255,255,.18); color: #fff; cursor: pointer;
    font-size: 20px; line-height: 1; display: grid; place-items: center;
}
.tfx-pp-head button:hover { background: rgba(255,255,255,.3); }

.tfx-pp-body { flex: 1; padding: 12px; overflow-y: auto; }

.tfx-pp-return-banner[hidden] { display: none !important; }
.tfx-pp-return-banner {
    margin-bottom: 12px; padding: 11px; border-radius: 8px;
    background: #fef5e6; border: 1.5px solid #f0c675;
}
.tfx-pp-return-banner p { margin: 0 0 9px; font-size: 12.5px; line-height: 1.4; color: #7a5a12; font-weight: 600; }

.tfx-pp-meta { display: grid; gap: 7px; margin-bottom: 12px; }
.tfx-pp-meta input, .tfx-pp-meta select {
    width: 100%; padding: 9px 11px; border: 1px solid #c5d4e5;
    border-radius: 7px; font: 13px/1 'Open Sans', Arial, sans-serif;
    background: #fff; color: #263648;
}
.tfx-pp-meta input:focus, .tfx-pp-meta select:focus {
    outline: none; border-color: #315f8f; box-shadow: 0 0 0 2px rgba(49,95,143,.15);
}

.tfx-pp-section { margin-bottom: 11px; }
.tfx-pp-label {
    display: block; margin-bottom: 5px;
    font-size: 10px; font-weight: 700; letter-spacing: .07em;
    color: #6b88a2; text-transform: uppercase;
}
.tfx-pp-seg { display: flex; border: 1.5px solid #315f8f; border-radius: 7px; overflow: hidden; }
.tfx-pp-seg button {
    flex: 1; border: 0; padding: 8px 4px; background: #fff; color: #315f8f;
    font: 600 12px/1 'Open Sans', Arial, sans-serif; cursor: pointer;
}
.tfx-pp-seg button + button { border-left: 1.5px solid #315f8f; }
.tfx-pp-seg button.active { background: #315f8f; color: #fff; }

.tfx-pp-filedrop {
    display: block; padding: 14px 10px; text-align: center;
    border: 2px dashed #9ab4ce; border-radius: 8px; cursor: pointer;
    font-size: 13px; color: #315f8f;
}
.tfx-pp-filedrop:hover { border-color: #315f8f; background: #f0f6fc; }
.tfx-pp-filedrop input { display: none; }

.tfx-pp-endpoint {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    border: 1px solid #c5d4e5; border-radius: 7px; background: #fff; margin-bottom: 5px;
}
.tfx-pp-endpoint:focus-within { border-color: #315f8f; }
.tfx-pp-endpoint svg { flex-shrink: 0; }
.tfx-pp-endpoint input { min-width: 0; flex: 1; border: 0; outline: 0; font: 13px 'Open Sans', Arial, sans-serif; background: transparent; }

.tfx-pp-point-row {
    display: flex; align-items: center; gap: 4px; padding: 5px 7px;
    margin-bottom: 4px; background: #f5f9fd; border: 1px solid #dde8f3; border-radius: 7px;
}
.tfx-pp-point-row input {
    min-width: 0; flex: 1; padding: 4px 7px; border: 1px solid #c5d4e5;
    border-radius: 5px; font: 12px 'Open Sans', Arial, sans-serif;
}
.tfx-pp-point-row button {
    width: 24px; height: 24px; border: 1px solid #c5d4e5; border-radius: 4px;
    background: #fff; cursor: pointer; font-size: 13px; flex-shrink: 0;
    display: grid; place-items: center; color: #315f8f; padding: 0;
}
.tfx-pp-point-row button:disabled { opacity: .3; cursor: default; }
@keyframes tfx-point-hi { 0%,50% { box-shadow: 0 0 0 3px rgba(243,156,18,.4); } 100% { box-shadow: none; } }
.tfx-pp-point-new { animation: tfx-point-hi 2s ease-out; border-color: #f39c12; }

.tfx-pp-status {
    padding: 8px 11px; margin-bottom: 10px; border-radius: 6px;
    background: #eef4fa; font-size: 12px; line-height: 1.4; color: #315f8f;
}
.tfx-pp-status.ok {
    background: #e3f7ea; color: #0f6b32; font-weight: 700; font-size: 13px;
    padding: 11px 13px; border: 1.5px solid #7bd6a0; box-shadow: 0 2px 8px rgba(21,108,53,.15);
}
.tfx-pp-status.warn{ background: #fef5e6; color: #9a6700; }
.tfx-pp-status.busy{ background: #eef4fa; color: #315f8f; }

.tfx-pp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tfx-pp-btn {
    padding: 10px 6px; border: 1.5px solid #315f8f; border-radius: 7px;
    background: #fff; color: #315f8f; font: 600 12px 'Open Sans', Arial, sans-serif; cursor: pointer;
}
.tfx-pp-btn:hover { background: #eef4fa; }
.tfx-pp-btn.primary { background: #315f8f; color: #fff; border-color: #315f8f; }
.tfx-pp-btn.primary:hover { background: #264b72; }
.tfx-pp-btn-full { grid-column: 1 / -1; }
#tfxSaveSlot > .tfx-pp-btn { display: block; width: 100%; box-sizing: border-box; }

@media (max-width: 680px) {
    .tfx-planner-panel { width: 100%; box-shadow: none; }
    .tfx-map-page.planner-open { padding-left: 0; }
    .tfx-map-page.planner-open .tfx-map-search { left: 10px; width: calc(100% - 22px); }
    .tfx-map-page.planner-open .leaflet-top.leaflet-left { left: 0; }
    .tfx-plan-toggle-wrap { display: none; }
    #tfxModeMap { display: none; }
}
