/* ZAP navigation layout (stage 2). Loaded after zap-theme.css.
   Same <nav class="bottom-nav"> and the same .nav-btn[data-screen] buttons, so app.js navTo(),
   the onboarding tour and every helper that looks up a nav button keep working unchanged.
   Phone and tablet: bottom bar with line icons. Desktop (>=1024px): fixed left sidebar. */

:root{--zap-sidebar-w:208px}

/* ---------- Shared: line icons ---------- */
.nav-btn .nav-icon{width:20px;height:20px;display:block;flex:0 0 auto}
.nav-btn span{font-size:11px;line-height:14px}

/* ---------- Phone / tablet: bottom bar ---------- */
@media (max-width:1023.98px){
  .bottom-nav{gap:0;padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px))}
  .bottom-nav .nav-btn{display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:64px;min-height:48px;padding:6px 4px;font-size:0}
  body[data-account-type="carrier"] .bottom-nav .nav-btn.carrier-only{display:flex!important}
  .bottom-nav .nav-btn span{margin:0}
  /* Phone card corners follow the theme (mobile-fix.css forced 22px) */
  body .card,body .list-card{border-radius:6px!important}
}

/* ---------- Desktop: left sidebar ---------- */
@media (min-width:1024px){
  .bottom-nav{
    position:fixed!important;top:0;bottom:0;left:0!important;right:auto!important;transform:none!important;
    width:var(--zap-sidebar-w)!important;max-width:none!important;
    display:flex;flex-direction:column;gap:2px;overflow-x:hidden;overflow-y:auto;
    padding:16px 10px calc(16px + env(safe-area-inset-bottom,0px)) calc(10px + env(safe-area-inset-left,0px));
    border:0!important;border-right:1px solid var(--zap-border)!important;box-shadow:none!important;border-radius:0;
    z-index:50
  }
  .bottom-nav::before{content:"Navigation";display:block;padding:4px 10px 10px;font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--zap-muted)}
  .bottom-nav .nav-btn{
    display:flex!important;flex-direction:row;align-items:center;gap:10px;
    width:100%;min-width:0;height:36px;padding:0 10px;border-radius:4px;
    font-size:0;text-align:left;cursor:pointer
  }
  body[data-account-type="carrier"] .bottom-nav .nav-btn.carrier-only{display:flex!important}
  .bottom-nav .nav-btn .nav-icon{width:18px;height:18px}
  .bottom-nav .nav-btn span{display:inline;margin:0;font-size:14px;line-height:20px;font-weight:500}
  .bottom-nav .nav-btn:hover{background:var(--zap-panel-2);color:var(--zap-text)}
  .bottom-nav .nav-btn.active{background:var(--zap-nav-active-bg);color:var(--zap-nav-active-text)}
  .bottom-nav .nav-btn.active span{font-weight:600}

  /* Content sits beside the sidebar and uses the available width */
  .app-shell{
    max-width:none!important;margin:0!important;
    padding:20px 28px 40px calc(var(--zap-sidebar-w) + 28px)!important;
    box-sizing:border-box
  }
  .app-shell>main,.app-shell>.topbar{max-width:1480px}
  /* Dialogs and the tour sit above the sidebar */
  body.zap-tour-active .bottom-nav{z-index:9997}
}

/* ---------- Desktop: collapsed sidebar (zap-nav-collapse.js) ---------- */
.zap-nav-toggle{display:none}
@media (min-width:1024px){
  .zap-nav-toggle{
    display:flex;align-items:center;justify-content:center;position:absolute;top:10px;right:8px;
    width:32px;height:32px;padding:0;background:transparent;border:1px solid var(--zap-border);border-radius:4px;
    color:var(--zap-text-2);cursor:pointer
  }
  .zap-nav-toggle:hover{background:var(--zap-panel-2);color:var(--zap-text)}
  .zap-nav-toggle:focus-visible,.bottom-nav .nav-btn:focus-visible{outline:2px solid var(--zap-action);outline-offset:1px}
  .zap-nav-toggle svg{width:16px;height:16px;display:block}
  body.zap-tour-active .zap-nav-toggle{display:none}
  .bottom-nav,.app-shell{transition:width .14s ease,padding-left .14s ease}
  /* The onboarding tour points at named items, so it always gets the full labelled sidebar */
  html[data-zap-nav="collapsed"] body:not(.zap-tour-active){--zap-sidebar-w:64px}
  html[data-zap-nav="collapsed"] body:not(.zap-tour-active) .app-shell{padding-left:calc(var(--zap-sidebar-w) + 24px)!important;padding-right:24px!important}
  html[data-zap-nav="collapsed"] body:not(.zap-tour-active) .bottom-nav{padding-left:10px;padding-right:10px;align-items:center}
  html[data-zap-nav="collapsed"] body:not(.zap-tour-active) .bottom-nav::before{display:none}
  html[data-zap-nav="collapsed"] body:not(.zap-tour-active) .zap-nav-toggle{position:static;flex:0 0 auto;width:44px;height:36px;margin-bottom:10px}
  html[data-zap-nav="collapsed"] body:not(.zap-tour-active) .bottom-nav .nav-btn{position:relative;flex:0 0 auto;width:44px;height:40px;padding:0;justify-content:center}
  html[data-zap-nav="collapsed"] body:not(.zap-tour-active) .bottom-nav .nav-btn .nav-icon{width:20px;height:20px}
  /* Visually hidden, not display:none: screen readers still read the label */
  html[data-zap-nav="collapsed"] body:not(.zap-tour-active) .bottom-nav .nav-btn span{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
  #zapNavTip{position:fixed;z-index:9500;padding:5px 9px;border-radius:4px;background:var(--zap-text);color:var(--zap-panel);font-size:12.5px;line-height:18px;font-weight:500;white-space:nowrap;pointer-events:none}
}
@media (prefers-reduced-motion:reduce){.bottom-nav,.app-shell{transition:none!important}}
