/* TradesFolks 18.4.41 — Desktop Header Final Balance
   Fixes 18.4.40 screenshots:
   - search no longer dominates ultra-wide screens
   - authenticated first name gets usable reserved width
   - logged-in/logged-out geometry stays on the same rail
   - actions remain compact without awkward empty gaps */

@media(min-width:1024px){
  /* Premium centered desktop rail. Ultra-wide screens should not stretch controls edge-to-edge. */
  .site-header.premium-header .header-main.shell{
    width:min(calc(100% - 32px),1680px)!important;
    max-width:1680px!important;
    margin-inline:auto!important;
    grid-template-columns:54px minmax(0,1fr) auto!important;
    justify-content:normal!important;
    align-items:center!important;
    gap:12px!important;
  }

  .site-header.premium-header .global-search{
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    justify-self:stretch!important;
    grid-template-columns:108px minmax(180px,1fr) 40px 88px!important;
  }

  /* Actions size from their real content; no artificial 430px blank reservation. */
  .site-header.premium-header .header-actions{
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:6px!important;
    flex-wrap:nowrap!important;
  }

  /* Logged-in identity: show useful first-name width instead of forced Raj... truncation. */
  .site-header.premium-header .header-actions>.tf-header-user{
    display:inline-flex!important;
    flex:0 1 auto!important;
    width:auto!important;
    min-width:76px!important;
    max-width:138px!important;
    padding:0 9px!important;
  }
  .site-header.premium-header .tf-header-user-name{
    width:auto!important;
    min-width:0!important;
    max-width:96px!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  /* Compact premium action dimensions. */
  .site-header.premium-header .header-actions>.tf-header-dashboard,
  .site-header.premium-header .header-actions>.join-button{
    min-width:78px!important;
    padding-inline:10px!important;
  }
  .site-header.premium-header .header-actions>.compare-header-link{
    min-width:88px!important;
    padding-inline:9px!important;
  }
  .site-header.premium-header .header-actions>.shopping-cart-link{
    min-width:98px!important;
    padding-inline:8px!important;
  }
}

/* Common 1280–1599 laptops: use nearly full rail but keep identity readable. */
@media(min-width:1280px) and (max-width:1599px){
  .site-header.premium-header .header-main.shell{
    width:calc(100% - 24px)!important;
    grid-template-columns:50px minmax(0,1fr) auto!important;
    gap:9px!important;
  }
  .site-header.premium-header .global-search{
    grid-template-columns:96px minmax(150px,1fr) 38px 78px!important;
  }
  .site-header.premium-header .global-search>.tf-header-search-submit{
    width:78px!important;min-width:78px!important;max-width:78px!important;
  }
  .site-header.premium-header .header-actions>.tf-header-user{
    min-width:70px!important;max-width:118px!important;padding-inline:7px!important;
  }
  .site-header.premium-header .tf-header-user-name{max-width:82px!important}
  .site-header.premium-header .header-actions>.tf-header-dashboard,
  .site-header.premium-header .header-actions>.join-button{min-width:72px!important;padding-inline:8px!important}
  .site-header.premium-header .header-actions>.compare-header-link{min-width:82px!important}
  .site-header.premium-header .header-actions>.shopping-cart-link{min-width:92px!important}
}

/* 1024–1279: compact labels progressively, never hide the actual first name. */
@media(min-width:1024px) and (max-width:1279px){
  .site-header.premium-header .header-main.shell{
    width:calc(100% - 20px)!important;
    grid-template-columns:46px minmax(0,1fr) auto!important;
    gap:7px!important;
  }
  .site-header.premium-header .global-search{
    grid-template-columns:82px minmax(110px,1fr) 36px 68px!important;
  }
  .site-header.premium-header .global-search>.tf-header-search-submit{
    width:68px!important;min-width:68px!important;max-width:68px!important;
  }
  .site-header.premium-header .header-actions{gap:4px!important}
  .site-header.premium-header .header-actions>.tf-header-user{
    display:inline-flex!important;
    min-width:58px!important;
    max-width:94px!important;
    padding-inline:6px!important;
  }
  .site-header.premium-header .tf-header-user-prefix{display:none!important}
  .site-header.premium-header .tf-header-user-name{max-width:78px!important}
  .site-header.premium-header .header-actions>.tf-header-dashboard{
    width:38px!important;min-width:38px!important;padding:0!important;font-size:0!important;
  }
  .site-header.premium-header .header-actions>.tf-header-dashboard::after{
    content:"⌂"!important;display:block!important;font-size:16px!important;line-height:1!important;color:#0b4ca5!important;
  }
  .site-header.premium-header .header-actions>.compare-header-link{min-width:74px!important;padding-inline:7px!important}
  .site-header.premium-header .header-actions>.shopping-cart-link{min-width:80px!important;padding-inline:7px!important}
  .site-header.premium-header .shopping-cart-link>span:not(.cart-svg-icon){display:none!important}
}

/* Logged-out state: avoid an oversized visual hole between Search and Sign in. */
@media(min-width:1600px){
  .site-header.premium-header .header-actions>.account-link:not(.tf-header-user){
    padding-inline:8px!important;
    min-width:auto!important;
  }
}
