/*
 * /public/assets/css/rinks_list.css
 * ============================================================
 * rinks/list 전용 스타일
 * - 전역(app.css) 위에 "보완/추가"만 담당
 * - 레이아웃: 좌(지도) / 우(리스트) 2단
 * - 모바일: 상(지도) / 하(리스트)
 * ============================================================
 *
 * [목차]
 *  1) 레이아웃: .rinks-layout, .map-wrap, .list-wrap
 *  2) 리스트 카드: .item, .row1~4, .thumb*
 *  3) 모달 공통: .modal-backdrop, .modal-panel, .modal-head/body
 *  4) 상세/확대: .modal-detail, #detailFrame, #rinksMapLarge
 *  5) 길찾기: .route-map-wrap, .route-map
 *  6) 상태/로딩: body.modal-lock, body.is-page-loading, #pageLoading
 */

/* 페이지 본문 여백/스크롤 제어 */
.page-main{ overflow:hidden !important; padding:0px !important; }

/* =========================
 * 1) 레이아웃
 * ========================= */
.rinks-layout{
	display:grid;
	grid-template-columns: 1fr 420px;
	height: calc(100vh - var(--header-h));
	overflow:hidden;
}
.map-wrap{ position:relative; border-right:1px solid #eef2f7; background:#fff; min-height:0; }
.map{ position:absolute; inset:0;margin:5px; border:#FFEBFF 1px solid; border-radius: 10px; }


.list-wrap{ display:flex; flex-direction:column; min-height:0; background:#fff; }
.list-head{ padding:10px 5px; border-bottom:1px solid #eef2f7; }
.filters{ display:flex; gap:8px; align-items:center; }
.sel{ width:100%; padding:10px 10px; border:1px solid #e5e7eb; border-radius:12px; background:#fff; font-size:13px; }

/* 리스트 스크롤 영역 */
.list{
	flex:1;
	min-height:0;
	padding: 5px;
	overflow-y:auto;
	-webkit-overflow-scrolling:touch;
	padding-bottom: calc(var(--footer-h) + 100px + env(safe-area-inset-bottom));
	display:flex;
	flex-direction:column;
	gap:8px;
	background:#fff;
}

/* =========================
 * 2) 리스트 카드
 * ========================= */
.item{
	display:flex;
	gap:10px;
	padding:12px;
	border-radius:12px;
	background:#ffffff;

	border:1px solid #eef2f7;
	box-shadow: 0 1px 2px rgba(0,0,0,0.04);

	align-items:stretch;

	position: relative;
	z-index: 0;

	transition:
		box-shadow .18s ease,
		border-color .18s ease,
		transform .12s ease;
}

/* hover: 배경색은 유지 + 테두리/글로우만 */
.item:hover{
	background:#ffffff;
	border-color: rgba(244, 63, 94, 0.35);
	box-shadow:
		0 0 0 1px rgba(244, 63, 94, 0.18),
		0 0 18px rgba(244, 63, 94, 0.12),
		0 6px 18px rgba(15, 23, 42, 0.06);
}
.item:active{
	transform: translateY(1px);
}

/* 선택 상태 */
.item.selected{
	background:#ffffff;
	border-color:#93c5fd;
	box-shadow:
		0 0 0 1px rgba(147, 197, 253, 0.28),
		0 0 18px rgba(59, 130, 246, 0.12),
		0 6px 18px rgba(15, 23, 42, 0.06);
	z-index: 1;
}
.item.selected:hover{
	background:#ffffff;
	border-color: rgba(95, 0, 255, 0.35);
	box-shadow:
		0 0 0 1px rgba(95, 0, 255, 0.18),
		0 0 18px rgba(95, 0, 255, 0.12),
		0 6px 18px rgba(15, 23, 42, 0.06);
}

.item .left{ flex:1 1 auto; min-width:0; }
.item .right{ flex:0 0 120px; align-self:stretch; }

.row1{
	display:flex;
	align-items:center;
	justify-content:space-between;
	gap:10px;
}
.name{
	font-weight:900;
	font-size:15px;
	min-width:0;
	overflow:hidden;
	text-overflow:ellipsis;
	white-space:nowrap;
	cursor:pointer;
}

.addr{ margin-top:4px; padding-left:5px; font-size:12px; color:#475569; line-height:1.35; }
.tel{ margin-top:6px; padding-left:5px; font-size:12px; color:#0f172a; opacity:.9; }

.row4{
	margin-top:6px;
	padding-left:5px;
	display:flex;
	align-items:center;
	justify-content:space-between;
	gap:10px;
}
.dist{
	font-size:12px;
	font-weight:900;
	color:#0f172a;
	white-space:nowrap;
}

.a-row{
	display:flex;
	align-items:center;
	justify-content:flex-end;
	gap:8px;
	flex:0 0 auto;
}

/* 버튼(즐겨찾기/액션) */
.icon, .fav{
	width:28px;
	height:28px;
	border-radius:999px;
	background: rgba(255,255,255,0.5);
	border: 1px solid rgba(226,232,240,0.9);
	display:inline-flex;
	align-items:center;
	justify-content:center;
	cursor:pointer;
	line-height:1;
	font-size:13px;
	color:#0f172a;
	transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
	box-shadow: 0 1px 2px rgba(15,23,42,0.08);
	backdrop-filter: blur(6px);
}
.icon:hover, .fav:hover{
	transform: translateY(-2px);
	background: rgba(255,255,255,0.75);
	border-color: rgba(148,163,184,0.8);
	box-shadow: 0 6px 14px rgba(15,23,42,0.12);
}
.icon:active, .fav:active{
	transform: translateY(-1px) scale(0.97);
}

/* 즐겨찾기 ON/OFF */
.fav.off{ color:#94a3b8; }
.fav.on{
	color:#e11d48;
	background: rgba(255, 228, 230, 0.65);
	border-color: rgba(251, 113, 133, 0.35);
}

/* 우측 썸네일 */
.thumb{ height:100%; padding:0px; box-sizing:border-box; }
.thumb-inner{
	width:100%;
	height:100%;
	border:1px solid #e5e7eb;
	border-radius:12px;
	overflow:hidden;
	background:#f8fafc;
	position:relative;
	display:flex;
	align-items:center;
	justify-content:center;
}
.thumb-img{
	width:100%;
	height:100%;
	object-fit:cover;
	display:none;
}
.thumb-placeholder{
	font-size:12px;
	color:#94a3b8;
}

.sentinel{ padding:10px 0; text-align:center; font-size:12px; color:#64748b; }

/* 인포윈도우 */
.iw{
	display:inline-block;
	padding:6px 10px;
	white-space:nowrap;
	font-size:12px;
	font-weight:900;
}

/* =========================
 * 3) 모달 공통
 * ========================= */
.modal-backdrop{
	position: fixed;
	inset: 0;
	background: rgba(15,23,42,.55);

	display: none;
	align-items: stretch;
	justify-content: stretch;

	padding: 3px;
	box-sizing: border-box;
	z-index: 9999;
}
.modal-backdrop.open{ 
	display:flex; 
	background: rgba(0,0,0,.82) !important;
	padding: 14px !important;              /* 화면 가장자리 여백 */
	box-sizing: border-box;
}
/* ✅ 모달 중첩 시(상세 iframe 위로) 우선순위 */
#routeModal{ z-index:10010; }
#mapModal{ z-index:10005; }

.modal-panel{
	display:flex;
	flex-direction:column;
	height:100%;
	width:100%;
	background:#fff;
	border-radius:10px;
	overflow:hidden;
	box-shadow:0 10px 40px rgba(0,0,0,.25);
}
.modal-head{
	flex:0 0 auto;
	display:flex;
	align-items:center;
	justify-content:space-between;
	padding:12px 16px;
	background:#fff;
	border-bottom:1px solid #e5e7eb;
}
/* 상세 모달 헤더: 좌(찜) / 중(제목) / 우(닫기) */
.modal-head-detail{
	display:grid;
	grid-template-columns: 44px 1fr 44px;
	align-items:center;
	justify-items:center;
}

.modal-title{
	font-size:14px;
	font-weight:700;
	color:#111827;
}

/* 제목 가운데정렬 고정 */
.modal-title-center{
	text-align:center;
	width:100%;
}

/* 찜 버튼(헤더 좌측) */
.modal-fav{
	width:36px;
	height:36px;
	border-radius:50%;
	border:1px solid #e5e7eb;
	background:#fff;
	cursor:pointer;
	font-size:18px;
	line-height:1;
	display:flex;
	align-items:center;
	justify-content:center;
	color:#ef4444;
}
.modal-fav.on{
	background:#fee2e2;
	border-color:#fecaca;
}
.modal-x{
	appearance:none;
	border:0;
	background:transparent;
	font-size:22px;
	line-height:1;
	cursor:pointer;

	width:36px;
	height:36px;
	border-radius:50%;

	display:flex;
	align-items:center;
	justify-content:center;

	color:#6b7280;
	transition:
		transform 0.4s ease,
		background-color 0.3s ease,
		color 0.3s ease;
}
.modal-x:hover{
	transform: rotate(360deg);
	background-color:#fee2e2;
	color:#dc2626;
}
.modal-x:active{
	transform: rotate(360deg) scale(0.9);
}

.modal-body{
	flex:1 1 auto;
	min-height:0;
	display:flex;
	flex-direction:column;
	padding:5px;
	gap:10px;
}
.modal-row{ display:flex; gap:10px; padding:6px 0; }
.modal-label{ width:44px; color:#64748b; font-size:12px; }
.modal-value{ flex:1; font-weight:900; font-size:13px; }
.modal-actions{ margin-top:12px; display:flex; gap:8px; justify-content:flex-end; }
.btn{ display:inline-block; padding:8px 10px; border:1px solid #e5e7eb; border-radius:12px; background:#fff; cursor:pointer; font-size:13px; text-decoration:none; color:#0f172a; }
.btn:hover{ background:#f8fafc; }
.modal-hint{ margin-top:10px; font-size:12px; color:#64748b; line-height:1.45; }

/* =========================
 * 4) 상세/확대
 * ========================= */
.modal-detail{
  position: fixed !important;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  /* 최소 360px, 최대 640px, 그 사이에서는 화면폭에 맞춰 가변 */
  width: clamp(360px, calc(100vw - 28px), 640px);

  /* 높이는 화면 기준 여유를 두고, 최대는 화면 안 */
  height: min(calc(100vh - 40px), 100%);

  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  border: #000 2px solid;
  box-shadow: 0 22px 70px rgba(0,0,0,.45);

  display: flex;
  flex-direction: column;
  z-index: 10010;
}
.modal-detail-body{
	flex: 1;
	padding:0 !important;
	height: calc(100% - 52px);
	overflow-y:auto;
	-webkit-overflow-scrolling:touch;
}
/* ✅ 상세 iframe 위 이미지뷰어가 열릴 때: 부모 상세모달 헤더 숨김 + 바디 100% */
#detailModal.imgviewer-open .modal-head{
  display:none !important;
}
#detailModal.imgviewer-open .modal-detail-body{
  height:100% !important; /* 기존 calc(100% - 52px) 무력화 */
}

/* ✅ 이미지뷰어 오픈 시: 백드롭 패딩 제거 + 상세모달 전체화면 확장 */
#detailModal.imgviewer-open{
  padding:0 !important;
  background:transparent !important;
}

/* ✅ 이미지뷰어 오픈 시 상세모달을 화면 전체로 확장 → 테두리/라운드가 화면 밖으로 밀려 안 보임 */
#detailModal.imgviewer-open .modal-detail{
  top:0 !important;
  left:0 !important;
  transform:none !important;
  width:100vw !important;
  height:100vh !important;
  border-radius:0 !important;
  border:none !important;
  box-shadow:none !important;
}

.modal-overlay{
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.6);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 10000;
}

.modal-overlay.open{
	display: flex;
}
/* 상세 모달 최소폭 360px 유지(사이트 min-width와 함께 동작) */
#detailModal .modal-panel.modal-detail{
	min-width: 360px;
}

/* overlay가 360 미만 화면에서도 모달을 가운데 유지 */
#detailModal.modal-backdrop{
	min-width: 360px;
}
#detailFrame{
	width:100%;
	height:100%;
	border:0;
	display:block;
	background:#fff;
}
/* ✅ 상세 iframe 이미지 뷰어가 열릴 때(부모에서 헤더 숨김) */
#detailModal.hide-head .modal-head{ display:none !important; }
#detailModal.hide-head .modal-detail-body{
	height: 100% !important;  /* 헤더가 사라지면 본문(iframe)이 전체 사용 */
}


/* =========================
 * 5) 길찾기
 * ========================= */
.route-map-wrap{
	flex:1 1 auto;
	min-height:0;
	margin-top:10px;
	width:100%;
	height:260px;
	border:1px solid #e5e7eb;
	border-radius:12px;
	overflow:hidden;
	background:#f8fafc;
}
.route-map{ width:100%; height:100%; }
.route-meta{
	margin: 6px 0 10px 0;
	font-size: 14px;
	font-weight: 700;
	color: #333;
}
@media (max-width: 899px){
	.route-map-wrap{ height:240px; }
}

/* =========================
 * 6) 상태/로딩
 * ========================= */
body.modal-lock{
	overflow:hidden !important;
	touch-action:none;
}
body.modal-lock .rinks-layout{ pointer-events:none; }
body.modal-lock #detailModal{ pointer-events:auto; }
body.modal-lock #routeModal{ pointer-events:auto; }
body.modal-lock #mapModal{ pointer-events:auto; }

body.is-page-loading .rinks-layout{ visibility:hidden; }

.page-loading{
	position: fixed;
	inset: 0;
	background: rgba(255,255,255,0.78);
	backdrop-filter: blur(6px);
	display:none;
	align-items:center;
	justify-content:center;
	z-index:9999;
}
.page-loading.open{ display:flex; }

.page-loading__panel{
	display:flex;
	flex-direction:column;
	gap:10px;
	align-items:center;
	padding:18px 18px;
	border-radius:16px;
	border:1px solid rgba(226,232,240,0.9);
	background: rgba(255,255,255,0.75);
	box-shadow: 0 10px 30px rgba(15,23,42,0.12);
}
.page-loading__text{ font-size:13px; font-weight:900; color:#0f172a; }

.page-loading__spinner{
	width:28px; height:28px;
	border-radius:999px;
	border:3px solid rgba(15,23,42,0.12);
	border-top-color: rgba(15,23,42,0.55);
	animation: spin 0.8s linear infinite;
}

/* 모바일 레이아웃 */
@media (max-width: 899px){
	.rinks-layout{
		grid-template-columns: 1fr;
		grid-template-rows: minmax(200px, 30vh) 1fr;
		height: calc(100vh - var(--header-h) - var(--footer-h) - (var(--content-gap) * 2));
	}
	.map-wrap{ border-right:0; border-bottom:1px solid #eef2f7; }
}

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