/* RURÁPIDO P2.5-U2 — fechamento cartográfico + Meu Mapa mobile */

/* MAPA ESTÁTICO/RELATÓRIOS
   A imagem passa a participar do fluxo normal. Ela própria define a altura do viewport.
   O SVG continua absoluto exatamente sobre a mesma caixa. Isso evita a resolução
   divergente de height:100% / aspect-ratio pelo Safari durante a impressão. */
.rr-sat-map-viewport{
  position:relative!important;
  display:block!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-height:none!important;
  aspect-ratio:auto!important;
  overflow:hidden!important;
  background:#e7ece8!important;
}
.rr-sat-map-viewport > img.rr-sat-image{
  position:relative!important;
  inset:auto!important;
  display:block!important;
  width:100%!important;
  height:auto!important;
  min-height:0!important;
  max-width:100%!important;
  max-height:none!important;
  aspect-ratio:1400/820!important;
  object-fit:fill!important;
  margin:0!important;
  padding:0!important;
  z-index:1!important;
}
.rr-sat-map-viewport > svg.rr-sat-overlay{
  position:absolute!important;
  inset:0!important;
  display:block!important;
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  max-width:none!important;
  max-height:none!important;
  z-index:2!important;
  overflow:hidden!important;
  pointer-events:none!important;
}
.rr-sat-map-viewport > .rr-sat-fallback{display:none!important}
.rr-sat-map-viewport.rr-map-image-error > .rr-sat-fallback{
  display:flex!important;
  z-index:0!important;
}
.rr-sat-source{
  left:8px!important;
  right:8px!important;
  width:auto!important;
  max-width:calc(100% - 16px)!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}

/* Impressão Safari/iOS: neutraliza regras mobile que antes deixavam
   o relatório preso a 100dvh/overflow scroll, cortando o topo do PDF. */
@media print{
  .rr-sat-map-viewport{
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    aspect-ratio:auto!important;
    overflow:hidden!important;
    break-inside:avoid!important;
    page-break-inside:avoid!important;
    -webkit-print-color-adjust:exact!important;
    print-color-adjust:exact!important;
  }
  .rr-sat-map-viewport > img.rr-sat-image{
    position:relative!important;
    width:100%!important;
    height:auto!important;
    aspect-ratio:1400/820!important;
    object-fit:fill!important;
    -webkit-print-color-adjust:exact!important;
    print-color-adjust:exact!important;
  }
  .rr-sat-map-viewport > svg.rr-sat-overlay{
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
  }
  .rr-sat-fallback{display:none!important}
  .rr-sat-source{
    background:rgba(255,255,255,.90)!important;
    color:#26372e!important;
    border:1px solid rgba(40,70,55,.20)!important;
    font-size:6pt!important;
    line-height:1.2!important;
    padding:1.2mm 1.5mm!important;
    bottom:1.5mm!important;
  }

  body.rr-map-report-print,
  body.rr-map-report-print #rr-map-report-overlay,
  body.rr-map-report-print .rr-map-report-overlay-inner,
  body.rr-map-report-print .rr-map-report-shell,
  body.rr-map-report-print .rr-map-report-doc{
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow:visible!important;
    position:static!important;
    transform:none!important;
  }
  body.rr-map-report-print .rr-map-report-overlay-inner{
    width:100%!important;
    -webkit-overflow-scrolling:auto!important;
    overscroll-behavior:auto!important;
  }
  body.rr-map-report-print .rr-map-report-shell{
    width:100%!important;
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
  }
  body.rr-map-report-print .rr-map-report-doc{
    padding:7mm!important;
  }
  body.rr-map-report-print .rr-map-report-top,
  body.rr-map-report-print .rr-map-report-actions{
    display:none!important;
    position:static!important;
  }
  body.rr-map-report-print .rr-map-report-map-card,
  body.modo-dossie .rr-map-static,
  body.modo-rr-print #rr-print-root .rr-map-static{
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }
  body.rr-map-report-print .rr-map-report-map-card{
    break-before:page!important;
    page-break-before:always!important;
  }
}

/* MEU MAPA — regra final e independente da classe no body.
   As classes abaixo só existem no Mapa Rural, então não afetam outros módulos. */
@media(max-width:820px){
  .rr-map-stage .rr-map-floatbar{
    position:absolute!important;
    top:8px!important;
    left:8px!important;
    right:8px!important;
    width:auto!important;
    height:50px!important;
    min-height:50px!important;
    display:grid!important;
    grid-template-columns:40px minmax(0,1fr) 112px!important;
    align-items:center!important;
    gap:6px!important;
    padding:5px!important;
    box-sizing:border-box!important;
    transform:none!important;
    z-index:1600!important;
  }
  .rr-map-stage .rr-map-titlebox{display:none!important}
  .rr-map-stage .rr-map-back{
    grid-column:1!important;
    width:40px!important;
    height:40px!important;
    min-width:40px!important;
    margin:0!important;
    padding:0!important;
  }
  .rr-map-stage .rr-map-uf-wrap{
    grid-column:2!important;
    width:100%!important;
    min-width:0!important;
    height:40px!important;
    min-height:40px!important;
    margin:0!important;
    padding:0 10px!important;
    box-sizing:border-box!important;
  }
  .rr-map-stage .rr-map-uf-wrap select{
    width:100%!important;
    min-width:0!important;
    height:100%!important;
    margin:0!important;
  }
  .rr-map-stage .rr-map-import-btn{
    grid-column:3!important;
    width:112px!important;
    min-width:112px!important;
    height:40px!important;
    min-height:40px!important;
    margin:0!important;
    padding:0 8px!important;
    box-sizing:border-box!important;
    white-space:nowrap!important;
  }

  /* Quatro ferramentas + CTA formam visualmente cinco colunas iguais. */
  .rr-map-stage .rr-map-rail{
    position:absolute!important;
    top:64px!important;
    left:8px!important;
    right:calc(20% + 4px)!important;
    width:auto!important;
    height:48px!important;
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:4px!important;
    margin:0!important;
    padding:0!important;
    z-index:1510!important;
  }
  .rr-map-stage .rr-map-rail-btn{
    width:100%!important;
    min-width:0!important;
    height:48px!important;
    min-height:48px!important;
    margin:0!important;
    padding:4px 2px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:2px!important;
    box-sizing:border-box!important;
    border-radius:10px!important;
  }
  .rr-map-stage .rr-map-rail-btn span{
    font-size:15px!important;
    line-height:1!important;
  }
  .rr-map-stage .rr-map-rail-btn em{
    max-width:100%!important;
    font-size:6.7px!important;
    line-height:1!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  .rr-map-stage .rr-map-report-cta{
    position:absolute!important;
    top:64px!important;
    right:8px!important;
    left:auto!important;
    width:calc(20% - 4px)!important;
    min-width:0!important;
    height:48px!important;
    min-height:48px!important;
    margin:0!important;
    padding:4px 2px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:2px!important;
    box-sizing:border-box!important;
    border-radius:10px!important;
    z-index:1520!important;
  }
  .rr-map-stage .rr-map-report-cta span{
    font-size:15px!important;
    line-height:1!important;
  }
  .rr-map-stage .rr-map-report-cta strong{
    font-size:6.7px!important;
    line-height:1!important;
    white-space:normal!important;
    text-align:center!important;
  }
  .rr-map-stage .leaflet-top.leaflet-left,
  .rr-map-stage .leaflet-top.leaflet-right{
    top:120px!important;
  }
  .rr-map-stage .rr-map-warning{
    top:120px!important;
  }
}
@media(max-width:390px){
  .rr-map-stage .rr-map-floatbar{
    grid-template-columns:40px minmax(0,1fr) 98px!important;
  }
  .rr-map-stage .rr-map-import-btn{
    width:98px!important;
    min-width:98px!important;
    font-size:9px!important;
  }
  .rr-map-stage .rr-map-rail-btn em,
  .rr-map-stage .rr-map-report-cta strong{
    font-size:6.2px!important;
  }
}
