:root {
  --primary: #e63946;
  --primary-dark: #c1121f;
  --dark: #1d3557;
  --shadow: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 14px;
  --nav-h: 52px;
  --bar-h: 44px;
  --bnav-h: 62px;
  --sheet-peek: 180px;  /* altura visível do painel no estado colapsado */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f4f4f6;
  overflow: hidden;          /* sem scroll no body — mapa ocupa tudo */
  height: 100dvh;
}

/* ── Navbar ── */
.prox-navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  height: var(--nav-h);
  background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.prox-title {
  font-size: 1rem; font-weight: 700; color: var(--dark);
  display: flex; align-items: center; gap: 8px;
}
.prox-title i { color: var(--primary); }
.btn-recenter {
  width: 36px; height: 36px; border-radius: 50%;
  background: #f0f0f0; border: none;
  font-size: 1rem; color: #555; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-recenter:hover { background: var(--primary); color: #fff; }
.btn-recenter.pulsing { animation: pulse 1s ease-in-out infinite; background: var(--primary); color: #fff; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }

/* ── Barra de raio ── */
.radius-bar {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0; z-index: 400;
  height: var(--bar-h);
  background: #fff;
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px;
  border-bottom: 1px solid #eee;
  overflow-x: auto; scrollbar-width: none;
}
.radius-bar::-webkit-scrollbar { display: none; }
.radius-label { font-size: 0.75rem; font-weight: 600; color: #aaa; white-space: nowrap; }
.rbtn {
  flex: 0 0 auto;
  border: 1.5px solid #e0e0e0; background: #fff;
  color: #666; border-radius: 20px;
  padding: 5px 14px; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; transition: all 0.18s; white-space: nowrap;
}
.rbtn:hover { border-color: var(--primary); color: var(--primary); }
.rbtn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.radius-count {
  margin-left: auto; flex-shrink: 0;
  font-size: 0.75rem; font-weight: 700; color: var(--primary);
  white-space: nowrap;
}

/* ── Mapa ── */
#map {
  position: fixed;
  top: calc(var(--nav-h) + var(--bar-h));
  left: 0; right: 0;
  bottom: calc(var(--sheet-peek) + var(--bnav-h));
  z-index: 1;
}
/* Leaflet overrides */
.leaflet-control-zoom { border-radius: 10px !important; overflow: hidden; }
.leaflet-control-attribution { font-size: 9px !important; }

/* ── Marcador customizado ── */
.custom-marker {
  display: flex; flex-direction: column; align-items: center;
}
.marker-bubble {
  background: var(--primary);
  color: #fff; font-size: 0.68rem; font-weight: 800;
  white-space: nowrap; padding: 5px 10px;
  border-radius: 20px; border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(230,57,70,0.4);
  cursor: pointer;
  transition: transform 0.15s;
}
.marker-bubble:hover { transform: scale(1.07); }
.marker-bubble.user-marker {
  background: var(--dark); box-shadow: 0 3px 10px rgba(29,53,87,0.4);
}
.marker-tail {
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--primary);
  margin-top: -1px;
}
.marker-tail.user-tail { border-top-color: var(--dark); }

/* Círculo de raio */
.leaflet-interactive { cursor: default !important; }

/* ── Painel deslizante ── */
.rest-sheet {
  position: fixed;
  left: 0; right: 0;
  bottom: var(--bnav-h);
  z-index: 300;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.13);
  height: calc(var(--sheet-peek) + 300px);   /* altura total (peek + expandido) */
  transform: translateY(300px);              /* inicia colapsado */
  transition: transform 0.35s cubic-bezier(.32,.72,0,1);
  display: flex; flex-direction: column;
}
.rest-sheet.expanded { transform: translateY(0); }
.rest-sheet.peeking  { transform: translateY(300px); }  /* só o peek visível */

.sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: #ddd; margin: 10px auto 0;
  cursor: grab; flex-shrink: 0;
}
.sheet-header {
  padding: 10px 16px 8px; flex-shrink: 0;
  border-bottom: 1px solid #f0f0f0;
}
.sheet-title { font-size: 0.9rem; font-weight: 700; color: var(--dark); }

.sheet-list {
  overflow-y: auto; flex: 1;
  padding: 8px 12px 16px;
  scrollbar-width: none;
}
.sheet-list::-webkit-scrollbar { display: none; }

/* Cards dentro do painel */
.sheet-card {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 4px; border-bottom: 1px solid #f5f5f5;
  cursor: pointer; border-radius: 10px;
  transition: background 0.15s;
}
.sheet-card:hover { background: #fafafa; }
.sheet-card:last-child { border-bottom: none; }
.sc-img {
  width: 58px; height: 58px; border-radius: 10px;
  object-fit: cover; flex-shrink: 0;
}
.sc-info { flex: 1; min-width: 0; }
.sc-name { font-size: 0.9rem; font-weight: 700; color: var(--dark); margin-bottom: 2px; }
.sc-desc { font-size: 0.76rem; color: #888; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-meta { display: flex; align-items: center; gap: 8px; font-size: 0.74rem; color: #aaa; }
.sc-rating { color: #f4a924; font-weight: 700; }
.sc-dist { color: var(--primary); font-weight: 700; }
.sc-arrow { color: #ddd; font-size: 0.8rem; flex-shrink: 0; }

.sheet-empty {
  text-align: center; padding: 28px 16px; color: #ccc;
}
.sheet-empty i { font-size: 2rem; display: block; margin-bottom: 10px; }
.sheet-empty p { font-size: 0.85rem; }

/* ── Permissão negada ── */
.perm-overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.perm-card {
  background: #fff; border-radius: var(--radius);
  padding: 32px 24px; max-width: 340px; width: 100%;
  text-align: center; box-shadow: var(--shadow);
}
.perm-card i { font-size: 3rem; color: var(--primary); margin-bottom: 14px; display: block; }
.perm-card h3 { font-size: 1.1rem; font-weight: 800; color: var(--dark); margin-bottom: 8px; }
.perm-card p { font-size: 0.88rem; color: #777; line-height: 1.6; margin-bottom: 20px; }
.btn-perm {
  display: block; width: 100%; padding: 13px;
  background: var(--primary); color: #fff; border: none;
  border-radius: 10px; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; margin-bottom: 10px; transition: background 0.2s;
}
.btn-perm:hover { background: var(--primary-dark); }
.btn-perm-sec {
  display: block; font-size: 0.85rem; color: #aaa;
  text-decoration: none; padding: 8px;
}
.btn-perm-sec:hover { color: var(--dark); }

/* Popup do Leaflet */
.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
  padding: 0 !important;
  overflow: hidden;
}
.leaflet-popup-content { margin: 0 !important; width: auto !important; }
.leaflet-popup-tip-container { display: none; }

.popup-inner {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 14px; cursor: pointer; min-width: 200px;
}
.popup-img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.popup-info { flex: 1; }
.popup-name { font-size: 0.88rem; font-weight: 700; color: var(--dark); margin-bottom: 2px; }
.popup-desc { font-size: 0.72rem; color: #888; margin-bottom: 4px; }
.popup-meta { display: flex; gap: 8px; font-size: 0.72rem; }
.popup-rating { color: #f4a924; font-weight: 700; }
.popup-dist { color: var(--primary); font-weight: 700; }
