/* css/header.css */

/* 1. CSS Variables for Brand Colors */
:root {
  --d3f-blue: #0D407F;   /* Main brand blue */
  --d3f-green: #2C9A3D;  /* Green from the D3F logo */
}

/* Reset & Basic Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
}

/* Container */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* 2. Preloader Styles */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}
#preloader.hidden {
  opacity: 0;
  visibility: hidden;
}
.spinner {
  border: 8px solid #f3f3f3;
  border-top: 8px solid var(--d3f-blue);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 3. Header & Logo / Brand Text */
header {
  background-color: var(--d3f-blue);
  color: #fff;
}
.header-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;  /* Spacing between image and brand text */
}
.logo-img {
  width: 50px;
  height: auto;
}
.brand-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--d3f-green);
}

/* 4. Navigation & Menu Items */
.nav {
  position: relative;
}
.nav-menu {
  list-style: none;
  display: flex;
  gap: 20px;
  align-items: center;
}
.nav-item a {
  text-decoration: none;
  color: var(--d3f-green);
  font-weight: bold;
  padding: 8px 12px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Hover/Active States */
.nav-item a:hover,
.nav-item.active > a {
  background-color: rgba(255, 255, 255, 0.2);  /* Slight highlight on hover */
  color: #fff;
  border-radius: 4px;
}

/* 5. Dropdown Menu */
.nav-item.dropdown {
  position: relative;
}
.nav-item.dropdown .arrow {
  margin-left: 5px;
  font-size: 0.7em;
}
.dropdown-menu {
  display: none;
  position: absolute;
  background-color: var(--d3f-blue);
  list-style: none;
  top: 100%;
  left: 0;
  min-width: 180px;
  border-radius: 0 0 4px 4px;
  z-index: 100;
}
.dropdown-menu li a {
  display: block;
  padding: 10px 15px;
  color: var(--d3f-green);
  font-weight: normal;
}
.dropdown-menu li a:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Show dropdown on hover for desktops */
.nav-item.dropdown:hover > .dropdown-menu {
  display: block;
}

/* 6. Mobile Menu Toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
}
.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  background-color: #fff;
  height: 3px;
  width: 25px;
  border-radius: 3px;
  position: relative;
  transition: all 0.3s ease;
}
.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
}
.hamburger::before {
  top: -8px;
}
.hamburger::after {
  top: 8px;
}
/* Toggle animation for mobile menu button when open */
.menu-toggle.open .hamburger {
  background-color: transparent;
}
.menu-toggle.open .hamburger::before {
  transform: translateY(8px) rotate(45deg);
}
.menu-toggle.open .hamburger::after {
  transform: translateY(-8px) rotate(-45deg);
}

/* 7. Mobile Responsiveness */
@media (max-width: 768px) {
  /* Mobile menu becomes overlay style, hidden by default */
  .nav-menu {
    display: none;
    flex-direction: column;
    background-color: var(--d3f-blue);
    position: absolute;
    top: 60px; /* Adjust as needed */
    right: 10px;
    width: 220px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  }
  .nav-menu.open {
    display: flex;
  }
  .nav-menu li {
    width: 100%;
    text-align: right;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  .nav-menu li:last-child {
    border-bottom: none;
  }
  
  /* Mobile dropdown: tap to open submenu */
  .nav-item.dropdown .dropdown-menu {
    position: static;
    display: none;
    flex-direction: column;
    width: 100%;
    border: none;
    box-shadow: none;
  }
  .nav-item.dropdown.open > .dropdown-menu {
    display: flex;
  }
  .nav-item.dropdown .arrow {
    float: right;
  }
  
  /* Show mobile toggle button */
  .menu-toggle {
    display: inline-block;
  }
}
