/**
 * 빈집지도 UI - 극도로 미니멀한 모던 디자인
 * 지도가 90% 이상 차지, 컨트롤은 미니멀화
 * 트렌드: 글래스모피즘 + 다크모드 지원 + 인터랙티브
 */

:root {
    --color-primary: #3498db;
    --color-accent: #e74c3c;
    --color-dark: #1a1a1a;
    --color-light: #ffffff;
    --color-text: #333333;
    --color-border: #e8e8e8;
    --color-bg: #f5f5f5;
    --color-lv05: #e53935;
    --color-lv04: #ff8a65;
    --color-lv03: #ffd54f;
    --color-lv02: #7ddc7d;
    --color-lv01: #b4ffb4;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
}

html, body {
    overflow: hidden;
    height: 100%;
}

/* ==================== 기본 레이아웃 ==================== */

.map-full-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 60px);
    min-height: 600px;
    background: #ffffff;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Pretendard', 'Noto Sans KR', sans-serif;
}

#vworldMapMain {
    width: 100%;
    height: 100%;
    background-color: #e8f4f8;
    z-index: 1;
    position: absolute;
    top: 0;
    left: 0;
}

#vworldMapMain.leaflet-container {
    font-family: inherit;
}

/* ==================== 안내 문구 배너 ==================== */

.map-notice-banner {
    position: absolute;
    top: 30px;
    left: 35%;
    transform: translateX(-50%);
    z-index: 800;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 36px 9px 14px;
    background: rgba(180, 70, 20, 0.92);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 20px;
    line-height: 1.5;
    border-radius: 999px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
    pointer-events: auto;
    white-space: nowrap;
    max-width: 90%;
}

.map-notice-banner .map-notice-icon {
    flex-shrink: 0;
    font-size: 20px;
    color: #ffd54f;
}

.map-notice-banner .map-notice-text {
    font-weight: 500;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-notice-banner .map-notice-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px;
    transition: color 0.2s;
}

.map-notice-banner .map-notice-close:hover {
    color: #fff;
}

.map-notice-banner.hidden {
    display: none;
}

@media all and (max-width: 768px) {
    .map-notice-banner {
        font-size: 11px;
        padding: 7px 30px 7px 12px;
        gap: 5px;
        top: 60px;
        white-space: normal;
        border-radius: 16px;
        max-width: 92%;
        width: 92%;
        left: 50%;
    }
    .map-notice-banner .map-notice-icon {
        font-size: 14px;
    }
}

/* ==================== 글래스모피즘 컨트롤 기본 스타일 ==================== */

.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

.glass-dark {
    background: rgba(30, 30, 30, 0.8);
    backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==================== 상단: 지역 필터 (sale.html locate_tools 스타일) ==================== */

/* locate_tools - sale.html과 동일한 스타일 */
.map-full-container .locate_tools {
    position: absolute;
    top: 20px;
    right: 196px;  /* 사이드 패널(280px) + 여백(16px) */
    z-index: 1050;
    transition: right 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 사이드 패널 닫혀있을 때 */
.side-list-panel.close ~ .locate_tools {
    right: 16px;
}

.map-full-container .locate_tools .mobile_toggle {
    display: none;
    width: 44px;
    height: 44px;
    border-radius: 3px;
    background-color: #fff;
    border: 1px solid #CDD1D5;
    font-size: 15px;
}

.map-full-container .locate_tools .mobile_toggle.opened {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.map-full-container .locate_tools .mobile_toggle.opened::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    background: url(/main/images/sub/sale_close.svg) no-repeat center center;
}

.map-full-container .locate_tools .mobile_toggle.opened .txt {
    display: none;
}

.map-full-container .locate_tools .locate_select {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 3px;
    border: 1px solid #CDD1D5;
    box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.2);
}

.map-full-container .locate_tools .locate_select .select_wrap {
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.map-full-container .locate_tools .locate_select .select_wrap select.custom_select {
    border: none;
    min-width: 0;
    height: 30px;
    font-size: 15px;
    padding-left: 10px;
    padding-right: 24px;
    max-width: 100px;
    text-overflow: ellipsis;
    background: url(/main/images/common/select_arrow_down.svg) no-repeat right 2px center;
}

.map-full-container .locate_tools .locate_select .bt_submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 42px;
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
    background-color: #4AA9D3;
    border: none;
    cursor: pointer;
}

.map-full-container .locate_tools .locate_select .bt_submit:hover {
    background-color: #2e8eb8;
}

.map-full-container .locate_tools .locate_select .bt_submit::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    background: url(/main/images/sub/sale_locate.svg) no-repeat center center;
}

/* ==================== 우측: 미니 데이터 카드 스택 ==================== */

.data-cards-container {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 950;
    width: 320px;
    max-height: 70%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeInRight 0.5s ease;
    overflow-y: auto;
    scroll-behavior: smooth;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

.data-cards-container::-webkit-scrollbar {
    width: 6px;
}

.data-cards-container::-webkit-scrollbar-track {
    background: transparent;
}

.data-cards-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.data-cards-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

.data-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(200, 200, 200, 0.3);
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--color-primary);
}

.data-card:hover {
    transform: translateY(-4px) translateX(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.98);
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-dark);
    margin: 0 0 8px 0;
}

.card-stats {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.stat-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 11px;
    color: #999;
    font-weight: 600;
}

.stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-left: 4px;
}

/* ==================== 좌하단: 범례 미니 위젯 ==================== */

.legend-widget {
    position: absolute;
    bottom: 50px;
    left: 24px;
    z-index: 950;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(200, 200, 200, 0.3);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease 0.1s both;
    max-width: 270px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.legend-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.legend-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-dark);
}

.legend-toggle {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: #999;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 20px;
}

.legend-toggle:hover {
    background: #f0f0f0;
}

.legend-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.legend-content.collapsed {
    display: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    color: #666;
}

.legend-color {
    width: 22px;
    height: 22px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.legend-color.lv05 { background: var(--color-lv05); }
.legend-color.lv04 { background: var(--color-lv04); }
.legend-color.lv03 { background: var(--color-lv03); }
.legend-color.lv02 { background: var(--color-lv02); }
.legend-color.lv01 { background: var(--color-lv01); }

/* 테이블 내 범례 아이콘 */
.legend_ico {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
}

.legend_ico.lv05 { background-color: var(--color-lv05); }
.legend_ico.lv04 { background-color: var(--color-lv04); }
.legend_ico.lv03 { background-color: var(--color-lv03); }
.legend_ico.lv02 { background-color: var(--color-lv02); }
.legend_ico.lv01 { background-color: var(--color-lv01); }

/* ==================== 우측 하단: 지도 컨트롤 (sale.html과 동일) ==================== */

.map-full-container .map_controls {
    position: absolute;
    bottom: 50px;
    right: 596px;  /* 사이드 패널(280px) + 여백(16px) */
    background-color: #fff;
    border-radius: 3px;
    border: 1px solid #CDD1D5;
    box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 사이드 패널 닫혀있을 때 */
.side-list-panel.close ~ .map_controls {
    right: 20px;
}

.map-full-container .map_controls .item {
    border-bottom: 1px solid #CDD1D5;
}

.map-full-container .map_controls .item:last-child {
    border: none;
}

.map-full-container .map_controls .item .bt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: #fff;
    border-radius: 3px;
    border: none;
    cursor: pointer;
}

.map-full-container .map_controls .item .bt:hover {
    background-color: #f4f5f6;
}

.map-full-container .map_controls .item .bt::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
}

.map-full-container .map_controls .item.plus .bt::before {
    background: url(/main/images/sub/sale_ctrl_plus.svg) no-repeat center;
}

.map-full-container .map_controls .item.minus .bt::before {
    background: url(/main/images/sub/sale_ctrl_minus.svg) no-repeat center;
}

.map-full-container .map_controls .item.curr .bt::before {
    background: url(/main/images/sub/sale_ctrl_home.svg) no-repeat center;
}

/* ==================== 우측 사이드: 리스트 패널 ==================== */

.side-list-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 580px;
    z-index: 920;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-left: 1px solid rgba(200, 200, 200, 0.3);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.1);
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.side-list-panel.close {
    transform: translateX(580px);
}

.side-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.side-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-dark);
}

.side-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #999;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 24px;
    font-weight: bold;
    padding: 0;
    z-index: 1000;
    flex-shrink: 0;
}

.side-close:hover {
    background: #f5f5f5;
    color: var(--color-dark);
}

.side-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}

/* ==================== 우측 사이드: 열기 버튼 ==================== */

.side-open-btn {
    position: absolute;
    right: 16px;
    top: 20px;
    transform: none;
    z-index: 910;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--color-primary), #2980b9);
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.side-open-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.side-list-panel.close ~ .side-open-btn {
    display: flex;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.list-table thead {
    position: sticky;
    top: 0;
    background: #f9f9f9;
}

.list-table th {
    padding: 5px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--color-dark);
    border-bottom: 1px solid #e8e8e8;
}

.list-table td {
    padding: 5px 8px;
    border-bottom: 1px solid #f5f5f5;
    color: var(--color-text);
}

.list-table tr:hover {
    background: #fafafa;
}

.list-table tr:last-child td {
    border-bottom: none;
}

/* ==================== Leaflet 팝업 커스텀 ==================== */

.leaflet-popup-content-wrapper {
    border-radius: 14px;
    padding: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(200, 200, 200, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    min-width: 200px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Pretendard', 'Noto Sans KR', sans-serif;
}

.leaflet-popup-tip-container {
    width: 48px;
    height: 24px;
    margin-left: -24px;
}

.leaflet-popup-tip {
    width: 20px;
    height: 20px;
    margin: -12px auto 0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.leaflet-container a.leaflet-popup-close-button {
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    font: 20px/28px -apple-system, BlinkMacSystemFont, sans-serif;
    color: #999;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.leaflet-container a.leaflet-popup-close-button:hover,
.leaflet-container a.leaflet-popup-close-button:focus {
    color: #fff;
    background: var(--color-accent);
}

/* 팝업 내부 콘텐츠 스타일 */
.popup-card {
    padding: 18px 20px 16px;
}

.popup-card .popup-title {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-primary);
    letter-spacing: -0.02em;
}

.popup-card .popup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
}

.popup-card .popup-row + .popup-row {
    border-top: 1px solid #f0f0f0;
}

.popup-card .popup-label {
    font-size: 14px;
    color: #888;
    font-weight: 500;
}

.popup-card .popup-value {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-primary);
}

.popup-card .popup-value.accent {
    color: var(--color-accent);
}

/* ==================== 로딩 인디케이터 ==================== */

#mapLoadingIndicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    padding: 28px 40px;
    border-radius: 20px;
    border: 1px solid rgba(200, 200, 200, 0.3);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    text-align: center;
}

.spinner {
    border: 3px solid #f0f0f0;
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

#mapLoadingIndicator .loading-text {
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
}

/* ==================== 모바일 최적화 ==================== */

.mobile-fab {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--color-primary), #2980b9);
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(52, 152, 219, 0.3);
    z-index: 960;
    font-size: 28px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-fab:hover {
    transform: scale(1.15);
    box-shadow: 0 12px 32px rgba(52, 152, 219, 0.4);
}

/* ==================== 반응형 디자인 ==================== */

@media screen and (max-width: 1200px) {
    .data-cards-container {
        width: 280px;
    }

    .map-full-container .locate_tools {
        right: 196px;
    }

    .map-full-container .locate_tools .locate_select .select_wrap select.custom_select {
        max-width: 90px;
        font-size: 14px;
    }
}

@media screen and (max-width: 860px) {
    /* locate_tools 모바일 - 항상 표시 */
    .map-full-container .locate_tools {
        top: 20px;
        right: 16px !important;
    }

    .map-full-container .locate_tools .mobile_toggle {
        display: none;  /* 토글 버튼 숨김 */
    }

    .map-full-container .locate_tools .locate_select {
        display: flex;  /* 항상 표시 */
    }

    .map-full-container .locate_tools .locate_select .select_wrap {
        display: flex;
        align-items: center;
        padding: 0 5px 0 0;
    }

    .map-full-container .locate_tools .locate_select .select_wrap select.custom_select {
        max-width: 125px;
        font-size: 14px;
    }

    .map-full-container .locate_tools .locate_select .bt_submit {
        width: 38px;
    }
}

@media screen and (max-width: 480px) {
    .map-full-container {
        height: calc(100vh - 50px);
    }

    .map-full-container .locate_tools {
        top: 10px;
        right: 10px !important;
    }

    .data-cards-container {
        height: 120px;
    }

    .data-card {
        min-width: 140px;
        padding: 12px 14px;
    }

    .card-title {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .stat-value {
        font-size: 14px;
    }

    .legend-widget {
        width: auto;
        min-width: 0;
        max-width: 140px;
        padding: 8px 10px;
        bottom: 70px;
        left: auto;
        top: auto;
        right: 10px;
        border-radius: 8px;
    }

    .legend-header {
        gap: 4px;
        margin-bottom: 6px;
    }

    .legend-title {
        font-size: 12px;
    }

    .legend-toggle {
        width: 22px;
        height: 22px;
        font-size: 14px;
    }

    .legend-content {
        gap: 4px;
    }

    .legend-item {
        gap: 5px;
        font-size: 11px;
    }

    .legend-color {
        width: 14px;
        height: 14px;
        border-radius: 2px;
    }

    /* 모바일: 지도 컨트롤 */
    .map-full-container .map_controls {
        bottom: 135px;
        right: 10px !important;
    }

    .mobile-fab {
        bottom: 20px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .side-list-panel {
        position: fixed;
        width: 100%;
        height: auto;
        max-height: 50%;
        bottom: 0;
        right: 0;
        left: 0;
        top: auto;
        border-left: none;
        border-top: 1px solid rgba(200, 200, 200, 0.3);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        z-index: 920;
    }

    .side-list-panel.open {
        transform: translateY(0);
    }

    .side-content {
        max-height: calc(50vh - 60px);
    }

    .list-table {
        font-size: 12px;
    }

    .list-table th,
    .list-table td {
        padding: 8px 6px;
    }
}