/* Mobile navigation reliability and visual layer. Loaded after all feature styles. */

@media (max-width: 760px) {
  :root {
    --mobile-nav-height: 88px;
  }

  body.usynai-brand .nav-list {
    z-index: 720;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    height: 72px;
    padding: 7px 8px;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid rgba(88, 72, 148, .13);
    border-radius: 22px;
    background: rgba(255, 255, 255, .98);
    box-shadow:
      0 18px 48px rgba(31, 26, 64, .2),
      0 1px 0 rgba(255, 255, 255, .95) inset;
    backdrop-filter: blur(24px) saturate(145%);
    pointer-events: auto;
    isolation: isolate;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    scroll-padding-inline: 12px;
    -webkit-overflow-scrolling: touch;
  }

  body.usynai-brand .nav-list::before,
  body.usynai-brand .nav-list::after {
    content: "";
    flex: 0 0 2px;
  }

  body.usynai-brand .nav-item {
    position: relative;
    z-index: 1;
    flex: 0 0 72px;
    width: 72px;
    min-width: 72px;
    max-width: 72px;
    min-height: 56px;
    padding: 6px 5px 5px;
    gap: 4px;
    border: 1px solid transparent;
    border-radius: 16px;
    color: #4d5365;
    background: transparent;
    box-shadow: none;
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition:
      color .16s ease,
      background .16s ease,
      border-color .16s ease,
      box-shadow .16s ease,
      transform .12s ease;
  }

  body.usynai-brand .nav-item > span:first-child {
    color: #676078;
    font-size: 20px;
    line-height: 21px;
    transition: color .16s ease, transform .16s ease;
  }

  body.usynai-brand .nav-item::after {
    color: inherit;
    font-size: 10.5px;
    font-weight: 780;
    line-height: 13px;
    letter-spacing: -.01em;
  }

  body.usynai-brand .nav-item:hover,
  body.usynai-brand .nav-item:focus-visible {
    color: #392d73;
    border-color: rgba(91, 61, 255, .12);
    background: #f4f1ff;
    outline: none;
  }

  body.usynai-brand .nav-item.active {
    color: #fff;
    border-color: rgba(255, 255, 255, .16);
    background: linear-gradient(145deg, #5f45dc, #342768);
    box-shadow: 0 10px 24px rgba(61, 43, 128, .3);
  }

  body.usynai-brand .nav-item.active > span:first-child {
    color: #fff;
    transform: translateY(-1px);
  }

  body.usynai-brand .nav-item.is-pressing {
    transform: scale(.96) !important;
  }

  body.usynai-brand .nav-item[data-view][aria-disabled="true"],
  body.usynai-brand .nav-item[data-awaiting-dashboard="true"] {
    cursor: pointer;
    opacity: 1;
  }

  body.usynai-brand .nav-item:disabled {
    opacity: .45;
  }

  body.usynai-brand .nav-item[data-view][aria-busy="true"]::before {
    content: "";
    position: absolute;
    top: 6px;
    right: 7px;
    width: 6px;
    height: 6px;
    border: 2px solid rgba(91, 61, 255, .2);
    border-top-color: #6b4cff;
    border-radius: 50%;
    animation: mobile-nav-spin .7s linear infinite;
  }

  body.usynai-brand .nav-item.active[aria-busy="true"]::before {
    border-color: rgba(255, 255, 255, .3);
    border-top-color: #fff;
  }

  body.usynai-brand .nav-item em {
    top: 2px;
    right: 3px;
    border-color: #ded8f7;
    color: #5841b9;
    background: #f4f1ff;
  }

  body.usynai-brand .nav-item.active em {
    border-color: rgba(255, 255, 255, .24);
    color: #fff;
    background: rgba(255, 255, 255, .14);
  }

  .mobile-navigation-feedback {
    position: fixed;
    z-index: 760;
    left: 18px;
    right: 18px;
    bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom) + 10px);
    padding: 11px 14px;
    border: 1px solid rgba(91, 61, 255, .16);
    border-radius: 15px;
    color: #24213d;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 14px 38px rgba(15, 23, 42, .18);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .16s ease, transform .16s ease;
    backdrop-filter: blur(18px);
  }

  .mobile-navigation-feedback.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  .mobile-deferred-view-loader {
    width: 100%;
    margin: 0 0 14px;
    padding: 13px 14px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 11px;
    border: 1px solid #ddd6fe;
    border-radius: 15px;
    color: #332b58;
    background: linear-gradient(135deg, #f8f6ff, #fff);
    box-shadow: 0 10px 28px rgba(73, 56, 137, .08);
  }

  .mobile-deferred-view-loader > span {
    width: 17px;
    height: 17px;
    border: 2px solid #ddd6fe;
    border-top-color: #6548dc;
    border-radius: 50%;
    animation: mobile-nav-spin .75s linear infinite;
  }

  .mobile-deferred-view-loader > div {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .mobile-deferred-view-loader strong {
    font-size: 12px;
    line-height: 1.25;
  }

  .mobile-deferred-view-loader small {
    color: #716a86;
    font-size: 10.5px;
    line-height: 1.35;
  }

  @keyframes mobile-nav-spin {
    to { transform: rotate(360deg); }
  }

  @media (prefers-reduced-motion: reduce) {
    body.usynai-brand .nav-item,
    .mobile-navigation-feedback {
      transition: none;
    }

    body.usynai-brand .nav-item[data-view][aria-busy="true"]::before,
    .mobile-deferred-view-loader > span {
      animation: none;
    }
  }
}
