/* ==========================================================================
   SHB Star 2026 – Header
   ========================================================================== */

.star-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 98px;
  padding: 21px 0;
  background: var(--star-white);
  transition: box-shadow 0.28s ease, height 0.28s ease, padding 0.28s ease;
}

.star-header.is-scrolled {
  box-shadow: 0 8px 28px rgba(39, 39, 113, 0.1);
}

.star-header .navbar {
  padding: 0;
  transition: gap 0.28s ease;
}

/* --- Logo ------------------------------------------------------------------ */
.star-header__brand {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 32px;
  padding: 0;
  margin: 0;
  transition: gap 0.28s ease;
}

.star-header__logo--shb,
.star-header__logo--star {
  flex: 0 0 auto;
  max-width: none;
  transition: width 0.28s ease, height 0.28s ease;
}

.star-header__logo--shb {
  width: 113px;
  height: 33px;
}

.star-header__logo--star {
  width: 92px;
  height: 45px;
}

/* --- Nav ------------------------------------------------------------------- */
.star-header__nav {
  display: flex;
  flex-direction: column;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.star-header__nav .nav-item {
  position: relative;
}

.star-header .star-header__nav .nav-link {
  padding: 16px 0;
  font-size: var(--body-size);
  line-height: var(--body-line);
  color: var(--se-100);
  white-space: nowrap;
  transition: color 0.2s ease, padding 0.28s ease;
}

.star-header__nav .nav-item.active .nav-link,
.star-header__nav .nav-link:hover {
  color: var(--pr-100);
}

.star-header__nav .nav-item.active::before {
  content: "";
  position: absolute;
  top: -21px;
  left: 0;
  width: 100%;
  height: 5px;
  background: var(--pr-100);
  border-radius: 0 0 4px 4px;
  transition: top 0.28s ease, height 0.28s ease;
}

/* --- Nút CTA --------------------------------------------------------------- */
.star-header__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  border-radius: 64px;
  background: var(--pr-100);
  font-weight: 700;
  font-size: var(--body-size);
  line-height: var(--body-line);
  color: var(--star-white);
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, padding 0.28s ease;
}

.star-header__cta:hover {
  background: var(--raw-orange-dark);
  color: var(--star-white);
}

/* --------------------------------------------------------------------------
   Desktop >= 1280px
   -------------------------------------------------------------------------- */
@media (min-width: 1280px) {
  .star-header .navbar {
    display: flex;
    gap: 80px;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
  }

  .star-header .navbar-toggler {
    display: none;
  }

  .star-header .navbar-collapse {
    display: flex !important;
    flex: 0 0 auto;
    gap: 80px;
    align-items: center;
    width: auto;
    height: auto !important;
    overflow: visible !important;
    transition: gap 0.28s ease;
  }

  .star-header__nav {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
  }

  /* Cuộn xuống: header gọn ~64px, chừa thêm không gian nội dung */
  .star-header.is-scrolled {
    height: 64px;
    padding: 8px 0;
  }

  .star-header.is-scrolled .navbar,
  .star-header.is-scrolled .navbar-collapse {
    gap: 40px;
  }

  .star-header.is-scrolled .star-header__brand {
    gap: 20px;
  }

  .star-header.is-scrolled .star-header__logo--shb {
    width: 96px;
    height: 28px;
  }

  .star-header.is-scrolled .star-header__logo--star {
    width: 74px;
    height: 36px;
  }

  .star-header.is-scrolled .star-header__nav .nav-link {
    padding: 8px 0;
    font-size: 15px;
  }

  .star-header.is-scrolled .star-header__nav .nav-item.active::before {
    top: -8px;
    height: 3px;
  }

  .star-header.is-scrolled .star-header__cta {
    padding: 10px 18px;
    font-size: 14px;
  }
}

/* --------------------------------------------------------------------------
   < 1280: menu overlay (không đẩy layout trang → mượt hơn height collapse)
   -------------------------------------------------------------------------- */
@media (max-width: 1279.98px) {
  .star-header {
    height: auto;
    padding: 16px 0;
  }

  .star-header.is-scrolled {
    padding: 10px 0;
  }

  .star-header.is-scrolled .star-header__logo--shb {
    width: 96px;
    height: 28px;
  }

  .star-header.is-scrolled .star-header__logo--star {
    width: 78px;
    height: 38px;
  }

  .star-header.is-scrolled .navbar-toggler {
    width: 40px;
    height: 40px;
  }

  .star-header .navbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  .star-header .navbar-toggler {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--se-40);
    border-radius: 10px;
    background: var(--star-white);
    transition: border-color 0.2s ease, background 0.2s ease;
  }

  .star-header .navbar-toggler:focus {
    outline: none;
    box-shadow: none;
  }

  .star-header .navbar-toggler.is-open {
    border-color: var(--pr-100);
    background: var(--pr-5);
  }

  .star-header .navbar-toggler-icon {
    position: relative;
    width: 18px;
    height: 2px;
    background: var(--se-100);
    border-radius: 1px;
    transition: background 0.2s ease;
  }

  .star-header .navbar-toggler-icon::before,
  .star-header .navbar-toggler-icon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: var(--se-100);
    border-radius: 1px;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .star-header .navbar-toggler-icon::before {
    top: -6px;
  }

  .star-header .navbar-toggler-icon::after {
    top: 6px;
  }

  .star-header .navbar-toggler.is-open .navbar-toggler-icon {
    background: transparent;
  }

  .star-header .navbar-toggler.is-open .navbar-toggler-icon::before {
    top: 0;
    transform: rotate(45deg);
    background: var(--pr-100);
  }

  .star-header .navbar-toggler.is-open .navbar-toggler-icon::after {
    top: 0;
    transform: rotate(-45deg);
    background: var(--pr-100);
  }

  /* Overlay panel: absolute → không reflow hero/section bên dưới */
  .star-header .navbar-collapse {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 40;
    flex-basis: auto;
    width: auto;
    margin: 0;
    padding: 12px 20px 20px;
    border-radius: 16px;
    background: var(--star-white);
    box-shadow: 0 16px 40px rgba(39, 39, 113, 0.14);
    will-change: opacity, transform;
    backface-visibility: hidden;
  }

  /* Mở: Bootstrap .collapsing + .show — animate opacity/transform, không !important display */
  .star-header .navbar-collapse.collapsing {
    display: block;
    height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translate3d(0, -8px, 0);
    transition: height 0.32s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .star-header .navbar-collapse.collapse.show {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  .star-header .navbar-collapse.collapse:not(.show) {
    display: none;
  }

  .star-header__nav {
    gap: 0;
  }

  .star-header__nav .nav-link {
    padding: 12px 0;
    border-bottom: 1px solid var(--se-5);
  }

  .star-header__nav .nav-item:last-child .nav-link {
    border-bottom: 0;
  }

  .star-header__nav .nav-item.active::before {
    display: none;
  }

  .star-header__nav .nav-item.active .nav-link {
    font-weight: 600;
  }

  .star-header__cta {
    margin-top: 16px;
    width: 100%;
  }

  .star-header .navbar-collapse.show .nav-item,
  .star-header .navbar-collapse.show .star-header__cta {
    animation: starNavItemIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .star-header .navbar-collapse.show .nav-item:nth-child(1) {
    animation-delay: 0.02s;
  }
  .star-header .navbar-collapse.show .nav-item:nth-child(2) {
    animation-delay: 0.05s;
  }
  .star-header .navbar-collapse.show .nav-item:nth-child(3) {
    animation-delay: 0.08s;
  }
  .star-header .navbar-collapse.show .nav-item:nth-child(4) {
    animation-delay: 0.11s;
  }
  .star-header .navbar-collapse.show .nav-item:nth-child(5) {
    animation-delay: 0.14s;
  }
  .star-header .navbar-collapse.show .nav-item:nth-child(6) {
    animation-delay: 0.17s;
  }
  .star-header .navbar-collapse.show .nav-item:nth-child(7) {
    animation-delay: 0.2s;
  }
  .star-header .navbar-collapse.show .star-header__cta {
    animation-delay: 0.24s;
  }
}

@keyframes starNavItemIn {
  from {
    opacity: 0;
    transform: translate3d(0, 6px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (max-width: 767.98px) {
  .star-header__logo--shb {
    width: 90px;
    height: 26px;
  }

  .star-header__logo--star {
    width: 73px;
    height: 36px;
  }

  .star-header.is-scrolled .star-header__logo--shb {
    width: 82px;
    height: 24px;
  }

  .star-header.is-scrolled .star-header__logo--star {
    width: 66px;
    height: 32px;
  }

  .star-header__brand {
    gap: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .star-header,
  .star-header .navbar,
  .star-header .navbar-collapse,
  .star-header__brand,
  .star-header__logo--shb,
  .star-header__logo--star,
  .star-header .star-header__nav .nav-link,
  .star-header__nav .nav-item.active::before,
  .star-header__cta {
    transition: none;
  }

  .star-header .navbar-collapse.collapsing,
  .star-header .navbar-toggler-icon,
  .star-header .navbar-toggler-icon::before,
  .star-header .navbar-toggler-icon::after {
    transition: none;
  }

  .star-header .navbar-collapse.show .nav-item,
  .star-header .navbar-collapse.show .star-header__cta {
    animation: none;
  }
}
