/* Nav: icons + labels on large screens; bottom icon bar on mobile */
#navbar {
  overflow: visible;
}

.nav-links {
  gap: 4px;
  overflow: visible;
}

.nav-links li {
  overflow: visible;
}

.nav-icon-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 10px 6px;
  min-width: 52px;
  text-decoration: none;
  color: #fff;
  transition: transform 0.25s ease;
  gap: 4px;
}

a.nav-auth-action {
  cursor: pointer;
}

.nav-icon-link i {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900;
  font-style: normal;
  font-size: 1.2rem;
  line-height: 1;
  display: block;
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1), color 0.25s ease;
}

.nav-icon-link:hover i,
.nav-icon-link:focus-visible i {
  transform: translateY(-2px) scale(1.08);
  color: #fff;
}

.nav-icon-link.active i {
  color: #fff;
}

.nav-tooltip {
  position: static;
  transform: none;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  white-space: nowrap;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  padding: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  box-shadow: none;
  line-height: 1.2;
  text-align: center;
}

.nav-tooltip::before {
  display: none;
}

.nav-icon-link.underline-effect::after {
  bottom: 0;
  width: 0;
  left: 50%;
}

.nav-icon-link.underline-effect:hover::after,
.nav-icon-link.underline-effect.active::after,
.nav-icon-link.underline-effect:focus-visible::after,
button.nav-icon-link.underline-effect:hover::after,
button.nav-icon-link.underline-effect:focus-visible::after {
  width: 60%;
  left: 20%;
}

.dropdown > .nav-icon-link {
  cursor: pointer;
}

.menu-toggle {
  display: none !important;
}

/* Mobile bottom navigation */
.mobile-nav-spacer,
.mobile-icon-nav {
  display: none;
}

@media (max-width: 768px) {
  #navbar .nav-links {
    display: none !important;
  }

  /* In-flow spacer — pushes content above the fixed bar */
  .mobile-nav-spacer {
    display: block;
    width: 100%;
    height: var(--mobile-nav-h, 72px);
    flex-shrink: 0;
    pointer-events: none;
  }

  .mobile-icon-nav {
    display: flex !important;
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    box-sizing: border-box;
    z-index: 10050;
    visibility: visible;
    opacity: 1;
    align-items: stretch;
    justify-content: space-around;
    min-height: 64px;
    padding: 4px 4px;
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
    padding-left: max(8px, env(safe-area-inset-left, 0px));
    padding-right: max(8px, env(safe-area-inset-right, 0px));
    gap: 2px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(36, 107, 206, 0.14);
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.1);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }

  .mobile-icon-nav-link {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: 56px;
    padding: 4px 2px 5px;
    border-radius: 12px;
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
  }

  .mobile-icon-nav-link i {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900;
    font-style: normal;
    font-size: clamp(0.95rem, 4vw, 1.15rem);
    line-height: 1;
    flex-shrink: 0;
  }

  .mobile-icon-nav-label {
    font-size: clamp(0.48rem, 2.6vw, 0.62rem);
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    width: 100%;
    color: inherit;
    letter-spacing: 0.01em;
  }

  .mobile-icon-nav-link.active {
    color: #246bce;
    background: rgba(36, 107, 206, 0.1);
  }

  .mobile-icon-nav-link.active .mobile-icon-nav-label {
    color: #246bce;
    font-weight: 700;
  }

  .mobile-icon-nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #246bce;
  }

  .mobile-icon-nav-link:active {
    background: rgba(36, 107, 206, 0.08);
  }

  button.mobile-icon-nav-link {
    font: inherit;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
  }

  .mobile-nav-dropdown {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
  }

  .mobile-nav-dropdown .mobile-icon-nav-link {
    width: 100%;
  }

  .mobile-nav-dropup-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10049;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }

  .mobile-nav-dropup-backdrop.is-visible {
    display: block;
    opacity: 1;
    visibility: visible;
  }

  .mobile-nav-dropup {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(var(--mobile-nav-h, 72px) + 10px);
    z-index: 10051;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(36, 107, 206, 0.14);
    border-radius: 14px;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.14);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  }

  .mobile-nav-dropdown.is-open .mobile-nav-dropup {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .mobile-nav-dropup-link {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-radius: 10px;
    color: #1e293b;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
  }

  .mobile-nav-dropup-link:hover,
  .mobile-nav-dropup-link:focus-visible,
  .mobile-nav-dropup-link:active {
    background: rgba(36, 107, 206, 0.1);
    color: #246bce;
  }

  body.has-mobile-icon-nav {
    scroll-padding-bottom: var(--mobile-nav-h, 72px);
  }

  body.has-mobile-icon-nav .site-footer {
    margin-bottom: 0;
  }
}

/* Very small phones — slightly compact bar */
@media (max-width: 380px) {
  .mobile-icon-nav {
    padding-left: 4px;
    padding-right: 4px;
    gap: 0;
  }

  .mobile-icon-nav-link {
    min-height: 52px;
    padding: 3px 1px 4px;
  }

  .mobile-icon-nav-label {
    font-size: 0.48rem;
  }

  .mobile-nav-dropdown {
    max-width: none;
  }

  .mobile-nav-dropup {
    left: 8px;
    right: 8px;
  }

  .mobile-nav-dropup-link {
    padding: 12px 14px;
    font-size: 0.9rem;
  }
}

/* Landscape phones — keep bar at visual bottom */
@media (max-width: 768px) and (orientation: landscape) {
  .mobile-icon-nav {
    min-height: 48px;
    padding-top: 4px;
    padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
  }

  .mobile-icon-nav-link {
    min-height: 48px;
    gap: 2px;
  }

  .mobile-icon-nav-label {
    font-size: 0.5rem;
  }
}
