/* 1. Global & Layout Styles */
body {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f3f4f6; /* 밝은 회색 배경 */
    display: flex; /* Flexbox 레이아웃 사용 */
    flex-direction: column; /* 세로 방향 정렬 */
    min-height: 100vh; /* 최소 높이를 화면 전체 높이로 설정 */
    overflow: hidden; /* 전체 페이지 스크롤 방지 */
}
/* 스크롤바 디자인 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #e0e0e0; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #888; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* 고정 헤더 */
.header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50; /* 다른 콘텐츠 위에 표시 */
}

/* 메인 콘텐츠 영역 (고정 헤더만큼 패딩 추가) */
.main-content-wrapper {
    padding-top: 70px; /* 헤더 높이만큼 상단 패딩 */
    flex: 1; /* 남은 공간을 모두 차지 */
    display: flex;
    position: relative; /* 오버레이될 사이드바의 기준점 */
    height: calc(100vh - 70px); /* 헤더를 제외한 나머지 화면 높이 */
    overflow: hidden; /* 슬라이드 애니메이션을 위해 추가 */
}

#map-container {
    flex: 1; /* 남은 공간 모두 차지 */
    position: relative; /* 플로팅 UI의 기준점 */
    overflow: hidden;
}

/* 2. Sidebar & Components */
.sidebar {
    position: absolute; /* 오버레이를 위해 absolute 포지션으로 변경 */
    top: 70px;
    left: 0;
    width: 500px; /* [MODIFIED] 사이드바 너비 */
    height: calc(100vh - 70px); /* 헤더를 제외한 나머지 화면 높이 */
    border-right: 1px solid #e5e7eb; /* 오른쪽 테두리 */
    background-color: #fff; /* 흰색 배경 */
    z-index: 45; /* 다른 콘텐츠와의 z-index 순서 */
    display: flex;
    flex-direction: column; /* 자식 요소들을 세로로 정렬 */
    transform: translateX(0); /* 기본값: 보임 */
    transition: transform 0.3s ease-in-out; /* transform 속성에 애니메이션 적용 */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
}

.details-sidebar {
    position: absolute; /* 오버레이를 위해 absolute 포지션으로 변경 */
    top: 70px;
    left: 0;
    width: 420px; /* 너비 고정 */
    height: calc(100vh - 70px);
    background-color: white;
    border-right: 1px solid #e5e7eb;
    z-index: 44; /* 메인 사이드바(45)보다 아래에 오도록 z-index 조정 */
    display: flex;
    flex-direction: column;
    transform: translateX(-100%); /* 기본값: 숨김 */
    transition: transform 0.3s ease-in-out; /* transform 속성에 애니메이션 적용 */
}

.details-sidebar.open {
    transform: translateX(515px); /* [MODIFIED] 500px(너비) + 15px */
}

/* 사이드바 토글 버튼 (기존과 동일) */
.protruding-button {
    position: fixed;
    top: 50%;
    left: 500px; /* [MODIFIED] 사이드바 너비와 동일하게 수정 */
    transform: translateY(-50%);
    z-index: 47; /* 상세 사이드바보다 위에 위치하도록 조정 */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 60px;
    background-color: #4F46E5;
    color: white;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    cursor: pointer;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    transition: left 0.3s ease-in-out;
}

.sidebar-section {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f7f9fc;
    flex-shrink: 0;
}

.section-title {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #555;
    margin-bottom: 12px;
}

.select-wrapper {
    position: relative;
}

.custom-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: white;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.select-wrapper::after {
    content: '▼';
    font-size: 12px;
    color: #555;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.category-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-btn {
    padding: 14px 0;
    font-size: 16px;
    font-weight: 500;
    background-color: #fff;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    text-align: center;
}

.category-btn:hover {
    background-color: #f0f0f0;
}

.category-btn.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: bold;
}

/* 인구 버튼 active색상 변경 */
a.category-btn.active[href="#chart-group"] {
    background-color: #0056B3; /* 예: 초록색 */
    border-color: #0056B3;     /* 테두리색 */
    color: white;
}

/* 3. Item List Styles */
.item-list-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    background-color: #f0f2f5;
    padding: 10px 12px;
    scroll-behavior: smooth; /* 부드럽게 스크롤 */
}

.item-card-group {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #d1d5db;
    background-color: #f9fafb;
    padding: 16px;
    /* display: none; */
}

/* 마지막 자식을 제외한 모든 item-card-group에 아래쪽 여백을 줌 */
.item-card-group:not(:last-child) {
    margin-bottom: 24px;
}

.item-card {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border: 1px solid #e9e9e9;
    margin: 0;
}

.item-card-group .item-card + .item-card {
    margin-top: 12px;
}

.item-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin: 0 0 8px 0;
}

.item-description {
    font-size: 14px;
    color: #666;
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.item-location {
    font-size: 13px;
    color: #888;
}

.summary-card {
    background-color: #e7f3ff;
    border: 1px solid #b3d7ff;
    text-align: center;
    padding: 24px 20px;
    position: relative;
}

.summary-card .summary-figure {
    font-size: 28px;
    font-weight: bold;
    color: #0056b3;
    margin-bottom: 4px;
}

.summary-card .summary-description {
    font-size: 14px;
    color: #0056b3;
    margin: 0;
}

/* 리스트 로딩바 */
.spinner {
    display: none;
    width: 40px;
    height: 40px;
    border: 4px solid #ccc;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 5. Responsive Styles (Media Queries) */
@media (min-width: 768px) {
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
}

@media (max-width: 767px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 320px;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
        transition: transform 0.3s ease-in-out;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    .sidebar-overlay { display: none; }
    .sidebar-overlay.visible { display: block; }
    .protruding-button { display: none; }
}


/* 카드담기 버튼 */
.cart-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background-color: rgba(0, 86, 179, 0.1);
    border: 1px solid rgba(0, 86, 179, 0.2);
    /* color: #0056b3; 6B9EFF 788896 7F56D9 4DB3A7 2563EB  */
    color: #2563EB;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    /* display: inline-flex; */
    display: none; /* pils */
}

.cart-btn:hover {
    background-color: rgba(0, 86, 179, 0.2);
}

.cart-btn:active {
    transform: scale(0.95);
}

.cart-btn svg {
    width: 20px;
    height: 20px;
}





/* 제자리 회전
.cart-btn svg {
    transition: transform 0.4s ease-in-out;
}
.cart-btn:hover svg {
    transform: rotate(360deg);
}
*/

/* 'bounce-effect' */
.cart-btn.bounce-effect svg {
    animation: bounce 0.6s ease;
}
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-15px); /* 위로 가장 높이 튀어 오름 */
    }
    60% {
        transform: translateY(-7px); /* 살짝 내려옴 */
    }
}

/* 'shake-effect' */
.cart-btn.shake-effect svg {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes shake {
    10%, 90% {
        transform: translateX(-1px);
    }
    20%, 80% {
        transform: translateX(2px);
    }
    30%, 50%, 70% {
        transform: translateX(-4px);
    }
    40%, 60% {
        transform: translateX(4px);
    }
}
