/* /mapa: the map that opens the app. Phones: full-screen map, actions on top, shop cards sliding at the bottom
 * (or a list). Computers: the list on the left, the map on the right. */
body.map-app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
body.map-app > #header { flex: none; }
body.map-app .site-header { position: relative; }

.mapx { position: relative; flex: 1; min-height: 0; }
.mapx-map { position: absolute; inset: 0; z-index: 0; background: #0e1814; }
.mapx-side { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; pointer-events: none; }
.mapx-side > * { pointer-events: auto; }

/* ---------------------------------------------------------------- top: next visit, "Quero cortar agora", filters */
.mapx-head { display: grid; gap: 8px; padding: 10px 12px 0; pointer-events: none; }
.mapx-head > * { pointer-events: auto; }
.mapx-head > [hidden] { display: none; }
.mapx-next a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--accent-line);
  background: rgba(12, 22, 18, .92); color: var(--text); font-size: .88rem; line-height: 1.3; text-decoration: none;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.mapx-next svg { width: 18px; height: 18px; flex: none; stroke: var(--accent-hi); fill: none; stroke-width: 1.8; stroke-linecap: round; }
.mapx-next span { flex: 1; min-width: 0; }
.mapx-next b { color: var(--accent-hi); }
.mapx-next i { font-style: normal; color: var(--text-3); font-size: 1.2rem; }

.mapx-now { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px; border: 1px solid var(--btn-primary-edge, transparent);
  border-radius: 16px; background: var(--btn-primary); color: var(--btn-primary-text); font: inherit; text-align: left; cursor: pointer;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .8); transition: transform .12s ease, filter .15s ease; }
.mapx-now:hover { filter: brightness(1.05); }
.mapx-now:active { transform: scale(.985); }
.mapx-now:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; }
.mapx-now svg { width: 24px; height: 24px; flex: none; fill: currentColor; }
.mapx-now strong { display: block; font-size: 1.04rem; font-weight: 750; line-height: 1.2; }
.mapx-now small { display: block; color: inherit; font-size: .8rem; font-weight: 550; opacity: .74; line-height: 1.3; }

.mapx-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 2px 12px 4px; }
.mapx-chips::-webkit-scrollbar { display: none; }
.mapx-chip { flex: none; min-height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: rgba(12, 22, 18, .9);
  color: var(--text); font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background-color .15s, border-color .15s, color .15s; }
.mapx-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-hi); }
.mapx-chip:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

/* ---------------------------------------------------------------- bottom sheet with the shops */
.mapx-sheet { margin-top: auto; display: flex; flex-direction: column; min-height: 0; padding-bottom: env(safe-area-inset-bottom);
  border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; background: rgba(12, 22, 18, .95);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 -18px 40px -24px rgba(0, 0, 0, .8); }
.mapx-grip { display: grid; place-items: center; height: 18px; border: 0; background: none; cursor: grab; touch-action: none; }
.mapx-grip span { width: 40px; height: 4px; border-radius: 99px; background: var(--line-3, rgba(244, 239, 228, .28)); }
.mapx-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px 8px; }
.mapx-sheet-head strong { font-size: .98rem; font-weight: 700; }
.mapx-listbtn { min-height: 34px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: none; color: var(--text);
  font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; }
.mapx-status { margin: 0; padding: 0 16px 12px; color: var(--text-2); font-size: .88rem; }
.mapx-status[hidden] { display: none; }

.mapx-cards { display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
  padding: 0 16px 14px; scroll-padding: 0 16px; }
.mapx-cards::-webkit-scrollbar { display: none; }
.mapx-cards .mx-card { flex: 0 0 calc(100% - 36px); max-width: 380px; scroll-snap-align: center; }
.mapx-cards:has(.mx-card:only-child) .mx-card { flex-basis: 100%; max-width: none; }

/* "Ver lista": the sheet grows and the cards stack. */
.mapx-sheet.is-open { height: 78%; }
.mapx-sheet.is-open .mapx-cards { flex: 1; flex-direction: column; overflow-x: hidden; overflow-y: auto; scroll-snap-type: none; overscroll-behavior-y: contain; }
.mapx-sheet.is-open .mapx-cards .mx-card { flex: none; max-width: none; }

/* ---------------------------------------------------------------- shop card */
.mx-card { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line-2); border-radius: 18px; background: var(--surface-1, #15231d);
  cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.mx-card:hover { border-color: var(--line-3, rgba(244, 239, 228, .28)); }
.mx-card.is-selected { border-color: var(--accent-line); box-shadow: inset 0 0 0 1px var(--accent-line); }
.mx-card:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.mx-top { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.mx-logo { flex: none; width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: var(--surface-2, #1c2c25); border: 1px solid var(--line); }
.mx-logo.is-default { object-fit: contain; padding: 9px; }
.mx-info { flex: 1; min-width: 0; }
.mx-info h3 a { color: inherit; text-decoration: none; }
.mx-info h3 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.mx-info h3 { margin: 1px 0 3px; font-family: var(--font-body); font-size: 1.02rem; font-weight: 700; letter-spacing: 0; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; color: var(--text-2); font-size: .84rem; line-height: 1.35; }
.mx-meta i { font-style: normal; color: var(--text-3); }
.mx-meta .mx-price { flex-basis: 100%; }
.mx-rate { color: var(--text); font-weight: 650; }
.mx-rate small { color: var(--text-3); font-weight: 500; font-size: .78rem; }
.mx-rate svg { width: 13px; height: 13px; margin-right: 3px; vertical-align: -1px; fill: var(--accent-hi); }
.mx-new { color: var(--text-3); }
.mx-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.mx-badge { padding: 3px 9px; border-radius: 999px; background: rgba(var(--ink-rgb), .07); color: var(--text-3); font-size: .72rem; font-weight: 650; line-height: 1.35; }
.mx-badge.open { background: rgba(46, 160, 105, .15); color: #8fdcb4; }
.mx-badge.mine { background: var(--accent-soft); color: var(--accent-hi); }
.mx-badge.home { color: var(--text-2); }
.mx-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
.mx-actions .btn { min-height: 52px; }
.mx-book { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; min-width: 0; padding: 7px 18px; text-align: left; line-height: 1.2; }
.mx-book > span { font-size: .95rem; }
.mx-book small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; font-size: .74rem; font-weight: 600; opacity: .72; }
.mx-more { padding: 0 16px; }
.mx-route { width: 52px; padding: 0; }
.mx-route svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linejoin: round; }

/* ---------------------------------------------------------------- map controls */
.mapx-locate { position: absolute; right: 12px; bottom: calc(var(--sheet-h, 230px) + 12px); z-index: 2; display: grid; place-items: center;
  width: 46px; height: 46px; border: 1px solid var(--line-2); border-radius: 50%; background: rgba(12, 22, 18, .94); color: var(--text);
  cursor: pointer; box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .8); }
.mapx-locate svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }
.mapx-locate.is-on { color: #6ea8ff; }
.mapx-locate.is-busy svg { animation: mapxPulse 1s ease-in-out infinite; }
@keyframes mapxPulse { 50% { opacity: .35; } }
.mapx-area { position: absolute; left: 50%; top: calc(var(--head-h, 120px) + 10px); z-index: 2; transform: translateX(-50%); min-height: 38px; padding: 0 16px;
  border: 1px solid var(--accent-line); border-radius: 999px; background: rgba(12, 22, 18, .94); color: var(--accent-hi); font: inherit; font-size: .86rem;
  font-weight: 650; cursor: pointer; box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .8); }
.mapx-area[hidden] { display: none; }
body.map-app .install-fab { bottom: calc(var(--sheet-h, 230px) + 16px); left: 12px; transform: none; }
body.map-app .install-fab:active { transform: scale(.96); }

/* The selected shop's pin stands out. */
.leaflet-marker-icon.is-selected .bk-drop { transform: rotate(-45deg) scale(1.16); background: linear-gradient(135deg, #f0d7a4, #c8ab78); }
.leaflet-marker-icon.is-selected .bk-pin-label { background: #c8ab78; border-color: #f0d7a4; color: #101c18; }
.leaflet-control-attribution { font-size: 10px; opacity: .7; }
body.map-app .leaflet-bottom { bottom: var(--sheet-h, 0px); }

/* ---------------------------------------------------------------- "Quero cortar agora" */
.mapx-now-window .modal-head { margin-bottom: 4px; }
#nowSub { margin: 0 0 14px; }
.mapx-picks { display: grid; gap: 8px; }
.mx-pick { display: grid; grid-template-columns: 62px 44px minmax(0, 1fr) 12px; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-2);
  border-radius: 16px; background: rgba(var(--ink-rgb), .03); color: var(--text); text-decoration: none; transition: border-color .15s, background-color .15s; }
.mx-pick:hover { border-color: var(--accent-line); background: rgba(var(--ink-rgb), .06); }
.mx-pick-time b { display: block; font-family: var(--font-display); font-size: 1.5rem; font-weight: 500; line-height: 1; color: var(--accent-hi); }
.mx-pick-time small { display: block; margin-top: 3px; color: var(--text-3); font-size: .74rem; }
.mx-pick .mx-logo { width: 44px; height: 44px; border-radius: 12px; }
.mx-pick-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .98rem; }
.mx-pick-info small { display: block; margin-top: 2px; color: var(--text-2); font-size: .8rem; line-height: 1.35; }
.mx-pick-go { color: var(--text-3); font-size: 1.3rem; }
@media (max-width: 480px) {
  .mapx-now-window { padding: 22px 16px; }
  .mx-pick { grid-template-columns: 58px minmax(0, 1fr) 12px; }
  .mx-pick .mx-logo { display: none; }
}
/* Phones: the card keeps the booking button wide (the shop page opens from its name). */
@media (max-width: 899px) {
  .mx-actions { grid-template-columns: minmax(0, 1fr) auto; }
  .mx-more { display: none; }
  body.map-app .site-header .nav-links:not(.logged) { display: none; }
  body.mapx-list .mapx-locate, body.mapx-list .install-fab, body.mapx-list .mapx-area { display: none !important; }
}

/* No map on this device: the list fills the screen. */
body.mapx-nomap .mapx-sheet { height: auto; flex: 1; border-radius: 0; }
body.mapx-nomap .mapx-cards { flex-direction: column; overflow-y: auto; scroll-snap-type: none; }
body.mapx-nomap .mapx-cards .mx-card { flex: none; max-width: none; }
body.mapx-nomap .mapx-grip, body.mapx-nomap .mapx-listbtn { display: none; }

/* ---------------------------------------------------------------- computers: list on the left, map on the right */
@media (min-width: 900px) {
  .mapx { display: grid; grid-template-columns: 420px minmax(0, 1fr); }
  .mapx-map { position: relative; inset: auto; grid-column: 2; grid-row: 1; }
  .mapx-side { position: relative; inset: auto; grid-column: 1; grid-row: 1; min-height: 0; border-right: 1px solid var(--line);
    background: rgba(12, 22, 18, .96); pointer-events: auto; }
  .mapx-head { padding: 18px 18px 6px; gap: 12px; }
  .mapx-chips { display: grid; grid-template-columns: 1fr 1fr; margin: 0; padding: 0; overflow: visible; }
  .mapx-sheet { flex: 1; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .mapx-grip, .mapx-listbtn { display: none; }
  .mapx-sheet-head { padding: 12px 18px 10px; }
  .mapx-status { padding: 0 18px 12px; }
  .mapx-cards { flex: 1; flex-direction: column; overflow-x: hidden; overflow-y: auto; scroll-snap-type: none; padding: 0 18px 18px; }
  .mapx-cards .mx-card, .mapx-cards:has(.mx-card:only-child) .mx-card { flex: none; max-width: none; }
  .mapx-locate { bottom: 104px; right: 10px; }
  .mapx-area { left: calc(420px + (100% - 420px) / 2); top: 16px; }
  body.map-app .leaflet-bottom { bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { .mx-card, .mapx-now, .mx-pick { transition: none; } .mapx-locate.is-busy svg { animation: none; } }
