/* =============================================
   navbar.css — MUHAZU Global
   Clean rebuild — no mega menu, no dropdowns
   ============================================= */

/* ---- Overlay bar — floats on top of hero, scrolls away ---- */
.navbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: transparent;
}

.navbar-inner {
  display: flex;
  align-items: center;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 5%;
  height: 68px;
  gap: 1rem;
}

/* ---- Logo ---- */
.nav-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo {
  height: 44px;
  width: auto;
}

.brand-name {
  height: 26px;
  width: auto;
}

/* ---- Desktop nav links ---- */
.nav-links {
  display: none;
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  gap: 0.125rem;
}

.nav-links li a {
  display: block;
  padding: 0.45rem 0.8rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.nav-links li a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

/* ---- Right actions ---- */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

/* ---- Login icon (CSS person — no SVG) ---- */
.nav-login {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
  position: relative;
  color: rgba(255,255,255,0.65);
  transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
}

/* Head */
.nav-login::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
}

/* Body */
.nav-login::after {
  content: '';
  width: 14px;
  height: 8px;
  border-radius: 8px 8px 0 0;
  background: currentColor;
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
}

.nav-login:hover {
  border-color: #CCF045;
  color: #CCF045;
  background: rgba(204,240,69,0.08);
}

/* Desktop CTA pill */
.nav-cta {
  display: none;
  padding: 0.5rem 1.25rem;
  background: #CCF045;
  color: #0D0D0D;
  font-size: 0.835rem;
  font-weight: 700;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.nav-cta:hover {
  background: #d4f55e;
  box-shadow: 0 4px 16px rgba(204, 240, 69, 0.28);
}

/* ---- Hamburger ---- */
.nav-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.nav-hamburger:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
  transform-origin: center;
}

.nav-hamburger.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.is-open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-hamburger.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Mobile overlay ---- */
.nav-mobile {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #0D0D0D;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
  overscroll-behavior: none;
  overflow-y: auto;
}

.nav-mobile.is-open {
  opacity: 1;
  visibility: visible;
}

.nav-mobile-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.65);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-mobile-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-mobile-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 5rem 2rem 3rem;
  gap: 2rem;
}

.nav-mobile-list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 320px;
}

.nav-mobile-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.nav-mobile-item:first-child {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.nav-mobile-link {
  display: block;
  padding: 1rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-mobile-link:hover,
.nav-mobile-link:focus,
.nav-mobile-link:active {
  color: #CCF045;
  text-decoration: none;
}

.nav-mobile-cta-btn {
  display: inline-block;
  padding: 0.875rem 2.5rem;
  background: #CCF045;
  color: #0D0D0D;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.nav-mobile-cta-btn:hover,
.nav-mobile-cta-btn:focus,
.nav-mobile-cta-btn:active {
  text-decoration: none;
}

.nav-mobile-cta-btn:hover {
  background: #d4f55e;
  box-shadow: 0 8px 24px rgba(204, 240, 69, 0.28);
}

/* ---- Scroll lock when mobile open ---- */
body.nav-open {
  overflow: hidden;
  touch-action: none;
}

/* ---- Safety net: kill all underlines inside mobile panel ---- */
.nav-mobile a,
.nav-mobile a:hover,
.nav-mobile a:focus,
.nav-mobile a:active,
.nav-mobile a:visited {
  text-decoration: none !important;
}

/* ---- Responsive show/hide ---- */
@media (min-width: 969px) {
  .nav-links       { display: flex; }
  .nav-cta         { display: inline-block; }
  .nav-hamburger   { display: none; }
}

@media (max-width: 968px) {
  .nav-links       { display: none; }
  .nav-cta         { display: none; }
  .nav-hamburger   { display: flex; }
  .nav-actions     { margin-left: auto; }
}

/* ---- Small screen: hide wordmark, keep icon ---- */
@media (max-width: 380px) {
  .brand-name { display: none; }
}

/* ---- Mobile services accordion ---- */
.nav-mobile-services-toggle {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.nav-mobile-chevron {
  color: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
  font-size: 0.65rem;
  line-height: 1;
  transition: transform 0.25s ease, color 0.2s ease;
}

.nav-mobile-services-toggle[aria-expanded="true"] .nav-mobile-chevron {
  transform: rotate(180deg);
  color: #CCF045;
}

.nav-mobile-sub {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.nav-mobile-sub.is-open {
  max-height: 460px;
}

.nav-mobile-sub li {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-mobile-sub-link {
  display: block;
  padding: 0.75rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-mobile-sub-link:hover,
.nav-mobile-sub-link:focus,
.nav-mobile-sub-link:active {
  color: #CCF045;
  text-decoration: none;
}

/* ---- Mobile nested legacy accordion ---- */
.nav-mobile-legacy-toggle {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.nav-mobile-sub-chevron {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.5rem;
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.25s ease, color 0.2s ease;
}

.nav-mobile-legacy-toggle[aria-expanded="true"] .nav-mobile-sub-chevron {
  transform: rotate(180deg);
  color: #CCF045;
}

.nav-mobile-sub-sub {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.nav-mobile-sub-sub.is-open {
  max-height: 340px;
}

.nav-mobile-sub-sub li {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.nav-mobile-sub-sub-link {
  display: block;
  padding: 0.6rem 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-mobile-sub-sub-link:hover {
  color: #CCF045;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .navbar,
  .navbar.is-scrolled,
  .nav-hamburger span,
  .nav-mobile,
  .nav-mobile-link,
  .nav-cta,
  .nav-mobile-cta-btn {
    transition: none;
    animation: none;
  }
}

/* =============================================
   Services dropdown — desktop only
   ============================================= */

.nav-services-item {
  position: relative;
}

/* flex override so chevron sits inline with text */
.nav-links .nav-services-trigger {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-services-chevron {
  color: rgba(255, 255, 255, 0.38);
  flex-shrink: 0;
  font-size: 0.55rem;
  line-height: 1;
  transition: transform 0.22s ease, color 0.15s ease;
}

.nav-services-item:hover .nav-services-chevron {
  transform: rotate(180deg);
  color: rgba(255, 255, 255, 0.8);
}

.services-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 218px;
  list-style: none;
  padding: 0.5rem;
  margin: 0;
  background: rgba(11, 11, 11, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-top: 2px solid #CCF045;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 2px 8px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* delayed close — lets mouse cross any gap without snapping shut */
  transition: opacity 0.18s ease 0.13s, visibility 0.18s ease 0.13s, transform 0.18s ease 0.13s;
  z-index: 1100;
}

/* invisible bridge fills the gap between nav link and dropdown panel */
.services-dropdown::before {
  content: '';
  position: absolute;
  top: -16px;
  left: 0;
  right: 0;
  height: 16px;
}

.nav-services-item:hover .services-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  /* open immediately, no delay */
  transition: opacity 0.15s ease 0s, visibility 0.15s ease 0s, transform 0.15s ease 0s;
}

.services-dropdown-item {
  display: block;
  padding: 0.6rem 0.9rem;
  font-size: 0.855rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.62);
  border-radius: 6px;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.services-dropdown-item:hover {
  color: #CCF045;
  background: rgba(204, 240, 69, 0.07);
}

/* desktop only */
@media (max-width: 968px) {
  .nav-services-chevron { display: none; }
  .services-dropdown    { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .services-dropdown,
  .nav-services-chevron {
    transition: none;
    animation: none;
  }
}

/* =============================================
   Takaful & Hibah — flyout submenu
   ============================================= */

.services-dropdown .has-submenu {
  position: relative;
}

/* Override display:block → flex so chevron sits inline */
.services-dropdown .sd-has-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Right-pointing chevron */
.sd-sub-chevron {
  color: rgba(255, 255, 255, 0.32);
  flex-shrink: 0;
  margin-left: 0.75rem;
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 0.2s ease, color 0.15s ease;
}

.services-dropdown .has-submenu:hover .sd-sub-chevron {
  transform: translateX(3px);
  color: #CCF045;
}

/* Highlight parent row while submenu is open */
.services-dropdown .has-submenu:hover .sd-has-sub {
  color: #CCF045;
  background: rgba(204, 240, 69, 0.07);
}

/* Flyout panel */
.takaful-submenu {
  position: absolute;
  top: 0;
  /* 100% = right edge of .has-submenu li (inside dropdown padding).
     +12px clears the dropdown's right padding (0.5rem≈8px) plus a 4px visual gap. */
  left: calc(100% + 12px);
  min-width: 200px;
  list-style: none;
  padding: 0.5rem;
  margin: 0;
  background: rgba(11, 11, 11, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 2px solid #CCF045;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65), 0 2px 8px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-5px);
  /* delayed close: gives the mouse time to cross the gap without snapping shut */
  transition: opacity 0.18s ease 0.12s, visibility 0.18s ease 0.12s, transform 0.18s ease 0.12s;
  z-index: 1200;
}

/* Invisible bridge: extends left of the submenu panel, covering the gap +
   the dropdown's right padding so mouse never loses the :hover chain. */
.takaful-submenu::before {
  content: '';
  position: absolute;
  top: 0;
  left: -20px;
  width: 20px;
  height: 100%;
}

.services-dropdown .has-submenu:hover .takaful-submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  /* open immediately */
  transition: opacity 0.15s ease 0s, visibility 0.15s ease 0s, transform 0.15s ease 0s;
}

/* Submenu items */
.sd-sub-item {
  display: block;
  padding: 0.55rem 0.85rem;
  font-size: 0.845rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.62);
  border-radius: 6px;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.sd-sub-item:hover {
  color: #CCF045;
  background: rgba(204, 240, 69, 0.07);
}

/* Desktop only */
@media (max-width: 968px) {
  .takaful-submenu { display: none !important; }
  .sd-sub-chevron  { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .takaful-submenu,
  .sd-sub-chevron {
    transition: none;
    animation: none;
  }
}

/* =============================================
   NAV LIGHT THEME
   Untuk pages dengan white/light background hero.
   Tambah class="nav-light" pada <body>.
   ============================================= */

/* Navbar bar — transparent, same as dark theme */
body.nav-light .navbar {
  background: transparent;
}

/* Brand name logo swap */
.brand-name--dark { display: none; }

body.nav-light .brand-name--light { display: none; }
body.nav-light .brand-name--dark  { display: block; }

/* Desktop nav links — direct children only, tidak kena dropdown items */
body.nav-light .nav-links > li > a {
  color: rgba(0, 0, 0, 0.60);
}

body.nav-light .nav-links > li > a:hover {
  color: #0D0D0D;
  background: rgba(0, 0, 0, 0.04);
}

/* Services & Calculators chevron */
body.nav-light .nav-services-chevron {
  color: rgba(0, 0, 0, 0.30);
}

body.nav-light .nav-services-item:hover .nav-services-chevron {
  color: rgba(0, 0, 0, 0.70);
}

/* Hamburger lines */
body.nav-light .nav-hamburger span {
  background: #0D0D0D;
}

body.nav-light .nav-hamburger:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Login icon */
body.nav-light .nav-login {
  border-color: rgba(0, 0, 0, 0.15);
  color: rgba(0, 0, 0, 0.50);
}

body.nav-light .nav-login:hover {
  border-color: #0D0D0D;
  color: #0D0D0D;
  background: rgba(0, 0, 0, 0.04);
}

/* CTA button — kekal lime, tiada perubahan */
/* body.nav-light .nav-cta { unchanged } */

/* =============================================
   3 CORE SERVICES — Bina / Lindung / Wariskan
   Dua baris setiap item: kata kerja + deskriptor.
   ============================================= */

/* Panel Services lebih lebar sebab item dua baris */
.services-dropdown--core {
  min-width: 268px;
}

/* .sd-has-sub sudah display:flex + space-between.
   .sd-core-text jadi kolum supaya verb dan deskriptor bertindan. */
.sd-core {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.sd-core-text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.sd-core-verb {
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.88);
  transition: color 0.15s ease;
}

.sd-core-desc {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.40);
  transition: color 0.15s ease;
}

.services-dropdown .has-submenu:hover .sd-core-verb {
  color: #CCF045;
}

.services-dropdown .has-submenu:hover .sd-core-desc {
  color: rgba(204, 240, 69, 0.62);
}

/* ---- Mobile: item core dua baris ---- */
.nav-mobile-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  min-width: 0;
}

.nav-mobile-core-verb {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.75);
  transition: color 0.2s ease;
}

.nav-mobile-core-desc {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.35);
  transition: color 0.2s ease;
}

.nav-mobile-core-toggle[aria-expanded="true"] .nav-mobile-core-verb {
  color: #CCF045;
}

.nav-mobile-core-toggle[aria-expanded="true"] .nav-mobile-core-desc {
  color: rgba(204, 240, 69, 0.55);
}

/* Tiga item core (dua baris) + satu sub-sub terbuka perlu ruang lebih
   daripada had 460px asal, kalau tidak senarai terpotong di bawah. */
.nav-mobile-sub.is-open {
  max-height: 640px;
}

@media (prefers-reduced-motion: reduce) {
  .sd-core-verb,
  .sd-core-desc,
  .nav-mobile-core-verb,
  .nav-mobile-core-desc {
    transition: none;
  }
}

/* ---- Bina: pautan terus, tiada flyout ----
   Selepas halaman branding dibuang, Bina cuma ada satu destinasi.
   Hover dulu dipacu oleh .has-submenu:hover; Bina bukan .has-submenu lagi,
   jadi perlu peraturan pada item itu sendiri. */
.services-dropdown-item.sd-core:hover .sd-core-verb {
  color: #CCF045;
}

.services-dropdown-item.sd-core:hover .sd-core-desc {
  color: rgba(204, 240, 69, 0.62);
}

.nav-mobile-core-link:hover .nav-mobile-core-verb,
.nav-mobile-core-link:focus .nav-mobile-core-verb,
.nav-mobile-core-link:active .nav-mobile-core-verb {
  color: #CCF045;
}

.nav-mobile-core-link:hover .nav-mobile-core-desc,
.nav-mobile-core-link:focus .nav-mobile-core-desc,
.nav-mobile-core-link:active .nav-mobile-core-desc {
  color: rgba(204, 240, 69, 0.55);
}

/* Peranti sentuh: :hover melekat selepas tap, jadi warna hover kekal
   pada item yang jari tersentuh semasa skrol. Batalkan hover sahaja,
   :focus dan :active kekal beri maklum balas tap. */
@media (hover: none) {
  .nav-mobile-core-link:hover .nav-mobile-core-verb {
    color: rgba(255, 255, 255, 0.75);
  }
  .nav-mobile-core-link:hover .nav-mobile-core-desc {
    color: rgba(255, 255, 255, 0.35);
  }
}
