/* =========================
   BASE / RESET
========================= */
html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.osm-root{
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
}

/* =========================
   TOPBAR
========================= */
.osm-topbar{
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid #d8d8d8;
  background: #ffffff;
  z-index: 50;
}

.osm-brand{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}
.osm-brand-text{
  font-weight: 700;
  font-size: 18px;
  color: #2b2b2b;
}

.osm-menu{
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
}
.osm-menu-item{
  color: #4b4b4b;
  text-decoration: none;
  font-size: 14px;
}
.osm-menu-item:hover{ text-decoration: underline; }

.osm-menu-item--primary{
  border: 1px solid #78c257;
  color: #2f7d1f;
  padding: 6px 10px;
  border-radius: 4px;
  text-decoration: none;
}
.osm-menu-item--primary:hover{
  text-decoration: none;
  filter: brightness(0.98);
}
.osm-menu-item--heart{ color: #e11d48; }

.osm-topbar-right{
  display: flex;
  align-items: center;
  gap: 8px;
}

.osm-pill{
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #d2d2d2;
  background: #f7f7f7;
  font-size: 13px;
  cursor: pointer;
}
.osm-pill--ghost{ background: #fff; }

/* =========================
   MAP / OVERLAYS LAYOUT
========================= */
.osm-map-wrap{
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.osm-map-layer{
  position: absolute;
  inset: 0;
  z-index: 1;
}

.osm-map{
  height: 100%;
  width: 100%;
}

/* evita o card cortar overlays absolutos */
.pane-card{ overflow: visible; }
.pane-body{ overflow: visible; }

/* =========================
   SEARCH (expand/collapse)
========================= */
.osm-search{
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255,255,255,0.96);
  border: 1px solid #d7d7d7;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.10);
  z-index: 1200;
  transition: width .25s ease;
  overflow: hidden;
}

.osm-search.collapsed{ width: 44px; }
.osm-search.expanded{ width: 360px; }

.osm-search-row{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
}

.osm-search.collapsed .osm-search-row{
  padding: 4px;
  justify-content: center;
}

.osm-search-input{
  flex: 1 1 auto;
  height: 34px;
  border: 1px solid #cfcfcf;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  outline: none;
  min-width: 0;
}

.osm-search-input:focus{
  border-color: #7fb4ff;
  box-shadow: 0 0 0 3px rgba(127,180,255,0.25);
}

.osm-search-btn{
  width: 38px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #cfcfcf;
  background: #fff;
  cursor: pointer;
}
.osm-search-btn:hover{ filter: brightness(0.98); }

.osm-search.collapsed .osm-search-input{
  opacity: 0;
  pointer-events: none;
  width: 0;
  padding: 0;
  border: none;
}

.osm-search.expanded .osm-search-input{
  opacity: 1;
  pointer-events: auto;
  width: 100%;
}

/* =========================
   RIGHT TOOLBAR
========================= */
.osm-rightbar{
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1200;
}

.osm-rbtn{
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #cfcfcf;
  background: rgba(255,255,255,0.95);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.10);
  display: grid;
  place-items: center;
  font-size: 16px;
}
.osm-rbtn:hover{ filter: brightness(0.98); }

.osm-rsep{
  height: 1px;
  width: 40px;
  background: rgba(0,0,0,0.15);
  margin: 2px 0;
}

/* =========================
   SCALE
========================= */
.osm-scale{
  position: absolute;
  left: 10px;
  bottom: 12px;
  display: inline-flex;
  gap: 8px;
  z-index: 1100;
}

.osm-scale-item{
  background: rgba(255,255,255,0.92);
  border: 1px solid #d2d2d2;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  color: #333;
}

/* =========================
   Leaflet
========================= */
.leaflet-control-attribution{ font-size: 11px; }
.leaflet-control-container{ z-index: 900; }

/* você usa offcanvas, então esconde layers control padrão */
.leaflet-control-layers { display: none !important; }

/* =========================
   OFFCANVAS CAMADAS
========================= */
.offcanvas{
  z-index: 20000 !important;
}
.offcanvas-backdrop{
  z-index: 19999 !important;
}

.offcanvas-layers .offcanvas-body{ padding: 0 !important; }

.layers-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  padding: 18px 18px 8px 18px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.layers-title{
  font-size: 32px;
  line-height: 1.05;
  font-weight: 700;
  color: #111;
  max-width: 280px;
}

.layers-close{
  border: none;
  background: transparent;
  font-size: 22px;
  padding: 8px 10px;
  cursor: pointer;
  opacity: 0.7;
}
.layers-close:hover{ opacity: 1; }

.layers-list{
  padding: 12px 14px 16px 14px;
  display:flex;
  flex-direction:column;
  gap: 14px;
}

.basemap-item{
  width: 100%;
  display:flex;
  gap: 12px;
  align-items:center;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.basemap-item:hover{ border-color: rgba(0,0,0,0.22); }

.basemap-meta{ flex: 1 1 auto; min-width: 0; }

.basemap-title{
  font-size: 18px;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.basemap-subtitle{
  font-size: 12px;
  color: rgba(0,0,0,0.55);
  margin-top: 2px;
}

.basemap-actions{
  display:flex;
  align-items:center;
  justify-content:center;
  width: 34px;
}

.basemap-info{ font-size: 18px; opacity: 0.55; }
.basemap-item:hover .basemap-info{ opacity: 0.85; }

.basemap-thumb{
  width: 120px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(0,0,0,0.10);
  background: #f2f2f2;
}

/* =========================
   SPLIT (mobile-friendly)
========================= */
.drag-handle{ touch-action: none; }

/* =========================
   RESPONSIVO (CELULAR / TABLET)
========================= */
@media (max-width: 900px){
  /* esconde menu longo no mobile/tablet */
  .osm-menu{ display: none; }

  .osm-brand{ min-width: 0; }
  .osm-brand-text{ font-size: 16px; }

  .osm-pill{
    height: 30px;
    padding: 0 8px;
    font-size: 12px;
  }
}

@media (max-width: 520px){
  /* diminui espaçamentos e evita overlap */
  .osm-topbar{
    gap: 8px;
    padding: 0 8px;
  }

  /* SEARCH: largura máxima dentro da tela */
  .osm-search.expanded{
    width: calc(100vw - 20px);
    max-width: 360px;
  }

  /* SEARCH: botão e input menores */
  .osm-search-input{ height: 32px; font-size: 13px; }
  .osm-search-btn{ width: 36px; height: 32px; }

  /* TOOLBAR: botões menores e um pouco mais abaixo para não bater no search */
  .osm-rightbar{
    top: 60px;           /* ✅ evita “bater” no search */
    right: 10px;
    gap: 6px;
  }
  .osm-rbtn{
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 15px;
  }

  /* SCALE mais compacta */
  .osm-scale{
    left: 10px;
    bottom: 10px;
  }
  .osm-scale-item{
    padding: 3px 7px;
    font-size: 11px;
  }

  /* OFFCANVAS: thumbs mais compactas */
  .layers-title{ font-size: 26px; }
  .basemap-thumb{ width: 96px; height: 50px; }
  .basemap-title{ font-size: 16px; }
}