/* RitWise native Android compact layout fix.
   The native activity reserves the Android navigation-bar inset. The web app
   only needs to reserve space for its own compact navigation. */

:root {
  --ritwise-native-nav-height: 60px;
  --ritwise-native-content-bottom: 62px;
}

html.ritwise-native,
html.ritwise-native body {
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}


/* Native WebView starts below the Android status bar. Do not add the web safe-area
   inset again; keep only a compact visual gap above the cloud status bar. */
html.ritwise-native body {
  padding-top: 0 !important;
}

html.ritwise-native .ritwise-status-dock {
  top: 0 !important;
  padding-top: 8px !important;
  padding-left: 12px !important;
  padding-right: 12px !important;
  z-index: 10020 !important;
}

html.ritwise-native .ritwise-app-content {
  padding-top: 60px !important;
}

html.ritwise-native * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Exactly one page container scrolls. The body itself never scrolls. */
html.ritwise-native .ritwise-native-scroll-root,
html.ritwise-native .ritwise-native-scroll-unlocked {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
}

html.ritwise-native .ritwise-native-scroll-root {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding-bottom: var(--ritwise-native-content-bottom) !important;
}

/* Stop the Home page from moving when its real content fits in the viewport. */
html.ritwise-native .ritwise-native-scroll-root.ritwise-native-no-scroll {
  overflow-y: hidden !important;
  overscroll-behavior-y: none !important;
  touch-action: manipulation !important;
}

html.ritwise-native .ritwise-native-remove-top-gap {
  padding-top: 8px !important;
  margin-top: 0 !important;
}

html.ritwise-native .ritwise-native-remove-child-top-gap {
  margin-top: 0 !important;
}

/* Compact app navigation. The Android system navigation inset is handled by
   MainActivity and therefore must not be added again in CSS. */
html.ritwise-native .ritwise-native-bottom-nav {
  box-sizing: border-box !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: var(--ritwise-native-nav-height) !important;
  min-height: var(--ritwise-native-nav-height) !important;
  max-height: var(--ritwise-native-nav-height) !important;
  padding: 2px 6px !important;
  margin: 0 !important;
  gap: 0 !important;
  align-items: stretch !important;
  overflow: hidden !important;
  z-index: 10000 !important;
}

html.ritwise-native .ritwise-native-bottom-nav > * {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 56px !important;
  margin: 0 !important;
  padding: 0 !important;
}

html.ritwise-native .ritwise-native-bottom-nav a,
html.ritwise-native .ritwise-native-bottom-nav button,
html.ritwise-native .ritwise-native-bottom-nav [role="button"] {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 56px !important;
  padding: 1px 3px !important;
  margin: 0 !important;
  line-height: 1 !important;
}

html.ritwise-native .ritwise-native-bottom-nav img,
html.ritwise-native .ritwise-native-bottom-nav svg {
  max-height: 25px !important;
  width: auto !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Keep text labels compact without clipping them. */
html.ritwise-native .ritwise-native-bottom-nav span,
html.ritwise-native .ritwise-native-bottom-nav small,
html.ritwise-native .ritwise-native-bottom-nav p {
  line-height: 1 !important;
  margin-top: 1px !important;
  margin-bottom: 0 !important;
}

html.ritwise-native [role="dialog"],
html.ritwise-native .bottom-sheet,
html.ritwise-native .bottomSheet,
html.ritwise-native .sheet,
html.ritwise-native .modal-content,
html.ritwise-native .drawer-content {
  max-height: calc(100% - var(--ritwise-native-nav-height)) !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
}


/* v2.50 production polish: keyboard + address form */
html.ritwise-native.ritwise-keyboard-open .ritwise-native-bottom-nav,
html.ritwise-native.ritwise-keyboard-open .ritwise-bottom-nav {
  display: none !important;
}

html.ritwise-native .ritwise-address-popup-backdrop {
  top: var(--ritwise-viewport-top, 0px) !important;
  bottom: auto !important;
  height: var(--ritwise-visible-height, 100dvh) !important;
  max-height: var(--ritwise-visible-height, 100dvh) !important;
  overflow: hidden !important;
}

html.ritwise-native .ritwise-address-popup-panel {
  max-height: calc(var(--ritwise-visible-height, 100dvh) - 24px) !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain !important;
  -webkit-overflow-scrolling: touch !important;
}

html.ritwise-native.ritwise-keyboard-open .ritwise-address-popup-backdrop {
  align-items: flex-start !important;
}

/* Houd ook de WebView-achtergrond groen zolang de bootfase actief is. */
html.ritwise-native.ritwise-booting,
html.ritwise-native.ritwise-booting body,
html.ritwise-native.ritwise-booting #root {
  background: #16a34a !important;
}
