/* RURÁPIDO P2.5-U3 — fechamento responsivo + impressão limpa */

/* Floating/support UI must never participate in printed pagination. */
@media print{
  body>.wa-float,
  .wa-float,
  .mobile-bottom-nav,
  .mobile-sheet,
  .mobile-sheet-backdrop,
  .dossie-map-note,
  .no-print{
    display:none!important;
    visibility:hidden!important;
  }
  body.modo-due-print{
    margin:0!important;
    padding:0!important;
    background:#fff!important;
    overflow:visible!important;
  }
  body.modo-due-print>#due-print-root{
    display:block!important;
    position:static!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
  }
  body.modo-due-print>.wa-float{display:none!important}
  body.modo-due-print .due-print-map,
  body.modo-due-print .rr-map-static,
  body.modo-due-print .rr-sat-map-viewport{
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }
  body.modo-dossie .dossie-map-note{display:none!important}
  body.modo-dossie #mapa-dossie{display:none!important}
  body.modo-dossie #mapa-dossie-print{
    display:block!important;
    position:static!important;
    overflow:visible!important;
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }

  /* Source label is a small footer inside the map, never a dark overlay. */
  .rr-sat-source{
    background:#fff!important;
    color:#4a5a51!important;
    border:0!important;
    border-top:1px solid #d4ddd7!important;
    border-radius:0!important;
    box-shadow:none!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    width:100%!important;
    max-width:100%!important;
    padding:1mm 2mm!important;
    font-size:5.5pt!important;
    line-height:1.1!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    opacity:1!important;
  }
  .rr-sat-map-viewport{
    padding-bottom:5mm!important;
    background:#eef2ef!important;
  }
}

/* Desktop: keep existing visual hierarchy. */
.rr-map-actions-row{display:block}
@media(min-width:821px){
  .rr-map-actions-row .rr-map-rail{position:absolute}
  .rr-map-actions-row .rr-map-report-cta{position:absolute}
}

/* Mobile/tablet: remove duplicate title from markup and make controls mathematically aligned. */
@media(max-width:820px){
  .rr-map-stage .rr-map-floatbar{
    position:absolute!important;
    top:8px!important;
    left:8px!important;
    right:8px!important;
    height:50px!important;
    min-height:50px!important;
    display:grid!important;
    grid-template-columns:42px minmax(0,1fr) minmax(104px,30%)!important;
    align-items:stretch!important;
    gap:6px!important;
    padding:4px!important;
    margin:0!important;
    box-sizing:border-box!important;
    z-index:1600!important;
  }
  .rr-map-stage .rr-map-back,
  .rr-map-stage .rr-map-uf-wrap,
  .rr-map-stage .rr-map-import-btn{
    position:static!important;
    width:100%!important;
    min-width:0!important;
    height:42px!important;
    min-height:42px!important;
    max-height:42px!important;
    margin:0!important;
    box-sizing:border-box!important;
  }
  .rr-map-stage .rr-map-back{padding:0!important}
  .rr-map-stage .rr-map-uf-wrap{
    display:flex!important;
    align-items:center!important;
    gap:7px!important;
    padding:0 10px!important;
  }
  .rr-map-stage .rr-map-uf-wrap select{
    flex:1 1 auto!important;
    width:auto!important;
    min-width:0!important;
    height:100%!important;
  }
  .rr-map-stage .rr-map-import-btn{
    padding:0 8px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  .rr-map-stage .rr-map-actions-row{
    position:absolute!important;
    top:64px!important;
    left:8px!important;
    right:8px!important;
    height:50px!important;
    display:grid!important;
    grid-template-columns:repeat(5,minmax(0,1fr))!important;
    gap:4px!important;
    margin:0!important;
    padding:0!important;
    z-index:1520!important;
  }
  .rr-map-stage .rr-map-actions-row .rr-map-rail{
    display:contents!important;
  }
  .rr-map-stage .rr-map-actions-row .rr-map-rail-btn,
  .rr-map-stage .rr-map-actions-row .rr-map-report-cta{
    position:static!important;
    inset:auto!important;
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    height:50px!important;
    min-height:50px!important;
    max-height:50px!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;
    transform:none!important;
  }
  .rr-map-stage .rr-map-actions-row .rr-map-rail-btn span,
  .rr-map-stage .rr-map-actions-row .rr-map-report-cta span{
    font-size:15px!important;
    line-height:1!important;
  }
  .rr-map-stage .rr-map-actions-row .rr-map-rail-btn em,
  .rr-map-stage .rr-map-actions-row .rr-map-report-cta strong{
    width:100%!important;
    max-width:100%!important;
    font-size:6.5px!important;
    line-height:1.05!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    text-align:center!important;
  }
  .rr-map-stage .leaflet-top.leaflet-left,
  .rr-map-stage .leaflet-top.leaflet-right,
  .rr-map-stage .rr-map-warning{
    top:122px!important;
  }
}
@media(max-width:390px){
  .rr-map-stage .rr-map-floatbar{
    grid-template-columns:40px minmax(0,1fr) 96px!important;
  }
  .rr-map-stage .rr-map-actions-row .rr-map-rail-btn em,
  .rr-map-stage .rr-map-actions-row .rr-map-report-cta strong{
    font-size:5.9px!important;
  }
}

/* P2.7.4 — mantém o título e o mapa técnico no mesmo fluxo de página. */
@media print{
  body.modo-dossie .dossie-map-section{
    break-before:page!important;
    page-break-before:always!important;
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }
  body.modo-dossie .dossie-map-section .dossie-map-wrap,
  body.modo-dossie .dossie-map-section #mapa-dossie-print,
  body.modo-dossie .dossie-map-section .rr-map-static{
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }
}


/* P2.7.5 — impressão isolada do Mapa Rural: evita duplicação do overlay responsivo no PDF. */
#rr-map-report-print-root{display:none}
@media print{
  body.rr-map-report-static-print{background:#fff!important;overflow:visible!important}
  body.rr-map-report-static-print> *:not(#rr-map-report-print-root){display:none!important}
  body.rr-map-report-static-print #rr-map-report-print-root{display:block!important;position:static!important;width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;background:#fff!important}
  body.rr-map-report-static-print #rr-map-report-print-root .rr-map-report-doc{display:block!important;position:static!important;width:100%!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;padding:7mm!important;background:#fff!important;color:#111!important}
  body.rr-map-report-static-print #rr-map-report-print-root .rr-map-report-grid{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;gap:4mm!important}
  body.rr-map-report-static-print #rr-map-report-print-root .rr-map-report-card{break-inside:avoid!important;page-break-inside:avoid!important}
  body.rr-map-report-static-print #rr-map-report-print-root .rr-map-report-map-card{break-before:page!important;page-break-before:always!important;break-inside:avoid!important;page-break-inside:avoid!important}
  body.rr-map-report-static-print #rr-map-report-print-root [data-rr-env-annex]{break-before:page!important;page-break-before:always!important}
}

/* P2.7.7 — Mapa Rural: evita página residual contendo apenas a nota metodológica.
   A mesma ressalva permanece no Diagnóstico Ambiental e no Relatório Técnico completo. */
@media print{
  body.rr-map-report-static-print #rr-map-report-print-root .rr-map-report-note{display:none!important}
}
