/* === Custom Header - Improved Layout + Mega Menu Fix === */

/* Header Base */
.smart-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: transparent;
  z-index: 9999;
  transition: background .35s ease, box-shadow .35s ease, transform .35s ease;
}

.container-inner {
  width: 100%;
  margin: 0;
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
}

/* ====== Layout ====== */
.header-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.main-nav {
  flex: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.header-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* ====== Logo Styles ====== */
.header-left .logo-link img {
  width: 80px;  /* Logo size for desktop */
  height: auto;
  object-fit: contain;
}

/* ====== Nav Menu ====== */
.primary-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 32px;
  margin: 0;
  padding: 0;
}

.primary-menu li {
  position: relative;
}

.primary-menu li a {
  text-decoration: none;
  color: #ffffff;
  font-weight: 600;
  font-size: 16px;
  transition: color .3s ease;
}

/* Mega menu / dropdown fix */
.primary-menu li ul,
.primary-menu li .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #ffffff;
  min-width: 260px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: opacity .3s ease, transform .3s ease;
  z-index: 99999;
  padding: 14px 0;
}

.primary-menu li:hover > ul,
.primary-menu li:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.primary-menu li ul li a {
  display: block;
  padding: 10px 20px;
  color: #000;
  text-align: left;
  font-weight: 500;
  transition: background .2s ease;
}

.primary-menu li ul li a:hover {
  background: #f5f5f5;
  color: #144062;
}

/* ====== Button ====== */
.header-btn {
  border: 2px solid #ffffff;
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 6px;
  font-weight: 600;
  background: transparent;
  transition: all .3s ease;
}

.header-btn:hover {
  background: #144062;
  border-color: #144062;
  color: #ffffff;
}

/* ====== Sticky and Hover ====== */
.smart-header.sticky,
.smart-header:hover {
  background: #ffffff !important;
  box-shadow: 0 4px 30px rgba(0,0,0,0.1);
}

.smart-header.sticky .primary-menu li a,
.smart-header:hover .primary-menu li a {
  color: #000000 !important;
}

.smart-header.sticky .header-btn,
.smart-header:hover .header-btn {
  background: #144062 !important;
  border-color: #144062 !important;
  color: #ffffff !important;
}

/* ====== Mini Logo ====== */
.mini-logo {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 80px;
  height: 80px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 100000;
}

.mini-logo img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.mini-logo.show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* ====== Hide header on scroll down ====== */
.smart-header.hidden {
  transform: translateY(-120%);
  opacity: 0;
  pointer-events: none;
}

/* Keep mega menu visible even if header is fixed */
.smart-header,
.primary-menu,
.primary-menu li,
.primary-menu li ul {
  overflow: visible !important;
  z-index: 9999;
}

/* ====== Responsive ====== */
@media (max-width: 1024px) {
  .smart-header {
    background: #ffffff; /* Background white on mobile/tablet */
  }

  .container-inner {
    padding: 12px 20px;
  }

  /* Hide navigation on smaller devices */
  .main-nav {
    display: none; /* Will be handled by JS for the hamburger menu */
  }

  /* Show hamburger menu on mobile/tablet */
  .hamburger-menu {
    display: block;
    cursor: pointer;
    font-size: 28px;
    color: #000000; /* Black hamburger menu */
  }

  .header-btn {
    display: none; /* Hide on mobile */
  }

  .mini-logo {
    width: 64px;
    height: 64px;
    top: 14px;
    left: 14px;
  }

  .mini-logo img {
    width: 48px;
    height: 48px;
  }

  /* Logo on mobile/tablet */
  .header-left .logo-link img {
    width: 70px;
    height: 70px;
  }

  /* When hamburger is clicked, display menu like a submenu */
  .main-nav.open {
    display: block;
    background-color: #ffffff; /* White background */
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  }

  .primary-menu {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .primary-menu li {
    width: 100%;
  }

  .primary-menu li a {
    padding: 10px 20px;
    text-align: left;
    font-size: 18px;
  }
}

@media (min-width: 1024px) {
  .hamburger-menu {
    display: none;
  }
}
