/* assets/css/header.css */

/* Base resets required for the header */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    "Roboto",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Helvetica Neue",
    Arial,
    sans-serif;
  background-color: #e8e8e8;
  padding-top: 100px;
}

/* --- Header Structure --- */

.header-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  z-index: 1000;
}

.header {
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  position: relative;
  z-index: 1000;
}

.header-container {
  padding: 8px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo img {
  height: 56px;
  width: auto;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 35px;
  align-items: center;
}

.nav-item {
  position: relative;
}

.nav-link {
  text-decoration: none;
  color: #999;
  font-size: 15px;
  font-weight: 400;
  transition: color 0.3s ease;
  cursor: pointer;
  padding: 10px 0;
  padding-bottom: 8px;
  display: inline-block;
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #000;
  transition: width 0.3s ease;
}

.nav-link:hover {
  color: #000;
}

.nav-link:hover::after {
  width: 100%;
}

.nav-link.active {
  color: #000;
}

.nav-link.active::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.login-btn {
  background: none;
  border: none;
  color: #000;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  transition: opacity 0.3s ease;
}

.login-btn:hover {
  opacity: 0.7;
}

.login-icon {
  width: 18px;
  height: 18px;
}

.contact-btn {
  background-color: #1a1a2e;
  color: #ffffff;
  border: none;
  padding: 12px 28px;
  border-radius: 25px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.contact-btn:hover {
  background-color: #2d2d44;
}

/* ============================================
   MEGA MENU - FLEXBOX LAYOUT
   ============================================ */

.mega-menu-desktop {
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  right: 0;
  background-color: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  margin-top: 10px;
  z-index: 999;
  overflow: hidden;
}

#servicesMegaMenuDesktop {
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  right: 0;
}

#servicesMegaMenuDesktop:hover {
  opacity: 1;
  visibility: visible;
}

#loginMegaMenuDesktop {
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  right: 0;
}

#loginMegaMenuDesktop:hover {
  opacity: 1;
  visibility: visible;
}

/* FLEXBOX LAYOUT - No borders between columns */
.mega-menu-grid {
  display: flex;
  gap: 50px;
  padding: 45px 40px 45px 50px;
  align-items: flex-start;
}

/* Each column takes equal space */
.mega-menu-column {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
}

/* TITLE STYLING - With divider underneath and clickable links */
.mega-menu-column h3 {
  font-size: 16px;
  font-weight: 700;
  color: #000;
  font-family: "Roboto", sans-serif;
  line-height: 1.3;
  margin-bottom: 8px;
  padding-bottom: 10px;
  position: relative;
}

/* Short divider under title (60% width) */
.mega-menu-column h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1.5px;
  width: 60%;
  background-color: #e0e0e0;
  border-radius: 1px;
}

.mega-menu-column h3 a {
  text-decoration: none;
  color: #000;
  font-size: 16px;
  font-weight: 700;
  transition:
    color 0.3s ease,
    opacity 0.3s ease;
  display: block;
  font-family: "Roboto", sans-serif;
  line-height: 1.3;
}

.mega-menu-column h3 a:hover {
  color: #666;
  opacity: 0.8;
}

/* First section title spacing */
.mega-menu-column h3:first-child {
  margin-top: 0;
}

/* Second section title spacing - matches your image */
.mega-menu-column h3:not(:first-child) {
  margin-top: 45px;
}

/* Lists - tight spacing to match your design */
.mega-menu-column ul {
  list-style: none;
  margin: 0;
  padding: 0;
  margin-top: 8px;
}

.mega-menu-column li {
  margin-bottom: 11px;
  line-height: 1.4;
}

.mega-menu-column li:last-child {
  margin-bottom: 0;
}

/* Placeholder items: invisible but keep spacing */
.mega-menu-column .placeholder a {
  visibility: hidden;
}

.mega-menu-column a {
  text-decoration: none;
  color: #6b6b6b;
  font-size: 14px;
  font-weight: 400;
  transition: color 0.3s ease;
  display: block;
  line-height: 1.5;
}

.mega-menu-column a:hover {
  color: #000;
}

/* CTA Column - slightly wider, the handshake section */
.mega-menu-cta {
  flex: 1.3;
  min-width: 250px;
  background-color: #f5f5f5;
  padding: 30px 28px;
  border-radius: 0 12px 12px 0;
  margin: -45px -40px -45px 0;
  padding-top: 45px;
  padding-bottom: 45px;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  position: relative;
  overflow: visible; /* allow decorative icon to show at the edge */
}

/* Decorative icon placed bottom-right and allowed to overflow outside the CTA */
.mega-menu-cta::before {
  content: "";
  position: absolute;
  right: -24px; /* outside padding */
  bottom: -1px;
  width: 230px;
  height: 230px;
  background-image: url("../../assets/img/logo-icon.png");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  opacity: 1;
  z-index: 0;
  pointer-events: none;
  transform: translateZ(0);
}

/* Prevent clipping by allowing overflow on the mega menu container on desktop */
@media (min-width: 769px) {
  .mega-menu-desktop {
    overflow: visible;
  }
}

@media (max-width: 768px) {
  .mega-menu-cta::before {
    display: none;
  }
}

.mega-menu-cta-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 180px;
  opacity: 0.05;
  z-index: 1;
  pointer-events: none;
}

.mega-menu-cta > * {
  position: relative;
  z-index: 2;
}

.mega-menu-cta img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 18px;
  object-fit: cover;
}

.mega-menu-cta p {
  font-size: 13px;
  color: #6b6b6b;
  line-height: 1.65;
  margin-bottom: 18px;
  font-weight: 400;
}

.mega-menu-cta a {
  color: #000;
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.3s ease;
}

.mega-menu-cta a::after {
  content: none;
}

/* Arrow span: exclude it from text-decoration so it won't be underlined */
.mega-menu-cta a .arrow {
  text-decoration: none;
  display: inline-block;
  margin-left: 6px;
  font-weight: 600;
}

.mega-menu-cta a:hover {
  opacity: 0.7;
}

/* Login Section Styling */
.login-section {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
}

.login-section h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 10px;
  color: #000;
  font-family: "Roboto", sans-serif;
  line-height: 1.3;
  position: relative;
}

/* Short divider under login title (60% width) */
.login-section h4::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1.5px;
  width: 60%;
  background-color: #e0e0e0;
  border-radius: 1px;
}

.login-section h4 a {
  text-decoration: none;
  color: #000;
  font-size: 16px;
  font-weight: 700;
  transition:
    color 0.3s ease,
    opacity 0.3s ease;
  display: block;
  font-family: "Roboto", sans-serif;
  line-height: 1.3;
}

.login-section h4 a:hover {
  color: #666;
  opacity: 0.8;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.login-form label {
  font-size: 13px;
  color: #6b6b6b;
  margin-bottom: -8px;
  font-weight: 500;
}

.login-form input {
  padding: 11px 14px;
  border: 1px solid #d5d5d5;
  border-radius: 6px;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  transition: border-color 0.3s ease;
}

.login-form input:focus {
  outline: none;
  border-color: #999;
}

.login-item {
  position: relative;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: #000;
  position: relative;
  width: 40px;
  height: 40px;
  justify-content: center;
  align-items: center;
}

.mobile-menu-toggle svg {
  width: 24px;
  height: 24px;
  stroke: #000;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hamburger-icon,
.close-icon {
  transition: opacity 0.2s ease;
}

.mobile-menu-toggle .close-icon {
  display: none;
}

.mobile-menu-toggle.active .hamburger-icon {
  display: none;
}

.mobile-menu-toggle.active .close-icon {
  display: block;
}

/* Mobile mega menu containers - hidden on desktop */
.mobile-mega-menu-container {
  display: none;
}

/* Mobile menu actions - hidden on desktop */
.mobile-menu-actions {
  display: none;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media (max-width: 1200px) {
  .mega-menu-grid {
    gap: 35px;
    padding: 35px 30px;
  }

  .mega-menu-cta {
    margin: -35px -30px -35px 0;
    padding-top: 35px;
    padding-bottom: 35px;
  }
}

@media (max-width: 1024px) {
  .header-container {
    padding: 20px 30px;
  }

  .nav-menu {
    gap: 25px;
  }

  .mega-menu-grid {
    flex-wrap: wrap;
    padding: 30px;
    gap: 40px 30px;
  }

  .mega-menu-column,
  .login-section {
    flex: 1 1 calc(50% - 15px);
    min-width: 250px;
    padding: 0;
  }

  .mega-menu-cta {
    flex: 1 1 100%;
    border-radius: 0 0 12px 12px;
    margin: 20px -30px -30px -30px;
    padding: 30px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px;
    padding-top: 80px;
  }

  .header-wrapper {
    top: 10px;
    width: calc(100% - 20px);
  }

  .header-container {
    padding: 15px 20px;
  }

  .mobile-menu-toggle {
    display: flex;
  }

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

  #servicesMegaMenuDesktop,
  #loginMegaMenuDesktop {
    display: none !important;
  }

  .mobile-mega-menu-container {
    display: block;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background-color: transparent;
  }

  .mobile-mega-menu-container.active {
    max-height: 3000px;
  }

  .mobile-mega-menu-container .mega-menu-desktop {
    display: block !important;
    position: static;
    margin-top: 0;
    border-radius: 0;
    border: none;
    padding: 20px;
    box-shadow: none;
    opacity: 1 !important;
    visibility: visible !important;
    background-color: #f9f9f9;
    margin-left: -25px;
    margin-right: -25px;
    width: calc(100% + 50px);
  }

  .mega-menu-grid {
    flex-direction: column;
    gap: 25px;
    padding: 0;
  }

  .mega-menu-column,
  .login-section {
    flex: 1 1 auto;
    min-width: 100%;
    padding: 0;
    padding-bottom: 25px;
    border-bottom: 1px solid #e0e0e0;
  }

  .mega-menu-column:last-child,
  .login-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .mega-menu-column h3,
  .login-section h4 {
    font-size: 15px;
    margin-bottom: 6px;
    padding-bottom: 8px;
  }

  .mega-menu-column h3 a,
  .login-section h4 a {
    font-size: 15px;
    padding: 4px 0;
    display: block;
  }

  .mega-menu-column h3:not(:first-child) {
    margin-top: 20px;
  }

  .mega-menu-column ul {
    margin-top: 8px;
  }

  .mega-menu-column li {
    margin-bottom: 9px;
  }

  .mega-menu-column a {
    font-size: 14px;
    padding: 3px 0;
  }

  .mega-menu-cta {
    display: none !important;
  }

  .login-form {
    margin-top: 12px;
    gap: 12px;
  }

  .login-form input,
  .login-form button {
    padding: 12px;
    border-radius: 8px;
  }

  .nav-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background-color: #ffffff;
    flex-direction: column;
    padding: 30px 25px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: none;
    border-radius: 12px;
    gap: 0;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
  }

  .nav-menu.active {
    display: flex;
    animation: slideDown 0.3s ease;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-item {
    width: 100%;
  }

  .nav-link {
    color: #333;
    font-size: 17px;
    padding: 14px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
  }

  .nav-link:hover {
    color: #000;
  }

  .nav-link.active {
    color: #000;
  }

  .nav-link::after {
    width: 0 !important;
    height: 0 !important;
    background: none !important;
  }

  .nav-item.has-mega-menu > .nav-link::after {
    content: " ▼" !important;
    font-size: 10px;
    margin-left: 5px;
    background: none !important;
    width: auto !important;
    height: auto !important;
    position: static !important;
  }

  .nav-item.has-mega-menu.active > .nav-link::after {
    content: " ▲" !important;
  }

  .mobile-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    margin-top: 20px;
  }

  .mobile-menu-actions .login-btn {
    justify-content: center;
    padding: 15px;
    font-size: 15px;
    width: 100%;
    background-color: #ffffff;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.2s ease;
  }

  .mobile-menu-actions .login-btn:hover {
    background-color: #f8f8f8;
    opacity: 1;
    border-color: #d0d0d0;
  }

  .mobile-menu-actions .contact-btn {
    width: 100%;
    padding: 15px;
    font-size: 15px;
    border-radius: 10px;
  }
}
