/* Unified circular language selector */
.language-selector {
  display: flex;
  align-items: center;
  margin-left: 16px;
  z-index: 1000;
}

#header .container > .d-flex.align-items-center {
  gap: 18px;
  justify-content: flex-end;
  width: 100%;
}

.language-dropdown {
  position: relative;
}

.language-current {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(10px);
}

.language-current:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.language-current:focus {
  outline: 2px solid rgba(255,255,255,0.7);
  outline-offset: 2px;
}

.language-current-text,
.language-dropdown-arrow {
  display: none !important;
}

.language-current-flag {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

.language-options {
  position: absolute;
  top: 58px;
  right: 0;
  min-width: 220px;
  background: rgba(30, 67, 86, 0.95);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 25px 55px rgba(0,0,0,0.25);
  display: none;
  flex-direction: column;
  gap: 8px;
}

.language-dropdown.open .language-options {
  display: flex;
}

.language-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.language-option:hover,
.language-option.active {
  background: rgba(255,255,255,0.12);
}

.language-option-flag {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.language-option-text {
  font-size: 14px;
}

@media (max-width: 991px) {
  .language-selector {
    margin-left: 8px;
  }
  .language-options {
    min-width: 180px;
  }
}

@media (max-width: 767px) {
  .language-selector {
    position: absolute;
    top: 12px;
    right: 70px;
  }
  .language-options {
    right: 0;
    left: auto;
  }
}

@media (max-width: 575px) {
  #header .container {
    position: relative;
    gap: 8px;
  }

  #header .logo {
    min-width: 0;
  }

  #header .logo .site-logo {
    font-size: 20px;
    letter-spacing: 1.5px;
    white-space: nowrap;
  }

  #header .container > .d-flex.align-items-center {
    flex: 0 0 auto;
    width: auto;
    gap: 8px;
  }

  .language-current {
    width: 40px;
    height: 40px;
  }
  .language-options {
    min-width: 150px;
    padding: 10px;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
  }
}

.language-selector:focus-within .language-options {
  display: flex;
}

.language-selector .language-current,
.language-selector .language-option {
  border: none;
}


/* Ensure nav collapses beside language selector */
@media (max-width: 991px) {
  #header .d-flex.align-items-center {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }
  #header .language-selector {
    position: static;
    margin-left: 0;
  }
  #navbar:not(.navbar-mobile) ul {
    display: none;
  }
  #navbar.navbar-mobile ul {
    display: block;
    background: #fff;
    padding: 10px 0;
  }
  #navbar.navbar-mobile a,
  #navbar.navbar-mobile a:focus {
    color: #1e4356 !important;
  }
}
