/* Màu và font theo stitch-export/DESIGN.md. Thiết kế cho điện thoại trước (nguyên tắc I). */
:root {
  --primary: #b02f00;
  --primary-container: #ff5722;
  --on-primary: #fff;
  --surface: #f9f9ff;
  --surface-low: #f0f3ff;
  --surface-high: #dee8ff;
  --on-surface: #111c2d;
  --muted: #5b4039;
  --outline: #e4beb4;
  --error: #ba1a1a;
  --ok: #1b6d24;
  --brand-navy: #2b374e;   /* chữ "Ú na", "Map" trong logo gốc */
  --brand-teal: #4b8484;   /* chữ "Ú nu" trong logo gốc — xanh vintage */
  --radius: 16px;
  --tap: 44px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  font: 16px/1.45 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--on-surface); background: var(--surface);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; }

#map { position: fixed; inset: 0; z-index: 0; background: #e8efe9; }

/* ---------- thanh trên ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px 16px;
  pointer-events: none;
}
.topbar h1 {
  margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em;
  background: rgba(255,255,255,.92); padding: 6px 12px; border-radius: 999px;
  box-shadow: 0 2px 8px rgba(17,28,45,.12);
}
.topbar > * { pointer-events: auto; }
.icon-btn {
  min-width: var(--tap); min-height: var(--tap); border: 0; border-radius: 999px;
  background: rgba(255,255,255,.95); box-shadow: 0 2px 8px rgba(17,28,45,.15); font-size: 20px;
}

/* ---------- nút nổi ---------- */
.fab {
  position: fixed; z-index: 500; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 16px);
  width: 64px; height: 64px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-teal); color: #fff;
  font-size: 30px; line-height: 1; box-shadow: 0 6px 18px rgba(43,55,78,.35);
}
.fab:active { transform: translateX(-50%) scale(.97); }
.fab-small {
  position: fixed; z-index: 500; right: 16px; bottom: calc(var(--safe-bottom) + 20px);
  width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: #fff; color: var(--primary); font-size: 24px; box-shadow: 0 2px 10px rgba(17,28,45,.2);
}

/* ---------- ghim ---------- */
.pin { background: none; border: 0; }
.pin img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.pin-emoji { display: grid; place-items: center; width: 100%; height: 100%; font-size: 28px; }
.me-dot {
  width: 16px; height: 16px; border-radius: 50%; background: #2a7de8;
  border: 3px solid #fff; box-shadow: 0 0 0 2px #2a7de8, 0 0 0 10px rgba(42,125,232,.18);
}

/* ---------- tấm trượt (sheet) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 900; background: rgba(17,28,45,.35);
  animation: fade .15s ease-out;
}
.sheet {
  position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0;
  max-height: 100%; height: var(--sheet-h, auto);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 24px rgba(17,28,45,.2);
  animation: up .2s ease-out;
}
.sheet.full { top: 0; border-radius: 0; }
.sheet-head {
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) * var(--top-safe, 0) + 8px) 8px 8px;
  border-bottom: 1px solid var(--surface-high);
}
.sheet-head h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; }
.sheet.full .sheet-head { --top-safe: 1; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
.sheet-foot {
  padding: 12px 16px calc(var(--safe-bottom) + 12px);
  border-top: 1px solid var(--surface-high); background: var(--surface);
  display: flex; gap: 8px;
}
@keyframes up { from { transform: translateY(30%); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- nút & ô nhập ---------- */
.btn {
  min-height: var(--tap); padding: 0 18px; border-radius: 12px; border: 1px solid var(--outline);
  background: #fff; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary { background: var(--primary-container); border-color: var(--primary-container); color: var(--on-primary); }
.btn.big { min-height: 56px; font-size: 17px; flex: 1; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--error); border-color: var(--error); }
.btn.block { width: 100%; }
.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  border: 1px solid var(--outline); border-radius: 12px; background: #fff;
}
.field textarea { min-height: 80px; resize: vertical; }
.field .error { color: var(--error); font-size: 14px; margin-top: 4px; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.notice {
  padding: 12px; border-radius: 12px; background: var(--surface-low); margin-bottom: 16px; font-size: 15px;
}
.notice.warn { background: #fff4e5; }
.notice.error { background: #ffdad6; color: #93000a; }

/* ---------- toast ---------- */
#toast {
  position: fixed; z-index: 2000; left: 50%; bottom: calc(var(--safe-bottom) + 88px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--on-surface); color: #fff; font-size: 15px; transition: .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--error); }

.leaflet-control-attribution { font-size: 10px; max-width: 70vw; }
/* Ghi nguồn bản đồ: đặt góc trên trái, dưới tiêu đề, để nút nổi không che. */
.leaflet-bottom.leaflet-right { top: calc(env(safe-area-inset-top, 0px) + 84px); bottom: auto; left: 0; right: auto; }
.leaflet-bottom.leaflet-right .leaflet-control-attribution { border-radius: 0 6px 6px 0; }

/* ---------- luồng check-in ---------- */
.rationale { text-align: center; padding: 24px 8px; }
.big-emoji { font-size: 64px; }
.pick-buttons { display: flex; gap: 8px; }
.pick-buttons .btn { flex: 1; min-height: 64px; }
.thumbs { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumbs li { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-high); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs .badge { position: absolute; left: 4px; bottom: 4px; font-size: 14px; background: rgba(255,255,255,.85); border-radius: 8px; padding: 0 4px; }
.thumbs .rm { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(17,28,45,.7); color: #fff; }
.thumbs .rm::after { content: ''; position: absolute; inset: -6px; } /* vùng chạm ≥ 44px */

.place-list, .pick-list { list-style: none; padding: 0; margin: 0 0 16px; }
.place-row, .pick-row, .menu-row {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 8px 4px; border: 0; border-bottom: 1px solid var(--surface-high); background: none;
}
.place-row .grow, .pick-row > span:first-child, .menu-row span { flex: 1; min-width: 0; }
.place-row small, .pick-row small, .menu-row small, .visit-head small { display: block; color: var(--muted); font-size: 13px; }
.place-row b, .pick-row b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist { color: var(--primary); font-weight: 700; white-space: nowrap; }
.count { color: var(--primary); font-size: 13px; font-weight: 600; white-space: nowrap; }
.row-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.row-btns .btn { flex: 1; }
.center { text-align: center; }
.link { border: 0; background: none; color: var(--primary); font-weight: 600; padding: 8px 4px; min-height: var(--tap); }

.mini-map-wrap { position: relative; margin: 0 -16px 4px; }
.mini-map { height: 55vh; min-height: 300px; }
.map-expand {
  position: absolute; z-index: 800; right: 10px; top: 10px; width: var(--tap); height: var(--tap);
  border: 0; border-radius: 12px; background: #fff; font-size: 22px; box-shadow: 0 2px 8px rgba(17,28,45,.25);
}
/* Bản đồ toàn màn hình để kéo ghim chính xác */
.mini-map-wrap.fullscreen { position: fixed; inset: 0; z-index: 1100; margin: 0; background: var(--surface); }
.mini-map-wrap.fullscreen .mini-map { height: 100%; }
.mini-map-wrap.fullscreen .map-expand { top: calc(env(safe-area-inset-top, 0px) + 10px); }
.leaflet-touch .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; }
.area-row { display: flex; align-items: center; gap: 8px; min-height: var(--tap); }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.group-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
  border: 2px solid transparent; border-radius: 12px; background: #fff; min-height: 84px;
}
.group-btn small { font-size: 11px; line-height: 1.2; text-align: center; }
.group-btn.on { border-color: var(--primary-container); background: #fff1ec; }
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; min-height: var(--tap); padding: 6px 4px; border: 1px solid var(--outline); border-radius: 12px;
  background: #fff; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.seg button small { font-weight: 400; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--primary-container); border-color: var(--primary-container); color: #fff; }
.seg button.on small { color: #fff; }

.visit-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.visit-head b { font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 12px; background: var(--surface-high); border-radius: 999px; }
.chip button { border: 0; background: none; width: 32px; height: 32px; }
.dish-add { display: flex; gap: 8px; }
.dish-add input { flex: 1; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--outline); border-radius: 12px; }
.stars { display: flex; gap: 4px; }
.stars button { width: 48px; height: 48px; border: 0; background: none; font-size: 32px; color: #d8d8d8; }
.stars button.on { color: #f5a623; }
.warn-text { color: #8a4b00; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; color: var(--muted); }
.menu-row { font-size: 20px; }
.menu-row span { font-size: 16px; }

/* ô địa chỉ trong biểu mẫu quán */
.addr-field { position: relative; margin-bottom: 12px; }
.addr-field > span small { font-weight: 400; }
.addr-row input { font-size: 16px; border-width: 2px; border-color: var(--primary-container); min-width: 0; }
.addr-row { display: flex; gap: 8px; }
.addr-row input { flex: 1; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--outline); border-radius: 12px; background: #fff; }
.btn.icon { min-width: var(--tap); padding: 0; font-size: 20px; }
.addr-list {
  position: absolute; z-index: 1200; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px 0;
  list-style: none; background: #fff; border-radius: 12px; box-shadow: 0 6px 20px rgba(17,28,45,.2);
  max-height: 50vh; overflow-y: auto;
}
.addr-list .hint { padding: 8px 12px; }
.addr-row-btn { width: 100%; min-height: 52px; border: 0; background: none; text-align: left; padding: 6px 12px; }
.addr-row-btn small { display: block; color: var(--muted); font-size: 13px; }

/* icon "You are here" */
.me-pin { background: none; border: 0; }
.me-pin img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
.fab-small { display: grid; place-items: center; padding: 0; }
.fab-small img, .btn.icon img { display: block; pointer-events: none; }

/* ---------- bước lượt ghé ---------- */
/* Ô ngày: input date trong suốt phủ kín ô → chạm đâu cũng mở lịch */
.date-box {
  position: relative; display: flex; align-items: center; min-height: 52px; padding: 0 14px;
  border: 1px solid var(--outline); border-radius: 12px; background: #fff; font-size: 17px; cursor: pointer;
}
.date-box .f-date { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.date-box .f-date::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.chip.on { background: #ffe1d6; }
.chips.suggest { margin-top: 8px; }
.chip-btn {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--outline); border-radius: 999px;
  background: #fff; font-size: 15px; position: relative;
}
.chip-btn::after { content: ''; position: absolute; inset: -2px 0; } /* vùng chạm ≥ 44px */
.chip-btn.add { border-color: var(--primary-container); color: var(--primary); font-weight: 600; }
.price-range { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.price-range input { flex: 1; min-width: 0; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--outline); border-radius: 12px; background: #fff; }

/* ---------- bản đồ tạo quán: tràn ngang, cao ~40% màn hình; ⛶ để xem toàn màn hình ---------- */
.mini-map-wrap { margin: 0 -16px 8px; }
.mini-map { height: 40vh; min-height: 240px; max-height: 360px; }

/* giờ bán: 2 ô chọn giờ, chạm đâu cũng mở bộ chọn */
.hours-row { display: flex; align-items: center; gap: 8px; }
.time-box {
  position: relative; flex: 1; display: flex; flex-direction: column; justify-content: center;
  min-height: 56px; padding: 4px 12px; border: 1px solid var(--outline); border-radius: 12px; background: #fff; cursor: pointer;
}
.time-box small { color: var(--muted); font-size: 12px; }
.time-box input { border: 0; padding: 0; font-size: 17px; background: none; min-height: 0; width: 100%; }

/* thẻ quán: ảnh đã check-in */
h3.sub { font-size: 15px; margin: 16px 0 8px; }
.photo-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-grid button { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--surface-high); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-date { position: absolute; left: 4px; bottom: 4px; padding: 0 6px; border-radius: 6px; background: rgba(17,28,45,.65); color: #fff; font-size: 11px; }
.sheet.viewer { background: #000; color: #fff; }
.sheet.viewer .sheet-head { border-color: #222; }
.sheet.viewer .sheet-body { display: flex; flex-direction: column; justify-content: center; padding: 0; }
.sheet.viewer .sheet-foot { background: #000; border-color: #222; }
.viewer-img { width: 100%; max-height: 70vh; object-fit: contain; }
.viewer-info { padding: 12px 16px; }
.viewer-info p { margin: 4px 0; }

/* ---------- thương hiệu: Ú na Ú nu Map ---------- */
.topbar h1.brand {
  display: flex; align-items: center; gap: 8px; padding: 4px 18px 4px 6px;
  font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--brand-navy);
}
.topbar h1.brand img { width: 48px; height: auto; }
.topbar h1.brand img { display: block; }
#splash {
  position: fixed; inset: 0; z-index: 3000; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; background: #fff; transition: opacity .35s ease;
}
#splash img { width: min(70vw, 300px); height: auto; animation: bob 1.4s ease-in-out infinite; }
#splash .splash-name { margin: 4px 0 0; font-size: 44px; font-weight: 800; letter-spacing: -0.03em; color: var(--brand-navy); }
.brand-teal { color: var(--brand-teal); }
#splash p { margin: 0; color: var(--muted); font-size: 15px; }
#splash.hide { opacity: 0; pointer-events: none; }
@keyframes bob { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { #splash img { animation: none; } }
