/* ============================================
   Global Header Styles
   ============================================ */

/* Top Bar Styles */
.top-bar {
  background: linear-gradient(to bottom, #111827, #111827);
  color: white;
  padding: 0.75rem 0;
  position: relative;
  overflow: hidden;
}

.top-bar .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.top-bar .flex {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Top Bar Responsive Layout */
@media (min-width: 768px) {
  .top-bar .flex {
    flex-direction: row;
  }
  
  .top-bar .flex > div:first-child {
    flex-direction: row;
    gap: 2rem;
  }
}

@media (max-width: 767px) {
  .top-bar .flex {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .top-bar .flex > div:first-child {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }
  
  .top-bar .flex > div:last-child {
    width: 100%;
    justify-content: center;
  }
}

/* Top Bar Statistic Items */
.top-bar .group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-bar .group > div:first-child {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  backdrop-filter: blur(4px);
}

.top-bar .group span {
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

@media (min-width: 1024px) {
  .top-bar .group span {
    font-size: 1rem;
  }
}

.top-bar .group:hover span {
  color: inherit;
}

.top-bar .group:hover .text-green-400 {
  color: #4ade80;
}

.top-bar .group:hover .text-yellow-400 {
  color: #facc15;
}

.top-bar .group:hover .text-blue-400 {
  color: #60a5fa;
}

/* Top Bar CTA Button */
.top-bar a[href="what-we-do.html"] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(to right, #facc15, #2563eb);
  color: #581c87;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  text-decoration: none;
}

.top-bar a[href="what-we-do.html"]:hover {
  background: linear-gradient(to right, #2563eb, #facc15);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.top-bar a[href="what-we-do.html"] svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.3s;
}

.top-bar a[href="what-we-do.html"]:hover svg {
  transform: translateX(4px);
}

/* Main Header Styles */
header.bg-white {
  background-color: white;
  padding: 1rem 0;
  width: 100%;
  position: relative;
  z-index: 50;
}

@media (max-width: 768px) {
  header.bg-white {
    padding: 0.75rem 0;
  }
}

header.bg-white .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (max-width: 640px) {
  header.bg-white .container {
    padding: 0 0.75rem;
  }
}

/* Logo Box */
.header_logo_box {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: 51;
}

@media (max-width: 1023px) {
  .header_logo_box {
    flex: 1;
  }
}

.header_logo_box img {
  max-width: 160px;
  height: auto;
  display: block;
}

.header-logo-img {
  width: 160px;
  height: auto;
}

@media (max-width: 768px) {
  .header-logo-img {
    width: 120px;
  }
}

@media (max-width: 480px) {
  .header-logo-img {
    width: 100px;
  }
}

/* Mobile Menu Toggle Button */
.navbar-toggler {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 2px solid #e5e7eb;
  border-radius: 0.375rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  font-size: 1.5rem;
  color: #111827;
  transition: all 0.3s ease;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  pointer-events: auto !important;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  z-index: 100;
  position: relative;
}

.navbar-toggler:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
}

.navbar-toggler:active {
  transform: scale(0.95);
}

@media (min-width: 1024px) {
  .navbar-toggler {
    display: none;
  }
}

.navbar-toggler-icon {
  display: block;
  font-size: 1.5rem;
  line-height: 1;
  transition: transform 0.3s ease;
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
  transform: rotate(90deg);
}

/* Navigation Styles */
nav.relative {
  position: relative;
  width: 100%;
}

@media (min-width: 1024px) {
  nav.relative {
    width: auto;
  }
  
  /* Ensure desktop nav container is visible */
  nav.relative.hidden {
    display: none;
  }
  
  nav.relative[class*="lg:block"] {
    display: block !important;
  }
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

nav ul li {
  position: relative;
}

nav ul li a {
  color: #111827;
  font-size: 1.125rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  display: block;
  padding: 0.5rem 0;
}

nav ul li a:hover {
  text-decoration: underline;
}

/* ============================================
   MOBILE MENU STYLES - CRITICAL FIX
   ============================================ */

/* Mobile Navigation - DEFAULT HIDDEN STATE */
@media (max-width: 1023px) {
  #mobile-nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    padding: 1rem;
    padding-top: 5rem;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    display: block;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  }
  
  /* VISIBLE STATE - When .show-menu class is added */
  #mobile-nav-menu.show-menu {
    transform: translateX(0) !important;
    visibility: visible !important;
  }
  
  /* Close Button Wrapper */
  .mobile-menu-close-wrapper {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0;
    border-bottom: none;
    z-index: 10000;
    pointer-events: auto !important;
  }

  /* Close Button */
  .mobile-menu-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background-color: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
    z-index: 10001;
    position: relative;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .mobile-menu-close-btn:hover {
    background-color: #e5e7eb;
    border-color: #d1d5db;
    transform: scale(1.1);
  }

  .mobile-menu-close-btn:active {
    transform: scale(0.95);
  }

  .mobile-menu-close-icon {
    font-size: 1.5rem;
    color: #111827;
    font-weight: bold;
    line-height: 1;
    display: block;
  }

  /* Menu Items Styling */
  #mobile-nav-menu li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
  }
  
  #mobile-nav-menu li:first-child {
    padding: 0;
    border-bottom: none;
  }
  
  #mobile-nav-menu li:last-child {
    border-bottom: none;
  }
  
  #mobile-nav-menu li a {
    padding: 0.75rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 1.125rem;
  }
  
  #mobile-nav-menu li a:hover {
    background-color: #f9fafb;
    text-decoration: none;
  }
  
  /* Overlay when menu is open */
  body.mobile-menu-open {
    overflow: hidden;
  }
}

/* Desktop Navigation - Always Visible */
@media (min-width: 1024px) {
  /* Hide mobile menu on desktop */
  #mobile-nav-menu {
    display: none !important;
  }
  
  /* Show desktop navigation container - Override Tailwind hidden class with multiple selectors */
  nav.relative.hidden[class*="lg:block"],
  nav.relative[class*="lg:block"],
  header nav.relative.hidden,
  header > div > nav.relative,
  .container nav.relative.hidden {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
  }
  
  /* Show desktop nav menu */
  #desktop-nav-menu {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
  }
  
  #desktop-nav-menu li {
    position: relative;
  }
  
  #desktop-nav-menu li a {
    color: #111827;
    font-size: 1.125rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    display: block;
    padding: 0.5rem 0;
    white-space: nowrap;
  }
  
  #desktop-nav-menu li a:hover {
    text-decoration: underline;
  }
  
  /* Desktop dropdown positioning */
  #desktop-nav-menu .dropdown-menu {
    right: 0;
    left: auto;
  }
}

/* Hide desktop nav on mobile */
@media (max-width: 1023px) {
  /* Hide desktop navigation container */
  nav.relative.hidden.lg\:block,
  nav.relative[class*="lg:block"] {
    display: none !important;
  }
  
  #desktop-nav-menu {
    display: none !important;
  }
  
  /* Ensure close button is visible on mobile */
  .mobile-menu-close-wrapper {
    display: block;
  }
}

/* Hide close button on desktop */
@media (min-width: 1024px) {
  .mobile-menu-close-wrapper {
    display: none !important;
  }
}

/* Dropdown Menu Styles */
.dropdown-menu {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 0.75rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  width: 1200px;
  max-width: 90vw;
  z-index: 50;
  display: none;
}

@media (max-width: 1024px) {
  #mobile-nav-menu .dropdown-menu {
    position: relative;
    left: auto;
    right: auto;
    width: 100%;
    max-width: 100%;
    margin-top: 0.5rem;
    margin-left: 0;
  }
  
  #mobile-nav-menu .dropdown-menu .grid {
    grid-template-columns: 1fr;
  }
}

.dropdown-menu.hidden {
  display: none;
}

.dropdown-menu:not(.hidden) {
  display: block;
}

/* Dropdown Header */
.dropdown-menu > div:first-child {
  background: linear-gradient(to right, #2563eb, #9333ea, #4f46e5);
  padding: 1rem;
  color: white;
}

.dropdown-menu > div:first-child h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.dropdown-menu > div:first-child p {
  color: #bfdbfe;
  font-size: 0.875rem;
}

/* Dropdown Content */
.dropdown-menu > div:last-child {
  padding: 1.5rem;
}

.dropdown-menu .grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .dropdown-menu .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .dropdown-menu .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Dropdown Category Items */
.dropdown-menu .group {
  margin-bottom: 0;
}

.dropdown-menu .group > div:first-child {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: linear-gradient(to right, #eff6ff, #eef2ff);
  border-radius: 0.5rem;
  border: 1px solid #dbeafe;
}

.dropdown-menu .group > div:first-child > div:first-child {
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(to right, #3b82f6, #4f46e5);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.dropdown-menu .group > div:first-child h4 {
  font-weight: 700;
  color: #111827;
  font-size: 1rem;
}

/* Dropdown Links */
.dropdown-menu .space-y-0\.5 {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.dropdown-menu .space-y-0\.5 a {
  display: block;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  color: #374151;
  text-decoration: none;
  border-radius: 0.25rem;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-menu .space-y-0\.5 a:hover {
  color: #2563eb;
  background-color: #eff6ff;
}

/* Dropdown Footer */
.dropdown-menu > div:last-child > div:last-child {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dropdown-menu > div:last-child > div:last-child > div:first-child {
  font-size: 0.75rem;
  color: #6b7280;
}

.dropdown-menu > div:last-child > div:last-child a {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 1rem;
  background: linear-gradient(to right, #2563eb, #9333ea);
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 0.5rem;
  text-decoration: none;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

.dropdown-menu > div:last-child > div:last-child a:hover {
  background: linear-gradient(to right, #1d4ed8, #7e22ce);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.dropdown-menu > div:last-child > div:last-child a svg {
  width: 0.75rem;
  height: 0.75rem;
  margin-left: 0.375rem;
  transition: transform 0.3s;
}

.dropdown-menu > div:last-child > div:last-child a:hover svg {
  transform: translateX(4px);
}

/* Category-specific colors */
.dropdown-menu .group:nth-child(2) > div:first-child {
  background: linear-gradient(to right, #f0fdf4, #ecfdf5);
  border-color: #bbf7d0;
}

.dropdown-menu .group:nth-child(2) > div:first-child > div:first-child {
  background: linear-gradient(to right, #22c55e, #10b981);
}

.dropdown-menu .group:nth-child(2) .space-y-0\.5 a:hover {
  color: #16a34a;
  background-color: #f0fdf4;
}

.dropdown-menu .group:nth-child(3) > div:first-child {
  background: linear-gradient(to right, #faf5ff, #f5f3ff);
  border-color: #e9d5ff;
}

.dropdown-menu .group:nth-child(3) > div:first-child > div:first-child {
  background: linear-gradient(to right, #a855f7, #8b5cf6);
}

.dropdown-menu .group:nth-child(3) .space-y-0\.5 a:hover {
  color: #9333ea;
  background-color: #faf5ff;
}

.dropdown-menu .group:nth-child(4) > div:first-child {
  background: linear-gradient(to right, #fff7ed, #fff1f2);
  border-color: #fed7aa;
}

.dropdown-menu .group:nth-child(4) > div:first-child > div:first-child {
  background: linear-gradient(to right, #f97316, #ef4444);
}

.dropdown-menu .group:nth-child(4) .space-y-0\.5 a:hover {
  color: #ea580c;
  background-color: #fff7ed;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.2s ease-out;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Override .hidden class for desktop navigation on large screens */
@media (min-width: 1024px) {
  /* Target the desktop nav specifically - multiple selector strategies */
  nav.relative.hidden[class*="lg:block"],
  nav.relative.hidden.lg\:block,
  header .container > div > nav.relative.hidden,
  header nav.relative:has(#desktop-nav-menu) {
    display: block !important;
    visibility: visible !important;
  }
  
  /* Ensure the nav container takes up space */
  header .container > div {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
}

/* Responsive adjustments for very small screens */
@media (max-width: 480px) {
  .top-bar .group span {
    font-size: 0.75rem;
  }
  
  .header_logo_box img,
  .header-logo-img {
    max-width: 100px;
    width: 100px;
  }
  
  .dropdown-menu {
    max-width: 100%;
    left: 0;
    right: 0;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
  
  nav ul li a {
    font-size: 1rem;
  }
  
  header.bg-white {
    padding: 0.75rem 0;
  }
}

/* Ensure header doesn't overlap content */
header.bg-white.sticky {
  position: sticky;
  top: 0;
  z-index: 50;
}
