/* ================================================================
   Property V2 — 매물관리 리뉴얼 전용 스타일
   ================================================================ */

/* ── CSS Variables ── */
:root {
    --v2-primary: #812B27;
    --v2-primary-hover: #570400;
    --v2-primary-light: #fffaf5;
    --v2-text: #222;
    --v2-text-muted: #555;
    --v2-text-light: #8B8E90;
    --v2-border: var(--rn-input-border, #E7E4DF);   /* 레거시 #d9d9d9 잔존 — renewal/property-common.css:21 별칭과 동일 값으로 (2026-09-02 3차 Y2) */
    --v2-border-light: #E7E7E7;
    --v2-bg: #FBFAFA;
    --v2-bg-hover: #faf5f5;
    --v2-bg-light: #f5f5f5;
    --v2-danger: #C62828;
    --v2-danger-bg: #FFF3F3;
    --v2-radius: 4px;
    --v2-transition: 150ms ease;
}

/* ── Card ── */
.v2-card {
    background: #fff;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    padding: 16px 24px;
    margin-bottom: 16px;
}

/* ── Section (접기/펼치기) ── */
.v2-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 12px 0;
    user-select: none;
}
.v2-section-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--v2-text);
}
.section-toggle {
    transition: transform 250ms ease;
}
.section-toggle.collapsed {
    transform: rotate(-90deg);
}
.v2-section-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 350ms ease;
}
.v2-section-body.collapsed {
    max-height: 0;
    padding: 0;
}

/* ── Buttons ── */
.v2-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 20px;
    height: 40px;
    border: 1px solid transparent;
    border-radius: var(--v2-radius);
    font-family: 'SUIT', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--v2-transition), border-color var(--v2-transition), color var(--v2-transition);
}
.v2-btn-sm {
    padding: 4px 12px;
    height: 32px;
    font-size: 13px;
}
.v2-btn._mainBg {
    background: var(--v2-primary);
    color: #fff;
    border-color: var(--v2-primary);
}
.v2-btn._mainBg:hover {
    background: var(--v2-primary-hover);
    border-color: var(--v2-primary-hover);
}
.v2-btn._dangerBg {
    background: #C62828;
    color: #fff;
    border-color: #C62828;
}
.v2-btn._dangerBg:hover {
    background: #B71C1C;
    border-color: #B71C1C;
}
.v2-btn._mainLine {
    background: #fff;
    color: var(--v2-primary);
    border-color: var(--v2-primary);
}
.v2-btn._mainLine:hover {
    background: var(--v2-bg-hover);
}
.v2-btn._blackLine {
    background: #fff;
    color: var(--v2-text);
    border-color: var(--v2-border);
}
.v2-btn._blackLine:hover {
    background: var(--v2-bg-light);
}
.v2-btn._danger {
    background: #fff;
    color: var(--v2-danger);
    border-color: var(--v2-danger);
}
.v2-btn._danger:hover {
    background: var(--v2-danger-bg);
}

/* ── Form Elements ── */
.v2-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
    margin-bottom: 12px;
}
.v2-form-row.single { grid-template-columns: 1fr; }
.v2-form-row.triple { grid-template-columns: 1fr 1fr 1fr; }

.v2-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.v2-form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--v2-text);
}
.v2-form-label.required::after {
    content: '*';
    color: var(--v2-danger);
    margin-left: 3px;
}

.v2-input,
.v2-select,
.v2-textarea {
    padding: 8px 12px;
    height: 40px;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    font-family: 'SUIT', sans-serif;
    font-size: 14px;
    color: var(--v2-text);
    outline: none;
    transition: border-color var(--v2-transition);
}
.v2-input:focus,
.v2-select:focus,
.v2-textarea:focus {
    border-color: var(--v2-primary);
}
.v2-textarea {
    height: auto;
    min-height: 80px;
    resize: vertical;
}

/* ── Radio / Checkbox Buttons ── */
.v2-radio-group,
.v2-check-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.radio-btn,
.check-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--v2-border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--v2-transition);
    user-select: none;
}
.radio-btn input,
.check-btn input {
    display: none;
}
.radio-btn.selected,
.check-btn.selected {
    background: var(--v2-primary);
    color: #fff;
    border-color: var(--v2-primary);
}

/* ── Tags / Badges ── */
.v2-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--v2-radius);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}
.v2-tag._green  { background: #E8F5E9; color: #2E7D32; }
.v2-tag._blue   { background: #E3F2FD; color: #1565C0; }
.v2-tag._orange  { background: #FFF3E0; color: #E65100; }
.v2-tag._red    { background: #FFEBEE; color: #C62828; }
.v2-tag._purple { background: #F3E5F5; color: #6A1B9A; }
.v2-tag._gray   { background: #F5F5F5; color: #757575; }
.v2-tag._yellow { background: #FFF8E1; color: #F57F17; }

/* ── Property List Item ── */
.v2-prop-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--v2-border-light);
    transition: background var(--v2-transition);
    cursor: pointer;
    position: relative;
}

/* 비공개 매물: 회색 톤 배경 + 좌측 빨간 띠 */
.v2-prop-item._hidden {
    background: #FAFAFA;
    border-left: 4px solid #D61919;
    padding-left: 12px;
}
.v2-prop-item._hidden:hover {
    background: #F5F5F5;
}
.v2-prop-item:hover {
    background: var(--v2-bg-hover);
}
.v2-prop-thumb {
    width: 72px;
    height: 72px;
    border-radius: var(--v2-radius);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--v2-bg-light);
}
.v2-prop-info {
    flex: 1;
    min-width: 0;
}
.v2-prop-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--v2-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.v2-prop-address {
    font-size: 12px;
    color: var(--v2-text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.v2-prop-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--v2-primary);
    text-align: right;
    white-space: nowrap;
}

/* ── Heart (관심매물) ── */
.v2-heart {
    cursor: pointer;
    font-size: 22px;
    color: var(--v2-border);
    transition: color 200ms, transform 400ms;
    user-select: none;
}
.v2-heart.liked {
    color: #E53935;
    animation: v2-heartPulse 400ms ease;
}
@keyframes v2-heartPulse {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* ── Pagination ── */
.v2-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 16px 0;
}
.page-btn {
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--v2-transition);
}
.page-btn:hover:not(.active):not(.disabled) {
    background: var(--v2-bg-light);
}
.page-btn.active {
    background: var(--v2-primary);
    color: #fff;
    border-color: var(--v2-primary);
}
.page-btn.disabled {
    opacity: .4;
    pointer-events: none;
}

/* ── Modal ── */
.v2-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: var(--rn-backdrop, rgba(34, 30, 28, .4)); /* 2026-09-02 5차 5Y-4 */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 250ms ease;
}
.v2-modal-overlay.show {
    opacity: 1;
}
.v2-modal {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(12px);
    transition: transform 250ms ease;
}
.v2-modal-overlay.show .v2-modal {
    transform: translateY(0);
}
.v2-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--v2-border-light);
}
.v2-modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}
.v2-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--v2-text-light);
    line-height: 1;
}
.v2-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}
.v2-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 24px;
    border-top: 1px solid var(--v2-border-light);
}

/* ── Toast ── */
.v2-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translate(-50%, -20px);
    padding: 12px 28px;
    border-radius: var(--v2-radius);
    font-size: 14px;
    font-weight: 600;
    z-index: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms ease, transform 250ms ease;
}
.v2-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
.v2-toast.success {
    background: #E8F5E9;
    color: #2E7D32;
}
.v2-toast.error {
    background: #FFEBEE;
    color: #C62828;
}
.v2-toast.info {
    background: #E3F2FD;
    color: #1565C0;
}

/* ── List Header ── */
.v2-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--v2-border-light);
}
.v2-list-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.v2-sort-bar {
    display: flex;
    gap: 4px;
}
.v2-sort-btn {
    padding: 4px 10px;
    border: 1px solid var(--v2-border);
    border-radius: var(--v2-radius);
    background: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--v2-transition);
}
.v2-sort-btn.active {
    background: var(--v2-primary);
    color: #fff;
    border-color: var(--v2-primary);
}

/* ── Filter Chip ── */
.v2-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1px solid var(--v2-border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: all var(--v2-transition);
}
.v2-chip.active {
    background: var(--v2-primary);
    color: #fff;
    border-color: var(--v2-primary);
}

/* ── Topbar (v2 페이지 상단) ── */
.v2-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.v2-topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--v2-text);
}
.v2-topbar-count {
    font-size: 14px;
    color: var(--v2-text-muted);
    margin-left: 8px;
    font-weight: 400;
}
.v2-topbar-actions {
    display: flex;
    gap: 8px;
}

/* ── Empty State ── */
.v2-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 320px;
    padding: 60px 20px;
    color: var(--v2-text-light);
}
.v2-empty .material-symbols-outlined {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: .5;
}
.v2-empty p {
    font-size: 14px;
}

/* ── Naver Map Cluster Icons ── */
.nv-cluster { border-radius: 50%; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: var(--rn-shadow-card, 0 1px 4px rgba(34, 30, 28, .04)); /* 2026-09-02 5차 5Y-5 */ cursor: pointer; }
.nv-cluster span { font-size: 12px; }
.nv-c1 { background: var(--v2-primary); width: 36px; height: 36px; }
.nv-c2 { background: var(--v2-primary); width: 42px; height: 42px; }
.nv-c3 { background: var(--v2-primary); width: 50px; height: 50px; }
.nv-c3 span { font-size: 13px; }
.nv-c4 { background: var(--v2-primary); width: 58px; height: 58px; }
.nv-c4 span { font-size: 14px; }
.nv-c5 { background: var(--v2-primary); width: 68px; height: 68px; }
.nv-c5 span { font-size: 15px; }

/* Single marker pin */
.nv-single-marker { cursor: pointer; filter: drop-shadow(0 1px 3px rgba(34, 30, 28, .25)); /* 2026-09-02 5차 5Y-5 — drop-shadow 는 토큰 형식이 달라 웜 잉크 직접 지정 */ }

/* Pin with badge (2~N건) */
.nv-pin-badge { position: relative; cursor: pointer; filter: drop-shadow(0 1px 3px rgba(34, 30, 28, .25)); /* 2026-09-02 5차 5Y-5 — drop-shadow 는 토큰 형식이 달라 웜 잉크 직접 지정 */ }
.nv-badge { position: absolute; top: -4px; right: -8px; min-width: 18px; height: 18px; background: var(--v2-primary); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 1.5px solid #fff; }

/* ── Photo Gallery (전체화면 이미지 뷰어) ── */
#photoGallery { display: none; position: fixed; inset: 0; z-index: 9999; align-items: center; justify-content: center; }
.gallery-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.92); }
.gallery-content { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.gallery-img-wrap { max-width: 85vw; max-height: 85vh; display: flex; align-items: center; justify-content: center; }
.gallery-img { max-width: 85vw; max-height: 85vh; object-fit: contain; border-radius: 4px; user-select: none; }
.gallery-close { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,.15); border: none; color: #fff; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 24px; z-index: 1; transition: background .15s; }
.gallery-close:hover { background: rgba(255,255,255,.3); }
.gallery-prev, .gallery-next { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.15); border: none; color: #fff; width: 48px; height: 48px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 28px; z-index: 1; transition: background .15s; }
.gallery-prev { left: 16px; }
.gallery-next { right: 16px; }
.gallery-prev:hover, .gallery-next:hover { background: rgba(255,255,255,.3); }
.gallery-counter { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 14px; font-weight: 600; background: rgba(0,0,0,.5); padding: 6px 16px; border-radius: 20px; z-index: 1; }

/* Map loading indicator — 좌하단, 마커 영역 회피 + 400ms 이상 지연 시에만 표시 */
.map-loading-indicator { position: absolute; bottom: 14px; left: 14px; background: rgba(255,255,255,.95); padding: 5px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; color: var(--v2-primary); box-shadow: 0 1px 4px rgba(0,0,0,.1); z-index: 10; display: none; pointer-events: none; }
.map-loading-indicator.show { display: block; }

/* ── Property Move Modal ── */
.v2-move-layout { display: grid; grid-template-columns: 1fr 280px; min-height: 460px; }
.v2-move-left { border-right: 1px solid var(--v2-border-light); padding: 16px; overflow-y: auto; }
.v2-move-right { padding: 16px; overflow-y: auto; max-height: 520px; }
.v2-move-section-title { font-size: 14px; font-weight: 700; color: var(--v2-text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.v2-move-badge { font-size: 12px; font-weight: 600; color: var(--v2-primary); background: var(--v2-primary-light); padding: 2px 8px; border-radius: 10px; }
.v2-move-filter { display: flex; gap: 6px; margin-bottom: 12px; }
.v2-move-list-wrap { border: 1px solid var(--v2-border-light); border-radius: var(--v2-radius); }
.v2-move-list-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--v2-border-light); background: var(--v2-bg-light); font-size: 13px; }
.v2-move-list { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; }
.v2-move-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--v2-border-light); transition: background var(--v2-transition); cursor: pointer; }
.v2-move-item:last-child { border-bottom: none; }
.v2-move-item:hover { background: var(--v2-bg-hover); }
.v2-move-item.selected { background: var(--v2-primary-light); }
.v2-move-check { flex-shrink: 0; display: flex; align-items: center; }
.v2-move-check input { width: 16px; height: 16px; accent-color: var(--v2-primary); cursor: pointer; }
.v2-move-thumb { width: 48px; height: 48px; border-radius: 4px; overflow: hidden; flex-shrink: 0; background: var(--v2-bg-light); display: flex; align-items: center; justify-content: center; }
.v2-move-thumb img { width: 100%; height: 100%; object-fit: cover; }
.v2-move-info { flex: 1; min-width: 0; }
.v2-move-addr { font-size: 13px; font-weight: 600; color: var(--v2-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-move-meta { font-size: 11px; color: var(--v2-text-light); margin-top: 2px; }
.v2-move-price { text-align: right; flex-shrink: 0; }
.v2-move-deal-type { font-size: 11px; color: var(--v2-text-light); }
.v2-move-deal-amount { font-size: 13px; font-weight: 700; color: var(--v2-primary); }
.v2-move-pager { display: flex; justify-content: center; gap: 2px; padding: 8px; }
.v2-move-page-btn { border: 1px solid var(--v2-border-light); background: #fff; padding: 4px 10px; border-radius: 4px; font-size: 12px; cursor: pointer; color: var(--v2-text); transition: all var(--v2-transition); }
.v2-move-page-btn:hover:not(:disabled) { background: var(--v2-bg-light); }
.v2-move-page-btn.active { background: var(--v2-primary); color: #fff; border-color: var(--v2-primary); }
.v2-move-page-btn:disabled { opacity: .4; cursor: default; }

/* Account list */
.v2-move-accounts { display: flex; flex-direction: column; gap: 4px; max-height: 400px; overflow-y: auto; }
.v2-move-account { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--v2-radius); cursor: pointer; transition: all var(--v2-transition); border: 2px solid transparent; }
.v2-move-account:hover { background: var(--v2-bg-hover); }
.v2-move-account.active { background: var(--v2-primary-light); border-color: var(--v2-primary); }
.v2-move-account-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--v2-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; flex-shrink: 0; }
.v2-move-account-info { flex: 1; }
.v2-move-account-name { font-size: 14px; font-weight: 600; color: var(--v2-text); }
.v2-move-account-group { font-size: 11px; color: var(--v2-text-light); margin-top: 1px; }

@media (max-width: 640px) {
    .v2-move-layout { grid-template-columns: 1fr; }
    .v2-move-left { border-right: none; border-bottom: 1px solid var(--v2-border-light); }
}

/* ═══════════ Detail Filter Grid ═══════════ */
.v2-detail-filter-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    padding-top: 16px;
}
@media (max-width: 1100px) {
    .v2-detail-filter-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .v2-detail-filter-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════ Spinner Animation ═══════════ */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ═══════════ Print ═══════════ */
#printArea { display: none; }

@media print {
    body > *:not(#printArea) { display: none !important; }
    #printArea { display: block !important; padding: 20px; }

    .print-detail-card { margin-bottom: 24px; padding: 16px; border: 1px solid #ddd; border-radius: 4px; }
    .print-detail-card + .print-detail-card { margin-top: 16px; }
    .print-page-break { page-break-before: always; }

    /* 인쇄 시 지도 컨테이너 */
    #printArea [id^="printMapContainer"] {
        width: 100% !important;
        height: 250px !important;
        overflow: hidden !important;
    }

    .print-list-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 16px; }
    .print-list-table caption { font-size: 16px; font-weight: 700; text-align: left; margin-bottom: 12px; }
    .print-list-table th, .print-list-table td { border: 1px solid #ccc; padding: 8px 10px; text-align: left; }
    .print-list-table th { background: #f5f5f5; font-weight: 600; font-size: 11px; color: #333; }
    .print-list-table td { font-size: 12px; color: #222; }
    .print-list-table tr:nth-child(even) td { background: #fafafa; }

    .print-header { font-size: 18px; font-weight: 700; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid #812B27; color: #812B27; }

    /* F9 — 여러 장 인쇄 시 사진 크게, 페이지 끊김 방지하면서 이어서 노출 */
    #printArea .detail-photo-thumb {
        min-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        max-height: 420px;
        margin: 0 0 12px 0 !important;
        overflow: visible !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    #printArea .detail-photo-thumb img {
        width: 100% !important;
        height: auto !important;
        max-height: 420px;
        object-fit: contain !important;
    }
    /* 사진 wrapper(flex/overflow-x 인라인) 도 print 시 강제 block (JS도 동시에 처리, CSS는 백업) */
    #printArea div:has(> .detail-photo-thumb) {
        display: block !important;
        overflow: visible !important;
        overflow-x: visible !important;
    }
}
