/*
 * BIOS Personal mobile section window R20.
 *
 * The navigation remains a stable layer while the selected section is shown
 * as a rounded, sliding workspace. This file intentionally follows R19 so the
 * interaction can be rolled back without changing the desktop shell.
 */

.mobile-section-menu {
  display: none;
}

@media (max-width: 760px),
  (max-width: 1024px) and (max-height: 500px) and (pointer: coarse) {
  html,
  body.bios-live.mobile-section-window {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #e8eef4;
  }

  body.bios-live.mobile-section-window .app {
    position: relative;
    display: block;
    width: 100%;
    height: 100dvh;
    min-height: 100svh;
    overflow: hidden;
    background:
      radial-gradient(circle at 14% 8%, rgba(42, 145, 239, .11), transparent 28%),
      linear-gradient(180deg, #f1f6fa 0%, #e6edf3 100%);
  }

  /* The full section list is the persistent layer behind the workspace. */
  body.bios-live.mobile-section-window .sidebar {
    position: fixed;
    z-index: 20;
    inset: 0 auto 0 0;
    display: flex !important;
    width: calc(100vw - 76px);
    max-width: 354px;
    height: 100dvh;
    min-height: 100svh;
    padding: calc(18px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }

  body.bios-live.mobile-section-window .sidebar::-webkit-scrollbar {
    display: none;
  }

  body.bios-live.mobile-section-window .sidebar > .brand {
    display: flex !important;
    min-height: 52px;
    margin: 0 6px 18px;
    color: #122238;
  }

  body.bios-live.mobile-section-window .sidebar > .pulse-card {
    display: none !important;
  }

  body.bios-live.mobile-section-window .sidebar .nav {
    display: flex;
    width: 100%;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 4px;
  }

  body.bios-live.mobile-section-window .sidebar .nav-item,
  body.bios-live.mobile-section-window .sidebar .nav-item[data-tab],
  body.bios-live.mobile-section-window .sidebar .nav-item[data-feature] {
    position: relative;
    display: flex !important;
    width: 100%;
    min-height: 52px;
    padding: 10px 12px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    border-radius: 16px;
    color: #51647a;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.25;
    text-align: left;
    white-space: normal;
  }

  body.bios-live.mobile-section-window .sidebar .nav-item:hover,
  body.bios-live.mobile-section-window .sidebar .nav-item.future-locked:hover {
    background: rgba(255, 255, 255, .48);
    color: #273b54;
  }

  body.bios-live.mobile-section-window .sidebar .nav-item.active {
    background: rgba(255, 255, 255, .9);
    color: #087cf0;
    box-shadow: 0 13px 28px -24px rgba(23, 62, 99, .48),
      inset 0 0 0 1px rgba(24, 110, 190, .08);
  }

  body.bios-live.mobile-section-window .sidebar .nav-symbol,
  body.bios-live.mobile-section-window .sidebar .nav-item.active .nav-symbol {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, .62);
    color: currentColor;
  }

  body.bios-live.mobile-section-window .sidebar .nav-symbol svg {
    width: 19px;
    height: 19px;
  }

  body.bios-live.mobile-section-window .sidebar .nav-symbol img {
    width: 23px;
    height: 23px;
  }

  body.bios-live.mobile-section-window .sidebar .nav-lock {
    position: static;
    width: 18px;
    height: 18px;
    margin-left: auto;
    flex: 0 0 18px;
    transform: none;
    border: 1px solid rgba(255, 255, 255, .9);
    background: #dfe8f0;
  }

  body.bios-live.mobile-section-window .sidebar > .sidebar-foot {
    display: flex !important;
    width: 100%;
    margin: 18px 0 0;
    padding: 16px 0 0;
    transform: none;
    border-top: 1px solid rgba(40, 74, 105, .1);
  }

  body.bios-live.mobile-section-window .sidebar-foot .profile {
    min-width: 0;
    padding: 10px 8px;
    border-radius: 16px;
  }

  body.bios-live.mobile-section-window .sidebar-foot .help {
    display: none;
  }

  /* The selected section is one coherent window, not another page below it. */
  body.bios-live.mobile-section-window .main,
  body.bios-live.mobile-section-window .main:has(> .view.active:not(.view-ai-chat)) {
    position: fixed;
    z-index: 30;
    inset: 6px;
    display: block;
    width: auto;
    max-width: none;
    height: calc(100dvh - 12px);
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid rgba(31, 59, 86, .09);
    border-radius: 30px;
    background: #fff;
    box-shadow: 0 28px 70px -42px rgba(16, 41, 66, .62);
    transform: translate3d(0, 0, 0);
    will-change: transform;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.bios-live.mobile-window-ready .main {
    transition: transform .42s cubic-bezier(.22, .82, .24, 1),
      filter .28s ease, box-shadow .28s ease;
  }

  body.bios-live.mobile-navigation-open .main,
  body.bios-live.mobile-navigation-open .main:has(> .view.active:not(.view-ai-chat)) {
    transform: translate3d(calc(100vw - 82px), 0, 0);
    filter: saturate(.72) brightness(.91);
    box-shadow: -18px 0 50px -30px rgba(13, 33, 55, .58);
  }

  body.bios-live.mobile-section-window .main::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 150;
    pointer-events: none;
    border-radius: inherit;
    background: rgba(25, 39, 55, .13);
    opacity: 0;
    transition: opacity .24s ease;
  }

  body.bios-live.mobile-navigation-open .main::after {
    opacity: 1;
  }

  body.bios-live.mobile-section-window .main > .view,
  body.bios-live.mobile-section-window .main > .view.active,
  body.bios-live.mobile-section-window .main > .view.active:not(.view-ai-chat) {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
  }

  body.bios-live.mobile-section-window .main > .view.active:not(.view-ai-chat) {
    min-height: calc(100dvh - 14px);
    padding: calc(76px + env(safe-area-inset-top)) 16px calc(34px + env(safe-area-inset-bottom));
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  body.bios-live.mobile-section-window .view-ai-chat.active {
    height: calc(100dvh - 14px);
    min-height: 0;
    padding: calc(76px + env(safe-area-inset-top)) 10px calc(8px + env(safe-area-inset-bottom));
  }

  body.bios-live.mobile-section-window .view-ai-chat .chat-workspace,
  body.bios-live.mobile-section-window .view-ai-chat .chat-workspace.insights-collapsed {
    display: grid;
    width: 100%;
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  body.bios-live.mobile-section-window .view-ai-chat .chat-insights-stack,
  body.bios-live.mobile-section-window .view-ai-chat .chat-rail-toggle {
    display: none;
  }

  body.bios-live.mobile-section-window .view-ai-chat .chat-experience,
  body.bios-live.mobile-section-window .view-ai-chat .chat-workspace.insights-collapsed .chat-experience {
    width: 100%;
    min-width: 0;
    transform: none !important;
  }

  body.bios-live.mobile-section-window .view-ai-chat .chat-thread {
    padding-right: 16px;
    padding-left: 16px;
  }

  body.bios-live.mobile-section-window .view-ai-chat .chat-thread > .message:not(.user) {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
  }

  body.bios-live.mobile-section-window .view-ai-chat .chat-thread > .message.user {
    max-width: 86%;
  }

  body.bios-live.mobile-section-window .mobile-section-menu {
    position: fixed;
    z-index: 200;
    top: calc(18px + env(safe-area-inset-top));
    left: 18px;
    display: grid;
    width: 46px;
    height: 46px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(30, 62, 92, .1);
    border-radius: 16px;
    background: rgba(244, 248, 251, .96);
    color: #476078;
    box-shadow: 0 12px 28px -22px rgba(19, 48, 76, .55),
      inset 0 1px 0 rgba(255, 255, 255, .82);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  body.bios-live.mobile-section-window .mobile-section-menu > span {
    display: grid;
    gap: 6px;
  }

  body.bios-live.mobile-section-window .mobile-section-menu i {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 99px;
    background: currentColor;
  }

  body.bios-live.mobile-section-window .mobile-section-menu i:last-child {
    width: 13px;
  }

  body.bios-live.mobile-section-window .mobile-section-menu-dot {
    position: absolute;
    top: 11px;
    right: 9px;
    width: 7px;
    height: 7px;
    border: 1px solid #fff;
    border-radius: 50%;
    background: #087cf0;
  }

  body.bios-live.mobile-section-window .mobile-section-menu:focus-visible {
    outline: 3px solid rgba(8, 124, 240, .24);
    outline-offset: 2px;
  }

  body.bios-live.mobile-navigation-open .mobile-section-menu {
    background: rgba(255, 255, 255, .96);
    color: #087cf0;
  }

  body.bios-live.mobile-section-window .notifications-popover {
    position: fixed;
    z-index: 260;
    top: calc(72px + env(safe-area-inset-top));
    right: 14px;
    bottom: auto;
    left: 14px;
    max-height: calc(100dvh - 100px - env(safe-area-inset-top));
  }

  body.bios-live.mobile-navigation-open .notifications-popover {
    display: none;
  }
}

@media (max-width: 360px) {
  body.bios-live.mobile-section-window .sidebar {
    width: calc(100vw - 68px);
    padding-inline: 12px;
  }

  body.bios-live.mobile-navigation-open .main,
  body.bios-live.mobile-navigation-open .main:has(> .view.active:not(.view-ai-chat)) {
    transform: translate3d(calc(100vw - 74px), 0, 0);
  }

  body.bios-live.mobile-section-window .main > .view.active:not(.view-ai-chat) {
    padding-inline: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.bios-live.mobile-window-ready .main,
  body.bios-live.mobile-section-window .main::after {
    transition: none;
  }
}
