/* Header Custom - Override Astra Theme */
/* Design: Logo kiri | Menu navigation kanan (Beranda, Program dropdown, About Us, Help) */

/* ========================================
   1. HIDE UNWANTED ELEMENTS
   ======================================== */

/* Hide search icon - tidak ada di design */
body #masthead .ast-header-search,
body .main-header-bar [data-section="section-header-search"] {
  display: none !important;
  visibility: hidden !important;
}

/* Hide button About Us duplicate - cukup di menu saja */
body #masthead .ast-header-button-1,
body .main-header-bar [data-section="section-hb-button-1"] {
  display: none !important;
  visibility: hidden !important;
}

/* ========================================
   2. HEADER CONTAINER
   ======================================== */

/* Force remove all borders and shadows from Astra */
body #masthead,
body #masthead *,
body .site-header,
body .main-header-bar-wrap,
body .main-header-bar,
body .ast-main-header-wrap,
body #masthead.site-header,
body .site-header.ast-primary-header,
body header.site-header {
  box-shadow: none !important;
  border: none !important;
  border-top: none !important;
  border-bottom: none !important;
  border-left: none !important;
  border-right: none !important;
}

body #masthead.site-header {
  background: #ffffff !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
  padding: 0 !important;
}

body #masthead .ast-main-header-wrap.main-header-bar-wrap {
  padding: 0 !important;
  margin: 0 !important;
}

body #masthead .main-header-bar.ast-primary-header-bar {
  padding: var(--spacing-sm) 0 !important;
  min-height: 70px !important;
}

/* Container width & alignment */
body #masthead .main-header-bar .ast-container {
  max-width: 1200px !important;
  margin: 0 auto !important;
  padding-left: var(--spacing-lg) !important;
  padding-right: var(--spacing-lg) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

body #masthead .ast-builder-grid-row {
  width: 100% !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

/* ========================================
   3. LOGO SECTION (KIRI)
   ======================================== */

body #masthead .site-header-primary-section-left {
  display: flex !important;
  align-items: center !important;
  flex: 0 0 auto !important;
}

body #masthead .site-branding {
  margin: 0 !important;
  padding: 0 !important;
}

body #masthead .custom-logo-link {
  display: inline-block !important;
  line-height: 0 !important;
}

body #masthead .custom-logo {
  max-height: 50px !important;
  width: auto !important;
  display: block !important;
}

body #masthead .site-title {
  display: none !important;
  /* Hide text title, pake logo aja */
}

/* ========================================
   4. MENU NAVIGATION (KANAN)
   ======================================== */

body #masthead .site-header-primary-section-right {
  display: flex !important;
  align-items: center !important;
  flex: 1 1 auto !important;
  justify-content: flex-end !important;
}

/* Menu container */
body #masthead .ast-builder-menu-1 {
  display: flex !important;
  align-items: center !important;
}

body #masthead .ast-builder-menu-1 .ast-main-header-bar-alignment {
  width: 100% !important;
}

body #masthead .ast-builder-menu-1 .main-header-bar-navigation {
  width: 100% !important;
}

/* Menu UL */
body #masthead .ast-builder-menu-1 .main-header-menu {
  display: flex !important;
  align-items: center !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 8px !important;
}

/* Menu items LI */
body #masthead .ast-builder-menu-1 .main-header-menu>.menu-item {
  position: relative !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

/* Menu links A - Badge style */
body #masthead .ast-builder-menu-1 .main-header-menu>.menu-item>.menu-link {
  display: inline-block !important;
  padding: 8px 18px !important;
  color: #333333 !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  border-radius: 20px !important;
  transition: all 0.3s ease !important;
  background: transparent !important;
  white-space: nowrap !important;
  line-height: 1.4 !important;
}

/* Hover state - badge dengan background */
body #masthead .ast-builder-menu-1 .main-header-menu>.menu-item>.menu-link:hover {
  color: var(--primary-color) !important;
  background: rgba(38, 149, 154, 0.12) !important;
  transform: translateY(-1px) !important;
}

/* Active/current menu - sama seperti hover tapi bold */
body #masthead .ast-builder-menu-1 .main-header-menu>.current-menu-item>.menu-link,
body #masthead .ast-builder-menu-1 .main-header-menu>.current_page_item>.menu-link,
body #masthead .ast-builder-menu-1 .main-header-menu>.menu-item.current-menu-item>.menu-link,
body #masthead .ast-builder-menu-1 .main-header-menu>.menu-item.current_page_item>.menu-link,
body #masthead .main-header-menu>.current-menu-item>a.menu-link,
body #masthead .main-header-menu>.current_page_item>a.menu-link,
body #masthead .ast-builder-menu-1 .main-header-menu .menu-item[aria-current="page"]>.menu-link {
  color: var(--primary-color) !important;
  font-weight: 600 !important;
  background: rgba(38, 149, 154, 0.12) !important;
  background-color: rgba(38, 149, 154, 0.12) !important;
}

/* Force active menu background - extra safety */
body #masthead .main-header-menu li.current-menu-item a,
body #masthead .main-header-menu li.current_page_item a {
  background: rgba(38, 149, 154, 0.12) !important;
}

/* ========================================
   5. DROPDOWN SUBMENU - ENHANCED STYLE
   ======================================== */

/* Dropdown arrow icon */
body #masthead .ast-builder-menu-1 .menu-item-has-children>.menu-link .dropdown-menu-toggle {
  display: none !important;
}

body #masthead .ast-builder-menu-1 .menu-item-has-children>.menu-link::after {
  content: " ▾" !important;
  font-size: 0.8em !important;
  margin-left: 4px !important;
  transition: transform 0.25s ease, opacity 0.25s ease !important;
  display: inline-block !important;
  opacity: 0.7 !important;
}

body #masthead .ast-builder-menu-1 .menu-item-has-children:hover>.menu-link::after {
  transform: rotate(180deg) !important;
  opacity: 1 !important;
}

/* Submenu container - Enhanced */
body #masthead .ast-builder-menu-1 .main-header-menu .sub-menu {
  position: absolute !important;
  top: calc(100% + 4px) !important;
  left: 0 !important;
  min-width: 180px !important;
  max-width: 220px !important;
  width: max-content !important;
  background: #ffffff !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
  border-radius: 12px !important;
  border-top: 3px solid var(--primary-color) !important;
  padding: 8px 0 !important;
  margin: 0 !important;
  list-style: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(-12px) scale(0.95) !important;
  transform-origin: top center !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  z-index: 1001 !important;
  overflow: hidden !important;
}

/* Show submenu on hover - Smooth animation */
body #masthead .ast-builder-menu-1 .menu-item-has-children:hover>.sub-menu {
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1) !important;
}

/* Submenu items */
body #masthead .ast-builder-menu-1 .sub-menu .menu-item {
  margin: 0 !important;
  padding: 0 !important;
  position: relative !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

body #masthead .ast-builder-menu-1 .sub-menu .menu-item:last-child {
  border-bottom: none !important;
}

/* Submenu links - Enhanced hover */
body #masthead .ast-builder-menu-1 .sub-menu .menu-link {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 10px 16px !important;
  color: #333333 !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  transition: all 0.25s ease !important;
  white-space: nowrap !important;
  position: relative !important;
  background: transparent !important;
}

/* Add arrow icon di kanan submenu */
body #masthead .ast-builder-menu-1 .sub-menu .menu-link::after {
  content: "→" !important;
  font-size: 0.9em !important;
  opacity: 0 !important;
  transform: translateX(-8px) !important;
  transition: all 0.25s ease !important;
}

/* Hover effect submenu - Slide & gradient */
body #masthead .ast-builder-menu-1 .sub-menu .menu-link:hover {
  background: linear-gradient(90deg, rgba(38, 149, 154, 0.08) 0%, rgba(38, 149, 154, 0.15) 100%) !important;
  color: var(--primary-color) !important;
  padding-left: 20px !important;
  font-weight: 600 !important;
}

body #masthead .ast-builder-menu-1 .sub-menu .menu-link:hover::after {
  opacity: 1 !important;
  transform: translateX(0) !important;
}

/* Active submenu item */
body #masthead .ast-builder-menu-1 .sub-menu .current-menu-item .menu-link {
  background: rgba(38, 149, 154, 0.08) !important;
  color: var(--primary-color) !important;
  font-weight: 600 !important;
}

/* Submenu arrow icon - hide Astra default */
body #masthead .ast-builder-menu-1 .sub-menu .menu-link .ast-icon {
  display: none !important;
}

/* ========================================
   6. MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 992px) {
  body #masthead .ast-builder-menu-1 .main-header-menu {
    gap: 6px !important;
  }

  body #masthead .ast-builder-menu-1 .main-header-menu>.menu-item>.menu-link {
    padding: 6px 14px !important;
    font-size: 0.9rem !important;
  }

  /* Tablet - adjust dropdown */
  body #masthead .ast-builder-menu-1 .sub-menu {
    min-width: 160px !important;
    max-width: 200px !important;
  }

  body #masthead .ast-builder-menu-1 .sub-menu .menu-link {
    padding: 8px 14px !important;
    font-size: 0.85rem !important;
  }
}

@media (max-width: 768px) {

  /* Show mobile toggle button - badge style */
  body #masthead .ast-mobile-header-wrap .ast-button-wrap .menu-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: 2px solid var(--primary-color) !important;
    color: var(--primary-color) !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    font-weight: 600 !important;
  }

  body #masthead .ast-mobile-header-wrap .menu-toggle:hover,
  body #masthead .ast-mobile-header-wrap .menu-toggle[aria-expanded="true"] {
    background: var(--primary-color) !important;
    color: #ffffff !important;
  }

  /* Hide desktop menu di mobile */
  body #masthead .ast-desktop-header {
    display: none !important;
  }

  /* Mobile menu styles */
  body #masthead .ast-mobile-header-content .ast-builder-menu-mobile .main-header-menu {
    flex-direction: column !important;
    gap: 0 !important;
  }

  body #masthead .ast-mobile-header-content .main-header-menu .menu-item {
    width: 100% !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
  }

  body #masthead .ast-mobile-header-content .main-header-menu .menu-link {
    padding: 12px 16px !important;
    border-radius: 0 !important;
    font-size: 0.95rem !important;
  }

  body #masthead .ast-mobile-header-content .main-header-menu .menu-link:active,
  body #masthead .ast-mobile-header-content .main-header-menu .current-menu-item .menu-link {
    background: rgba(38, 149, 154, 0.1) !important;
    color: var(--primary-color) !important;
    font-weight: 600 !important;
  }

  /* Submenu mobile - Enhanced */
  body #masthead .ast-mobile-header-content .sub-menu {
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: linear-gradient(135deg, rgba(38, 149, 154, 0.08) 0%, rgba(38, 149, 154, 0.05) 100%) !important;
    border-left: 3px solid var(--primary-color) !important;
    padding: 8px 0 8px 20px !important;
    margin: 8px 0 !important;
  }

  /* Mobile submenu items */
  body #masthead .ast-mobile-header-content .sub-menu .menu-item {
    border-bottom: 1px solid rgba(38, 149, 154, 0.1) !important;
  }

  body #masthead .ast-mobile-header-content .sub-menu .menu-item:last-child {
    border-bottom: none !important;
  }

  body #masthead .ast-mobile-header-content .sub-menu .menu-link {
    padding: 10px 16px !important;
    font-size: 0.9rem !important;
  }

  body #masthead .ast-mobile-header-content .sub-menu .menu-link:hover,
  body #masthead .ast-mobile-header-content .sub-menu .current-menu-item .menu-link {
    background: rgba(38, 149, 154, 0.15) !important;
    color: var(--primary-color) !important;
    font-weight: 600 !important;
  }
}

/* ========================================
   7. RESET ASTRA DEFAULT STYLES
   ======================================== */

/* Force remove all Astra borders and shadows */
body #masthead,
body #masthead.site-header,
body .site-header,
body .main-header-bar-wrap,
body .ast-main-header-wrap,
body .main-header-bar,
body header[role="banner"] {
  box-shadow: none !important;
  -webkit-box-shadow: none !important;
  -moz-box-shadow: none !important;
  border: 0 !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
  border-left: 0 !important;
  border-right: 0 !important;
}

/* Remove Astra shadow/border defaults */
body #masthead .ast-builder-menu-1 .main-header-menu.ast-menu-shadow {
  box-shadow: none !important;
}

body #masthead .ast-builder-menu-1 .sub-menu.submenu-with-border {
  border: none !important;
}

/* Remove Astra default spacing */
body #masthead .ast-builder-menu-1 .menu-item .menu-link {
  margin: 0 !important;
}

/* Ensure no inline styles override */
body #masthead * {
  box-sizing: border-box !important;
}