/* ═══════════════════════════════════════════════════════════════
   랜드매니저 — 화면 겹침 막기 (2026-10-13)
   JB 「화면 중앙이.. 전체적으로 체크를 안한거같네」 「전체적으로 사용환경을 잘 체크해야지」
   겹침 전수 검사(7 화면 크기 × 10 상황)에서 나온 것만 고친다. 기존 기능 코드는 건드리지 않는다.
   ═══════════════════════════════════════════════════════════════ */

/* ① 최근 검색 목록을 열면 주황 안내 띠를 숨긴다 (띠가 목록 위를 덮었다 — JB 화면) */
body:has(#floating-search-dropdown.visible) #area-status-msg,
body:has(#floating-search-input:focus) #area-status-msg {
    display: none !important;
}

/* ② 위성 비교의 연도 막대가 검색창을 덮었다 → 검색창 아래로 내리고, 그동안 주황 띠는 숨긴다 */
#compare-year-bar {
    top: 66px !important;
}
body:has(#compare-year-bar[style*="flex"]) #area-status-msg {
    display: none !important;
}

/* ③ PC: 「사용법」 둥근 단추는 오른쪽 도구 패널 맨 아래로 들어갔다 → 떠 있는 단추는 숨긴다
      (규제 구역 범례·도구 패널과 겹치던 것) */
@media (min-width: 769px) {
    body:has(#lm-tool-strip) #lm-tut-help {
        display: none !important;
    }

    /* 지도 오른쪽 아래 범례·출처 표기를 도구 패널 왼쪽으로 비킨다 */
    body:has(#lm-tool-strip) .leaflet-bottom.leaflet-right {
        right: calc(14px + 58px + 10px);
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* ④ PC 가로 화면: 오른쪽 결과 칸이 열리면 검색창·주황 띠·범례를 남은 지도 가운데로 옮긴다
      (결과 칸·도구 패널과 겹치던 것). 태블릿 세로는 결과 칸이 아래 시트라 해당 없음 */
@media (min-width: 769px) and (orientation: landscape) {
    body.sidebar-right-open #floating-search,
    body.sidebar-right-open #area-status-msg {
        left: calc((100vw - 360px - 72px) / 2) !important;
    }
    body.sidebar-right-open.sidebar-left-open #floating-search,
    body.sidebar-right-open.sidebar-left-open #area-status-msg {
        left: calc(340px + (100vw - 340px - 360px - 72px) / 2) !important;
    }
    body.sidebar-right-open:has(#lm-tool-strip) .leaflet-bottom.leaflet-right {
        right: calc(374px + 58px + 10px);
    }

    /* ⑤ 「공지」 단추가 결과 칸 머리줄을 덮었다 → 결과 칸 왼쪽으로 비킨다 */
    body.sidebar-right-open #notice-link {
        right: 375px !important;
    }
}

/* ⑥ 지도 출처 표기(Leaflet · © OpenStreetMap)·범례가 아래 안내 문구(footer 45px)에 가려졌다.
      OSM 은 출처 표기가 보이는 것이 이용 조건이다 → 지도 아래 모서리를 안내 문구 위로 올린다 */
@media (min-width: 769px) {
    .leaflet-bottom {
        bottom: 46px;
    }
    #regulation-panel {
        bottom: 54px !important;
        max-height: min(380px, calc(100vh - 54px - 120px)) !important;
    }
}

/* ⑦ 결과 칸이 열려 검색창을 옮길 때 왼쪽 위 「입력 & 작업」 단추와 겹치지 않게 (태블릿 가로 1180)
      두 칸이 다 열리면 남는 폭에 맞춰 검색창·주황 띠를 줄인다 */
@media (min-width: 769px) and (orientation: landscape) {
    body.sidebar-right-open #floating-search,
    body.sidebar-right-open #area-status-msg {
        left: max(392px, calc((100vw - 360px - 72px) / 2)) !important;
    }
    body.sidebar-right-open.sidebar-left-open #floating-search,
    body.sidebar-right-open.sidebar-left-open #area-status-msg {
        left: calc(340px + (100vw - 340px - 360px - 72px) / 2) !important;
    }
    body.sidebar-right-open.sidebar-left-open #floating-search {
        width: min(480px, calc(100vw - 340px - 360px - 72px - 24px)) !important;
    }
    body.sidebar-right-open.sidebar-left-open #area-status-msg {
        max-width: calc(100vw - 340px - 360px - 72px - 24px) !important;
        white-space: normal !important;
        text-align: center;
    }
}

/* ⑧ 태블릿 세로: 메뉴가 아래 반쪽 시트일 때 오른쪽 도구 패널이 시트 뒤로 반쯤 보였다 → 시트가 열리면 숨긴다 */
@media (orientation: portrait) and (min-width: 769px) and (max-width: 1100px) {
    body.sidebar-left-open #lm-tool-strip,
    body.sidebar-right-open #lm-tool-strip {
        display: none !important;
    }
}

/* ⑨ 폭이 좁으면 아래 안내 문구가 세 줄(59px)로 늘어난다 → 그만큼 더 올린다 (태블릿 세로 820) */
@media (min-width: 769px) and (max-width: 1000px) {
    .leaflet-bottom {
        bottom: 62px;
    }
    #regulation-panel {
        bottom: 70px !important;
    }
}

/* ⑩ 좁은 화면에서 두 칸이 다 열리면 주황 안내 띠가 들어갈 자리가 없다 → 숨긴다 (메뉴 안 지역 표시 줄이 같은 일을 한다) */
@media (max-width: 1400px) {
    body.sidebar-right-open.sidebar-left-open #area-status-msg {
        display: none !important;
    }
}

/* ⑪ (2026-10-17) 위성 비교 막대의 「위치 차이」 안내 줄(z2500 안)이 오른쪽 도구 패널(z1500)의 설명 말풍선을 덮었다
      (태블릿 세로 820). 말풍선은 마우스를 올린 동안만 뜨므로, 그동안만 도구 패널을 막대 위로 올린다 */
#lm-tool-strip:hover {
    z-index: 2600;
}
