/* ===== 전체 레이아웃 설정 ===== */

html,
body {
    height: 100%
}

body {
    margin: 0;
    background: #bfe1f2;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue',
        'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    color: #0f172a
}


.layout {
    display: flex;
    height: 100vh;
    overflow: hidden
}

body.noscroll {
    overflow: hidden
}

/* ===== 왼쪽 사이드바 ===== */
.sidebar {
    width: 240px;
    background: #243447 linear-gradient(180deg, #223140, #1a2530);
    color: #cfe5ff;
    padding: 12px;
    position: relative;
    box-shadow: 6px 0 18px rgba(0, 0, 0, .12);
    z-index: 200;
}

.card {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 4px;
    padding: 6px 8px;
    margin-bottom: 7px
}

.title {
    color: #9fd0ff;
    font-weight: 500;
    font-size: 12px;
    margin-bottom: 6px;
    margin-top: 2px
}

.row {
    display: flex;
    gap: 8px;
    align-items: center
}

/* 메인 버튼 스타일 - 색상별 구분 */
.btn {
    flex: 1;
    border: 0;
    border-radius: 6px;
    padding: 0 5px;
    /* 좌우만 여백 */
    font-weight: 500;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 30px;
    line-height: 1px;
    /* 텍스트를 버튼 높이에 맞춤 */
    text-align: center;
    /* 가로 중앙 */
}


/* 이동경로 버튼 - 파랑 */
.btn.route {
    background: #2e86f6;
    box-shadow: 0 6px 14px rgba(46, 134, 246, .25);
}

.btn.route.active {
    background: #fff !important;
    color: #2e86f6 !important;
    box-shadow: 0 4px 12px rgba(46, 134, 246, .2);
}

/* 방문지 버튼 - 초록 */
.btn.visit {
    background: #10b981;
    box-shadow: 0 6px 14px rgba(16, 185, 129, .25);
}

.btn.visit.active {
    background: #fff !important;
    color: #10b981 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, .2);
}

/* 축제 버튼 - 보라 */
.btn.festival {
    background: #8b5cf6;
    box-shadow: 0 6px 14px rgba(139, 92, 246, .25);
}

.btn.festival.active {
    background: #fff !important;
    color: #8b5cf6 !important;
    box-shadow: 0 4px 12px rgba(139, 92, 246, .2);
}


/* 통계 버튼 - 주황 */
.btn.stats {
    background: #30818d;
    box-shadow: 0 6px 14px rgba(11, 72, 4, 0.25);
}

.btn.stats.active {
    background: #fff !important;
    color: #30818d !important;
    box-shadow: 0 6px 14px rgba(11, 72, 4, 0.25);
}

/* 톱니바퀴(설정) 버튼 */
.gear-btn {
    width: 30px;
    height: 30px;
    border-radius: 41px;
    border: 1px solid rgba(0, 0, 0, 0);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.gear-btn[data-panel="route"] {
    background: #2e86f6;
    /* 초록색 */
}

.gear-btn[data-panel="visit"] {
    background: #10b981;
    /* 초록색 */
}

.gear-btn[data-panel="festival"] {
    background: #8b5cf6;
    /* 초록색 */
}

/* 드롭다운 선택 상자 */
.select {
    width: 100%;
    height: 34px;
    border-radius: 10px;
    background: #0f172a;
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, .15);
    padding: 0 8px;
    margin: 3px 0;
    font-size: 12px;
    font-weight: 700;
    outline: none;
}

.select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, .25)
}

/* ===== 메인 지도 영역 ===== */
main {
    position: relative;
    flex: 1
}

canvas {
    display: block
}

/* ===== 슬라이드 패널들 ===== */
.drawer {
    position: absolute;
    top: 14px;
    left: -120px;
    width: 300px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 16px 0 40px rgba(0, 0, 0, .22);
    transform: translateX(-120%);
    opacity: 1;
    pointer-events: none;
    transition: transform .90s cubic-bezier(.22, .85, .23, 1), opacity .60s ease;
    z-index: 199;
    overflow: hidden;
    max-height: calc(100vh - 28px);
    display: flex;
    flex-direction: column;
}

.drawer.open {
    left: 1px;
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}


/* 패널 헤더 - 기능별 색상 */
.dv-head {
    color: #fff;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    height: 20px;
}

.dv-head.route {
    background: #2e86f6;
}

.dv-head.visit {
    background: #10b981;
}

.dv-head.festival {
    background: #8b5cf6;
}

.dv-head.stats {
    background: #f97316;
}

.dv-title {
    font-weight: 600;
    font-size: 16px
}

/* 닫기 버튼 */
.dv-close {
    margin-left: auto;
    width: 30px;
    height: 26px;
    border-radius: 8px;
    background: #111;
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer
}

/* 패널 본문 */
.dv-body {
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    overflow: auto;
}

/* 단일 컬럼 레이아웃 (방문지/축제용) */
.dv-body.single-column {
    grid-template-columns: 1fr;
}

/* 상단 컨트롤 바 */
.topbar {
    grid-column: 1/-1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f5fb;
    border: 1px solid #e3edf9;
    border-radius: 10px;
    padding: 8px
}

.mini {
    font-size: 12px;
    color: #64748b
}

/* 작은 칩 버튼들 */
.chip-btn {
    padding: 6px 16px;
    /* 좌우 여백 늘림 */
    border-radius: 6px;
    border: 1px solid #c8d6ee;
    background: #0f172a;
    color: #fff;
    font-size: 11px;
    /* 글자 크기 키움 */
    font-weight: 300;
    cursor: pointer;
    height: 30px;
    /* 버튼 높이 */
    width: auto;
    /* 자동 너비 (300px 고정 삭제) */
    min-width: 80px;
    /* 최소 너비 */
}

.chip-btn.gray {
    background: #6b7280;
}


/* ===== 연도별 월 선택 컴포넌트 ===== */
.year-card {
    background: #f7fafc;
    border: 1px solid #e5edf6;
    border-radius: 12px;
    padding: 6px
}

.y-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px
}

.y-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eaf2ff;
    border: 1px solid #d7e3f7;
    border-radius: 999px;
    padding: 5px 6px;
    font-weight: 600;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
}

.master {
    width: 16px;
    height: 16px
}

.months-box {
    background: #ffffff;
    border: 1px solid #e8edf5;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .08)
}

.months {
    display: grid;
    grid-template-columns: 20px 1fr 22px;
    gap: 6px 8px;
    align-items: center
}

.m-check {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid #057390;
    background: #e5e5e5;
    position: relative;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08)
}

.m-check:checked {
    background: #2731ab;
    border-color: #2f2f2f
}

.m-check:checked::after {
    content: "✓";
    color: #fff;
    font-weight: 500;
    font-size: 11px;
    position: absolute;
    inset: 0;
    line-height: 16px;
    text-align: center
}

.m-pill {
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 11px;
    font-weight: 500;
    color: #4b5563;
    background: linear-gradient(180deg, #eef5ff 0%, #e2ecfb 100%);
    border: 1px solid #d5e2f7;
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 1px 2px rgba(15, 23, 42, .06);
    cursor: pointer;
}

.m-chip {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1px solid #c7d5e8;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .16);
    cursor: pointer;
    transition: transform .08s ease
}

.m-chip:hover {
    transform: translateY(-1px)
}

/* ===== 하단 컨트롤 영역 ===== */
.control {
    grid-column: 1/-1;
    background: #fff;
    border: 1px solid #e6edf8;
    border-radius: 12px;
    padding: 12px
}

.range {
    width: 100%;
    accent-color: #2ea0f6
}

.percent {
    text-align: center;
    margin-top: 6px;
    color: #475569;
    font-weight: 500;
    font-size: 12px
}

.act {
    width: 100%;
    padding: 10px 0;
    border: 0;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
    cursor: pointer;
    margin-top: 10px;

}

.act+.act {
    margin-top: 16px
}

.save {
    background: linear-gradient(180deg, #12acb6, #000000)
}

.load {
    background: linear-gradient(180deg, #1c529b, #000000)
}


/* ===== 카드 스타일 ===== */
.p-card {
    grid-column: 1/-1;
    background: #f8fafc;
    border: 1px solid #e7eef8;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px
}

.ipt,
.sel {
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid #dbe3f2;
    background: #fff
}

.lab {
    font-size: 12px;
    color: #475569;
    margin-bottom: 6px;
    display: block
}

/* ===== 색상 팔레트 팝오버 ===== */
.palette {
    position: fixed;
    display: none;
    grid-template-columns: repeat(4, 24px);
    grid-template-rows: repeat(4, 24px);
    gap: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, .15);
    z-index: 9999;
}

.p-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
    cursor: pointer;
    transition: all 0.2s ease;
}

.p-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}

/* ===== 알림 메시지 ===== */
/* 공통 */
.note {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 16px;
    border-radius: 10px;
    color: #fff;
    font-weight: 500;
    font-size: 13px;
    box-shadow: 0 12px 30px rgba(16, 185, 129, .28);
    animation: slideDown .2s ease-out;
    z-index: 9999;
}

/* 채널별 색상 */
.note.route {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8)
}

/* 이동경로 = 파랑 */
.note.fest {
    background: linear-gradient(135deg, #ab5df7, #4b0490)
}

/* 이동경로 = 파랑 */
.note.visit {
    background: linear-gradient(135deg, #10b981, #059669)
}

/* 방문지   = 초록 */
.note.err {
    background: linear-gradient(135deg, #ef4444, #dc2626)
}

/* 에러     = 빨강 */
.note.info {
    background: linear-gradient(135deg, #717171, #212121)
}

/* 기타/정보 = 회청 */

/* 애니메이션 (기존과 동일하게) */
@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0
    }

    to {
        transform: translateY(0);
        opacity: 1
    }
}

@keyframes slideUp {
    to {
        transform: translateY(-10px);
        opacity: 0
    }
}


.highlight {
    font-weight: 800;
    /* 굵게 */
    color: #2563eb;
    /* 파랑 */
    background: #e0f2fe;
    /* 연한 배경 */
    padding: 0 4px;
    /* 양옆 여백 */
    border-radius: 4px;
    /* 둥근 모서리 */
}

.topbar {
    grid-column: 1/-1;
    display: flex;
    flex-direction: column;
    /* 위쪽과 아래쪽을 세로 배치 */
    background: #f0f5fb;
    border: 1px solid #e3edf9;
    border-radius: 10px;
    padding: 8px;
    gap: 6px;
    /* 위/아래 간격 */
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    /* 색상/버튼 간격 */
}

.topbar-text {
    font-size: 12px;
    color: #374151;
    text-align: center;
}


.alpha-row {
    display: flex;
    align-items: center;
    /* 세로 가운데 정렬 */
    gap: 4px;
    /* 요소 간격 */
    margin: 8px 3px;
    /* 좌우·상하 여백 */
    margin-top: -5px;
    margin-bottom: -1px;
}

.alpha-row .mini {
    flex: 0 0 auto;
    margin-right: 1px;
    /* 투명도 오른쪽 여백 */
}

.alpha-row .range {
    flex: 1;
    /* 슬라이더는 가로로 늘어나기 */
}

.alpha-row .percent {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin-top: -2px;
}

.logo-container {
    text-align: center;
    /* 가로 가운데 정렬 */
    margin: 7px 0;
    /* 위아래 여백 */
}

.logo {
    width: 120px;
    height: 38px;
    display: inline-block;
    /* text-align:center 적용 가능하게 */
    margin-top: -12px;
    margin-bottom: 2px;
}

.zoom-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 3px 5px 3px;
    background: #2c3a4b;
    /* 어두운 카드 배경과 어울리게 */

    border-radius: 8px;
}

.zoom-bar button {
    width: 23px;
    height: 23px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(180deg, #3b82f6, #1e40af);
    /* 파랑 계열 */
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.zoom-bar button:hover {
    background: linear-gradient(180deg, #2563eb, #1e3a8a);
    transform: scale(1.05);
}

.zoom-bar input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #4b5563;
    /* 트랙 색상 (회색) */
    border-radius: 4px;
    outline: none;
}

/* 슬라이더 트랙 */
.zoom-bar input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: linear-gradient(90deg, #60a5fa, #2563eb);
    border-radius: 4px;
}

/* 슬라이더 손잡이 */
.zoom-bar input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #2563eb;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: -4px;
    /* 손잡이를 트랙 중앙에 오게 */
}

.zoom-bar input[type="range"]::-webkit-slider-thumb:hover {
    background: #2563eb;
    border-color: #fff;
}

#scaleBarContainer {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    font-family: Pretendard, sans-serif;
    text-align: right;
    /* ✅ 전체 오른쪽 정렬 */
}

#scaleLabel {
    font-size: 12px;
    font-weight: 600;
    color: #111;
    margin-bottom: 2px;
}

#scaleCanvas {
    width: 120px;
    height: 14px;
    display: block;
    margin-left: auto;
    /* ✅ 오른쪽 붙이기 */
    margin-bottom: 2px;
}

.copyright {
    font-size: 11px;
    font-weight: 600;
    color: #666;
}

#symbolCanvas {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 20;
    pointer-events: none;
    /* 이벤트는 메인 canvas가 받음 */
}

/* ===== Population Legend (CSS) ===== */
/* 제목 헤더 */
.legend-head {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin: 10px 0 8px 0px;
    font-family: Pretendard, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

.legend-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 3px;
    letter-spacing: .2px;
}

.legend-unit {
    font-weight: 400;
    font-size: 12px;
    opacity: .9;
}

/* 레벨별 제목 색 (시안/핑크/레드 톤) */
.legend-title.sido {
    color: #e54b4b;
}

.legend-title.sgg {
    color: #2b9ad4;
}

.legend-title.emd {
    color: #ff69b4;
}

#population-legend .legend-body>div {
    margin: 0px 22px 4px 10px;
}

/* ================= Legend (image + labels) ================= */
.legend-image {
    /* ---- 조절 노브 ---- */
    --img-bottom-gap: 7px;
    /* 배경이미지 아래 여백 */
    --inset-top: 3px;
    /* 라벨 상단 시작 위치 (막대 첫줄과 맞춤) */
    --inset-side: 14px;
    /* 좌우 여백 */
    --row-h: 22px;
    /* 각 막대(라벨) 높이 */
    --row-gap: 8.5px;
    /* 막대 사이 간격 */
    --inset-bottom: 29px;
    /* ⬅︎ 아래쪽 여백(필요시 10~20px로 조절) */

    width: 213px;
    height: 208px;
    /* 배경 막대 이미지 background: rgb(241,241,241); */

    background-image: none !important;
    background-repeat: no-repeat;
    background-position: top center;
    background-size: 100% calc(100% - var(--img-bottom-gap));
    position: relative;
    /* 기존 레이아웃 유지용 마진 (필요 없으면 삭제) */
    margin-left: 6px;
    box-sizing: border-box;
    /* 테두리 포함하여 폭 계산 */
}



/* 위 배경 (원본) */
.legend-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--legend-url);
    background-repeat: no-repeat;
    background-position: top center;
    background-size: 100% calc(100% - var(--img-bottom-gap, 0px));
    opacity: var(--bg-alpha, 1);
    background: url("img/popu_legend.png") no-repeat top center;
    background-size: 100% 100%;
    z-index: 1;
    pointer-events: none;
    /* 클릭 차단 */
}

.legend-bars,
.legend-labels {
    position: absolute;
    top: var(--inset-top);
    right: var(--inset-side);
    left: var(--inset-side);
    bottom: var(--inset-bottom);
    /* ⬅︎ ① 아래쪽 여백 */
}

/* 라벨 컨테이너: 7개 그리드로 정확히 배치 */
.legend-labels {
    display: grid;
    grid-template-rows: repeat(7, var(--row-h));
    gap: var(--row-gap);
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 20;
}


/* 기본 라벨(검정 + 흰 외곽선 링) */
/* 기본 라벨(검정 + 흰 외곽선 링) */
.legend-labels li {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 0;
    text-align: center;

    font-weight: 900;
    /* 600~700 권장 (너무 두꺼우면 흐릿) */
    font-size: 13px;
    /* 15~16px 사이에서 정수로 */
    line-height: var(--row-h);
    letter-spacing: 0;
    /* -값은 흐릿해짐 */

    color: #111;
    /* 본문: 검정 */

    /* 선명한 흰 외곽선 – 0 blur, 4방향 1px 링 */
    text-shadow:
        -1px 0 0 #fff, 1px 0 0 #fff,
        0 -1px 0 #fff, 0 1px 0 #fff;

    /* 렌더링 힌트 (브라우저별 효과 다름) */
    -webkit-font-smoothing: auto;
    text-rendering: optimizeSpeed;
}

/* 상단 3개: 빨강 + 같은 외곽선 (지정 클래스로 적용 중이라면 이 규칙이 덮어씀) */
.legend-labels li.legend-label--bright {
    color: #b42424 !important;
    /* #ef4444 / #dc2626 등 취향대로 */
}

/* 여행경로보기 하면서 추가 */
.m-pill.disabled {
    opacity: 0.2;
    /* 흐리게 */
    pointer-events: none;
    /* 클릭 막기 */
}

.m-chip.disabled {
    opacity: 0.1;
    /* 흐리게 */
    pointer-events: none;
    /* 클릭 막기 */
}

/* 비활성화 상태 */
.gear-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
    /* 클릭 불가 */
    filter: grayscale(0.2);
}

/* ✅ 체크박스 비활성화 상태 */
.m-check:disabled {
    background: #e4e4e4 !important;
    border-color: #e4e4e4 !important;
    cursor: not-allowed;
    opacity: 0.4;
}

/* 토글 전체 */
.mainmap-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    /* 토글과 텍스트 간격 */
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    justify-content: center;
}

/* 체크박스 숨기기 */
.mainmap-toggle input {
    display: none;
}

/* 토글 바탕 */
.mainmap-toggle .slider {
    position: relative;
    width: 40px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    transition: background 0.3s;
}

/* 토글 동그라미 */
.mainmap-toggle .slider::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

/* 체크되었을 때 배경색/위치 변경 */
.mainmap-toggle input:checked+.slider {
    background: #f63b3b;
    /* 파랑 */
}

.mainmap-toggle input:checked+.slider::before {
    transform: translateX(20px);
}

/* 텍스트 */
.mainmap-toggle .label-text {
    user-select: none;
}



/* 기본은 숨김 */
#population-legend {
    display: none;
}

/* 보일 때만 */
#population-legend.is-visible {
    display: block;
}

/* 혹시 스타일 충돌이 있으면 !important 추가 */
#population-legend.is-hidden {
    display: none !important;
}




@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -100%)
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0)
    }
}

@keyframes slideUp {
    to {
        opacity: 0;
        transform: translate(-50%, -100%)
    }
}



/* ===== Tooltip 스타일 ===== */
.tooltip-box {
    background: linear-gradient(135deg, #fffbe6, #f9fcbf);
    color: #333;
    padding: 16px 18px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    border: 1px solid #999;
    position: relative;
    width: 280px;
    font-family: 'Segoe UI', Pretendard, sans-serif;
    transition: all 0.2s ease-in-out;
}

.tooltip-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
}

.tooltip-icon {
    flex-shrink: 0;
    margin-right: 6px;
    font-size: 18px;
    margin-top: 2px;
    line-height: 1.2;
}

.tooltip-title {
    font-weight: bold;
    font-size: 16px;
    color: #034f84;
    word-break: keep-all;
    line-height: 1.2;
}

.tooltip-content {
    font-size: 14px;
}

.total-population {
    display: none;
    /* 전체 인구 카드 숨김 */
}

/* 통합 진행바 스타일 */
.progress-container {
    margin-top: 20px;
    height: 40px;
    background: rgba(255, 255, 255, 0.4);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(3, 79, 132, 0.15);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.combined-progress {
    position: relative;
    margin-bottom: 8px;
}

.combined-bar {
    width: 100%;
    height: 24px;
    margin-top: 17px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.1),
        0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
}

.combined-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
    border-radius: 12px 12px 0 0;
    z-index: 1;
}

.combined-segment {
    height: 100%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.3);
}

.combined-segment::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, transparent 100%);
    border-radius: 12px 12px 0 0;
}

.male-segment {
    background: linear-gradient(145deg, #4dabf7 0%, #339af0 50%, #228be6 100%);
    border: 1px solid #1c7ed6;
    border-radius: 12px 0 0 12px;
}

.female-segment {
    background: linear-gradient(145deg, #ff6b6b 0%, #ff5252 50%, #f03e3e 100%);
    border: 1px solid #e03131;
    border-radius: 0 12px 12px 0;
}

/* 막대바 위 전체 정보 */
.total-overlay {
    position: absolute;
    top: -43px;
    width: 130px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 13px;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
}

.population-icon {
    font-size: 14px;
}

/* 막대바 위 개별 정보 */
.segment-overlay {
    position: absolute;
    top: 1px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    z-index: 10;
    pointer-events: none;
}

.male-overlay {
    left: 25%;
    transform: translateX(-50%);
}

.female-overlay {
    right: 25%;
    transform: translateX(50%);
}

.segment-count {
    padding: 3px 6px;
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 2px;
}

#tipMale {
    margin-top: 0px;
    margin-left: 15px;
}

#tipFemale {
    margin-top: 0px;
    margin-right: 15px;
}

.segment-percent-Male {
    background: rgba(216, 239, 255, 0.58);
    width: 33px;
    color: rgb(46, 46, 46);
    padding: 3px 1px 4px 5px;
    border-radius: 26px;
    margin-top: -22px;
    margin-right: 88px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    left: 7px;
}

.segment-percent-Female {
    background: rgba(216, 239, 255, 0.58);
    width: 33x;
    color: rgb(46, 46, 46);
    padding: 3px 1px 4px 5px;
    border-radius: 26px;
    margin-top: -22px;
    margin-left: 92px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    left: 7px;
}

/* 하단 범례 */
.legend {
    font-family: pretendard;
    font-size: 10.5px;
    font-weight: 500;

}

.legend-item-male {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: -53px;
    margin-left: -1px;
}

.legend-item-female {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: -12px;
    margin-left: 227px;
    width: 44px;
}

.legend-dot-male {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.legend-dot-female {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.legend-male {
    background: linear-gradient(145deg, #4dabf7, #339af0);
}

.legend-female {
    background: linear-gradient(145deg, #ff6b6b, #ff5252);
}

/* 마켓데이터 섹션 */
.market-section {
    margin-top: 10px;
}

.market-title {
    font-weight: bold;
    font-size: 14px;
    color: #034f84;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.market-note {
    font-size: 11px;
    color: #666;
    font-style: italic;
    margin-top: -24px;
    margin-left: 161px;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.market-note2 {
    font-size: 12px;
    color: #2b2b2b;
    font-style: italic;
    font-weight: 600;
    margin-top: 1px;
    margin-left: 1px;
    margin-bottom: -5px;
    letter-spacing: -0.5px;
}

/* ============================================
     테이블 헤더 스타일
     ============================================ */

.tooltip-table {
    width: 100%;
    /* 🔧 테이블이 넘치지 않도록 자동 폭 레이아웃 사용 */
    table-layout: auto;
    /* 🔧 최대 폭 제한 (툴팁 크기에 맞춤) */
    max-width: 100%;
    border-collapse: collapse;
    font-family: "Pretendard", sans-serif;
    font-size: 11px;
}

.tooltip-table thead {
    background-color: #004a7a;
    color: #fff;
}

.tooltip-table th {
    padding: 4px 2px;
    /* 🔧 헤더 텍스트 정렬 */
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid #ccc;
    /* 🔧 텍스트가 줄바꿈되도록 설정 */
    white-space: normal;
    word-break: break-word;
}

/* ============================================
     순위 열 (첫 번째 열) - 이 부분을 좁게 설정!
     ============================================ */


.tooltip-table td:first-child {
    /* 🔧 순위 열 데이터 칸도 동일하게 좁게 */
    width: 16px;

    background-color: #c1eef0;
    color: darkblue;
    font-weight: 600;
    text-align: center;
    padding: 2px 2px;
    border: 1px solid #ddd;
}

/* ============================================
     상품 열들 (2, 3, 4번째 열) - 동등하게 배분
     ============================================ */

.tooltip-table td:nth-child(2),
.tooltip-table td:nth-child(4) {
    /* 🔧 상품 열 동일 폭 설정 */
    width: 62px;
    /* min-width: 70px; */
    text-align: center;
    padding: 2px 2px;
    background-color: #f5f9ff;
    border: 1px solid #ddd;

    /* 🔧 2줄 제한 및 ... 표시 (수정된 방식) */
    line-height: 1.2;
    overflow: hidden;

    word-break: break-word;
    overflow-wrap: break-word;
}

.tooltip-table td:nth-child(3) {
    width: 47px;
    text-align: center;
    padding: 2px 2px;
    background-color: #f5f9ff;
    border: 1px solid #ddd;

    /* 🔧 2줄 제한 및 ... 표시 (수정된 방식) */
    line-height: 1.2;
    overflow: hidden;

    word-break: break-word;
    overflow-wrap: break-word;
}

/* ============================================
     순위 뱃지 스타일
     ============================================ */

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 🔧 뱃지 크기 축소 (24px → 20px) */
    width: 15px;
    height: 15px;
    border-radius: 50%;
    color: #fff;
    font-weight: 800;
    /* 🔧 폰트 크기 줄임 */
    font-size: 10px;
    flex-shrink: 0;
}

.rank-1 {
    background: #eab308;
}

/* gold */
.rank-2 {
    background: #7086ad;
}

/* silver */
.rank-3 {
    background: #733f1b;
}

/* bronze */


.product-name {
    display: block;
    font-weight: 500;
    color: #333;
}

.product-size {
    display: block;
    font-size: 10px;
    color: #666;
    margin-top: 2px;
}


#symbolTooltip {
    position: absolute;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#symbolTooltip.show {
    z-index: 9999;
    opacity: 1;
    transform: scale(1);
}

/* 패널 기본 스타일 */
.side-panel {
    position: fixed;
    top: 0;
    right: -700px;
    /* 처음에는 숨김 */
    width: 700px;
    height: 100%;
    background: #fff;
    box-shadow: -3px 0 6px rgba(0, 0, 0, 0.2);
    transition: right 0.4s ease;
    /* 부드러운 슬라이드 */
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

/* 패널 활성화 상태 */
.side-panel.active {
    right: 0;
    /* 슬라이드 인 */
}

/* iframe은 패널 내부 꽉 채움 */
.side-panel iframe {
    flex: 1;
    width: 100%;
    border: none;
}

/* 닫기 버튼 */
#closePanel {
    position: absolute;
    left: -40px;
    top: 4%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.39);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 패널 열릴 때 닫기 버튼 표시 */
.side-panel.active #closePanel {
    opacity: 1;
    pointer-events: auto;
}

/* 닫기 버튼 hover 효과 */
#closePanel:hover {
    background: rgba(0, 3, 120, 0.46);
    transform: translateY(-50%) scale(1.1);
}


/* ===================================
   여행 방문지 툴팁 스타일 (마켓 툴팁 방식)
   =================================== */
/* ===== 여행방문지 Tooltip 스타일 ===== */
.visit-tooltip {
    position: absolute;
    transform: translate(-50%, -100%);
    /* 중심기준 + 위로 */
    pointer-events: none;
    z-index: 190;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 4px 20px;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    font-size: 14px;
    min-width: 150px;
    max-width: 240px;
    /* 💡 너무 커지지 않게 제한 */
    word-wrap: break-word;
    /* 텍스트 줄바꿈 허용 */
    
    /* ✅ 추가 부분 */
    text-align: center; 
    /* 텍스트 가운데 정렬 */
    display: flex;
    /* 내부 컨텐츠 수평정렬 */
    flex-direction: column;
    /* 세로 방향 정렬 */
    align-items: center;
    /* 아이콘+텍스트 수평 가운데 */
    justify-content: center;
    /* 세로 방향 가운데 */
}

.visit-tooltip-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 0;
    margin-left: -12px;
    line-height: 1.2;
}

.visit-tooltip-date {
    margin-left: 7px;
    font-size: 12px;
    opacity: 0.9;
    font-weight: 400;
}