/* ============================================================
   실거래 분석 — real_estate.css  v3.0
   ============================================================ */

/* ── 전체 래퍼 ─────────────────────────────────────────────── */
.re-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 16px 60px;
}

/* ── 물건종류 탭 ─────────────────────────────────────────────── */
.re-type-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0;
}
.re-type-tab {
    padding: 8px 22px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    text-decoration: none;
    border-radius: 6px 6px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -2px;
    transition: all .15s;
}
.re-type-tab:hover { color: #3cb371; background: #f5fdf8; }
.re-type-tab.active {
    color: #2d5016;
    background: #fff;
    border-color: #e0e0e0;
    border-bottom-color: #fff;
}

/* ── 검색 영역 ──────────────────────────────────────────────── */
.re-search-area {
    margin-bottom: 24px;
}
.re-search-row {
    position: relative;
    margin-bottom: 10px;
}
.re-search-box {
    display: flex;
    align-items: center;
    border: 2px solid #3cb371;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(60,179,113,.12);
}
.re-search-icon {
    padding: 0 12px;
    font-size: 17px;
    color: #3cb371;
    flex-shrink: 0;
}
.re-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    padding: 13px 0;
    background: transparent;
    color: #222;
}
.re-search-clear {
    padding: 0 14px;
    background: none;
    border: none;
    font-size: 15px;
    color: #999;
    cursor: pointer;
    flex-shrink: 0;
}
.re-search-clear:hover { color: #333; }

/* ── 시도/시군구 선택 ────────────────────────────────────────── */
.re-search-area .re-region-selects {
    margin-bottom: 10px;
}
.re-region-selects {
    display: flex;
    gap: 8px;
    align-items: center;
}
.re-region-sel {
    flex: 1;
    height: 40px;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 13px;
    color: #333;
    background: #fff;
    cursor: pointer;
}
.re-region-sel:focus { border-color: #3cb371; outline: none; }
.re-region-sel:disabled { background: #f5f5f5; color: #aaa; cursor: default; }
.re-region-btn {
    height: 40px;
    padding: 0 20px;
    background: #3cb371;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
    flex-shrink: 0;
}
.re-region-btn:hover:not(:disabled) { background: #2d9e5c; }
.re-region-btn:disabled { background: #bdbdbd; cursor: default; }

/* ── 기간 선택 버튼 ──────────────────────────────────────────── */
.re-period-group {
    display: flex;
    gap: 4px;
}
.re-period-btn {
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: all .15s;
}
.re-period-btn:hover { border-color: #3cb371; color: #3cb371; }
.re-period-btn.active { background: #3cb371; border-color: #3cb371; color: #fff; }

/* ── 자동완성 ────────────────────────────────────────────────── */
.re-autocomplete {
    position: absolute;
    top: calc(100% + 2px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    z-index: 300;
    overflow: hidden;
    display: none;
    max-height: 320px;
    overflow-y: auto;
}
.re-ac-group {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    padding: 6px 14px 2px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.re-ac-item {
    padding: 9px 14px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: background .1s;
}
.re-ac-item:hover { background: #f5fdf8; color: #2d5016; }

/* ── 결과 영역 ──────────────────────────────────────────────── */
.re-region-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.re-region-breadcrumb {
    font-size: 18px;
    font-weight: 700;
    color: #2d5016;
}
.re-bread-sep { color: #999; font-weight: 400; }
.re-bread-dong { color: #3cb371; }
.re-region-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.re-back-btn {
    font-size: 13px;
    color: #3cb371;
    background: none;
    border: 1px solid #3cb371;
    border-radius: 6px;
    padding: 5px 12px;
    cursor: pointer;
    transition: all .15s;
}
.re-back-btn:hover { background: #f5fdf8; }
.re-ym-select {
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 5px 10px;
    color: #333;
    background: #fff;
    cursor: pointer;
}

/* ── 요약 카드 ──────────────────────────────────────────────── */
.re-summary-cards {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}
@media (max-width: 900px) {
    .re-summary-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 500px) {
    .re-summary-cards { grid-template-columns: repeat(2, 1fr); }
}
.re-card {
    background: #fff;
    border: 1px solid #e8f5e9;
    border-radius: 8px;
    padding: 12px 14px;
    text-align: center;
}
.re-card-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}
.re-card-value {
    font-size: 17px;
    font-weight: 700;
    color: #2d5016;
}

/* ── 분석 탭 ─────────────────────────────────────────────────── */
.re-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 18px;
    overflow-x: auto;
}
.re-tab {
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    color: #777;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    position: relative;
}
.re-tab:hover { color: #3cb371; }
.re-tab.active {
    color: #3cb371;
    border-bottom-color: #3cb371;
}
.re-tab-lock {
    font-size: 10px;
    opacity: .7;
    margin-left: 2px;
}
.re-tab-content { display: none; }
.re-tab-content.active { display: block; }

/* ── 로딩 ────────────────────────────────────────────────────── */
.re-loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}
.re-loading::before {
    content: '';
    display: block;
    width: 28px;
    height: 28px;
    border: 3px solid #e0e0e0;
    border-top-color: #3cb371;
    border-radius: 50%;
    animation: reSpin .7s linear infinite;
    margin: 0 auto 12px;
}
@keyframes reSpin { to { transform: rotate(360deg); } }

/* ── 검색 로딩 오버레이 ──────────────────────────────────────── */
.re-search-loading {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,.65);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.re-search-loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: #fff;
    padding: 28px 40px;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,.12);
    font-size: 14px;
    font-weight: 600;
    color: #2d5016;
}
.re-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #e0e0e0;
    border-top-color: #3cb371;
    border-radius: 50%;
    animation: reSpin .7s linear infinite;
}

/* ── 테이블 ──────────────────────────────────────────────────── */
.re-table-wrap { overflow-x: auto; }
.re-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.re-table th {
    background: #f5fdf8;
    color: #2d5016;
    font-weight: 600;
    padding: 9px 12px;
    text-align: left;
    border-bottom: 2px solid #c8e6c9;
    white-space: nowrap;
}
.re-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    white-space: nowrap;
}
.re-table tbody tr:hover { background: #f9fef9; }
.re-row-clickable:hover td { cursor: pointer; }
.re-row-clickable:hover td:first-child { color: #3cb371; text-decoration: underline; }
.text-right { text-align: right !important; }
.re-up   { color: #e53935; font-weight: 600; }
.re-down { color: #1565c0; font-weight: 600; }

/* ── Free 제한 배너 ──────────────────────────────────────────── */
.re-free-limit-banner {
    text-align: center;
    padding: 14px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 0 0 8px 8px;
    font-size: 13px;
    color: #795548;
}
.re-free-limit-banner a {
    color: #3cb371;
    font-weight: 600;
    text-decoration: none;
    margin-left: 6px;
}

/* ── 잠금 오버레이 ───────────────────────────────────────────── */
.re-locked-overlay {
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-linear-gradient(
        135deg, #fafafa 0px, #fafafa 10px, #f5f5f5 10px, #f5f5f5 20px
    );
    border: 2px dashed #ddd;
    border-radius: 10px;
}
.re-lock-msg { text-align: center; padding: 30px; }
.re-lock-icon { font-size: 36px; margin-bottom: 10px; }
.re-lock-title { font-size: 17px; font-weight: 700; color: #444; margin-bottom: 8px; }
.re-lock-desc  { font-size: 13px; color: #888; margin-bottom: 16px; }
.re-lock-btn {
    display: inline-block;
    padding: 9px 22px;
    background: #3cb371;
    color: #fff;
    border-radius: 20px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background .15s;
}
.re-lock-btn:hover { background: #2d9e5c; }

/* ── Tab 2: 분포 차트 ────────────────────────────────────────── */
.re-dist-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 800px) {
    .re-dist-grid { grid-template-columns: 1fr; }
}
.re-dist-card {
    background: #fff;
    border: 1px solid #e8f5e9;
    border-radius: 10px;
    padding: 16px;
}
.re-dist-card h4 {
    font-size: 13px;
    font-weight: 700;
    color: #2d5016;
    margin: 0 0 12px;
    text-align: center;
}

/* ── Tab 3: 히트맵 ───────────────────────────────────────────── */
.re-sub-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e8f5e9;
    padding-bottom: 0;
}
.re-sub-tab {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.re-sub-tab:hover { color: #3cb371; }
.re-sub-tab.active { color: #3cb371; border-bottom-color: #3cb371; }
.re-stab-content { display: none; }
.re-stab-content.active { display: block; }
.re-heatmap-desc {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
}
.re-heatmap-table td {
    min-width: 52px;
    font-size: 12px;
}

/* ── Tab 4: 추이 + 거래목록 ─────────────────────────────────── */
.re-trend-wrap {
    background: #fff;
    border: 1px solid #e8f5e9;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}
.re-trend-wrap h4 {
    font-size: 13px;
    font-weight: 700;
    color: #2d5016;
    margin: 0 0 10px;
}
.re-trades-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.re-trades-header h4 { font-size: 14px; font-weight: 700; color: #333; margin: 0; }
.re-trades-total { font-size: 12px; color: #888; }
.re-trades-search {
    flex: 1;
    min-width: 160px;
    max-width: 260px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0 10px;
    font-size: 13px;
    color: #333;
    background: #fff;
    margin-left: auto;
}
.re-trades-search:focus { border-color: #3cb371; outline: none; }

/* ── 페이지네이션 ────────────────────────────────────────────── */
.re-pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 14px;
}
.re-page-btn {
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    color: #333;
    transition: all .15s;
}
.re-page-btn:hover { border-color: #3cb371; color: #3cb371; }
.re-page-btn.active { background: #3cb371; border-color: #3cb371; color: #fff; }

/* ── Tab 5: 지도 ─────────────────────────────────────────────── */
.re-map-container {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}
.re-map-notice {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: #f5fdf8;
    border: 1px solid #c8e6c9;
    border-radius: 10px;
    padding: 24px 28px;
    margin: 10px 0;
}
.re-map-notice-icon { font-size: 32px; }
.re-map-notice strong { display: block; font-size: 15px; color: #2d5016; margin-bottom: 6px; }
.re-map-notice span { font-size: 13px; color: #666; }

/* ── 지도 컨트롤 ────────────────────────────────────────────── */
.re-map-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.re-map-controls-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-right: 4px;
}
.re-map-mode-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: all .15s;
}
.re-map-mode-btn:hover { border-color: #3cb371; color: #3cb371; }
.re-map-mode-btn.active { background: #3cb371; border-color: #3cb371; color: #fff; }

/* ── 지도 범례 ──────────────────────────────────────────────── */
.re-map-legend {
    margin-top: 12px;
    text-align: center;
}
.re-map-legend-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.re-map-legend-gradient {
    width: 200px;
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(to right, rgba(80,180,60,.85), rgba(255,180,60,.85), rgba(255,40,60,.85));
    border: 1px solid #e0e0e0;
}
.re-map-legend-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}
.re-map-legend-title {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* ── 동 순위 리스트 ──────────────────────────────────────────── */
.re-map-dong-list {
    margin-top: 16px;
}
.re-map-rank-title {
    font-size: 13px;
    font-weight: 700;
    color: #2d5016;
    margin-bottom: 10px;
}
.re-map-rank-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px;
}
.re-map-rank-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f9fef9;
    border: 1px solid #e8f5e9;
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s;
}
.re-map-rank-item:hover {
    background: #e8f5e9;
    border-color: #a5d6a7;
}
.re-map-rank-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #3cb371;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.re-map-rank-item:nth-child(1) .re-map-rank-num { background: #e53935; }
.re-map-rank-item:nth-child(2) .re-map-rank-num { background: #ff8f00; }
.re-map-rank-item:nth-child(3) .re-map-rank-num { background: #fdd835; color: #333; }
.re-map-rank-dong {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}
.re-map-rank-val {
    font-size: 13px;
    font-weight: 700;
    color: #2d5016;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .re-map-rank-grid { grid-template-columns: 1fr; }
    #reKakaoMap { height: 360px !important; }
}

/* ── 사용법 안내 ─────────────────────────────────────────────── */
.re-howto {
    background: #fff;
    border: 1px solid #e8f5e9;
    border-radius: 12px;
    padding: 24px 28px;
    margin-top: 8px;
}
.re-howto-title {
    font-size: 15px;
    font-weight: 700;
    color: #2d5016;
    margin: 0 0 18px;
}
.re-howto-steps {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}
.re-howto-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.re-howto-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2d5016, #3cb371);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.re-howto-desc {
    font-size: 13px;
    color: #444;
    line-height: 1.6;
}
.re-howto-desc strong {
    color: #2d5016;
}
.re-howto-tip {
    font-size: 12px;
    color: #888;
}
.re-howto-note {
    background: #f0fdf4;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: #555;
}
@media (max-width: 600px) {
    .re-howto { padding: 18px 16px; }
    .re-howto-steps { grid-template-columns: 1fr; gap: 12px; }
}

/* ── Tab 6: AI 시장성격 분석 ────────────────────────────────── */
.mi-wrap {
    padding: 8px 0;
}
.mi-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.mi-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a3a1a;
    margin: 0 0 4px;
}
.mi-desc {
    font-size: 13px;
    color: #666;
    margin: 0;
}
.mi-refresh-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 6px;
    color: #166534;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.mi-refresh-btn:hover { background: #dcfce7; }
.mi-error {
    padding: 14px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 14px;
}
.mi-no-region {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
    background: #f9fafb;
    border-radius: 8px;
}
.mi-generated-at {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
    text-align: right;
}
.mi-table .mi-dong-cell {
    font-weight: 600;
    color: #2d5016;
    white-space: nowrap;
    width: 120px;
}
.mi-table .mi-summary-cell {
    font-size: 13px;
    line-height: 1.7;
    color: #374151;
}
.mi-notice {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 12px;
    text-align: right;
}
@media (max-width: 600px) {
    .mi-header { flex-direction: column; }
    .mi-table .mi-dong-cell { width: 80px; font-size: 12px; }
    .mi-table .mi-summary-cell { font-size: 12px; }
}
