/* ===== 카테고리 필터 바 ===== */
.map-cat-bar {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid #F0F0F0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.map-cat-bar::-webkit-scrollbar { display: none; }

.map-cat-item {
    flex: 0 0 auto;
    min-width: 44px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #E5E5E5;
    border-radius: 18px;
    background: #fff;
    font-size: 15px;
    color: #1A1A1A;
    cursor: pointer;
    transition: all 0.15s;
}

.map-cat-item.active {
    background: #FFD60A;
    border-color: #FFD60A;
    font-weight: 700;
}

/* ===== 페이지 레이아웃: 헤더·카테고리바 아래를 지도가 화면 끝까지 채운다 =====
   높이를 calc(100vh - 고정값) 으로 잡으면 헤더 높이·탭바 모양(모바일 바닥 고정 / 데스크톱 플로팅 독)에 따라
   어긋나서 flex 로 남은 높이를 채운다. 모바일은 바닥 고정 탭바(60px) 만큼 아래를 비운다 */
body.map-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;   /* iOS 사파리: 주소창 뒤까지 포함하지 않는 실제 보이는 높이 */
    overflow: hidden;
    padding-bottom: 60px;
    box-sizing: border-box;
}

body.map-page .map-container {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}

/* ===== 지도 컨테이너 ===== */
.map-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 60px - 56px - 56px); /* viewport - 헤더 - 카테고리바 - 탭바 */
    /* iOS 사파리는 100vh 가 하단 주소창 뒤까지 포함돼 지도 바닥(목록보기·내 위치 버튼)이 탭바에 가려졌다
       → 실제 보이는 높이(dvh) 사용, 미지원 브라우저는 위 100vh 값 */
    height: calc(100dvh - 60px - 56px - 56px);
}

#kakao-map {
    width: 100%;
    height: 100%;
}

/* ===== 가맹점 마커 ===== */
.map-marker {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transform: translateX(-50%);
    transition: transform 0.2s;
    user-select: none;
}

.map-marker.selected {
    transform: translateX(-50%) scale(1.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    z-index: 10;
}

/* 받을 수 있는 쿠폰이 있는 가게 — 왼쪽 위 🎟 배지 */
.map-marker.has-coupon {
    position: relative;
}

.map-marker-coupon {
    position: absolute;
    top: -7px;
    left: -7px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FFD60A;
    border: 2px solid #fff;
    box-sizing: border-box;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* 같은 좌표(같은 건물) 묶음 마커 */
.map-marker-group {
    position: relative;
    background: #1A1A1A;
}

.map-marker-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 10px;
    background: #FFD60A;
    color: #1A1A1A;
    border: 2px solid #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

/* ===== 현재 위치 마커 ===== */
.current-location-marker {
    position: relative;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.current-location-marker .cl-dot {
    position: absolute;
    inset: 0;
    background: #2962FF;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.current-location-marker .cl-pulse {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    background: rgba(41, 98, 255, 0.25);
    border-radius: 50%;
    animation: cl-pulse 1.8s ease-out infinite;
    z-index: 1;
}

@keyframes cl-pulse {
    0%   { transform: scale(0.5); opacity: 0.9; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* ===== 내 위치 버튼 ===== */
.btn-my-location {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    font-size: 20px;
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-my-location:active {
    background: #f5f5f5;
}

/* 화면 안에 가맹점이 없을 때 안내 (지도 상단 중앙 카드) */
.map-empty {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 360px;
    box-sizing: border-box;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
    text-align: center;
    z-index: 50;
}

.map-empty[hidden] {
    display: none;
}

.map-empty-text {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.map-empty-btn {
    width: 100%;
    padding: 11px 0;
    border: none;
    border-radius: 10px;
    background: var(--color-primary);
    color: #1A1A1A;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

/* ===== 바텀시트 공통 ===== */
.map-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 150;
}

.map-sheet-overlay.open { display: block; }

.map-sheet {
    position: fixed;
    left: 50%;
    bottom: 60px; /* 하단 탭바(60px) 위로 띄움 */
    width: 100%;
    max-width: 430px;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateX(-50%) translateY(calc(100% + 60px));
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 151;
    max-height: calc(100vh - 80px); /* 탭바 + 여백 제외 */
    max-height: calc(100dvh - 80px);
    overflow-y: auto;
    box-sizing: border-box;
}

.map-sheet.open {
    transform: translateX(-50%) translateY(0);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin: 10px auto 8px;
}

.sheet-content {
    padding: 8px 20px 24px;
}

/* ===== 가맹점 시트 ===== */
.store-header {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.store-thumb {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    background: #F5F5F5;
}

.store-info {
    flex: 1;
    min-width: 0;
}

.store-title {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.store-emoji {
    font-size: 18px;
    line-height: 1;
}

.store-name {
    font-size: 16px;
    font-weight: 700;
    color: #1A1A1A;
}

.category-badge {
    background: #FFD60A;
    color: #1A1A1A;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.store-rating {
    font-size: 13px;
    color: #f5a623;
    font-weight: 600;
    margin-bottom: 6px;
}

.store-address {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    cursor: pointer;
}

.store-address:active { color: #1A1A1A; }

/* 미제휴 업체: 쿠폰 대신 가게 정보 */
.store-brief {
    border-top: 1px solid #f0f0f0;
    padding: 12px 0 2px;
    margin-bottom: 14px;
}

.brief-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 13px;
    color: #444;
    line-height: 1.45;
}

.brief-row a {
    color: #444;
    text-decoration: none;
}

.brief-icon {
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

.brief-intro {
    margin: 4px 0 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #F7F7F7;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

/* 쿠폰 리스트 */
.coupon-list {
    border-top: 1px solid #f0f0f0;
    padding-top: 12px;
    margin-bottom: 14px;
}

.map-no-coupon {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 16px 0;
    margin: 0;
}

.map-coupon-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #f9f9f9;
}

.map-coupon-item:last-child { border-bottom: none; }

.map-coupon-item .coupon-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.map-coupon-item .coupon-name {
    font-size: 13px;
    color: #666;
}

.map-coupon-item .coupon-benefit {
    font-size: 14px;
    font-weight: 700;
    color: #1A1A1A;
}

.map-coupon-item .coupon-remain {
    font-size: 11px;
    color: #999;
}

.btn-issue {
    flex-shrink: 0;
    background: #FFD60A;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    color: #1A1A1A;
    min-height: 36px;
}

.btn-issue:active { opacity: 0.8; }
.btn-issue.issued {
    background: #E0E0E0;
    color: #999;
    cursor: default;
}
.btn-issue.btn-issue-login {
    background: #1A1A1A;
    color: #fff;
}

.btn-store-detail {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px;
    background: #1A1A1A;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== 같은 건물 가맹점 목록 시트 ===== */
.map-group-title {
    font-size: 16px;
    font-weight: 700;
    color: #1A1A1A;
    margin: 4px 0 4px;
}

.map-group-address {
    font-size: 13px;
    color: #666;
    margin: 0 0 12px;
}

.map-group-list {
    border-top: 1px solid #f0f0f0;
}

.map-group-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid #f5f5f5;
    background: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.map-group-item:active { background: #FAFAFA; }

.map-group-emoji {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #F5F5F5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.map-group-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.map-group-name {
    font-size: 15px;
    font-weight: 700;
    color: #1A1A1A;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-group-meta {
    font-size: 12px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-group-arrow {
    flex-shrink: 0;
    font-size: 20px;
    color: #BBB;
}

.map-group-back {
    display: inline-block;
    margin: 0 0 10px;
    padding: 6px 12px;
    border: 1px solid #E5E5E5;
    border-radius: 16px;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    font-family: inherit;
}

/* ===== 길찾기 시트 ===== */
.nav-sheet-content {
    padding: 0 20px 24px;
}

.nav-store-name {
    font-size: 16px;
    font-weight: 700;
    color: #1A1A1A;
    margin: 4px 0 4px;
}

.nav-address {
    font-size: 13px;
    color: #666;
    margin: 0 0 16px;
}

.nav-btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-bottom: 8px;
    border: 1px solid #E5E5E5;
    border-radius: 12px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    color: #1A1A1A;
    cursor: pointer;
    text-align: center;
}

.nav-btn:active { background: #F5F5F5; }

.nav-btn.cancel {
    margin-top: 8px;
    background: #F5F5F5;
    border-color: #F5F5F5;
    color: #666;
}

/* ===== 목록보기 플로팅 버튼 ===== */
.btn-store-list {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 18px;
    border: none;
    border-radius: 21px;
    background: #1A1A1A;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    z-index: 50;
    white-space: nowrap;
}

.btn-store-list[hidden] { display: none; }

.btn-store-list:active { transform: translateX(-50%) scale(0.97); }

.btn-store-list-icon { font-size: 15px; }

.btn-store-list-count {
    min-width: 20px;
    padding: 1px 7px;
    border-radius: 10px;
    background: #FFD60A;
    color: #1A1A1A;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
}

/* ===== 업체 목록 시트 ===== */
.list-sheet {
    display: flex;
    flex-direction: column;
    max-height: 72vh;
    max-height: 72dvh;
    overflow: hidden;
}

.list-head {
    padding: 2px 20px 10px;
    border-bottom: 1px solid #F0F0F0;
}

.list-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #1A1A1A;
}

.list-hint {
    margin: 3px 0 0;
    font-size: 12px;
    color: #999;
}

.list-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px 12px;
}

.list-item {
    display: flex;
    gap: 12px;
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid #F5F5F5;
    background: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.list-item:active { background: #FAFAFA; }

.list-thumb {
    flex-shrink: 0;
    width: 76px;
    height: 76px;
    border-radius: 10px;
    object-fit: cover;
    background: #F5F5F5;
}

.list-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 2px;
}

.list-name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.list-name-text {
    font-size: 15px;
    font-weight: 700;
    color: #1A1A1A;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    font-size: 12px;
    color: #666;
}

.list-coupon {
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: 6px;
    background: #FFF6CC;
    color: #8A6D00;
    font-weight: 700;
}

.list-coupon-name,
.list-hours {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-rating {
    color: #f5a623;
    font-weight: 600;
}

/* 리뷰 0개 제휴 가맹점 — ★ 0.0 대신 (메인 .shop-new 와 같은 모양) */
.rating-new {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #E8590C;
    border: 1px solid #E8590C;
    border-radius: 4px;
    padding: 0 4px;
    line-height: 16px;
    vertical-align: middle;
}

.list-addr {
    font-size: 12px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-addr b {
    color: #555;
    font-weight: 600;
}

/* 데스크톱/태블릿: 탭바가 바닥에서 띄운 플로팅 독(bottom 20px, 높이 60px)이 된다 (common.css)
   → 지도는 바닥까지 채우고, 버튼·시트는 독 위로 올린다 */
@media (min-width: 768px) {
    body.map-page { padding-bottom: 0; }

    .btn-store-list,
    .btn-my-location { bottom: 96px; }

    .map-sheet {
        bottom: 92px;
        transform: translateX(-50%) translateY(calc(100% + 92px));
        max-height: calc(100vh - 110px);
        max-height: calc(100dvh - 110px);
        border-radius: 20px;
    }

    .map-sheet.open { transform: translateX(-50%) translateY(0); }
}

/* 탭바가 항상 위에 */
.tab-bar { z-index: 200; }
