/*
  Ultracell V20.42 — Cache, Banner e Scroll Consolidation
  Camada final incremental baseada na auditoria V20.41.
  Objetivos:
  - consolidar correções de banner/aviso V20.39 e foto 100% V20.40;
  - preservar destravamento de rolagem Android V20.41;
  - reduzir risco de overflow horizontal e bloqueio de toque;
  - não alterar regras de negócio.
  Build: 20-42-cache-banner-scroll-consolidation
*/

@media (max-width: 760px) {
  html,
  body {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body.v19-store-mobile-active:not(.modal-open):not(.uc-image-viewer-open),
  body.uc-backoffice-mobile-app-active:not(.modal-open):not(.uc-image-viewer-open),
  body.official-mobile-active:not(.modal-open):not(.uc-image-viewer-open) {
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: auto !important;
  }

  body.v19-store-mobile-active:not(.modal-open):not(.uc-image-viewer-open) #app,
  body.v19-store-mobile-active:not(.modal-open):not(.uc-image-viewer-open) .v19-app {
    min-height: 100dvh !important;
    height: auto !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
  }

  body.v19-store-mobile-active .v19-app {
    width: min(100vw, 430px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Aviso textual: sempre contido em card e sem estouro lateral. */
  body.v19-store-mobile-active .catalog-dev-notice-v19:not(.is-image),
  body.v19-store-mobile-active .catalog-dev-notice:not(.is-image) {
    box-sizing: border-box !important;
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    min-width: 0 !important;
    margin: 10px auto 12px !important;
    padding: 12px 14px !important;
    border-radius: 22px !important;
    border: 1px solid rgba(226, 232, 240, .98) !important;
    background: rgba(255,255,255,.97) !important;
    color: #111827 !important;
    box-shadow: 0 12px 26px rgba(15, 23, 42, .07) !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) !important;
    gap: 6px 8px !important;
    align-items: center !important;
    justify-content: start !important;
    text-align: left !important;
    overflow: hidden !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    touch-action: pan-y !important;
  }

  body.v19-store-mobile-active .catalog-dev-notice-v19:not(.is-image)::before,
  body.v19-store-mobile-active .catalog-dev-notice:not(.is-image)::before {
    content: '⚠' !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    border-radius: 12px !important;
    display: grid !important;
    place-items: center !important;
    background: #fff7ed !important;
    color: #c2410c !important;
    font-size: 14px !important;
    font-weight: 1000 !important;
    line-height: 1 !important;
  }

  body.v19-store-mobile-active .catalog-dev-notice-dot {
    display: none !important;
  }

  body.v19-store-mobile-active .catalog-dev-notice-v19 strong,
  body.v19-store-mobile-active .catalog-dev-notice strong,
  body.v19-store-mobile-active .catalog-dev-notice-v19 span:not(.catalog-dev-notice-dot),
  body.v19-store-mobile-active .catalog-dev-notice span:not(.catalog-dev-notice-dot) {
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    line-height: 1.2 !important;
  }

  body.v19-store-mobile-active .catalog-dev-notice-v19 strong,
  body.v19-store-mobile-active .catalog-dev-notice strong {
    color: #0f172a !important;
    font-size: clamp(12px, 3.6vw, 14px) !important;
    font-weight: 1000 !important;
    letter-spacing: -.02em !important;
  }

  body.v19-store-mobile-active .catalog-dev-notice-v19 span:not(.catalog-dev-notice-dot),
  body.v19-store-mobile-active .catalog-dev-notice span:not(.catalog-dev-notice-dot) {
    color: #334155 !important;
    font-size: clamp(12px, 3.45vw, 14px) !important;
    font-weight: 650 !important;
  }

  /* Banner com imagem: a foto deve preencher 100% da área visual. */
  body.v19-store-mobile-active .catalog-dev-notice-v19.is-image,
  body.v19-store-mobile-active .catalog-dev-notice.is-image {
    box-sizing: border-box !important;
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    min-width: 0 !important;
    margin: 10px auto 14px !important;
    padding: 0 !important;
    border-radius: 24px !important;
    overflow: hidden !important;
    background: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, .08) !important;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .12) !important;
    display: block !important;
    touch-action: pan-y !important;
  }

  body.v19-store-mobile-active .catalog-dev-notice-v19.is-image::before,
  body.v19-store-mobile-active .catalog-dev-notice.is-image::before {
    display: none !important;
    content: none !important;
  }

  body.v19-store-mobile-active .catalog-dev-notice-image {
    box-sizing: border-box !important;
    display: block !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: clamp(120px, 36vw, 170px) !important;
    min-height: clamp(120px, 36vw, 170px) !important;
    max-height: clamp(120px, 36vw, 170px) !important;
    padding: 0 !important;
    margin: 0 !important;
    object-fit: cover !important;
    object-position: center center !important;
    border-radius: 0 !important;
    background: transparent !important;
    touch-action: pan-y !important;
  }

  body.v19-store-mobile-active .catalog-dev-notice-caption {
    box-sizing: border-box !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 10px 14px 12px !important;
    background: #fff !important;
    border-radius: 0 !important;
    overflow-wrap: anywhere !important;
  }

  body.v19-store-mobile-active .v19-page:not([hidden]) {
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
  }

  body.v19-store-mobile-active .v19-page-cart:not([hidden]) .v19-cart-content {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    padding-bottom: calc(124px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.uc-backoffice-mobile-app-active .uc-app-content,
  body.uc-backoffice-mobile-app-active .uc-mobile-app-content,
  body.official-mobile-active .official-mobile-content {
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Passkey está temporariamente indisponível quando as Functions não existem. */
  .biometric-settings-panel.is-server-unavailable {
    opacity: .92 !important;
  }

  .biometric-settings-panel.is-server-unavailable button,
  .auth-actions-biometric #login-biometric-btn,
  #mobile-more-biometric[disabled] {
    opacity: .55 !important;
    cursor: not-allowed !important;
  }
}

@media (max-width: 360px) {
  body.v19-store-mobile-active .catalog-dev-notice-v19:not(.is-image),
  body.v19-store-mobile-active .catalog-dev-notice:not(.is-image),
  body.v19-store-mobile-active .catalog-dev-notice-v19.is-image,
  body.v19-store-mobile-active .catalog-dev-notice.is-image {
    width: calc(100% - 18px) !important;
    max-width: calc(100% - 18px) !important;
  }

  body.v19-store-mobile-active .catalog-dev-notice-image {
    height: 118px !important;
    min-height: 118px !important;
    max-height: 118px !important;
  }
}
