/* =========================================
   Universal Global Header
========================================= */

.universal-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 5rem;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 30px rgba(0, 85, 255, 0.05);
}

/* Left: Logo */
.header-left .brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent, #0055ff);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* Right: Navigation */
.header-right .nav-list {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
  padding: 0.5rem 0;
}

.nav-item > a {
  color: var(--text-dark, #1e293b);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}

.nav-item > a:hover {
  color: var(--accent, #0055ff);
}

.dropdown-arrow {
  font-size: 0.7rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

/* Dropdown Menus */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(15px);
  background: rgba(255, 255, 255, 1);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 85, 255, 0.1);
  padding: 1rem;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 220px;
}

/* Mega-Menu for long lists (Convert & Generate) */
.dropdown-menu.mega-menu {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 1.5rem;
  min-width: 450px;
}

/* Add to your existing header.css */

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted, #475569);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.dropdown-menu a i {
  font-size: 1.1rem;
  color: var(--text-muted, #475569);
  transition: color 0.2s ease;
}

.dropdown-menu li:hover a,
.dropdown-menu li:hover a i {
  color: var(--accent, #0055ff);
}

/* Hover Logic */
.nav-item:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-item:hover .dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown Items */
.dropdown-menu li {
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  transition: background 0.2s;
}

.dropdown-menu li:hover {
  background: rgba(0, 85, 255, 0.05);
}

.dropdown-menu a {
  color: var(--text-muted, #475569);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  display: block;
  white-space: nowrap;
  transition: color 0.2s;
}

.dropdown-menu li:hover a {
  color: var(--accent, #0055ff);
}

/* Push main content down so it doesn't hide under the fixed header */
body {
  padding-top: 80px;
}

/* Mobile Responsiveness for Header */
@media (max-width: 992px) {
  .universal-header {
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
    position: relative; /* Change from fixed to relative to avoid blocking content */
  }

  /* Create a horizontal scrolling menu for mobile */
  .header-right {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  .nav-list {
    width: max-content; /* Forces items to stay inline */
    gap: 1.5rem;
  }

  /* Convert Mega-Menus to single columns on smaller screens */
  .dropdown-menu.mega-menu {
    grid-template-columns: 1fr;
    min-width: 250px;
  }
}

/* Mobile & Tablet Responsiveness for Header */
@media (max-width: 992px) {
  body {
    padding-top: 0;
  }
  /* 1. Fix the top gap and layout */
  .universal-header {
    position: relative;
    flex-direction: column;
    padding: 1.5rem 1rem;
    gap: 1.5rem;
    margin-top: 0; /* Adds spacing below the header */
  }

  .page-wrapper {
    padding-top: 2rem !important; /* Overrides the 100px desktop gap */
  }

  /* 2. Remove the slider and center all menu items */
  .header-right {
    width: 100%;
  }

  .nav-list {
    display: flex;
    flex-wrap: wrap; /* Allows menus to stack cleanly instead of sliding */
    justify-content: center;
    gap: 1rem 1.5rem;
    width: 100%;
  }

  /* 3. Fix hidden submenus with a modern full-width layout */
  .nav-item {
    position: static; /* Allows the dropdown to map to the whole screen width */
  }

  .dropdown-menu {
    top: 100%;
    left: 5%;
    width: 90%;
    transform: translateY(10px); /* Removes the desktop centering math */
    box-sizing: border-box;
  }

  .nav-item:hover .dropdown-menu {
    transform: translateY(0);
  }

  /* Mega-Menus will automatically split into 2 columns on tablet and 1 on phones */
  .dropdown-menu.mega-menu {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    min-width: 0;
  }
}
