/* App shell — mobile no-zoom + soft page transitions */

html {
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}

body.dark-bg-main {
  overscroll-behavior-y: contain;
}

/* Prevent iOS focus-zoom on form fields */
@media (max-width: 991.98px) {
  input,
  select,
  textarea,
  .form-control,
  .ra-dep-input,
  .ra-wd-input {
    font-size: 16px !important;
  }
}

#ra-app-main {
  min-height: 40vh;
  transition: opacity 0.16s ease;
}

/* Soft-nav transitions: avoid permanent will-change:transform (breaks fixed bottom nav) */
html.ra-nav-leaving #ra-app-main,
html.ra-nav-entering #ra-app-main {
  will-change: opacity;
}

html.ra-nav-leaving #ra-app-main {
  opacity: 0;
  pointer-events: none;
}

html.ra-nav-entering #ra-app-main {
  opacity: 0;
}

html.ra-nav-ready #ra-app-main {
  opacity: 1;
}

/*
 * Nested page includes of #ra-bottom-nav are hidden.
 * Canonical nav is a direct child of body (layout), same as crash screen.
 */
#ra-app-main #ra-bottom-nav,
.ra-app-main #ra-bottom-nav,
main #ra-bottom-nav {
  display: none !important;
}

/* Desktop: hide bottom nav */
#ra-bottom-nav {
  display: none;
}

/* Mobile: fixed viewport bottom nav (crash-parity) */
@media (max-width: 991.98px) {
  body.ra-app-shell {
    padding-bottom: 0;
  }

  body.ra-app-shell #ra-app-main,
  body.ra-app-shell .ra-app-main {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.ra-app-shell #ra-profile-page,
  body.ra-app-shell #ra-profile-content,
  body.ra-app-shell .ra-dep-page #ra-profile-content,
  body.ra-app-shell .ra-wd-page #ra-profile-content,
  body.ra-app-shell .ra-tf-page #ra-profile-content,
  body.ra-app-shell .ra-wallet-page #ra-profile-content {
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  }

  body.ra-app-shell > #ra-bottom-nav,
  body.dark-bg-main.ra-app-shell > #ra-bottom-nav,
  body.ra-app-shell > nav#ra-bottom-nav {
    display: flex !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0 !important;
    z-index: 1200 !important;
    height: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
    padding: 0 4px env(safe-area-inset-bottom, 0px) !important;
    align-items: center;
    justify-content: space-around;
    background: rgba(8, 12, 24, 0.98) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-sizing: border-box !important;
    transform: none !important;
    -webkit-transform: none !important;
    filter: none !important;
    perspective: none !important;
    contain: none !important;
  }

  body.ra-app-shell > #ra-bottom-nav .ra-bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 8px;
    background: transparent;
    border: none;
    color: #64748b;
    text-decoration: none;
    cursor: pointer;
  }

  body.ra-app-shell > #ra-bottom-nav .ra-bnav-item .material-symbols-outlined {
    font-size: 18px;
    color: inherit;
  }

  body.ra-app-shell > #ra-bottom-nav .ra-bnav-label {
    font-size: 10px;
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
  }

  body.ra-app-shell > #ra-bottom-nav .ra-bnav-item.active,
  body.ra-app-shell > #ra-bottom-nav .ra-bnav-item.active .ra-bnav-label,
  body.ra-app-shell > #ra-bottom-nav .ra-bnav-item.active .material-symbols-outlined {
    color: #ff5f2e;
  }

  body.ra-app-shell > #ra-bottom-nav .ra-bnav-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 0 6px;
    background: transparent;
    border: none;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
  }

  body.ra-app-shell > #ra-bottom-nav .ra-bnav-center-btn {
    width: 46px;
    height: 46px;
    margin-top: -14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6a35, #cc1a00);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(255, 95, 46, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    color: #fff;
  }

  body.ra-app-shell > #ra-bottom-nav .ra-bnav-center-btn .material-symbols-outlined {
    font-size: 19px;
    color: #fff;
    transform: rotate(30deg);
  }

  body.ra-app-shell > #ra-bottom-nav .ra-bnav-center-label {
    font-size: 10px;
    font-weight: 700;
    color: #ff5f2e;
  }

  body.ra-app-shell > #ra-bottom-nav .ra-bnav-center.active .ra-bnav-center-btn {
    box-shadow: 0 4px 18px rgba(255, 95, 46, 0.75);
  }
}

/* Top progress line while soft-navigating */
#ra-nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 100000;
  pointer-events: none;
  opacity: 0;
  background: transparent;
  overflow: hidden;
}

#ra-nav-progress.is-active {
  opacity: 1;
}

#ra-nav-progress.is-active::after {
  content: '';
  display: block;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #ff5f2e, #ff8a50);
  box-shadow: 0 0 12px rgba(255, 95, 46, 0.55);
  animation: ra-nav-progress-slide 0.85s ease-in-out infinite;
}

@keyframes ra-nav-progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

/* Soft fade for header chrome during swap */
#ra-topbar {
  transition: opacity 0.12s ease;
}

html.ra-nav-leaving #ra-topbar {
  opacity: 0.72;
}
