/**
 * TourAdviser - Language Switcher Styles
 */

.language-switcher {
  position: relative;
  display: inline-block;
  margin-left: 1.5rem;
  padding-left: 1.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 9001; /* Higher z-index to ensure it's above other elements */
}

.language-current {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  color: #222;
  background: none;
  border: none;
  box-shadow: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s, outline-color 0.2s;
  user-select: none;
  gap: 6px;
}

.language-current:focus-visible {
  outline: 2px solid #1e6bb8;
  outline-offset: 2px;
  border-radius: 6px;
}

.language-current:hover {
  color: #0056b3; /* Subtle highlight on hover, match link hover */
  background: none;
  border: none;
}

.language-current .arrow-down {
  border: solid #fff;
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 2px;
  margin-left: 5px;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.language-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  min-width: 120px;
  background-color: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: none;
  z-index: 9002;
  list-style: none;
  padding: 4px;
  margin: 0;
}

.language-switcher.active .language-dropdown {
  display: block;
  animation: fadeIn 0.2s ease; /* Add animation for better UX */
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.language-switcher.active .arrow-down {
  transform: rotate(-135deg);
}

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

.language-current #currentLanguageCode {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: inherit;
  background: none;
  padding: 0;
  border-radius: 0;
  margin-right: 0.5em;
  display: inline-block;
}

.language-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.6rem 0.8rem;
  color: #222;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  gap: 8px;
}

.language-flag {
  width: 16px;
  height: 12px;
  border-radius: 2px;
  object-fit: cover;
  flex-shrink: 0;
}

.language-name {
  flex: 1;
}

.language-code {
  font-size: 0.8rem;
  opacity: 0.7;
  font-weight: 600;
}

.language-option:hover {
  background-color: #f5f5f5;
  color: #0056b3;
}

.language-option.active {
  background-color: #e6f7ff;
  font-weight: 600;
  color: #0056b3;
}

/* Mobile Adjustments */
@media (max-width: 991px) {
  .language-switcher {
    margin: 1rem auto 0;
    padding: 1rem 0 0;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    display: block;
  }
  
  .language-current {
    display: inline-flex;
    justify-content: center;
    margin: 0 auto;
  }
  
  .language-dropdown {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
  
  .language-switcher.active .language-dropdown {
    transform: translateX(-50%);
    animation: fadeInMobile 0.2s ease;
  }
  
  @keyframes fadeInMobile {
    from { opacity: 0; transform: translateX(-50%) translateY(-5px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
  }
}

/* RTL Support for future languages */
html[dir="rtl"] .language-switcher {
  margin-right: 1.5rem;
  margin-left: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  border-left: none;
  padding-right: 1.5rem;
  padding-left: 0;
}

html[dir="rtl"] .language-current .arrow-down {
  margin-right: 5px;
  margin-left: 0;
} 