/**
 * CBR IDX — 지도 + 목록 분할 뷰 (v1.22)
 *
 * cbr-listings.css 를 건드리지 않고 분할 뷰 전용 스타일만 담는다.
 * 의존: cbr-listings.css (카드/필터바 스타일)
 */

:root {
	--cbr-map-h: 720px;         /* 데스크톱 지도 높이 */
	--cbr-map-h-mobile: 60vh;   /* 모바일 지도 높이 */
	--cbr-navy: #0A3D39;
	--cbr-gold: #2DD4BF;
}

/* ---------------------------------------------------------------------
 * 레이아웃
 * ------------------------------------------------------------------- */

/* 필터 줄 — 반경 제거 후 한 줄에 안정적으로 들어가도록 검색창 폭을 조정 */
.cbr-fbz .cbr-fbz-search {
	flex: 1 1 240px;
	min-width: 200px;
	max-width: 340px;
}

.cbr-fbz .cbr-fbz-reset {
	margin-left: 4px;
}

.cbr-splitview {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
	gap: 20px;
	align-items: start;
	margin-top: 12px;
}

.cbr-split-list {
	min-width: 0;
}

.cbr-split-map {
	position: sticky;
	top: 90px;               /* 고정 헤더 아래 */
	height: var(--cbr-map-h);
	min-height: 420px;
	border-radius: 12px;
	overflow: hidden;
	background: #eef1f4;
	border: 1px solid #DEEBE9;
}

.cbr-map {
	width: 100%;
	height: 100%;
}

/*
 * 분할 뷰에서는 카드가 좁아지므로 2열 고정.
 * v1.22.1: cbr-listings.css 994줄의 repeat(4) !important 를 이겨야 하므로
 *          동일하게 !important 를 붙인다 (파일 로드 순서상 이쪽이 나중).
 */
.cbr-splitview .cbr-listing-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	gap: 18px !important;
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

/* 전체폭 목록 / 전체폭 지도 전환 */
.cbr-splitview[data-view="list"] {
	grid-template-columns: minmax(0, 1fr);
}
.cbr-splitview[data-view="list"] .cbr-split-map {
	display: none;
}
.cbr-splitview[data-view="list"] .cbr-listing-grid {
	grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
	max-width: 1140px !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

.cbr-splitview[data-view="map"] {
	grid-template-columns: minmax(0, 1fr);
}
.cbr-splitview[data-view="map"] .cbr-split-list {
	display: none;
}
.cbr-splitview[data-view="map"] .cbr-split-map {
	height: calc(100vh - 220px);
}

/* ---------------------------------------------------------------------
 * 요약 줄 + View 토글 (v1.22.2)
 * 좌: "1,234 listings" / 우: Split · List · Map
 * ------------------------------------------------------------------- */

.cbr-fbz .cbr-fb-summary {
	display: flex !important;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}

.cbr-view-toggle {
	display: inline-flex;
	margin-left: auto;
	border: 1px solid #d8dde3;
	border-radius: 999px;
	overflow: hidden;
	background: #fff;
	flex: 0 0 auto;
}

.cbr-view-toggle button {
	appearance: none;
	border: 0;
	background: transparent;
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 600;
	color: #4a5563;
	cursor: pointer;
	line-height: 1.2;
}

.cbr-view-toggle button + button {
	border-left: 1px solid #e6e9ee;
}

.cbr-view-toggle button.is-active {
	background: var(--cbr-navy);
	color: #fff;
}

/* ---------------------------------------------------------------------
 * 가격 핀 / 클러스터
 * ------------------------------------------------------------------- */

.cbr-pin {
	position: absolute;
	transform: translate(-50%, -50%);
	background: #fff;
	color: var(--cbr-navy);
	border: 1px solid rgba(22, 35, 60, .18);
	border-radius: 999px;
	padding: 5px 10px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
	box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
	cursor: pointer;
	z-index: 1;
	transition: transform .12s ease, background .12s ease, color .12s ease;
}

.cbr-pin:hover,
.cbr-pin.is-active {
	background: var(--cbr-navy);
	color: #fff;
	transform: translate(-50%, -50%) scale(1.08);
	z-index: 5;
}

/* 자사(CBR) 매물 강조 */
.cbr-pin-office {
	background: var(--cbr-gold);
	color: #1b1b1b;
	border-color: rgba(0, 0, 0, .12);
}
.cbr-pin-office:hover,
.cbr-pin-office.is-active {
	background: var(--cbr-navy);
	color: #fff;
}

.cbr-pin-cluster {
	background: var(--cbr-navy);
	color: #fff;
	border-color: rgba(255, 255, 255, .7);
	min-width: 34px;
	height: 34px;
	padding: 0 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	border-radius: 999px;
}

/* Leaflet divIcon 초기화 */
.leaflet-marker-icon .cbr-pin {
	position: relative;
	transform: translate(-50%, -50%);
}

/* ---------------------------------------------------------------------
 * 핀 팝업
 * ------------------------------------------------------------------- */

.cbr-map-pop {
	width: 230px;
	font-family: inherit;
}
.cbr-map-pop a {
	text-decoration: none;
	color: inherit;
	display: block;
}
.cbr-map-pop-img {
	width: 100%;
	height: 130px;
	overflow: hidden;
	border-radius: 8px 8px 0 0;
	background: #eef1f4;
}
.cbr-map-pop-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.cbr-map-pop-body {
	padding: 10px 4px 4px;
}
.cbr-map-pop-price {
	font-size: 17px;
	font-weight: 700;
	color: var(--cbr-navy);
}
.cbr-map-pop-meta {
	font-size: 13px;
	color: #4a5563;
	margin-top: 2px;
}
.cbr-map-pop-addr {
	font-size: 13px;
	color: #5A7A77;
	margin-top: 4px;
	line-height: 1.35;
}
.cbr-map-pop-mls {
	font-size: 11px;
	color: #8b93a0;
	margin-top: 6px;
}

/* Google InfoWindow 기본 패딩 축소 */
.gm-style .gm-style-iw-c {
	padding: 8px !important;
}
.gm-style .gm-style-iw-d {
	overflow: hidden !important;
}

/* ---------------------------------------------------------------------
 * 줌아웃 가드 오버레이 / 안내
 * ------------------------------------------------------------------- */

.cbr-map-overlay {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 18px;
	display: flex;
	justify-content: center;
	pointer-events: none;
	z-index: 3;
}

.cbr-map-overlay-box {
	pointer-events: auto;
	display: flex;
	align-items: center;
	gap: 14px;
	max-width: 92%;
	background: rgba(17, 24, 39, .92);
	color: #fff;
	padding: 12px 16px;
	border-radius: 10px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
	font-size: 14px;
}

.cbr-map-overlay-box strong {
	font-weight: 600;
}

.cbr-map-overlay-box p {
	margin: 0;
	font-size: 13px;
	opacity: .85;
	display: none; /* 좁은 오버레이에서는 제목만, 상세 문구는 목록 쪽에서 안내 */
}

.cbr-map-overlay-box button {
	appearance: none;
	border: 0;
	background: #fff;
	color: #111827;
	font-weight: 700;
	font-size: 13px;
	padding: 8px 14px;
	border-radius: 8px;
	cursor: pointer;
	white-space: nowrap;
}

.cbr-map-note {
	position: absolute;
	top: 12px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(255, 255, 255, .95);
	border: 1px solid #DEEBE9;
	color: #374151;
	font-size: 12.5px;
	padding: 6px 12px;
	border-radius: 999px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
	z-index: 3;
	white-space: nowrap;
}

/* 지도에서 강조된 카드 */
.cbr-card-link.is-mapfocus .cbr-listing-card,
.cbr-card-wrap.is-mapfocus .cbr-listing-card {
	outline: 2px solid var(--cbr-gold);
	outline-offset: 2px;
	border-radius: 10px;
}

/* ---------------------------------------------------------------------
 * CRMLS 고지 블록 (목록 하단)
 * ------------------------------------------------------------------- */

.cbr-idx-disclaimer-block {
	margin-top: 28px;
	padding: 18px;
	background: #f6f7f9;
	border-radius: 10px;
}

.cbr-idx-disclaimer-logo {
	height: 30px;
	width: auto;
	display: block;
	margin: 0 auto 12px;
}

.cbr-idx-disclaimer-block .cbr-idx-disclaimer {
	font-size: 12.5px;
	line-height: 1.7;
	color: #5A7A77;
	margin: 0;
}

.cbr-idx-disclaimer-block .cbr-idx-copyright {
	font-size: 12.5px;
	color: #5A7A77;
	margin: 10px 0 0;
}

/* ---------------------------------------------------------------------
 * 반응형 — 태블릿/모바일
 * ------------------------------------------------------------------- */

@media (max-width: 1100px) {
	.cbr-splitview {
		grid-template-columns: minmax(0, 1fr);
	}

	/* 모바일 기본: 목록만. 지도는 토글로 연다. */
	.cbr-splitview[data-view="split"] .cbr-split-map,
	.cbr-splitview[data-view="list"] .cbr-split-map {
		display: none;
	}

	.cbr-splitview[data-view="map"] .cbr-split-list {
		display: none;
	}
	.cbr-splitview[data-view="map"] .cbr-split-map {
		display: block;
		position: relative;
		top: 0;
		height: var(--cbr-map-h-mobile);
		min-height: 380px;
	}

	.cbr-splitview .cbr-listing-grid,
	.cbr-splitview[data-view="list"] .cbr-listing-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		max-width: none !important;
	}

	/* Split 버튼은 모바일에서 의미가 없다 */
	.cbr-view-toggle button[data-view="split"] {
		display: none;
	}

	.cbr-view-toggle {
		margin-left: 0;
	}
}

@media (max-width: 900px) {
	.cbr-splitview .cbr-listing-grid,
	.cbr-splitview[data-view="list"] .cbr-listing-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 560px) {
	.cbr-splitview .cbr-listing-grid,
	.cbr-splitview[data-view="list"] .cbr-listing-grid {
		grid-template-columns: minmax(0, 1fr) !important;
	}
	.cbr-map-note {
		font-size: 11.5px;
		white-space: normal;
		max-width: 90%;
		text-align: center;
	}
}
