/* XSeller V3.6.4-R3.2 — Mobile Sidebar & Responsive Fix */

/* Desktop remains R3.1 wide */
@media (min-width:901px){
  html body.dash #sidebar,
  html body.voiceStudioPage #sidebar{
    width:260px!important;
    min-width:260px!important;
    max-width:260px!important;
    transform:none!important;
    left:0!important;
    visibility:visible!important;
    pointer-events:auto!important;
  }

  html body.dash .workspace,
  html body.voiceStudioPage .workspace,
  html body.dash main.workspace{
    margin-left:260px!important;
  }

  html body .mobileMenu{
    display:none!important;
  }
}

/* Mobile/tablet drawer */
@media (max-width:900px){
  html,body{
    width:100%!important;
    max-width:100%!important;
    overflow-x:hidden!important;
  }

  html body.dash,
  html body.voiceStudioPage{
    min-width:0!important;
  }

  html body.dash #sidebar,
  html body.voiceStudioPage #sidebar,
  html body #sidebar{
    position:fixed!important;
    top:0!important;
    bottom:0!important;
    left:0!important;
    right:auto!important;
    width:min(310px,86vw)!important;
    min-width:0!important;
    max-width:min(310px,86vw)!important;
    height:100dvh!important;
    max-height:100dvh!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior:contain!important;
    transform:translate3d(-105%,0,0)!important;
    transition:transform .22s ease!important;
    visibility:visible!important;
    opacity:1!important;
    pointer-events:none!important;
    z-index:10020!important;
    box-shadow:18px 0 44px rgba(0,0,0,.42)!important;
    background:#0d1116!important;
    padding-top:58px!important;
  }

  html body.sidebarOpen #sidebar,
  html body.xsMobileNavOpen #sidebar{
    transform:translate3d(0,0,0)!important;
    pointer-events:auto!important;
  }

  /* Reliable floating hamburger */
  html body .mobileMenu{
    display:flex!important;
    position:fixed!important;
    top:max(10px,env(safe-area-inset-top))!important;
    left:10px!important;
    width:44px!important;
    height:44px!important;
    min-width:44px!important;
    min-height:44px!important;
    padding:0!important;
    margin:0!important;
    align-items:center!important;
    justify-content:center!important;
    border:1px solid #303844!important;
    border-radius:10px!important;
    background:rgba(15,19,24,.96)!important;
    color:#f3f4f6!important;
    font-size:22px!important;
    line-height:1!important;
    box-shadow:0 8px 24px rgba(0,0,0,.30)!important;
    z-index:10040!important;
    cursor:pointer!important;
    pointer-events:auto!important;
    touch-action:manipulation!important;
    -webkit-tap-highlight-color:transparent!important;
  }

  html body.sidebarOpen .mobileMenu,
  html body.xsMobileNavOpen .mobileMenu{
    left:min(calc(86vw - 54px),256px)!important;
  }

  /* Full-screen clickable backdrop, but below sidebar */
  html body .xsMobileNavBackdrop{
    display:none;
    position:fixed;
    inset:0;
    z-index:10010;
    background:rgba(0,0,0,.52);
    backdrop-filter:blur(2px);
    -webkit-backdrop-filter:blur(2px);
    pointer-events:auto;
  }

  html body.sidebarOpen .xsMobileNavBackdrop,
  html body.xsMobileNavOpen .xsMobileNavBackdrop{
    display:block!important;
  }

  /* Sidebar items remain tappable and large */
  html body #sidebar .tool,
  html body #sidebar .sideLink,
  html body #sidebar .adminlink,
  html body #sidebar .logout,
  html body #sidebar a.sideLink,
  html body #sidebar button.tool{
    width:calc(100% - 24px)!important;
    max-width:none!important;
    min-height:46px!important;
    margin:4px 12px!important;
    padding:11px 13px!important;
    font-size:15px!important;
    line-height:1.3!important;
    pointer-events:auto!important;
    touch-action:manipulation!important;
    position:relative!important;
    z-index:1!important;
  }

  html body #sidebar .logo{
    margin:0 14px 16px!important;
  }

  /* Main content: no desktop offset */
  html body.dash .workspace,
  html body.voiceStudioPage .workspace,
  html body.dash main.workspace{
    width:100%!important;
    max-width:100%!important;
    margin-left:0!important;
    padding-left:12px!important;
    padding-right:12px!important;
    padding-top:62px!important;
    overflow-x:hidden!important;
  }

  html body.dash .workspace>header,
  html body.voiceStudioPage .workspace>header{
    width:100%!important;
    max-width:100%!important;
    margin-left:0!important;
    margin-right:0!important;
  }

  /* Voice page */
  html body.voiceStudioPage .voiceHero,
  html body.voiceStudioPage .voiceGrid,
  html body.voiceStudioPage .voiceHistorySection,
  html body.voiceStudioPage .voiceFreeSafeNote,
  html body.voiceStudioPage .voiceViInfo,
  html body.voiceStudioPage .voiceNotice{
    width:100%!important;
    max-width:100%!important;
    margin-left:0!important;
    margin-right:0!important;
  }

  html body.voiceStudioPage .voiceGrid{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:14px!important;
  }

  html body.voiceStudioPage .voiceCard,
  html body.voiceStudioPage .voiceHistorySection{
    min-width:0!important;
    max-width:100%!important;
  }

  html body.voiceStudioPage .voiceTwoCol{
    grid-template-columns:minmax(0,1fr)!important;
  }

  html body.voiceStudioPage .voiceSelected{
    grid-template-columns:38px minmax(0,1fr)!important;
  }

  html body.voiceStudioPage #previewVoiceBtn{
    grid-column:1/-1!important;
    width:100%!important;
  }

  html body.voiceStudioPage .voiceResultCard{
    min-height:330px!important;
  }

  html body.voiceStudioPage .voiceHistoryItem{
    grid-template-columns:minmax(0,1fr)!important;
  }

  html body.voiceStudioPage .voiceHistoryMeta{
    flex-wrap:wrap!important;
    white-space:normal!important;
  }

  /* Workspace form */
  html body.dash .panel,
  html body.dash .history,
  html body.dash .historyExplorer,
  html body.dash .accountCard,
  html body.dash .upgradeHero,
  html body.dash .packageGrid,
  html body.dash .paymentHelp{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }

  html body.dash .twocol{
    grid-template-columns:minmax(0,1fr)!important;
  }

  html body.dash textarea,
  html body.dash input,
  html body.dash select{
    max-width:100%!important;
  }
}

@media (max-width:520px){
  html body.dash .workspace,
  html body.voiceStudioPage .workspace{
    padding-left:9px!important;
    padding-right:9px!important;
  }

  html body.voiceStudioPage .voiceCard,
  html body.voiceStudioPage .voiceHistorySection,
  html body.voiceStudioPage .voiceHero{
    padding:16px!important;
  }

  html body.voiceStudioPage .voiceResultActions{
    grid-template-columns:1fr!important;
  }

  html body.voiceStudioPage .voiceResultActions>*{
    width:100%!important;
  }
}
