/*
  V11.63.1 — Mobile Contract/Quote Actions Flow Safe
  Escopo: SOMENTE mobile.
  Objetivo: impedir que a barra de ações do wizard fique por cima dos campos em telas pequenas.
  Não altera desktop, Supabase, cache, PDF, criação/salvamento ou regras de negócio.
*/

@media (max-width:900px){
  /* Contratos: a navegação do wizard passa a fazer parte do fluxo do formulário no celular.
     Antes ela era sticky e podia cobrir cliente/campos ao preencher. */
  .modal-box .contract-wizard-actions,
  #modalBody .contract-wizard-actions,
  .drawer .contract-wizard-actions,
  #drawerBody .contract-wizard-actions{
    position:static!important;
    inset:auto!important;
    bottom:auto!important;
    top:auto!important;
    z-index:auto!important;
    width:100%!important;
    max-width:100%!important;
    margin:18px 0 0!important;
    padding:12px 0 0!important;
    background:transparent!important;
    border-top:1px solid rgba(255,255,255,.08)!important;
    box-shadow:none!important;
    transform:none!important;
  }

  .modal-box .contract-wizard-actions .right,
  #modalBody .contract-wizard-actions .right,
  .drawer .contract-wizard-actions .right,
  #drawerBody .contract-wizard-actions .right{
    width:100%!important;
    max-width:100%!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
  }

  .modal-box .contract-wizard-actions .btn,
  #modalBody .contract-wizard-actions .btn,
  .drawer .contract-wizard-actions .btn,
  #drawerBody .contract-wizard-actions .btn{
    width:100%!important;
    min-height:46px!important;
    margin:0!important;
  }

  /* Mais respiro depois das ações para Safari/iPhone não esconder o último botão na barra do navegador. */
  #modalBody:has(.contract-wizard-actions),
  #drawerBody:has(.contract-wizard-actions){
    padding-bottom:calc(132px + env(safe-area-inset-bottom,0px))!important;
    scroll-padding-bottom:calc(156px + env(safe-area-inset-bottom,0px))!important;
  }

  /* Fallback para navegadores sem :has(): mantém respiro geral nos modais/drawers sem mexer no desktop. */
  #modalBody,
  #drawerBody{
    scroll-margin-bottom:calc(132px + env(safe-area-inset-bottom,0px))!important;
  }

  /* Orçamentos: mantém os rodapés de etapa dentro do fluxo, sem comportamento fixo/sticky caso herde regra genérica. */
  .modal-box .quote-step-footer-v10806,
  #modalBody .quote-step-footer-v10806,
  .drawer .quote-step-footer-v10806,
  #drawerBody .quote-step-footer-v10806{
    position:static!important;
    bottom:auto!important;
    z-index:auto!important;
    width:100%!important;
    max-width:100%!important;
    margin:18px 0 0!important;
    padding:14px 0 0!important;
    background:transparent!important;
    box-shadow:none!important;
    transform:none!important;
  }

  .modal-box .quote-step-footer-v10806 .btn,
  #modalBody .quote-step-footer-v10806 .btn,
  .drawer .quote-step-footer-v10806 .btn,
  #drawerBody .quote-step-footer-v10806 .btn{
    width:100%!important;
    min-height:46px!important;
  }
}
