/* ==========================================================================
   EduHome Connect - Robust Sticky Header & Multi-Level Navigation Styles
   ========================================================================== */

.site-header,
#masthead,
header.site-header,
.ehf-header #masthead {
  position: sticky !important;
  top: 0 !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 99999 !important;
  background: #ffffff !important;
  box-shadow: 0 2px 16px rgba(6, 38, 84, 0.08) !important;
  transition: box-shadow 0.25s ease;
}

.site-header.is-scrolled,
#masthead.is-scrolled {
  box-shadow: 0 4px 20px rgba(6, 38, 84, 0.12) !important;
}

/* Hide Social Media Topbar completely after scrolling down */
.site-header.is-scrolled .header-topbar,
#masthead.is-scrolled .header-topbar {
  display: none !important;
}

/* Top Bar Styling - Shown at Top of Page */
.header-topbar {
  background: radial-gradient(at center center, #004AB5 0%, #062654 82%);
  color: #ffffff;
  padding: 8px 25px;
  font-size: 0.875rem;
  position: relative;
  z-index: 10;
}

.header-topbar-container {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-contact {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-contact a {
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.topbar-contact a:hover {
  color: #FCC902;
}

.topbar-social {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-social a {
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  text-decoration: none;
  transition: transform 0.2s ease, color 0.2s ease;
}

.topbar-social a svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  display: inline-block;
  vertical-align: middle;
}

.topbar-social a:hover {
  color: #FCC902;
  transform: translateY(-2px);
}

/* Main Navbar - Sticky on Scroll */
.header-main {
  position: sticky !important;
  top: 0 !important;
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(6, 38, 84, 0.06);
  box-shadow: 0 2px 12px rgba(6, 38, 84, 0.06);
  transition: box-shadow 0.25s ease, background 0.25s ease;
  z-index: 99999;
}

.site-header.is-scrolled .header-main {
  box-shadow: 0 4px 20px rgba(6, 38, 84, 0.12) !important;
}

.header-main-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 72px;
  transition: min-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-logo a {
  display: inline-block;
  vertical-align: middle;
}

.header-logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
  display: block;
  transition: height 0.3s ease;
}

/* Nav Menu Desktop */
.nav-menu-desktop {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu-desktop > li {
  position: relative;
}

.nav-menu-desktop > li > a {
  font-family: 'Raleway', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #062654;
  padding: 24px 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: color 0.2s ease, padding 0.3s ease;
}

.site-header.is-sticky .nav-menu-desktop > li > a,
#masthead.is-sticky .nav-menu-desktop > li > a {
  padding: 18px 4px;
}

.nav-menu-desktop > li > a:hover,
.nav-menu-desktop > li.active > a {
  color: #0059D9;
}

.nav-menu-desktop .dropdown-icon {
  font-size: 10px;
  transition: transform 0.25s ease;
}

.nav-menu-desktop > li:hover > a .dropdown-icon {
  transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   Desktop Submenu (Level 1)
   -------------------------------------------------------------------------- */
.nav-submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(6, 38, 84, 0.15);
  border-radius: 8px;
  padding: 8px 0;
  border: 1px solid #edf2f7;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  list-style: none;
  margin: 0;
}

.nav-menu-desktop > li:hover > .nav-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-submenu > li {
  position: relative;
  list-style: none;
}

.nav-submenu > li > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  font-family: 'Raleway', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #062654;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.nav-submenu > li > a:hover {
  background-color: #ebf3ff;
  color: #0059D9;
  padding-left: 22px;
}

.flyout-icon {
  font-size: 10px;
  color: #94a3b8;
  transition: transform 0.2s ease, color 0.2s ease;
}

.has-sub-submenu:hover > a .flyout-icon {
  color: #0059D9;
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   Desktop Flyout Submenu (Level 2)
   -------------------------------------------------------------------------- */
.nav-sub-submenu {
  position: absolute;
  top: 0;
  left: 100%;
  min-width: 230px;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(6, 38, 84, 0.15);
  border-radius: 8px;
  padding: 8px 0;
  border: 1px solid #edf2f7;
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1010;
  list-style: none;
  margin: 0;
}

.has-sub-submenu:hover > .nav-sub-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.nav-sub-submenu > li > a {
  display: block;
  padding: 9px 18px;
  font-family: 'Raleway', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #062654;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.nav-sub-submenu > li > a:hover {
  background-color: #ebf3ff;
  color: #0059D9;
  padding-left: 22px;
}

/* Header Action Buttons */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-login {
  background: #062654;
  color: #ffffff !important;
  font-family: 'Raleway', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(6, 38, 84, 0.2);
}

.btn-login:hover {
  background: #0059D9;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 89, 217, 0.3);
}

/* --------------------------------------------------------------------------
   Mobile Hamburger Button & Drawer Navigation
   -------------------------------------------------------------------------- */
.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #0059D9;
  color: #ffffff !important;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 89, 217, 0.3);
  transition: all 0.2s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-toggle:hover,
.mobile-nav-toggle:active {
  background: #062654;
  transform: scale(1.05);
}

/* Mobile Drawer Overlay */
.mobile-nav-drawer {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(6, 38, 84, 0.7) !important;
  backdrop-filter: blur(5px) !important;
  -webkit-backdrop-filter: blur(5px) !important;
  z-index: 99999999 !important;
  opacity: 0 !important;
  visibility: hidden !important;
  display: block !important;
  pointer-events: none !important;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s ease !important;
}

.mobile-nav-drawer.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Mobile Drawer Slide-out Panel */
.mobile-drawer-content {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  width: 320px !important;
  max-width: 85vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  background: #ffffff !important;
  box-shadow: -8px 0 35px rgba(0, 0, 0, 0.35) !important;
  padding: 24px 20px 40px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  transform: translateX(100%) !important;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  z-index: 100000000 !important;
  box-sizing: border-box !important;
}

.mobile-nav-drawer.active .mobile-drawer-content {
  transform: translateX(0) !important;
}

.mobile-drawer-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding-bottom: 14px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  margin-bottom: 16px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.mobile-drawer-header img {
  height: 36px !important;
  max-height: 36px !important;
  width: auto !important;
  max-width: 180px !important;
  object-fit: contain !important;
  display: block !important;
  flex-shrink: 0 !important;
}

.mobile-drawer-close {
  background: transparent !important;
  border: none !important;
  color: #062654 !important;
  cursor: pointer !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
}

.mobile-drawer-close i {
  font-size: 1.25rem !important;
  line-height: 1 !important;
  color: #062654 !important;
  transition: color 0.2s ease, transform 0.2s ease !important;
}

.mobile-drawer-close:hover,
.mobile-drawer-close:active,
.mobile-drawer-close:focus {
  background: #ebf3ff !important;
}

.mobile-drawer-close:hover i,
.mobile-drawer-close:active i {
  color: #0059D9 !important;
  transform: rotate(90deg) !important;
}

.mobile-nav-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 0 30px 0 !important;
}

.mobile-nav-list > li {
  border-bottom: 1px solid #f1f5f9 !important;
  list-style: none !important;
  margin: 0 0 2px 0 !important;
}

.mobile-nav-list > li > a,
.mobile-nav-list a {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 12px 10px !important;
  font-family: 'Raleway', sans-serif !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #062654 !important;
  text-decoration: none !important;
  border-radius: 8px !important;
  transition: background-color 0.2s ease, color 0.2s ease !important;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-list a:hover,
.mobile-nav-list a:active,
.mobile-nav-list a:focus {
  background-color: #ebf3ff !important;
  color: #0059D9 !important;
}

.mobile-dropdown-toggle {
  cursor: pointer !important;
  color: #062654 !important;
}

.mobile-dropdown-toggle i {
  font-size: 13px !important;
  color: #0059D9 !important;
  transition: transform 0.25s ease !important;
  pointer-events: none !important;
}

.mobile-dropdown-toggle.rotated i {
  transform: rotate(180deg) !important;
}

.mobile-submenu {
  display: none !important;
  list-style: none !important;
  margin: 4px 0 8px 10px !important;
  padding: 4px 0 4px 10px !important;
  border-left: 2px solid #0059D9 !important;
  background: #f8fafc !important;
  border-radius: 6px !important;
}

.mobile-submenu.open {
  display: block !important;
}

.mobile-submenu li {
  border: none !important;
  list-style: none !important;
  margin: 0 !important;
}

.mobile-submenu a {
  color: #1e293b !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  padding: 8px 10px !important;
}

.mobile-submenu a:hover {
  color: #0059D9 !important;
  background-color: #ebf3ff !important;
}

.mobile-sub-submenu {
  border-left-color: #FCC902 !important;
  margin-left: 10px !important;
  background: #f1f5f9 !important;
}

.mobile-sub-submenu a {
  color: #475569 !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
}

/* Responsive Rules */
@media (max-width: 1080px) {
  .desktop-navigation {
    display: none !important;
  }

  .mobile-nav-toggle {
    display: inline-flex !important;
  }

  .header-main .header-actions .btn-login {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .header-topbar {
    padding: 6px 14px !important;
    display: block !important;
  }

  .header-topbar-container {
    justify-content: center !important;
    gap: 8px !important;
  }

  .topbar-contact {
    display: none !important;
  }

  .topbar-social {
    gap: 16px !important;
    justify-content: center !important;
    width: 100% !important;
  }

  .topbar-social a {
    width: 26px !important;
    height: 26px !important;
  }

  .header-main-container {
    padding: 10px 18px !important;
    min-height: 78px !important;
  }

  .header-logo img {
    height: 54px !important;
    max-height: 54px !important;
  }

  .mobile-nav-toggle {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.35rem !important;
    border-radius: 10px !important;
  }
}

@media (max-width: 480px) {
  .header-topbar {
    padding: 10px 10px !important;
  }

  .topbar-social {
    gap: 14px !important;
  }

  .topbar-social a {
    width: 24px !important;
    height: 24px !important;
  }

  .topbar-social a svg,
  .topbar-social a i {
    width: 13px !important;
    height: 13px !important;
  }

  .header-main-container {
    padding: 8px 16px !important;
    min-height: 76px !important;
  }

  .header-logo img {
    height: 52px !important;
    max-height: 52px !important;
  }

  .mobile-nav-toggle {
    width: 42px !important;
    height: 42px !important;
  }
}
