/* ==================== apt-price-map.css - 시세맵 스타일 ==================== */

/* 전역 변수 */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-bg: #1a1a2e;
    --light-bg: #f8f9fa;
    --border-color: #ddd;
    --text-primary: #333;
    --text-secondary: #666;
    --header-height: 70px;
    --filter-width: 320px;
}

/* 기본 레이아웃 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary);
    overflow: hidden;
}

#aptMapApp {
    display: flex;
    height: calc(100vh - var(--header-height));
    width: 100vw;
}

/* ==================== 헤더 ==================== */
.aptmap-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.aptmap-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

/* .current-location {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.current-location i {
    color: var(--primary-color);
} */

.current-location-box {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    margin-left: auto;
    margin-right: 10px;
}

.current-location-box i {
    color: var(--primary-color);
}

/* ==================== 필터 패널 ==================== */
.filter-panel {
    width: var(--filter-width);
    height: 100%;
    overflow-y: auto;
    background: var(--light-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.filter-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-btn:hover {
    color: var(--text-primary);
}

/* 필터 섹션 */
.filter-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* 지역 선택 */
.filter-section select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.filter-section select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 버튼 스타일 */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--secondary-color);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* 가격 입력 */
.price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-inputs input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.price-inputs input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.price-inputs span {
    color: var(--text-secondary);
}

/* 면적 프리셋 */
.area-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.area-presets button {
    padding: 8px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.area-presets button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 면적 체크박스 */
.area-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.area-checkboxes label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.area-checkboxes input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 급매 체크박스 */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 통계 섹션 */
.statistics {
    background: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.statistics h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.statistics dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    font-size: 14px;
}

.statistics dt {
    font-weight: 500;
    color: var(--text-secondary);
}

.statistics dd {
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
}

/* ==================== 지도 컨테이너 ==================== */
.map-container {
    flex: 1;
    position: relative;
    height: 100%;
}

#aptMap {
    width: 100%;
    height: 100%;
}

/* 지도 컨트롤 */
.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    gap: 10px;
}

.btn-filter {
    display: none;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    gap: 8px;
    align-items: center;
}

.btn-filter:hover {
    background: var(--light-bg);
}

/* ==================== 로딩 오버레이 ==================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-content p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==================== 모바일 반응형 ==================== */
@media (max-width: 768px) {

    /* 헤더 */
    :root {
        --header-height: 50px;
    }

    .current-location {
        font-size: 12px;
    }

    /* 필터 패널 - 하단 슬라이드 */
    .filter-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 70vh;
        margin-top: 0;
        transform: translateY(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 200;
        border-right: none;
        border-top: 1px solid var(--border-color);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.15);
    }

    .filter-panel.active {
        transform: translateY(0);
    }

    /* 필터 헤더 */
    .filter-header {
        margin-bottom: 16px;
    }

    .close-btn {
        display: block;
    }

    /* 지도 컨테이너 */
    .map-container {
        width: 100%;
        margin-top: 50px;
    }

    /* 모바일 필터 버튼 */
    .btn-filter.mobile-only {
        display: flex;
    }

    /* 통계 */
    .statistics {
        padding: 12px;
    }

    .statistics dl {
        font-size: 13px;
    }

    /* 가격 입력 */
    .price-inputs input {
        padding: 8px;
        font-size: 13px;
    }

    /* 면적 프리셋 */
    .area-presets {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .area-presets button {
        padding: 6px;
        font-size: 12px;
    }
}

/* ==================== 태블릿 반응형 ==================== */
@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --filter-width: 280px;
    }

    .aptmap-header h1 {
        font-size: 20px;
    }

    .filter-panel {
        padding: 16px;
    }
}

/* ==================== 스크롤바 스타일 ==================== */
.filter-panel::-webkit-scrollbar {
    width: 8px;
}

.filter-panel::-webkit-scrollbar-track {
    background: transparent;
}

.filter-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.filter-panel::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==================== 유틸리티 클래스 ==================== */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }
}

/* ==================== 접근성 개선 ==================== */
button:focus,
input:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 화면 리더기용 텍스트 숨김 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}