/* FoodCare Foodborne Guide 0.20.12
 * Compact Scientific Workspace Header
 * One stable analysis navigation component, sticky on desktop only.
 */

/* Neutralise the legacy fixed-position experiment from 0.20.11. */
.fbp-analysis-shell.fbp-fixed-desktop{
  position:static!important;
  inset:auto!important;
  left:auto!important;
  right:auto!important;
  top:auto!important;
  width:auto!important;
  transform:none!important;
}
.fbp-analysis-shell-spacer{
  display:none!important;
  height:0!important;
  min-height:0!important;
  margin:0!important;
  padding:0!important;
}

/* Workspace container: scientific, compact and aligned with the application. */
body.fbp-analysis-context .fbp-analysis-shell:not([hidden]){
  box-sizing:border-box!important;
  width:min(calc(100vw - 28px),1920px)!important;
  max-width:none!important;
  margin:10px auto 18px!important;
  padding:0!important;
  border:1px solid #c9d6e8!important;
  border-top:4px solid #214b9a!important;
  border-radius:14px!important;
  background:#f5f8fd!important;
  overflow:visible!important;
  box-shadow:0 10px 26px rgba(22,52,102,.11)!important;
}

/* First row: active analysis identity and actions. */
body.fbp-analysis-context .fbp-analysis-shell-head{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:center!important;
  gap:14px!important;
  min-height:52px!important;
  padding:8px 12px!important;
  border:0!important;
  border-radius:10px 10px 0 0!important;
  background:linear-gradient(180deg,#ffffff 0%,#f5f8fd 100%)!important;
  color:#173b82!important;
}
body.fbp-analysis-context .fbp-analysis-identity{
  display:flex!important;
  align-items:center!important;
  gap:10px!important;
  min-width:0!important;
}
body.fbp-analysis-context .fbp-analysis-mark{
  display:grid!important;
  place-items:center!important;
  flex:0 0 36px!important;
  width:36px!important;
  height:36px!important;
  border-radius:10px!important;
  background:linear-gradient(145deg,#173b82,#2b5cb4)!important;
  color:#fff!important;
  font-size:16px!important;
  line-height:1!important;
  font-weight:900!important;
  box-shadow:0 6px 14px rgba(31,76,157,.20)!important;
}
body.fbp-analysis-context .fbp-analysis-copy{
  display:grid!important;
  gap:3px!important;
  min-width:0!important;
}
body.fbp-analysis-context .fbp-analysis-title{
  margin:0!important;
  color:#173b82!important;
  opacity:1!important;
  font-size:14px!important;
  line-height:1.15!important;
  letter-spacing:.035em!important;
  text-transform:uppercase!important;
  font-weight:900!important;
  white-space:nowrap!important;
}
body.fbp-analysis-context .fbp-analysis-context-row{
  display:flex!important;
  align-items:center!important;
  gap:7px!important;
  min-width:0!important;
  flex-wrap:wrap!important;
}
body.fbp-analysis-context .fbp-analysis-context-name{
  display:inline-flex!important;
  align-items:center!important;
  min-width:0!important;
  max-width:min(520px,44vw)!important;
  min-height:27px!important;
  margin:0!important;
  padding:4px 9px!important;
  border:1px solid #cad8eb!important;
  border-radius:999px!important;
  background:#e9f0fb!important;
  color:#244a8d!important;
  font-size:13px!important;
  line-height:1.2!important;
  font-weight:800!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
body.fbp-analysis-context .fbp-analysis-save-state{
  display:inline-flex!important;
  align-items:center!important;
  gap:6px!important;
  min-height:27px!important;
  margin:0!important;
  padding:4px 9px!important;
  border:1px solid #badcc8!important;
  border-radius:999px!important;
  background:#e9f7ee!important;
  color:#17643d!important;
  font-size:13px!important;
  line-height:1.2!important;
  font-weight:850!important;
  white-space:nowrap!important;
}
body.fbp-analysis-context .fbp-analysis-dirty .fbp-analysis-save-state{
  border-color:#efd083!important;
  background:#fff4d5!important;
  color:#7b5200!important;
}
body.fbp-analysis-context .fbp-analysis-save-state:before{
  content:""!important;
  flex:0 0 7px!important;
  width:7px!important;
  height:7px!important;
  border-radius:50%!important;
  background:currentColor!important;
}

body.fbp-analysis-context .fbp-analysis-shell-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:8px!important;
  min-width:0!important;
  margin:0!important;
  white-space:nowrap!important;
}
body.fbp-analysis-context .fbp-analysis-shell-actions a,
body.fbp-analysis-context .fbp-analysis-shell-actions button{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-height:36px!important;
  margin:0!important;
  padding:7px 11px!important;
  border-radius:9px!important;
  font-size:13px!important;
  line-height:1.2!important;
  font-weight:850!important;
  text-decoration:none!important;
  white-space:nowrap!important;
  box-shadow:none!important;
}
body.fbp-analysis-context .fbp-analysis-shell-actions .fbp-methodology-button-persistent{
  border:1px solid #9fb5d8!important;
  background:#fff!important;
  color:#214b91!important;
}
body.fbp-analysis-context .fbp-analysis-shell-actions .fbp-methodology-button-persistent:hover,
body.fbp-analysis-context .fbp-analysis-shell-actions .fbp-methodology-button-persistent:focus-visible{
  border-color:#527bbd!important;
  background:#edf4ff!important;
  outline:none!important;
}
body.fbp-analysis-context .fbp-analysis-shell-actions .fbp-exit-analysis{
  border:1px solid #ddb1ba!important;
  background:#fff7f8!important;
  color:#a21f34!important;
}
body.fbp-analysis-context .fbp-analysis-shell-actions .fbp-exit-analysis:hover,
body.fbp-analysis-context .fbp-analysis-shell-actions .fbp-exit-analysis:focus-visible{
  border-color:#bd6275!important;
  background:#fff0f2!important;
  outline:none!important;
}

/* Second row: stable tab navigation. */
body.fbp-analysis-context .fbp-analysis-nav{
  display:grid!important;
  grid-template-columns:repeat(7,minmax(0,1fr))!important;
  gap:6px!important;
  width:100%!important;
  min-width:0!important;
  margin:0!important;
  padding:7px!important;
  border:0!important;
  border-top:1px solid #d8e1ee!important;
  border-radius:0 0 10px 10px!important;
  background:#eef3fa!important;
  overflow:visible!important;
  box-sizing:border-box!important;
}
body.fbp-analysis-context .fbp-analysis-nav button{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-width:0!important;
  width:100%!important;
  min-height:40px!important;
  margin:0!important;
  padding:7px 8px!important;
  border:1px solid #cad7e8!important;
  border-radius:9px!important;
  background:#fff!important;
  color:#2a4775!important;
  font-size:13px!important;
  line-height:1.18!important;
  font-weight:760!important;
  text-align:center!important;
  white-space:normal!important;
  box-shadow:none!important;
  transition:background .16s ease,border-color .16s ease,color .16s ease,box-shadow .16s ease!important;
}
body.fbp-analysis-context .fbp-analysis-nav button:hover,
body.fbp-analysis-context .fbp-analysis-nav button:focus-visible{
  border-color:#7f9fce!important;
  background:#f5f8ff!important;
  color:#173b82!important;
  outline:none!important;
}
body.fbp-analysis-context .fbp-analysis-nav button.active{
  border-color:#214b98!important;
  background:#214b98!important;
  color:#fff!important;
  box-shadow:0 4px 11px rgba(33,75,152,.18)!important;
}

/* Desktop-only sticky behaviour. No scroll listeners and no left/width recalculation. */
@media (min-width:1180px) and (hover:hover) and (pointer:fine){
  body.fbp-analysis-context .fbp-workspace{
    overflow:visible!important;
  }
  body.fbp-analysis-context .fbp-analysis-shell.fbp-analysis-sticky-active:not([hidden]){
    position:sticky!important;
    top:8px!important;
    left:auto!important;
    right:auto!important;
    inset-inline:auto!important;
    z-index:10030!important;
    width:min(calc(100vw - 28px),1920px)!important;
    margin:10px auto 18px!important;
    transform:none!important;
  }
  body.admin-bar.fbp-analysis-context .fbp-analysis-shell.fbp-analysis-sticky-active:not([hidden]){
    top:40px!important;
  }
}

/* Compact desktop: retain the shell and allow only the tabs to scroll internally. */
@media (min-width:760px) and (max-width:1370px){
  body.fbp-analysis-context .fbp-analysis-shell-head{
    grid-template-columns:minmax(0,1fr) auto!important;
  }
  body.fbp-analysis-context .fbp-analysis-nav{
    display:flex!important;
    flex-wrap:nowrap!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    scrollbar-width:thin!important;
    overscroll-behavior-inline:contain!important;
    scroll-snap-type:x proximity!important;
  }
  body.fbp-analysis-context .fbp-analysis-nav button{
    flex:0 0 165px!important;
    width:auto!important;
    scroll-snap-align:start!important;
  }
}

/* Mobile/tablet: static, naturally flowing, no floating behaviour. */
@media (max-width:1179px),(hover:none),(pointer:coarse){
  body.fbp-analysis-context .fbp-analysis-shell,
  body.fbp-analysis-context .fbp-analysis-shell.fbp-analysis-sticky-active:not([hidden]),
  body.fbp-analysis-context .fbp-analysis-shell.fbp-fixed-desktop{
    position:static!important;
    inset:auto!important;
    left:auto!important;
    right:auto!important;
    top:auto!important;
    width:calc(100% - 12px)!important;
    max-width:100%!important;
    margin:8px auto 14px!important;
    transform:none!important;
  }
}
@media (max-width:760px){
  body.fbp-analysis-context .fbp-analysis-shell-head{
    grid-template-columns:1fr!important;
    align-items:start!important;
    gap:8px!important;
    padding:9px!important;
  }
  body.fbp-analysis-context .fbp-analysis-mark{
    flex-basis:34px!important;
    width:34px!important;
    height:34px!important;
  }
  body.fbp-analysis-context .fbp-analysis-context-name{
    max-width:calc(100vw - 92px)!important;
  }
  body.fbp-analysis-context .fbp-analysis-shell-actions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    width:100%!important;
  }
  body.fbp-analysis-context .fbp-analysis-shell-actions>*{
    width:100%!important;
    min-width:0!important;
    white-space:normal!important;
    text-align:center!important;
  }
  body.fbp-analysis-context .fbp-analysis-nav{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:6px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    scrollbar-width:thin!important;
    scroll-snap-type:x proximity!important;
  }
  body.fbp-analysis-context .fbp-analysis-nav button{
    flex:0 0 148px!important;
    width:auto!important;
    min-height:39px!important;
    scroll-snap-align:start!important;
  }
}

/* Account for the sticky header when navigating to content anchors. */
.fbp-results-panel,
.fbp-risk-legend,
.fbp-scoring-algorithm,
.fbp-scientific-wide-toolbar,
.fbp-risk-table tr[data-pathogen-id],
.fbp-tool-view{
  scroll-margin-top:126px!important;
}
@media (max-width:1179px){
  .fbp-results-panel,
  .fbp-risk-legend,
  .fbp-scoring-algorithm,
  .fbp-scientific-wide-toolbar,
  .fbp-risk-table tr[data-pathogen-id],
  .fbp-tool-view{
    scroll-margin-top:16px!important;
  }
}

@media (prefers-reduced-motion:reduce){
  body.fbp-analysis-context .fbp-analysis-nav button{
    transition:none!important;
  }
}
