/* KARETA.KZ — r294 navigation/header/bottom-nav normalization
   Scope: navigation surfaces only. No route or JS behavior changes. */

:root{
  --ui-nav-h: var(--nav-h, 64px);
  --ui-bottom-nav-h: var(--bottom-nav-h, var(--bnav-h, 68px));
  --ui-nav-item-h: 40px;
  --ui-bnav-item-h: 54px;
  --ui-nav-gap: var(--space-2, 8px);
  --ui-nav-icon: var(--ui-icon-lg, 22px);
}

/* Desktop header/nav must be a structural shell, not a second card layer. */
#nav,
.site-header{
  z-index: var(--z-sticky, 50);
  max-width: 100%;
  overflow: visible;
  box-sizing: border-box;
}

.nav-inner,
.nav-links,
.nav-right,
.nav-logo{
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.nav-inner{
  gap: var(--space-4, 16px);
}

.nav-links{
  display: flex;
  align-items: center;
  gap: var(--space-2, 8px);
  min-width: 0;
  overflow: hidden;
}

.nav-link,
.nav-auth-btn,
.burger{
  min-height: var(--ui-nav-item-h, 40px);
  border-radius: var(--ui-radius-btn, 10px);
  box-sizing: border-box;
}

.nav-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2, 8px);
  max-width: 190px;
  min-width: 0;
  padding: 0 var(--space-3, 12px);
  font-size: var(--ui-text-sm, 13px);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover,
.nav-link.active{
  transform: none !important;
}

.nav-link.active{
  background: var(--ui-surface-soft, rgba(255,107,0,.08));
}

.nav-link.active::after{
  left: var(--space-3, 12px);
  right: var(--space-3, 12px);
  bottom: 4px;
  height: 2px;
  border-radius: var(--ui-radius-pill, 999px);
}

.nav-logo{
  overflow: hidden;
}

.nav-logo-text,
.nav-logo-page,
.nav-phone{
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-auth-btn{
  min-width: 0;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: none !important;
}

/* Mobile bottom nav: one standard, no scaling layout shift. */
#bottom-nav{
  z-index: var(--z-bottom-nav, 80);
  height: calc(var(--ui-bottom-nav-h, 68px) + env(safe-area-inset-bottom, 0px));
  padding: 0 var(--space-1, 4px) env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
  max-width: 100%;
  overflow: visible;
}

#bottom-nav .bnav-inner,
.bnav-inner{
  height: var(--ui-bottom-nav-h, 68px);
  display: flex;
  align-items: stretch;
  gap: var(--space-1, 4px);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.bnav-item{
  flex: 1 1 0;
  min-width: 0;
  min-height: var(--ui-bnav-item-h, 54px);
  max-width: 100%;
  margin: var(--space-1, 4px) 0;
  padding: var(--space-1, 4px);
  border-radius: var(--ui-radius-btn, 10px);
  box-sizing: border-box;
  display: grid;
  grid-template-rows: 26px 1fr;
  place-items: center;
  gap: 2px;
  overflow: hidden;
  transform: none !important;
  transition: background-color .15s var(--ease, ease), color .15s var(--ease, ease), border-color .15s var(--ease, ease);
}

.bnav-item:hover,
.bnav-item:active,
.bnav-item.active{
  transform: none !important;
}

.bnav-item:active{
  background: var(--ui-surface-soft, rgba(255,107,0,.08));
}

.bnav-item.active{
  background: rgba(255,107,0,.12);
  color: var(--orange);
}

.bnav-icon-wrap{
  width: 26px;
  height: 26px;
  min-width: 26px;
  max-width: 26px;
  display: grid;
  place-items: center;
  position: relative;
  color: inherit;
}

.bnav-icon{
  font-size: var(--ui-nav-icon, 22px);
  line-height: 1;
  transform: none !important;
  transition: color .15s var(--ease, ease);
}

.bnav-item.active .bnav-icon,
.bnav-item:active .bnav-icon{
  transform: none !important;
}

.bnav-item.active .bnav-icon-wrap::after{
  display: none !important;
}

.bnav-label,
.bnav-lbl{
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: .1px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}

.bnav-badge{
  top: -5px;
  right: -8px;
  z-index: 2;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--ui-radius-pill, 999px);
  box-sizing: border-box;
  pointer-events: none;
}

/* Client role may contain more items. Keep it scrollable, but keep every item same size. */
@media (max-width: 640px){
  #bottom-nav[data-role="client"] .bnav-inner[data-count="6"],
  #bottom-nav[data-role="client"] .bnav-inner[data-count="7"]{
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }
  #bottom-nav[data-role="client"] .bnav-inner[data-count="6"]::-webkit-scrollbar,
  #bottom-nav[data-role="client"] .bnav-inner[data-count="7"]::-webkit-scrollbar{display:none;}

  #bottom-nav[data-role="client"] .bnav-inner[data-count="6"] .bnav-item,
  #bottom-nav[data-role="client"] .bnav-inner[data-count="7"] .bnav-item{
    flex: 0 0 64px;
    width: 64px;
    scroll-snap-align: start;
  }
}

/* Header must not fight bottom nav on small screens. */
@media (max-width: 900px){
  .nav-links,
  .nav-phone{
    display: none !important;
  }
  #bottom-nav{
    display: flex;
  }
  #app{
    padding-bottom: calc(var(--ui-bottom-nav-h, 68px) + env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 901px){
  #bottom-nav{
    display: none !important;
  }
  .nav-links{
    display: flex;
  }
}

/* Accessibility: same focus ring as buttons, no layout jump. */
.nav-link:focus-visible,
.nav-auth-btn:focus-visible,
.burger:focus-visible,
.bnav-item:focus-visible{
  outline: 2px solid var(--orange, #ff6b00);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(255,107,0,.16);
}
