/* ============================================================================
   NomadingSpot 공용 컴포넌트 (A안 소프트 미니멀, Phase 1)
   style.css 다음에 읽는다. 같은 선택자는 여기 값이 이긴다.
   - 토스트: 하단 어두운 알약
   - 하단 탭바: 흰 바탕, 활성 탭은 진한 글자
   - 바텀시트: 카페 정보 카드(.cafe-info-card)
   - 카공 지표 바: .ns-metrics (자리 상태 + 혼잡도 막대 + 콘센트/와이파이/카공 중 타일)
   ============================================================================ */

/* --- 토스트 ------------------------------------------------------------- */
.toast-container {
    top: auto;
    bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 12px);
    flex-direction: column-reverse;
}
.toast {
    gap: 10px;
    padding: 14px 18px;
    border: 0;
    border-radius: var(--radius-md);
    background: var(--toast-bg);
    color: var(--toast-text);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-sm);
    font-weight: var(--weight-medium);
    transform: translateY(12px);
    transition: opacity 0.2s var(--ease-out), transform 0.3s var(--ease-out);
}
.toast--show { opacity: 1; transform: translateY(0); }
.toast--hide { opacity: 0; transform: translateY(8px); }
[data-theme="dark"] .toast { background: var(--toast-bg); box-shadow: var(--shadow-lg); }
.toast--success .toast-icon { color: #3DBE7A; }
.toast--error .toast-icon { color: #F97066; }
.toast--info .toast-icon { color: #84ADFF; }
.toast--badge .toast-icon { color: #FDB022; }
body.page-cafe-detail .toast-container { bottom: calc(var(--safe-bottom) + 96px); }

/* --- 하단 탭바 ----------------------------------------------------------- */
.bottom-nav {
    background: var(--surface-card);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: 1px solid var(--line);
    box-shadow: none;
    padding-top: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
}
.nav-item {
    gap: 4px;
    padding: 6px 0;
    min-width: 0;
    border-radius: 0;
    color: var(--text-weak);
    transition: color var(--transition-fast);
}
.nav-item.active {
    color: var(--text-strong);
    background: transparent;
}
.nav-item .nav-icon-svg,
.nav-item-home .nav-icon-svg { width: 24px; height: 24px; }
.nav-item.active .nav-icon-svg { stroke: currentColor; stroke-width: 2.2; }
.nav-label { font-size: 11px; font-weight: var(--weight-medium); }
.nav-item.active .nav-label { font-weight: var(--weight-bold); }
.nav-item:active { transform: scale(0.96); }

/* --- 바텀시트 (지도 카페 카드) -------------------------------------------- */
.cafe-info-card {
    background: var(--surface-card);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -6px 24px rgba(25, 31, 40, 0.10);
}
[data-theme="dark"] .cafe-info-card { box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.45); }
.cafe-info-handle {
    width: 36px;
    height: 5px;
    border-radius: 3px;
    background: var(--line-strong);
    margin: 8px auto 4px;
}
/* 손잡이 터치 영역은 넓게 */
.cafe-info-handle::before {
    content: "";
    display: block;
    height: 28px;
    margin: -12px -40px 0;
}

/* --- 카공 지표 바 -------------------------------------------------------- */
.ns-metrics {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin: var(--space-4) 0;
}
.ns-metrics-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-3);
}
.ns-metrics-label { font-size: 13px; color: var(--text-normal); }
.ns-metrics-status {
    font-size: 26px;
    font-weight: var(--weight-heavy);
    letter-spacing: -0.8px;
    line-height: 1.25;
    color: var(--text-weak);
}
.ns-metrics-sub { font-size: 12px; color: var(--text-weak); margin-top: 2px; }

/* 혼잡도 1(널널)~5(빈 자리 없음), 0 = 정보 없음 */
.ns-level-1, .ns-level-2 { --ns-level-color: var(--brand); }
.ns-level-3 { --ns-level-color: var(--warning); }
.ns-level-4 { --ns-level-color: #F97316; }
.ns-level-5 { --ns-level-color: var(--danger); }
.ns-metrics-status[class*="ns-level-"]:not(.ns-level-0) { color: var(--ns-level-color); }

.ns-meter {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding-bottom: 4px;
    flex: none;
}
.ns-meter i {
    display: block;
    width: 10px;
    border-radius: 3px;
    background: var(--line);
}
.ns-meter i:nth-child(1) { height: 14px; }
.ns-meter i:nth-child(2) { height: 20px; }
.ns-meter i:nth-child(3) { height: 26px; }
.ns-meter i:nth-child(4) { height: 32px; }
.ns-meter i:nth-child(5) { height: 38px; }
.ns-meter i.on { background: var(--ns-level-color, var(--line-strong)); }

.ns-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
}
.ns-tile {
    background: var(--surface-sunken);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    color: var(--text-normal);
}
.ns-tile-label { font-size: 12px; color: var(--text-normal); }
.ns-tile-value {
    font-size: 17px;
    font-weight: var(--weight-heavy);
    color: var(--text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ns-metrics.is-loading .ns-metrics-status,
.ns-metrics.is-loading .ns-tile-value {
    color: transparent;
    background: var(--surface-sunken);
    border-radius: 6px;
    animation: ns-pulse 1.2s ease-in-out infinite;
}
.ns-metrics.is-loading .ns-metrics-status { width: 140px; }
.ns-metrics.is-loading .ns-tile-value { background: var(--line); width: 60%; }
@keyframes ns-pulse { 50% { opacity: 0.55; } }

@media (max-width: 340px) {
    .ns-metrics-status { font-size: 22px; }
    .ns-tile { padding: 10px; }
    .ns-tile-value { font-size: 15px; }
}

/* --- 카페 상세 (Phase 2) ------------------------------------------------- */
.cafe-detail-hero-header .cafe-detail-list-btn {
    width: 44px;
    height: 44px;
    margin-left: -10px;
    color: var(--text-strong);
}
.cafe-detail-hero-header .cafe-detail-list-btn:hover { color: var(--text-strong); background: var(--surface-sunken); }
.cafe-detail-meta-row { align-items: center; color: var(--text-normal); }
.cafe-detail-meta-row .meta-icon { display: inline-flex; color: var(--text-weak); }
.hero-chip-icon { display: inline-flex; filter: none; color: #F5B400; }
#detail-metrics .ns-metrics { margin: var(--space-5) 0 var(--space-3); }
.info-section h3,
.blog-section h3 { display: flex; align-items: center; gap: 8px; }
.info-section h3 .icon,
.blog-section h3 .icon { color: var(--text-weak); flex: none; }
.review-icon { display: inline-flex; color: var(--text-weak); }
.rating-sub-icon { display: inline-flex; vertical-align: -3px; color: var(--text-weak); }
.rating-sub-badge { display: inline-flex; align-items: center; gap: 3px; }
.blog-author, .blog-date { display: inline-flex; align-items: center; gap: 4px; }
/* 상단: 뒤로(왼쪽) · 저장(오른쪽), 카페명은 그 아래 한 줄 */
.cafe-detail-hero-header { flex-wrap: wrap; gap: 0; margin-bottom: var(--space-2); }
.cafe-detail-hero-header .cafe-detail-save-btn { order: 2; margin-left: auto; width: 44px; height: 44px; color: var(--text-strong); }
.cafe-detail-hero-header .cafe-detail-list-btn { order: 1; }
.cafe-detail-hero-header .cafe-detail-hero-title {
    order: 3;
    flex: 0 0 100%;
    margin-top: var(--space-2);
}
.cafe-detail-hero-title {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--text-strong);
    font-size: 26px;
    font-weight: var(--weight-heavy);
    letter-spacing: -0.8px;
    line-height: 1.3;
}
body.page-cafe-detail { background: var(--surface-card); }
body.page-cafe-detail .cafe-detail {
    background: var(--surface-card);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* --- 지도 현재 위치 버튼 (Phase 2): 위치는 map.js 가 바텀시트 위로 맞춘다 --- */
.current-location-btn {
    width: 44px;
    height: 44px;
    border: 0;
    background: var(--surface-card);
    box-shadow: 0 2px 10px rgba(25, 31, 40, 0.14);
    color: var(--text-strong);
    transition: bottom 0.25s ease, opacity 0.2s ease, transform var(--transition-fast);
}
.current-location-btn:hover { transform: none; box-shadow: 0 2px 10px rgba(25, 31, 40, 0.14); }
.current-location-btn .current-location-icon { width: 20px; height: 20px; }

/* --- 홈 인사, 내 정보, 모임 아이콘 (Phase 2) ------------------------------- */
.home-greeting-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--brand-weak);
    color: var(--brand);
}
.profile-avatar-emoji { display: inline-flex; filter: none; color: var(--on-brand); }
.profile-section-icon { display: inline-flex; color: var(--text-weak); }
.profile-badge-icon { display: inline-flex; color: var(--brand); }
.group-card-meta-item, .group-card-seats { display: inline-flex; align-items: center; gap: 4px; }
.sd-info-icon, .sd-map-icon, .wizard-selected-cafe-icon { display: inline-flex; color: var(--text-weak); }

/* --- 내 방문 기록 (2026-11-05 경량화) ------------------------------------- */
.visit-card {
    background: var(--surface-card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.visit-card + .visit-card { margin-top: var(--space-2); }
.visit-card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.visit-card-cafe { font-size: 16px; font-weight: var(--weight-bold); color: var(--text-strong); text-decoration: none; flex: 1 0 100%; }
a.visit-card-cafe:hover { text-decoration: underline; }
.visit-card-date { font-size: 12px; color: var(--text-weak); }
.visit-card-rating { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; font-size: 13px; font-weight: var(--weight-bold); color: var(--text-strong); }
.visit-card-rating .icon { color: #F5B400; }
.visit-card-tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.visit-tile {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    background: var(--surface-sunken);
    font-size: 12px;
}
.visit-tile-label { display: inline-flex; align-items: center; gap: 3px; color: var(--text-weak); }
.visit-tile-value { font-weight: var(--weight-bold); color: var(--text-strong); }
.visit-card-title { margin: 0; font-size: 14px; font-weight: var(--weight-bold); color: var(--text-strong); }
.visit-card-body { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-normal); white-space: pre-line; word-break: keep-all; overflow-wrap: anywhere; }
.visit-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.visit-tag { font-size: 12px; color: var(--brand); }

.my-visits-section { margin: var(--space-5) 0 var(--space-3); }
.my-visits-title { display: flex; align-items: center; gap: 6px; margin: 0 0 var(--space-3); font-size: 15px; font-weight: var(--weight-bold); color: var(--text-strong); }
.my-visits-title .icon { color: var(--text-weak); }
.my-visits-count { font-size: 12px; font-weight: var(--weight-bold); color: var(--brand); background: var(--brand-weak); border-radius: 999px; padding: 1px 8px; }
.my-visits-empty { margin: 0; padding: 14px 16px; border-radius: 16px; background: var(--surface-sunken); font-size: 14px; color: var(--text-weak); }

/* 지도 카드 요약 */
.card-visits { margin: var(--space-4) 0; display: flex; flex-direction: column; gap: 8px; }
.card-visits-head { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: var(--weight-bold); color: var(--text-strong); }
.card-visits-head .icon { color: var(--text-weak); }
.card-visits-body { margin: 0; font-size: 13px; color: var(--text-normal); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-visits-empty { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--text-weak); }

/* 내 기록 탭 */
.records-page { max-width: 640px; margin: 0 auto; padding: var(--space-5) 16px calc(var(--bottom-nav-height) + var(--safe-bottom) + 24px); }
.records-header { margin-bottom: var(--space-4); }
.records-title { margin: 0; font-size: 24px; font-weight: var(--weight-heavy); letter-spacing: -0.6px; color: var(--text-strong); }
.records-sub { margin: 4px 0 0; font-size: 14px; color: var(--text-weak); }
.records-empty { text-align: center; padding: 48px 16px; border-radius: 20px; background: var(--surface-sunken); }
.records-empty-icon { display: inline-flex; color: var(--text-weak); margin-bottom: 8px; }
.records-empty-title { margin: 0 0 6px; font-size: 16px; font-weight: var(--weight-bold); color: var(--text-strong); }
.records-empty-desc { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-weak); }
.records-empty-desc code { font-size: 12px; background: var(--surface-card); padding: 1px 5px; border-radius: 5px; }
a.profile-stat-chip { text-decoration: none; color: inherit; }
body.page-records { display: block; overflow-y: auto; min-height: 0; }
body.page-records main { flex: none; padding: 0; }
body.page-records main.container { padding: 0; max-width: 100%; }

/* 카페 추가 (주인) */
.records-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.records-add { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 36px; padding: 0 12px; border-radius: var(--radius-pill); background: var(--brand-weak); color: var(--brand-strong); font-size: 14px; font-weight: var(--weight-bold); text-decoration: none; }
.cafe-new-back { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 8px -4px; font-size: 14px; color: var(--text-weak); text-decoration: none; }
.cafe-new-form { display: flex; flex-direction: column; gap: 10px; }
.cafe-new-input { width: 100%; box-sizing: border-box; min-height: 56px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-card); color: var(--text-strong); font: inherit; font-size: 16px; line-height: 1.4; resize: vertical; }
.cafe-new-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.cafe-new-status { min-height: 20px; margin: 14px 0 8px; font-size: 13px; color: var(--text-weak); }
.cafe-new-results { display: flex; flex-direction: column; gap: 8px; }
.cafe-new-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--surface-card); border: 1px solid var(--line); }
.cafe-new-item-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.cafe-new-item-name { font-size: 15px; color: var(--text-strong); }
.cafe-new-item-addr { font-size: 13px; color: var(--text-normal); overflow-wrap: anywhere; }
.cafe-new-item-cat { font-size: 12px; color: var(--text-weak); }
.cafe-new-item-cat.is-warn { color: var(--warning-text); }
.cafe-new-btn { flex: none; height: 40px; padding: 0 16px; border: 0; border-radius: var(--radius-md); background: var(--brand); color: var(--on-brand); font: inherit; font-size: 14px; font-weight: var(--weight-bold); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.cafe-new-btn:disabled { opacity: 0.6; }
.cafe-new-btn--ghost { background: var(--surface-sunken); color: var(--text-normal); font-weight: var(--weight-medium); font-size: 13px; }

/* 지도 마커: 내 기록 기준(2026-11-11) */
.map-marker-wrap.is-closed { opacity: 0.45; }
.ns-dot { width: 12px; height: 12px; margin: 2px; border-radius: 50%; background: #6B7684; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.35); box-sizing: border-box; }
.ns-dot--saved { width: 16px; height: 16px; background: var(--brand); }
.ns-pin { position: relative; width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--brand); border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
.ns-pin span { transform: rotate(45deg); color: #fff; font-size: 13px; font-weight: 800; line-height: 1; }

/* 지도 '추천' 말풍선(2026-11-11). 꼬리 끝이 카페 위치(앵커 0,0)를 가리킨다 */
.rec-bubble { position: absolute; left: 0; bottom: 0; transform: translate(-50%, -10px); display: flex; flex-direction: column; gap: 1px; min-width: 96px; max-width: 168px; padding: 7px 10px 8px; border-radius: 12px; background: #fff; color: #191F28; box-shadow: 0 4px 14px rgba(0,0,0,0.18); font-size: 12px; line-height: 1.3; cursor: pointer; white-space: nowrap; }
.rec-bubble::after { display: none; content: ''; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; background: #fff; transform: translateX(-50%) rotate(45deg); box-shadow: 3px 3px 4px rgba(0,0,0,0.08); }
.rec-bubble-title { align-self: flex-start; padding: 1px 6px; border-radius: 6px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; }
.rec-bubble-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.rec-bubble-reason { color: #6B7684; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.rec-bubble.rec-mine .rec-bubble-title { background: #F59E0B; }
.rec-bubble.rec-near .rec-bubble-title { background: #3182F6; }
.rec-bubble.is-closed { opacity: 0.6; }
/* 2026-11-24: 말풍선은 map.js 가 겹치지 않는 자리에 둔다. 바로 위에 붙으면 꼬리, 떨어지면 점까지 가는 선(rec-stem, 회전) */
.rec-bubble.rec-tail::after { display: block; }
.rec-stem { position: absolute; left: 0; top: 0; width: 0; height: 2px; margin-top: -1px; background: #fff; box-shadow: 0 0 2px rgba(0,0,0,0.3); transform-origin: 0 50%; pointer-events: none; z-index: -1; }
/* 추천 버튼: 현재 위치 버튼 위, 같은 모양. 켜면 브랜드 색 */
.rec-btn { position: absolute; right: 1rem; z-index: 900; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--surface-card, #fff); color: var(--text-strong, #191F28); box-shadow: 0 2px 10px rgba(25, 31, 40, 0.14); cursor: pointer; transition: top 0.25s ease, opacity 0.2s ease, background 0.15s ease; }
.rec-btn svg { width: 20px; height: 20px; }
.rec-btn.active { background: var(--brand, #16794C); color: #fff; }

/* --- 빠른 체크인(2026-11-13, 주인만): 현재 위치 버튼 왼쪽 --------------------- */
.checkin-btn {
    position: absolute; right: calc(1rem + 52px); bottom: 100px; z-index: 900;
    display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 16px;
    border: 0; border-radius: 22px; background: var(--brand, #3182F6); color: #fff;
    font-size: 14px; font-weight: 700; box-shadow: 0 2px 10px rgba(25, 31, 40, 0.18);
    transition: top 0.25s ease, opacity 0.2s ease;
}
.checkin-btn svg { width: 16px; height: 16px; }
.checkin-btn.is-busy { opacity: 0.6; }
.checkin-chooser { position: fixed; inset: 0; z-index: 20000; background: rgba(0, 0, 0, 0.35); display: flex; align-items: flex-end; }
.checkin-panel { width: 100%; padding: 18px 16px calc(16px + var(--safe-bottom, 0px)); border-radius: 20px 20px 0 0; background: var(--surface-card, #fff); }
.checkin-q { margin: 0 0 10px; font-size: 16px; font-weight: 700; color: var(--text-strong, #191F28); }
.checkin-opt { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 48px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--line, #E5E8EB); background: none; font-size: 15px; color: var(--text-strong, #191F28); text-align: left; }
.checkin-opt small { color: var(--text-weak, #8B95A1); font-size: 13px; }
.checkin-cancel { width: 100%; margin-top: 10px; min-height: 44px; border: 0; border-radius: 12px; background: var(--surface-subtle, #F2F4F6); font-size: 15px; color: var(--text-strong, #191F28); }
