/* ─────────── 페이지 기본 ─────────── */
html, body { margin: 0; padding: 0; height: 100%;
             font-family: "맑은 고딕", system-ui, sans-serif; overflow: hidden; }

/* ─────────── 좌측 컨트롤 패널 ─────────── */
#panel {
    position: absolute; top: 10px; left: 10px; z-index: 10;
    background: rgba(255,255,255,0.96); padding: 12px 14px; border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25); font-size: 13px;
    width: 500px; max-height: 92vh; overflow-y: auto;
}
#panel h3 { margin: 0 0 6px 0; font-size: 14px; }
#panel h4 { margin: 12px 0 4px 0; font-size: 12.5px; color: #444;
            border-top: 1px solid #eee; padding-top: 10px; }
.sub { color: #666; font-size: 12px; margin-bottom: 8px; line-height: 1.5; }
#fileInput { width: 100%; margin-top: 4px; }

/* ─────────── 지도 종류 토글 버튼 ─────────── */
.mapTypeRow { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.mapTypeRow .mtLabel { font-size: 11.5px; color: #555;
                        margin-right: 4px; white-space: nowrap; }
.mapTypeRow button {
    flex: 1; padding: 5px 8px; font-size: 12px; cursor: pointer;
    background: #fff; color: #1976d2; border: 1px solid #1976d2;
    border-radius: 4px;
}
.mapTypeRow button.active { background: #1976d2; color: #fff; }

/* ─────────── 상단 통계 박스 (총/표시/중복/스킵/수정) ─────────── */
.stat { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.stat > div { flex: 1; padding: 4px 6px; background: #f0f3f7;
              border-radius: 5px; text-align: center; font-size: 11.5px;
              min-width: 60px; }
.stat b { font-size: 14px; }

/* ─────────── 로그 출력 영역 ─────────── */
#log { margin-top: 8px; max-height: 130px; overflow-y: auto;
       border-top: 1px solid #eee; padding-top: 6px; font-size: 11.5px;
       line-height: 1.5; }
#log .ok  { color: #1a7f37; }      /* 성공 메시지 */
#log .err { color: #c0392b; }      /* 오류 메시지 */
#log .muted { color: #888; }       /* 일반 안내 */

/* ─────────── 수정 내역 박스 (마커 드래그한 기록) ─────────── */
#editList { max-height: 180px; overflow-y: auto; font-size: 11.5px;
            line-height: 1.55; background: #fffbe6; border: 1px solid #f3e08a;
            border-radius: 5px; padding: 6px 8px; }
#editList:empty::before { content: "마커를 드래그하면 여기에 수정 내역이 표시됩니다.";
                           color: #999; font-style: italic; }
#editList .row { padding: 2px 0; border-bottom: 1px dashed #e9d77d; }
#editList .row:last-child { border-bottom: none; }
#editList .name { font-weight: bold; color: #b35900; }
#editList .delta { color: #555; font-size: 10.5px; }

/* ─────────── 패널 하단 버튼들 ─────────── */
.btnrow { display: flex; gap: 6px; margin-top: 6px; }
.btnrow button {
    flex: 1; padding: 6px 10px; font-size: 12px; cursor: pointer;
    background: #1976d2; color: #fff; border: none; border-radius: 5px;
}
.btnrow button:disabled { background: #b0b6c0; cursor: not-allowed; }
.btnrow button.secondary { background: #fff; color: #1976d2;
                            border: 1px solid #1976d2; }

/* ─────────── 선택한 마커 정보 박스 ─────────── */
#markerInfo {
    background: #f4f9ff; border: 1px solid #d0e0f5;
    border-radius: 6px; padding: 10px 12px; margin-top: 4px;
    font-size: 12px; line-height: 1.55;
}
#miContent.empty { color: #999; font-style: italic; }
#miContent .miTitle { font-weight: bold; font-size: 14px;
                      color: #1976d2; word-break: keep-all; }
#miContent .miAddr { color: #444; margin-bottom: 2px; word-break: keep-all; }
#miContent .miExcelNote {
    color: #888; font-size: 11px; margin: 0 0 6px 0; line-height: 1.35;
}
/* ─ 장비 정보를 엑셀 표처럼 보여주는 테이블 ─
   border-collapse 로 셀 사이 빈틈을 없애고, 각 셀에 1px 회색 테두리.
   th(머리줄)는 엑셀 헤더처럼 약간 회색 배경.
   패널 폭 안에만 맞춤(가로 스크롤 없음) — table-layout:fixed + colgroup */
#miContent .miTableWrap {
    margin-top: 6px;
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
}
#miContent .miTable {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 10px;
}
#miContent .miTable col.miW-year { width: 9%; }
#miContent .miTable col.miW-biz { width: 18%; }
#miContent .miTable col.miW-type { width: 28%; }
#miContent .miTable col.miW-fac { width: 17%; }
#miContent .miTable col.miW-open { width: 14%; }
#miContent .miTable col.miW-fims { width: 14%; }
#miContent .miTable .miFimsBtns {
    display: flex; flex-wrap: wrap; gap: 3px; justify-content: center;
    align-items: center; padding: 1px 0;
}
#miContent .miTable .miFimsBtns button.fims-file-btn {
    padding: 2px 5px; font-size: 9px; cursor: pointer; border-radius: 3px;
    border: 1px solid #1565c0; background: #fff; color: #1565c0;
    line-height: 1.2; white-space: nowrap;
}
#miContent .miTable .miFimsBtns button.fims-file-btn:hover {
    background: #e3f2fd;
}
#miContent .miTable .miFimsBtns button.fims-file-btn:disabled {
    opacity: 0.45; cursor: not-allowed;
}
#miContent .miTable th,
#miContent .miTable td {
    border: 1px solid #b6c6d8; padding: 2px 3px; text-align: center;
    vertical-align: middle;
    background: #fff;
    word-break: break-word;
    overflow-wrap: break-word;
}
#miContent .miTable td.miYear {
    white-space: nowrap;
}
#miContent .miTable td.miWrap { white-space: normal; word-break: keep-all; }
/* 시설일·개통일: 한 줄 유지(패널 안 폭은 colgroup 비율로 확보) */
#miContent .miTable th.miDate,
#miContent .miTable td.miDate {
    white-space: nowrap;
    min-width: 0;
    font-size: 9.5px;
    letter-spacing: -0.02em;
    box-sizing: border-box;
}
#miContent .miTable th {
    background: #e8eef7; color: #333; font-weight: bold;
}
/* 각 칸 색상 — 연도: 올해 숫자면 파랑, 아니면 회색 */
#miContent .miTable td.miYearThis { color: #1565c0; font-weight: bold; }
#miContent .miTable td.miYearOther { color: #888; font-weight: normal; }
#miContent .miTable th.miTypeCol,
#miContent .miTable td.miType {
    color: #666;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 클릭하면 그 셀의 값만 클립보드 복사. hover 시 노란 배경. */
#miContent .copyable { cursor: pointer; transition: background .15s; }
#miContent .copyable:hover { background: #ffe9a8 !important;
                              outline: 1px dashed #b35900; }

/* ─────────── 검색 입력창 / 결과 목록 ─────────── */
.searchRow { display: flex; gap: 6px; margin-top: 4px; }
.searchRow input[type=text] { flex: 1; padding: 5px 8px;
                               border: 1px solid #ccc; border-radius: 4px;
                               font-size: 12.5px; }
.searchRow button { padding: 5px 12px; background: #1976d2; color: #fff;
                     border: none; border-radius: 4px; cursor: pointer;
                     font-size: 12px; }
#nameSearch { width: 100%; box-sizing: border-box; padding: 5px 8px;
              border: 1px solid #ccc; border-radius: 4px;
              font-size: 12.5px; margin-top: 4px; }
#addrResults, #nameResults {
    margin-top: 4px; max-height: 180px; overflow-y: auto;
    border: 1px solid #e3e5ea; border-radius: 4px;
    background: #fafbfc; font-size: 11.5px; line-height: 1.45;
}
#addrResults:empty, #nameResults:empty { display: none; }
#addrResults .resItem {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}
.resItem { padding: 5px 8px; cursor: pointer; border-bottom: 1px solid #eee;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resItem:last-child { border-bottom: none; }
.resItem:hover { background: #e8f0fe; }
.resItem .gv { color: #b35900; font-weight: bold; }
.resItem .nm { color: #1a73e8; }
.resItem .ad { color: #666; }

/* 주소 검색: 상단 주소 + 국소명 검색과 같은 톤의 국소 블록 */
#addrResults .resItem .addrTopLine {
    display: block;
    color: #444;
    font-size: 11.5px;
    line-height: 1.45;
    word-break: keep-all;
}
#addrResults .resAddrNearSites {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #e3e5ea;
}
#addrResults .resAddrSiteRow { margin-top: 6px; }
#addrResults .resAddrSiteRow:first-child { margin-top: 0; }

#addrResults .addrRefSectionTitle {
    font-size: 11.5px;
    font-weight: bold;
    color: #444;
    padding: 8px 8px 4px 8px;
    margin: 0;
    border-top: 1px solid #dde4ee;
    background: #f4f7fb;
    cursor: default;
}
#addrResults .addrKakaoLoading {
    color: #888;
    font-style: italic;
    cursor: default;
}

/* ─────────── 지도 영역 (전체 화면을 채움) ─────────── */
#map { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }

/* ─────────── 짧은 알림 토스트 메시지 ─────────── */
.toast {
    position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%);
    background: rgba(0,0,0,0.82); color: #fff; padding: 8px 14px;
    border-radius: 6px; font-size: 13px; z-index: 100;
    opacity: 0; transition: opacity .25s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ─ 연도·사업구분 필터 (지도 마커 + 정보 표 공통) ─ */
.filterPanel {
    margin-top: 6px; padding: 8px 10px;
    background: #f8fafc; border: 1px solid #dde4ee; border-radius: 6px;
    font-size: 11.5px;
}
.filterRow {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 6px;
}
.filterRow:first-child { margin-top: 0; }
.filterLbl { font-weight: bold; color: #444; }
.filterAllBtn {
    padding: 2px 8px; font-size: 11px; cursor: pointer;
    background: #fff; color: #1976d2; border: 1px solid #1976d2;
    border-radius: 4px;
}
.filterChecks {
    display: flex; flex-wrap: wrap; gap: 4px 10px;
    max-height: 100px; overflow-y: auto; margin-top: 4px;
    padding: 4px 2px;
}
.filterChecks label {
    display: inline-flex; align-items: center; gap: 3px;
    cursor: pointer; white-space: nowrap;
}
.filterChecks input { margin: 0; cursor: pointer; }

/* 실사서 경로 지정(파일명·UNC 전체경로 목록) */
.fimsListBlock { margin-top: 4px; padding-top: 8px; border-top: 1px solid #eee; }
.fimsListBlock .fimsToolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.fimsListBlock #fimsFileListInput { flex: 1; min-width: 160px; font-size: 12px; }
.fimsListBlock #fimsFileListStatus {
    font-size: 11px; color: #666; line-height: 1.45; margin-top: 6px;
    word-break: break-all;
}
.fimsListBlock .fimsClrBtn {
    padding: 4px 10px; font-size: 11.5px; cursor: pointer; border-radius: 4px;
    background: #fff; color: #1976d2; border: 1px solid #1976d2;
}
