/* assets/css/matzip.css */
:root {
  --bg: #fffdf9;
  --ink: #1f1a17;
  --sub: #7a6f68;
  --line: #ece5de;
  --soft: #f6f1eb;
  --accent: #e8590c;
  --accent-ink: #fff;
  --naver: #03c75a;
  --danger: #d6336c;
  --r: 14px;
  --side-w: 380px;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.app { position: fixed; inset: 0; }
/* 네이버 지도가 컨테이너에 position:relative 를 인라인으로 박아서 inset 만으론 높이가 0 이 된다 */
#map { position: absolute !important; inset: 0; width: 100%; height: 100%; }

/* ── 버튼 ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 600;
  white-space: nowrap;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost   { background: #fff; }
.btn.naver   { background: var(--naver); border-color: var(--naver); color: #fff; flex: 1; }
.btn.danger  { color: var(--danger); border-color: #f3c4d4; }
.btn:disabled { opacity: .5; cursor: default; }

/* ── 사이드 패널 ──────────────────────────────────── */
.side {
  position: absolute; top: 12px; left: 12px; bottom: 12px; width: var(--side-w);
  background: var(--bg); border-radius: var(--r); box-shadow: 0 8px 30px rgba(40, 25, 10, .18);
  display: flex; flex-direction: column; overflow: hidden; z-index: 10;
}
.grip { display: none; }
.view { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.side-head { padding: 18px 18px 8px; }
.side-head h1 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.02em; }
.head-actions { display: flex; gap: 8px; margin-top: 12px; }

.filter { display: flex; gap: 8px; padding: 8px 18px; }
.filter input, .filter select {
  height: 38px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 0 10px;
}
.filter input { flex: 1; min-width: 0; }

.chips { display: flex; gap: 6px; padding: 4px 18px 10px; overflow-x: auto; scrollbar-width: none; }
.chips button {
  flex: none; height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; cursor: pointer;
}
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.list { list-style: none; margin: 0; padding: 0 10px 12px; overflow-y: auto; flex: 1; }
.list li {
  display: flex; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 12px; cursor: pointer;
}
.list li:hover, .list li.on { background: var(--soft); }
.list .thumb {
  flex: none; width: 56px; height: 56px; border-radius: 10px; background: var(--soft) center/cover;
  display: grid; place-items: center; font-size: 22px;
}
.list .meta { min-width: 0; flex: 1; }
.list .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .sm { font-size: 13px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .rt { flex: none; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.list .rt.none { color: #bbb; font-weight: 500; font-size: 13px; }
.list:empty { flex: 0; }
.empty { padding: 30px; text-align: center; color: var(--sub); }

/* ── 상세 ─────────────────────────────────────────── */
.detail-head { display: flex; gap: 6px; align-items: flex-start; padding: 14px 14px 6px; }
.back { width: 36px; height: 36px; border: 0; background: none; font-size: 28px; line-height: 1; cursor: pointer; flex: none; }
.detail-title h2 { margin: 2px 0 2px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.detail-title .cat { font-size: 13px; color: var(--sub); }
.detail-body { padding: 4px 18px 22px; overflow-y: auto; flex: 1; }

.score { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.stars { position: relative; display: inline-block; font-size: 20px; letter-spacing: 1px; line-height: 1; }
.stars .bg { color: #e3dcd5; }
.stars .fg { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: var(--accent); }
.score .num { font-size: 20px; font-weight: 800; }
.score.none { color: var(--sub); font-size: 14px; }
.visited { margin: 0 0 10px; font-size: 13px; color: var(--sub); }
.review { white-space: pre-wrap; line-height: 1.6; margin: 0 0 14px; }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.photos:empty { display: none; }
.photos .ph {
  position: relative; aspect-ratio: 1; border-radius: 10px; background: var(--soft) center/cover; cursor: zoom-in; border: 0;
}
.photos .ph .del {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; cursor: pointer;
}
.upload { margin-bottom: 14px; }

/* 상세 섹션 (내 사진 / 메뉴 / 블로그) */
.sec { margin: 18px 0 8px; font-size: 15px; font-weight: 800; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; }
.sec-head .sec { margin: 0; }
.sec-empty { margin: 0 0 10px; font-size: 13px; color: var(--sub); }
.sec-empty:empty { display: none; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }

.menus { list-style: none; margin: 8px 0 4px; padding: 0; }
.menus li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.menus li:last-child { border-bottom: 0; }
.menus .mthumb {
  flex: none; width: 64px; height: 64px; border-radius: 10px; border: 0; padding: 0;
  background: var(--soft) center/cover; cursor: zoom-in;
}
.menus .mthumb.none { cursor: default; display: grid; place-items: center; font-size: 22px; }
.menus .mbody { min-width: 0; flex: 1; }
.menus .mtop { display: flex; justify-content: space-between; gap: 8px; }
.menus .mname { font-weight: 700; }
.menus .repr { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 6px; background: #fff0e6; color: var(--accent); font-size: 11px; font-weight: 700; vertical-align: 1px; }
.menus .mprice { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.menus .mdesc {
  margin-top: 2px; font-size: 12px; color: var(--sub); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 메뉴 | 블로그 후기 탭 */
.tabs { display: flex; gap: 0; margin: 20px 0 6px; border-bottom: 1px solid var(--line); }
.tabs button {
  flex: 1; height: 40px; border: 0; background: none; cursor: pointer;
  font-size: 15px; font-weight: 700; color: var(--sub);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.pane-tools { display: flex; justify-content: flex-end; margin: 6px 0 2px; }

.blog { margin-top: 8px; }
.posts { list-style: none; margin: 4px 0 0; padding: 0; }
.posts li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.posts a { color: var(--ink); font-weight: 600; text-decoration: none; }
.posts a:hover { text-decoration: underline; }
.posts .pmeta { font-size: 12px; color: var(--sub); margin-top: 2px; }
.source { margin: 8px 0 0; font-size: 11px; color: var(--sub); }
.upload.busy { opacity: .6; pointer-events: none; }

.addr { font-size: 13px; color: var(--sub); margin: 8px 0 10px; }
.links { display: flex; gap: 8px; }
.links .btn { flex: 1; padding: 0 10px; }
/* 별점 줄 오른쪽에 수정/삭제 */
.score-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.admin-btns { display: flex; gap: 6px; flex: none; }

/* ── 지도 마커 ────────────────────────────────────── */
.mz-pin {
  position: relative; transform: translate(-50%, -100%);
  display: inline-flex; align-items: center; gap: 3px; padding: 4px 8px; border-radius: 99px;
  background: var(--pin, var(--accent)); color: #fff; font: 800 12px/1 Pretendard, sans-serif;
  box-shadow: 0 2px 6px rgba(0,0,0,.25); white-space: nowrap; cursor: pointer;
  transition: transform .12s;
}
.mz-pin::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; margin-left: -5px;
  border: 5px solid transparent; border-bottom: 0; border-top-color: var(--pin, var(--accent));
}
/* 가게 이름은 항상 보인다 (길면 말줄임) */
.mz-pin .n { font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.mz-pin.on, .mz-pin:hover { transform: translate(-50%, -100%) scale(1.12); z-index: 2; }
.mz-pin.r5 { --pin: #d9480f; }
.mz-pin.r4 { --pin: #f76707; }
.mz-pin.r3 { --pin: #f59f00; }
.mz-pin.r2 { --pin: #868e96; }
.mz-pin.r0 { --pin: #adb5bd; }
.mz-home {
  transform: translate(-50%, -50%); padding: 5px 10px; border-radius: 8px; background: var(--ink); color: #fff;
  font: 700 12px/1 Pretendard, sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.3); white-space: nowrap;
}

.admin-link {
  position: absolute; right: 14px; bottom: 30px; z-index: 5; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: var(--sub); text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.15); opacity: .6;
}
.admin-link:hover { opacity: 1; }

/* ── 추가/수정 다이얼로그 ─────────────────────────── */
.editor {
  border: 0; padding: 0; border-radius: 18px; width: min(480px, calc(100vw - 24px));
  max-height: calc(100vh - 40px); background: var(--bg); box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.editor::backdrop { background: rgba(30, 20, 10, .35); }
.editor-inner { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.editor header { display: flex; justify-content: space-between; align-items: center; }
.editor h3 { margin: 0; font-size: 18px; }
.editor .x { border: 0; background: none; font-size: 18px; cursor: pointer; }
.editor .row { display: flex; gap: 8px; }
.editor input[type=search], .editor input[type=url], .editor input[type=date], .editor textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff;
}
.editor .row input { flex: 1; }
.editor label, .editor .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--sub); }
.editor textarea { resize: vertical; color: var(--ink); font-weight: 400; }

.results { list-style: none; margin: 8px 0 0; padding: 0; }
.results li { padding: 10px; border-radius: 10px; cursor: pointer; }
.results li:hover { background: var(--soft); }
.results .nm { font-weight: 700; }
.results .sm { font-size: 12px; color: var(--sub); }
.results .msg { color: var(--sub); cursor: default; }
.results .msg:hover { background: none; }

.picked { padding: 12px; border-radius: 12px; background: var(--soft); }
.picked .nm { font-weight: 800; }
.picked .sm { font-size: 12px; color: var(--sub); }

.stars-input { display: flex; gap: 2px; font-size: 30px; line-height: 1; user-select: none; }
.stars-input .s { position: relative; color: #ddd; cursor: pointer; }
.stars-input .s .fill { position: absolute; left: 0; top: 0; width: 0; overflow: hidden; color: var(--accent); }
.stars-input .s .fill.half { width: 50%; }
.stars-input .s .fill.full { width: 100%; }
.stars-input .val { margin-left: 10px; font-size: 16px; font-weight: 800; color: var(--ink); align-self: center; }
.stars-input .clr { margin-left: 6px; font-size: 12px; color: var(--sub); align-self: center; cursor: pointer; border: 0; background: none; }

.ed-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fff0f3; color: var(--danger); font-size: 14px; }
.ed-actions { display: flex; justify-content: space-between; gap: 8px; }

/* ── 라이트박스 / 토스트 ──────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.88); display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 6px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
}

/* ── 로그인 ───────────────────────────────────────── */
.login-page { display: grid; place-items: center; padding: 16px; }
.login-card { width: min(340px, 100%); display: flex; flex-direction: column; gap: 10px; }
.login-card h1 { margin: 0; font-size: 24px; font-weight: 800; }
.login-card .sub { margin: 0 0 8px; color: var(--sub); }
.login-card input { height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; }
.login-card .btn { height: 44px; }
.back-link { font-size: 13px; color: var(--sub); text-align: center; margin-top: 6px; }

/* ── 모바일: 사이드 → 바텀시트 ────────────────────── */
@media (max-width: 720px) {
  .side {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 46vh;
    border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px);
    transition: height .2s;
  }
  .side.tall { height: 86vh; }
  .side.short { height: 120px; }
  .grip {
    display: block; flex: none; height: 22px; border: 0; background: none; cursor: pointer; position: relative;
  }
  .grip::before {
    content: ""; position: absolute; left: 50%; top: 8px; width: 40px; height: 5px; margin-left: -20px;
    border-radius: 99px; background: #d8cfc6;
  }
  .side-head { padding-top: 2px; }
  .side-head h1 { font-size: 18px; }
  .admin-link { bottom: auto; top: calc(14px + env(safe-area-inset-top, 0px)); }
}
