/**
 * Navigation - Mobile Topbar
 * Mobile navigation and responsive styles
 * Part 2 of 3 (modularized from navigation.hig.css)
 */
/* Mobile topbar */
.mobile-nav {
  display: none;
}

.mobile-navigation-drawer,
.mobile-navigation-overlay {
  display: none;
}

.mobile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0.7rem 0.9rem;
  background: var(--hig-color-surface);
  border-bottom: 1px solid var(--hig-color-divider);
  height: var(--mobile-topbar-height);
  position: sticky;
  top: 0;
  z-index: 1020;
  backdrop-filter: blur(12px);
}

.mobile-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--hig-color-text);
  font-weight: 600;
}

.mobile-topbar-logo {
  border-radius: var(--hig-radius-full);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.mobile-topbar-text {
  font-size: 0.95rem;
  letter-spacing: 0;
}

.mobile-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mobile-domain-switcher {
  position: relative;
}

.mobile-domain-switcher__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--hig-color-divider);
  border-radius: var(--hig-radius-small);
  background: var(--hig-color-surface-alt);
  color: var(--hig-color-text);
  cursor: pointer;
  list-style: none;
}

.mobile-domain-switcher__trigger::-webkit-details-marker {
  display: none;
}

.mobile-domain-switcher__trigger:hover,
.mobile-domain-switcher__trigger:focus-visible {
  background: rgba(0, 113, 227, 0.08);
  color: var(--hig-color-primary);
  outline: none;
}

.mobile-domain-switcher__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  min-width: 210px;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--hig-color-divider);
  border-radius: var(--hig-radius-medium, 8px);
  background: var(--hig-color-surface);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
  z-index: 1060;
}

.mobile-domain-switcher__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.55rem 0.65rem;
  border-radius: var(--hig-radius-small);
  color: var(--hig-color-text-secondary);
  font-size: 0.86rem;
  text-decoration: none;
}

.mobile-domain-switcher__item:hover,
.mobile-domain-switcher__item:focus-visible,
.mobile-domain-switcher__item.is-active {
  background: rgba(0, 113, 227, 0.1);
  color: var(--hig-color-text);
  outline: none;
}

.mobile-domain-switcher__item i {
  width: 1rem;
  color: var(--hig-color-text-muted);
  text-align: center;
}

.mobile-nav-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--hig-radius-small);
  border: 1px solid var(--hig-color-divider);
  background: var(--hig-color-surface-alt);
  color: var(--hig-color-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mobile-nav-toggle i {
  font-size: 1.2rem;
}

.mobile-topbar-actions .notification-button {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-nav-toggle:hover,
.mobile-nav-toggle:focus-visible {
  background: rgba(0, 113, 227, 0.08);
  color: var(--hig-color-primary);
  border-color: rgba(0, 113, 227, 0.4);
  outline: none;
}

@media (max-width: 991.98px) {
  .mobile-nav {
    display: block;
  }

  .mobile-topbar {
    position: fixed;
    top: 8px;
    left: 8px;
    right: 8px;
    border-radius: var(--hig-radius-small);
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(24, 24, 27, 0.94);
    box-shadow: none;
  }

  .mobile-domain-switcher__trigger {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #f4f4f5;
  }

  .mobile-domain-switcher__menu {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(24, 24, 27, 0.98);
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.mobile-navigation-open {
    overflow: hidden;
    touch-action: none;
  }

  .mobile-navigation-drawer {
    position: fixed;
    inset: 8px auto 8px 8px;
    display: flex;
    flex-direction: column;
    width: min(86vw, 320px);
    max-width: calc(100vw - 32px);
    border: 1px solid var(--hig-color-divider);
    border-radius: var(--hig-radius-medium);
    background: var(--hig-color-surface);
    box-shadow: var(--hig-shadow-elevated);
    transform: translateX(calc(-100% - 24px));
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0.22s ease;
    z-index: var(--hig-z-modal);
  }

  .mobile-navigation-drawer.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .mobile-navigation-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: var(--hig-spacing-2) var(--hig-spacing-3);
    border-bottom: 1px solid var(--hig-color-divider);
  }

  .mobile-navigation-drawer__brand {
    display: inline-flex;
    align-items: center;
    gap: var(--hig-spacing-2);
    color: var(--hig-color-text);
    font-weight: 600;
    text-decoration: none;
  }

  .mobile-navigation-drawer__brand img {
    border-radius: var(--hig-radius-full);
  }

  .mobile-navigation-drawer__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--hig-radius-small);
    background: transparent;
    color: var(--hig-color-text);
  }

  .mobile-navigation-drawer__body {
    flex: 1;
    min-height: 0;
    padding: var(--hig-spacing-2);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .mobile-navigation-drawer__list {
    display: grid;
    gap: var(--hig-spacing-1);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .mobile-navigation-drawer .hig-nav__link,
  .mobile-navigation-drawer .hig-nav__sublink {
    width: 100%;
    min-height: 44px;
  }

  .mobile-navigation-overlay {
    position: fixed;
    inset: 0;
    display: block;
    padding: 0;
    border: 0;
    background: color-mix(in srgb, var(--hig-color-text) 38%, transparent);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    z-index: calc(var(--hig-z-overlay) + 50);
  }

  .mobile-navigation-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .main-wrapper,
  .main-content {
    min-width: 0;
    max-width: 100%;
  }

  .main-content {
    overflow-x: clip;
  }

  .hig-sidebar {
    position: fixed;
    top: 8px;
    left: 8px;
    height: calc(100vh - 16px);
    width: min(78vw, 304px);
    transform: translateX(calc(-100% - 16px));
    border-radius: var(--hig-radius-small);
    transition: transform 0.25s ease;
    z-index: 1040;
    box-shadow: none;
  }

  .hig-sidebar.show {
    transform: translateX(0);
  }

  .hig-sidebar__content {
    padding: var(--hig-spacing-4) var(--hig-spacing-3);
    gap: var(--hig-spacing-4);
  }

  body.dark-theme .hig-sidebar {
    margin: 0;
    width: min(78vw, 304px);
    max-width: min(78vw, 304px);
    border-radius: var(--hig-radius-small);
  }

  body.dark-theme .hig-sidebar__header {
    padding: 0.65rem 0.7rem;
  }

  body.dark-theme .hig-sidebar__content {
    padding: 8px 7px;
  }
}

@media (max-width: 767.98px) {
  body.dark-theme .hig-sidebar {
    width: min(82vw, 286px);
    max-width: min(82vw, 286px);
  }

  body.dark-theme .hig-nav__link,
  body.dark-theme .hig-nav__sublink {
    padding: 0.38rem 0.46rem;
  }
}

body:not(.dark-theme) .hig-sidebar,
body.light-theme .hig-sidebar {
  background: var(--hig-color-surface) !important;
  color: var(--hig-color-text);
}

body.dark-theme .hig-sidebar {
  background:
    linear-gradient(180deg, rgba(29, 29, 31, 0.99) 0%, rgba(26, 26, 28, 0.995) 100%) !important;
  border-right-color: transparent !important;
  border-radius: 0 18px 18px 0;
  margin: 8px 0 8px 0;
  height: calc(100vh - 16px);
  box-shadow:
    4px 0 32px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  color: var(--hig-color-text);
}

body.dark-theme .sidebar-mode {
  padding: 0;
}

body.dark-theme .hig-sidebar__content {
  padding: 10px 8px 12px;
  gap: 10px;
}

body.dark-theme .hig-nav__list {
  gap: 4px;
}

body.dark-theme .hig-nav__list + .hig-nav__list {
  margin-top: 10px;
}

body.dark-theme .sidebar-nav .hig-nav__list::before {
  content: "";
  display: block;
  height: 1px;
  margin: 8px 6px 12px;
  background: rgba(255, 255, 255, 0.06);
}

body.dark-theme .hig-sidebar__header {
  border-bottom-color: transparent;
  padding: 10px 8px 8px;
}

body.dark-theme .hig-nav__submenu {
  border-left-color: var(--hig-color-border);
}

body.dark-theme .hig-sidebar__content .sidebar-guest {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

body.dark-theme .hig-nav__link,
body.dark-theme .hig-nav__sublink,
body.dark-theme .hig-nav__dropdown-item {
  color: #d5d5db !important;
}

body.dark-theme .hig-nav__link,
body.dark-theme .hig-nav__sublink {
  padding: 0.44rem 0.44rem;
  border-radius: var(--hig-radius-small);
}

body.dark-theme .hig-nav__sublink {
  padding-left: 0.78rem;
}

body.dark-theme .hig-nav__link i:first-child,
body.dark-theme .hig-nav__sublink i:first-child {
  font-size: 0.84rem;
  color: #a1a1aa;
}

body.dark-theme .hig-nav__section {
  color: #8f8f96;
  background: transparent;
  border: none;
  padding: 0.42rem 0.46rem 0.24rem;
}

body.dark-theme .hig-nav__section i:first-child {
  color: #8f8f96;
}

body.dark-theme .sidebar-footer__eyebrow,
body.dark-theme .sidebar-account__context {
  color: #8f8f96;
}

body.dark-theme .hig-sidebar__footer {
  border-top-color: rgba(255, 255, 255, 0.06);
}

@media (max-width: 991.98px) {
  .sidebar-overlay {
    backdrop-filter: blur(6px);
    background-color: rgba(3, 7, 18, 0.46);
  }
}
