/**
 * @file
 * Header component styles.
 */

/* Header sticky */
.header {
  position: -webkit-sticky; /* Safari */
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  width: 100%;
  overflow-x: hidden;
}

/* Header content layout */
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  width: 100%;
}

/* Logo container responsive */
.logo-container {
  display: flex;
  align-items: center;
  flex-shrink: 1;
  min-width: 0;
}

/* Mobile menu button - Hidden by default */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  padding: 5px;
  flex-shrink: 0;
  margin-left: auto;
}

.hamburger-line {
  display: block;
  width: 25px;
  height: 3px;
  background-color: #1e3a52;
  margin: 3px 0;
  transition: all 0.3s ease;
  border-radius: 2px;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

.mobile-menu-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 300px;
  height: 100vh;
  background-color: white;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
}

.mobile-menu-overlay.active .mobile-menu-content {
  transform: translateX(0);
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;
  background-color: #f8f9fa;
}

.mobile-logo img {
  max-height: 40px;
  width: auto;
}

.mobile-menu-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #1e3a52;
  cursor: pointer;
  padding: 5px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.mobile-menu-close:hover {
  background-color: #e9ecef;
}

.mobile-nav {
  padding: 20px 0;
}

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

.mobile-nav li {
  border-bottom: 1px solid #eee;
}

.mobile-nav a {
  display: block;
  padding: 15px 20px;
  color: #1e3a52;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.mobile-nav a:hover,
.mobile-nav a:focus {
  background-color: #f8f9fa;
  color: #376994;
}

/* Hamburger animation when active */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
  .mobile-menu-toggle {
    display: flex;
  }
  
  .desktop-nav {
    display: none !important;
  }
  
  .mobile-menu-content {
    width: 100%;
  }
  
  .header-content {
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
  }
  
  .logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 auto;
    min-width: 0;
  }
  
  .logo-container img {
    max-height: 30px;
    width: auto;
    flex-shrink: 1;
  }
  
  /* Ensure hamburger stays on the right */
  .mobile-menu-toggle {
    order: 2;
    margin-left: auto;
  }
  
  /* Ensure no horizontal overflow */
  .header {
    max-width: 100vw;
  }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .mobile-menu-toggle {
    display: flex;
  }
  
  .desktop-nav {
    display: none !important;
  }
  
  .mobile-menu-content {
    width: 320px;
  }
  
  .header-content {
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
  }
  
  .logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 1 auto;
    min-width: 0;
  }
  
  .logo-container img {
    max-height: 35px;
    width: auto;
    flex-shrink: 1;
  }
  
  /* Ensure hamburger stays on the right */
  .mobile-menu-toggle {
    order: 2;
    margin-left: auto;
  }
}

/* Medium devices and up - Hide mobile menu, show desktop nav */
@media (min-width: 768px) {
  .mobile-menu-toggle {
    display: none !important;
  }
  
  .mobile-menu-overlay {
    display: none !important;
  }
  
  .desktop-nav {
    display: block !important;
  }
  
  .header-content {
    justify-content: space-between;
    align-items: center;
  }
  
  .logo-container {
    display: flex;
    align-items: center;
    gap: 20px;
  }
}
