/* ProfitPanda Hub mobile shell + Guides navigation
   Load this stylesheet after the existing inline/canonical Hub styles. */

@media (max-width: 900px) {
  html {
    overflow-x: hidden !important;
    scrollbar-gutter: auto !important;
  }

  body {
    overflow-x: hidden;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  /* Keep the top bar focused on identity/account; move primary navigation
     to a persistent, thumb-friendly bottom bar. */
  .hub-header {
    padding: 0 16px !important;
    gap: 12px !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none !important;
    filter: none !important;
  }

  .hub-brand-group,
  .hub-right-group {
    min-width: 0 !important;
  }

  .hub-logo,
  .hub-logo span {
    min-width: 0 !important;
  }

  .btn-discord-hub {
    display: none !important;
  }

  .user-menu-name,
  .user-menu-btn > svg {
    display: none !important;
  }

  .user-menu-btn {
    width: 44px !important;
    height: 44px !important;
    padding: 9px !important;
    justify-content: center !important;
    border-radius: 50% !important;
  }

  .hub-nav-links {
    position: fixed !important;
    inset: auto 0 0 0 !important;
    transform: none !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    width: 100% !important;
    height: calc(64px + env(safe-area-inset-bottom)) !important;
    padding: 7px max(8px, env(safe-area-inset-right))
      calc(7px + env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left)) !important;
    gap: 4px !important;
    background: rgba(13, 16, 22, 0.98) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.32) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    z-index: 2000 !important;
  }

  .hub-nav-link {
    min-width: 0 !important;
    min-height: 50px !important;
    padding: 6px 3px !important;
    gap: 4px !important;
    flex-direction: column !important;
    justify-content: center !important;
    border: 0 !important;
    border-radius: 10px !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
  }

  .hub-nav-link svg {
    width: 19px !important;
    height: 19px !important;
  }

  .hub-nav-link.active {
    color: #fff !important;
    background: rgba(16, 185, 129, 0.14) !important;
    border: 0 !important;
  }

  /* Dashboard */
  .wrap {
    width: auto !important;
    margin-inline: 16px !important;
  }

  .home-main {
    min-height: auto !important;
    padding: 28px 0 28px !important;
    justify-content: flex-start !important;
  }

  .home-header {
    margin-bottom: 18px !important;
  }

  .home-greeting {
    font-size: clamp(1.45rem, 7vw, 1.75rem) !important;
    line-height: 1.2 !important;
  }

  .hero-panel {
    min-height: 0 !important;
    padding: 22px 20px !important;
    gap: 18px !important;
    border-radius: 14px !important;
  }

  .hero-onboard-title {
    font-size: clamp(1.4rem, 7vw, 1.8rem) !important;
  }

  .dest-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .dest-card {
    min-height: 112px !important;
    padding: 20px !important;
  }

  /* Guides mobile topic picker, inserted by guides-mobile.js */
  .guides-mobile-toolbar {
    position: sticky;
    top: 68px;
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 6px 16px;
    background: rgba(13, 16, 22, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .mobile-nav-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 10px !important;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    font-size: 0.86rem;
    font-weight: 700;
  }

  .mobile-nav-toggle svg {
    flex: 0 0 auto;
  }

  .guides-mobile-current {
    min-width: 0;
    overflow: hidden;
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hub-layout {
    min-height: calc(100dvh - 120px - 64px) !important;
    position: static !important;
    z-index: auto !important;
  }

  .hub-sidebar {
    position: fixed !important;
    top: 120px !important;
    bottom: calc(64px + env(safe-area-inset-bottom)) !important;
    left: 0 !important;
    width: min(88vw, 340px) !important;
    height: auto !important;
    padding: 16px 12px 28px !important;
    transform: translateX(-105%) !important;
    background: #0d1016 !important;
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.58) !important;
    overscroll-behavior: contain;
    z-index: 1600 !important;
  }

  .hub-sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  .guides-mobile-backdrop {
    position: fixed;
    inset: 120px 0 calc(64px + env(safe-area-inset-bottom)) 0;
    z-index: 1500;
    display: block;
    width: 100%;
    background: rgba(0, 0, 0, 0.58);
    border: 0;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }

  .guides-mobile-backdrop[hidden] {
    display: none;
  }

  body.guides-drawer-open {
    overflow: hidden;
  }

  .sidebar-standalone-item,
  .hub-nav-item,
  .hub-group-header {
    min-height: 44px;
  }

  .sidebar-standalone-item,
  .hub-nav-item {
    padding-block: 11px !important;
  }

  .hub-content-pane {
    width: 100% !important;
    padding: 24px 18px 36px !important;
  }

  .hub-article {
    width: 100%;
    max-width: 42rem;
  }

  .doc-h1 {
    margin-bottom: 14px !important;
    font-size: clamp(1.8rem, 9vw, 2.15rem) !important;
    line-height: 1.18 !important;
  }

  .doc-h2 {
    margin-top: 30px !important;
    font-size: clamp(1.25rem, 6vw, 1.4rem) !important;
    line-height: 1.25 !important;
  }

  .doc-intro-text,
  .doc-paragraph,
  .doc-bullet-list,
  .doc-numbered-list,
  .simple-callout {
    font-size: 1rem !important;
    line-height: 1.68 !important;
  }

  .doc-bullet-list,
  .doc-numbered-list {
    padding-left: 20px !important;
  }

  .simple-callout {
    padding: 16px !important;
  }

  .hub-article img,
  .hub-article video,
  .hub-article iframe {
    max-width: 100% !important;
    height: auto;
  }

  .hub-article pre,
  .hub-article table {
    max-width: 100%;
    overflow-x: auto;
  }

  .hub-article article:focus {
    outline: none;
  }
}

@media (max-width: 380px) {
  .hub-header {
    padding-inline: 12px !important;
  }

  .hub-logo span {
    display: none !important;
  }

  .hub-brand-group {
    gap: 8px !important;
  }

  .hub-content-pane {
    padding-inline: 16px !important;
  }
}

@media (min-width: 901px) {
  .guides-mobile-toolbar,
  .guides-mobile-backdrop {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hub-sidebar {
    transition: none !important;
  }
}
