/* ==========================================================================
   WEB PARTNER SOLUTIONS - HEADER STYLESHEET
   Navbar, Logo, Navigation Links, Mega Dropdown, Mobile Drawer & Overlay
   ========================================================================== */

/* --- Header / Navigation Bar --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 1000;
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 194, 203, 0.14);
  box-shadow: 0 4px 20px -4px rgba(0, 180, 216, 0.08);
  transition: var(--transition-smooth);
}

.header.scrolled {
  background: #ffffff;
  border-bottom: 1px solid var(--card-border);
  height: 70px;
  box-shadow: 0 8px 30px -10px rgba(0, 194, 203, 0.14);
}

body.dark-theme .header {
  background: #ffffff;
  border-bottom-color: rgba(0, 194, 203, 0.16);
}

body.dark-theme .header.scrolled {
  background: #ffffff;
  box-shadow: 0 8px 30px -10px rgba(0, 194, 203, 0.14);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  position: relative;
}

/* --- Brand Logo --- */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.5px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.logo-text span:first-child {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 800;
}

.logo-text span:last-child {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
}

/* --- Navigation Links --- */
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.mobile-nav-header,
.mobile-nav-cta,
.nav-icon {
  display: none;
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-secondary);
  position: relative;
  padding: 8px 0;
  display: inline-flex;
  align-items: center;
}

.nav-link:hover {
  color: var(--color-primary-dark);
}

.nav-link.active {
  color: var(--color-primary-dark);
  font-weight: 600;
}

body.dark-theme .nav-link:hover,
body.dark-theme .nav-link.active {
  color: var(--color-accent);
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2.5px;
  background: var(--gradient-primary);
  border-radius: 4px;
  transition: var(--transition-smooth);
}

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

/* --- Navigation Item Dropdown --- */
.nav-item-dropdown {
  position: static;
  display: inline-flex;
  align-items: center;
}

.dropdown-arrow {
  font-size: 0.72rem;
  margin-left: 6px;
  transition: transform 0.3s ease;
}

.nav-item-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
  color: var(--color-primary-dark);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  width: 960px;
  max-width: min(960px, calc(100vw - 32px));
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 20px 50px -10px rgba(0, 180, 216, 0.15);
  padding: 24px 28px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  z-index: 1200;
}

.dropdown-menu.dropdown-menu-wide {
  width: 1200px;
  max-width: min(1200px, calc(100vw - 32px));
}

.dropdown-menu.dropdown-menu-products {
  width: 1000px;
  max-width: min(1000px, calc(100vw - 32px));
}

body.dark-theme .dropdown-menu {
  background: #ffffff;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.25);
}

.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -16px;
  left: 0;
  width: 100%;
  height: 16px;
}

.nav-item-dropdown:hover .dropdown-menu,
.nav-item-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.dropdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.dropdown-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.dropdown-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.dropdown-column {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dropdown-cat-title {
  font-family: "Poppins", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--card-border);
  display: block;
}

body.dark-theme .dropdown-cat-title {
  color: var(--color-primary-dark);
}

.dropdown-item {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 6px 8px;
  border-radius: var(--border-radius-sm);
  transition: color 0.2s ease;
  display: block;
  line-height: 1.35;
  background: transparent !important;
  border-left: none !important;
  text-decoration: none;
}

.dropdown-item:hover {
  background: transparent !important;
  color: #00c2cb !important;
  border-left: none !important;
  padding-left: 8px !important;
}

body.dark-theme .dropdown-item:hover {
  background: transparent !important;
  color: #00c2cb !important;
  border-left: none !important;
  padding-left: 8px !important;
}

.dropdown-item-action {
  font-weight: 600;
  color: #00828a !important;
}

.dropdown-item-action:hover {
  color: #00c2cb !important;
}

/* Expert Consultation Card in Column 5 of Mega Dropdown */
.dropdown-expert-card {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f0fdfa;
  border: 1px solid rgba(0, 194, 203, 0.28);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
}

.expert-card-text {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 500;
  line-height: 1.3;
}

.expert-card-cta {
  font-size: 0.82rem;
  font-weight: 700;
  color: #00828a;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.expert-card-cta:hover {
  color: #00c2cb !important;
  transform: translateX(3px);
}

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

.header .btn-quote {
  padding: 10px 24px;
  font-size: 0.92rem;
  border-radius: var(--border-radius-pill);
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
  transition: var(--transition-smooth);
}

.theme-toggle:hover {
  color: var(--color-primary-dark);
  border-color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.08);
}

.theme-toggle .sun-icon {
  display: none;
}

body.dark-theme .theme-toggle .moon-icon {
  display: none;
}

body.dark-theme .theme-toggle .sun-icon {
  display: block;
}

/* Mobile Menu Toggle Button */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  z-index: 1001;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 2.5px;
  background: var(--text-primary);
  border-radius: 4px;
  transition: var(--transition-smooth);
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(8.5px) rotate(45deg);
}
.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
  transform: translateY(-8.5px) rotate(-45deg);
}

/* --- Mobile Navigation Overlay & Drawer --- */
body.menu-open {
  overflow: hidden !important;
}

.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(12, 20, 39, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* --- Responsive Header Styles --- */
@media (max-width: 991px) {
  :root {
    --header-height: 70px;
  }

  .header .btn-quote {
    display: none !important;
  }

  .menu-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 340px;
    max-width: 88vw;
    height: 100vh;
    background: #ffffff;
    border-left: 1px solid var(--card-border);
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 30px 20px;
    gap: 10px;
    transition: var(--transition-smooth);
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.12);
  }

  body.dark-theme .nav-links {
    background: #ffffff;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
  }

  .nav-links.active {
    right: 0;
  }

  .mobile-nav-header {
    display: block;
    width: 100%;
    padding-bottom: 14px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--card-border);
  }

  .mobile-nav-cta {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--card-border);
  }

  .nav-links .nav-link {
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    padding: 10px 6px;
    display: flex;
    align-items: center;
    color: var(--text-primary);
  }

  .nav-item-dropdown {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-item-dropdown .nav-link {
    width: 100%;
    justify-content: space-between;
    cursor: pointer;
  }

  .nav-item-dropdown .dropdown-arrow {
    transition: transform 0.3s ease;
  }

  .nav-item-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
    color: #00c2cb;
  }

  .dropdown-menu,
  .dropdown-menu.dropdown-menu-wide,
  .dropdown-menu.dropdown-menu-products {
    position: static;
    transform: none !important;
    width: 100%;
    max-width: 100%;
    box-shadow: none;
    border: 1px solid rgba(0, 194, 203, 0.15);
    background: #f8fcfe;
    border-radius: 12px;
    padding: 14px 12px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    display: none;
    margin-top: 4px;
    box-sizing: border-box;
  }

  .nav-item-dropdown.active .dropdown-menu {
    display: block;
    animation: fadeInSlideDown 0.25s ease forwards;
  }

  .dropdown-grid,
  .dropdown-grid-4,
  .dropdown-grid-5 {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .dropdown-column {
    gap: 3px;
  }

  .dropdown-cat-title {
    font-size: 0.78rem;
    padding-bottom: 4px;
    margin-bottom: 6px;
    color: #009ca6;
  }

  .dropdown-item {
    font-size: 0.84rem;
    padding: 6px 6px;
  }
}

@media (max-width: 480px) {
  .logo {
    gap: 8px;
  }
  .logo-text span:first-child {
    font-size: 0.98rem;
  }
  .logo-text span:last-child {
    font-size: 0.78rem;
    letter-spacing: 1px;
  }
  .menu-toggle {
    width: 44px;
    height: 44px;
  }
}

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