.header-navigation {
  position: relative;
  z-index: 50;
  background-color: var(--header-bg, #3c1415);
  box-shadow: var(--shadow-md);

  .header-bismillah {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    pointer-events: none;

    @media (max-width: 991.98px) {
      left: calc(50% + 10px);
      top: 6px;
    }

    .bismillah {
      width: 106px;
      height: 23px;
      margin: 0 auto;
      background: url("../../images/bismillah.png") no-repeat center;
      background-size: contain;
      text-indent: -9999px;
      display: block;

      @media (max-width: 991.98px) {
        width: 92px;
        height: 20px;
      }
    }
  }

  .header-bar {
    background-color: var(--header-bg, #3c1415);
    position: relative;
    z-index: 10;
    padding: 0;
    min-height: 68px;

    @media (min-width: 992px) {
      min-height: 88px;
    }
  }

  .header-row {
    min-height: 68px;

    @media (min-width: 992px) {
      min-height: 88px;
    }
  }

  .header-logo-container {
    position: relative;
    width: 240px;
    height: 88px;
    flex-shrink: 0;
    z-index: 30;

    @media (max-width: 991.98px) {
      width: 120px;
      height: 68px;
    }
  }

  .header-nav-container {
    z-index: 10;
    margin-top: 20px;

    @media (min-width: 992px) {
      margin-top: 30px;
    }
  }
}

/* Logo Bulge & SVG Curve */
.header-navigation .logo-bulge-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 240px;
  height: 138px;
  pointer-events: none;

  @media (max-width: 991.98px) {
    width: 120px;
    height: 96px;
  }

  .site-name {
    display: none !important;
  }

  .site-logo {
    display: block;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 106px;
    height: auto;
    z-index: 20;
    pointer-events: auto;
    text-decoration: none;

    @media (max-width: 991.98px) {
      top: 6px;
      width: 68px;
    }
  }

  .site-logo img {
    width: 106px;
    height: auto;
    max-height: none;
    display: block;
    margin: 0 auto;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: transform 0.25s ease;

    @media (max-width: 991.98px) {
      width: 68px;
    }

    &:hover {
      transform: scale(1.03);
    }
  }
}

.header-navigation .curved-bulge-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 240px;
  height: 138px;
  pointer-events: none;
  z-index: 10;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.4));

  @media (max-width: 991.98px) {
    width: 120px;
    height: 96px;
  }

  svg {
    width: 100%;
    height: 100%;
    display: block;
  }

  .bulge-fill {
    fill: var(--bulge-bg, #3c1415);
  }
}

/* Primary Navigation Bar */
.navbar-anwar {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;

  .navbar-toggler {
    display: none;
    background: transparent;
    border: 1px solid var(--gold-color);
    border-radius: var(--border-radius-sm);
    color: var(--gold-color);
    padding: 6px 10px;
  }

  .navbar-toggler-icon {
    display: inline-block;
    width: 22px;
    height: 2px;
    background-color: var(--gold-color);
    position: relative;
    vertical-align: middle;

    &::before,
    &::after {
      content: "";
      position: absolute;
      width: 22px;
      height: 2px;
      background-color: var(--gold-color);
      left: 0;
    }

    &::before {
      top: -7px;
    }

    &::after {
      bottom: -7px;
    }
  }

  ul.menu,
  .navbar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;

    @media (min-width: 992px) {
      flex-direction: row;
      align-items: center;
      gap: 0.5rem;
    }
  }

  li.menu-item,
  .nav-item {
    position: relative;
    margin: 0;

    > a,
    > .nav-link {
      color: var(--header-text-cream, #d8b693) !important;
      font-weight: 500;
      font-size: 0.8125rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      padding: 8px 14px;
      display: block;
      text-decoration: none;
      border-radius: var(--border-radius-sm);
      transition:
        color 0.2s ease-in-out,
        background-color 0.2s ease-in-out;

      &:hover,
      &.active,
      &.is-active,
      &[aria-current="page"] {
        color: #ffffff !important;
        background-color: rgba(255, 255, 255, 0.12);
      }
    }
  }

  .dropdown {
    position: relative;
  }

  .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    min-width: 180px;
    padding: 8px 0;
    margin: 2px 0 0;
    background-color: #ffffff;
    border: 1px solid var(--gold-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-md);
    list-style: none;

    &.show {
      display: block;
    }

    .nav-link {
      color: var(--text-dark) !important;
      font-weight: 500;
      text-transform: none;
      font-size: 0.875rem;
      padding: 8px 16px;
      display: block;

      &:hover {
        background-color: var(--parchment-color) !important;
        color: var(--primary) !important;
      }
    }
  }

  @media (max-width: 991.98px) {
    .navbar-toggler {
      display: inline-block;
    }

    .navbar-collapse {
      display: none;
      width: 100%;
      position: absolute;
      top: 100%;
      left: 0;
      background-color: var(--primary);
      border-top: 1px solid rgba(225, 190, 98, 0.3);
      border-bottom: 2px solid var(--gold-color);
      padding: 12px 15px;
      margin-top: 8px;
      box-shadow: var(--shadow-md);
      z-index: 100;

      &.show {
        display: block;
      }
    }

    .navbar-nav {
      align-items: flex-start;
      gap: 8px;
    }

    .nav-item,
    .nav-item > .nav-link {
      width: 100%;
    }
  }
}

/* Expanding Inline Search (V5) */
.header-search-container {
  position: relative;
  display: flex;
  align-items: center;

  .header-search-form {
    display: flex;
    align-items: center;
    position: relative;
  }

  .btn-search-toggle {
    background: transparent;
    border: 1px solid rgba(225, 190, 98, 0.4);
    color: var(--gold-color);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9375rem;
    cursor: pointer;
    transition:
      transform 0.2s ease-in-out,
      background-color 0.2s ease-in-out,
      border-color 0.2s ease-in-out;
    padding: 0;

    &:hover {
      background-color: rgba(225, 190, 98, 0.15);
      color: #ffffff;
      border-color: var(--gold-color);
      transform: scale(1.05);
    }
  }

  .search-input-wrapper {
    overflow: hidden;
    width: 0;
    opacity: 0;
    display: flex;
    align-items: center;
    transition:
      width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
      opacity 0.25s ease;
    position: relative;
  }

  .header-search-input {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--gold-color);
    border-radius: var(--border-radius-pill);
    color: #ffffff;
    font-size: 0.8125rem;
    padding: 6px 32px 6px 14px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s ease;

    &::placeholder {
      color: rgba(225, 190, 98, 0.7);
    }

    &:focus {
      border-color: #ffffff;
    }
  }

  .btn-search-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--gold-color);
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;

    &:hover {
      color: #ffffff;
    }
  }

  &.search-expanded {
    .search-input-wrapper {
      width: 220px;
      opacity: 1;
      margin-right: 8px;

      @media (min-width: 1200px) {
        width: 260px;
      }
    }

    .btn-search-toggle {
      background-color: var(--gold-color);
      color: var(--primary);
    }
  }

  @media (max-width: 991.98px) {
    &.search-expanded {
      position: absolute;
      inset: 0;
      background-color: var(--primary);
      z-index: 100;
      padding: 0 1rem;
      display: flex;
      align-items: center;
      margin: 0 !important;

      .header-search-form {
        width: 100%;
      }

      .search-input-wrapper {
        width: calc(100% - 46px);
        opacity: 1;
        margin-right: 8px;
      }
    }
  }
}
