/* Bootstrap Reset for Header */
#header {
  margin: 0 !important;
  padding: 0 !important;
  min-height: 60px;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Prevent FOUC (Flash of Unstyled Content) */
#header:empty {
  opacity: 0;
}

.masthead .logo img {
  max-width: 280px !important;
  height: auto !important;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

/* Responsive Header Styles */
.masthead {
  background-color: rgba(0,0,0,0.85);
  padding: 5px 30px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  /* Make header sticky at the top of the viewport */
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  backdrop-filter: blur(6px) saturate(110%);
  -webkit-backdrop-filter: blur(6px) saturate(110%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  margin: 0 !important;
  z-index: 1100; /* stay above most page content */
  max-width: 100vw;
  width: 100%;
  box-sizing: border-box;
}

.masthead .logo {
  flex-shrink: 0;
}

.masthead .logo img {
  max-width: 280px;
  height: auto;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  vertical-align: middle;
  filter: brightness(1);
}

.masthead .logo:hover img {
  filter: brightness(1.1);
  transform: scale(1.02);
}

.masthead-border {
  width: 100%;
  height: 2px;
  background-color: #000;
  clear: both;
  margin: 0 !important;
  padding: 0 !important;
}

/* Desktop layout */
.masthead-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.navigation {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navigation a {
  color: white;
  text-align: center;
  padding: 12px 20px;
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  border-radius: 25px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.navigation a:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.navigation a:active {
  transform: translateY(0);
}

/* Logged in state styling */
#loginLink[style*="color: rgb(59, 165, 93)"],
#loginLink[style*="color:#3ba55d"] {
  background-color: rgba(59, 165, 93, 0.2);
  border: 1px solid rgba(59, 165, 93, 0.5);
}

#loginLink[style*="color: rgb(59, 165, 93)"]:hover,
#loginLink[style*="color:#3ba55d"]:hover {
  background-color: rgba(59, 165, 93, 0.3);
  border: 1px solid rgba(59, 165, 93, 0.7);
}

/* Hamburger Menu */
.hamburger-menu {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  z-index: 1002;
  transition: all 0.3s ease;
}

.hamburger-menu span {
  width: 25px;
  height: 3px;
  background: white;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger-menu:hover span {
  background: rgba(255, 255, 255, 0.8);
}

.hamburger-menu.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

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

.hamburger-menu.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Responsive Breakpoint */
@media screen and (max-width: 1000px) {
  .masthead {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
    max-width: 100vw;
    width: 100%;
    box-sizing: border-box;
  }
  
  .masthead-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0;
    box-sizing: border-box;
  }
  
  .masthead .logo {
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
  }
  
  .masthead .logo img {
    max-width: min(240px, 60vw);
    width: 100%;
    height: auto;
  }
  
  .hamburger-menu {
    display: flex;
  }
  
  .navigation {
    flex-direction: column;
    width: 100%;
    gap: 8px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
    margin-top: 0;
  }
  
  .navigation.active {
    max-height: 400px;
    margin-top: 15px;
  }
  
  .navigation a {
    display: block;
    text-align: center;
    margin: 0 auto;
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 25px;
    max-width: 200px;
    opacity: 1;
  }
  
  .language-selector {
    position: relative;
    margin-left: 0;
    z-index: 1001;
  }
}

/* Language Selector Styles */
.language-selector {
  position: relative;
  z-index: 1001;
}

.dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  color: white;
  border-radius: 25px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.dropdown-toggle:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.dropdown-toggle:active {
  transform: translateY(0);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background-color: #2b2d31;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  list-style: none;
  padding: 8px;
  margin: 0;
  min-width: 150px;
  max-width: 180px;
  width: max-content;
}

.dropdown-menu li {
  margin: 0;
  padding: 0;
}

.dropdown-menu li a {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  box-sizing: border-box;
  text-decoration: none !important;
  color: #ffffff !important;
  border-radius: 6px;
  white-space: nowrap;
  float: none !important;
  margin: 2px 0 !important;
  width: 100%;
  font-size: 15px;
  transition: background-color 0.2s;
}

.dropdown-menu li a img {
  margin-right: 10px;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.dropdown-menu li a:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

/* When script shows the menu (inline style), we still want the animated appearance */
.dropdown-menu[style*="display: block"] {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}

/* Mobile dropdown adjustments */
@media screen and (max-width: 1000px) {
  .dropdown-menu {
    right: 0;
    left: auto;
    min-width: 140px;
  }
  
  .dropdown-menu li a {
    padding: 10px 12px;
    font-size: 15px;
  }
}