/* Language Switcher Core Component Styles */

.language-switcher {
  position: relative;
  display: inline-block;
}

.language-switcher__button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  color: #2c3e50;
  transition: all 0.3s ease;
}

.language-switcher__button:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.2);
}

.language-switcher__button:focus {
  outline: 2px solid #4a90e2;
  outline-offset: 2px;
}

.language-switcher__current {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.language-switcher__flag {
  font-size: 1.25rem;
  line-height: 1;
}

.language-switcher__code {
  font-weight: 600;
  font-size: 0.875rem;
}

.language-switcher__icon {
  transition: transform 0.3s ease;
}

.language-switcher__icon--open {
  transform: rotate(180deg);
}

.language-switcher__dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 160px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  z-index: 1000;
}

.language-switcher__item {
  margin: 0;
}

.language-switcher__option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  color: #2c3e50;
  text-align: left;
  transition: background-color 0.2s ease;
}

.language-switcher__option:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.language-switcher__option--active {
  background-color: rgba(74, 144, 226, 0.1);
  font-weight: 600;
}

.language-switcher__option--active:hover {
  background-color: rgba(74, 144, 226, 0.15);
}

.language-switcher__name {
  flex: 1;
}

/* Transition animations */
.language-dropdown-enter-active,
.language-dropdown-leave-active {
  transition: all 0.2s ease;
}

.language-dropdown-enter-from,
.language-dropdown-leave-to {
  opacity: 0;
  transform: translateY(-10px);
}

/* Language Switcher Positioning and Global Styles */

.language-switcher-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  
  @media (max-width: 768px) {
    top: 15px;
    right: 15px;
    
    .language-switcher {
      &__button {
        padding: 6px 8px;
        font-size: 14px;
      }
    }
  }
  
  /* Hide on very small screens to avoid header conflict */
  @media (max-width: 480px) {
    display: none;
  }
}

/* Integration with site header when header has language switcher */
.site-header {
  &__language-switcher {
    margin-left: auto;
    
    .language-switcher {
      &__button {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.2);
        color: white;
        
        &:hover {
          background: rgba(255, 255, 255, 0.2);
          border-color: rgba(255, 255, 255, 0.3);
        }
      }
      
      &__dropdown {
        right: 0;
        left: auto;
        min-width: 140px;
      }
    }
  }
}

/* Language direction support */
[dir="rtl"] {
  .language-switcher-container {
    right: auto;
    left: 20px;
    
    @media (max-width: 768px) {
      left: 15px;
    }
  }
  
  .language-switcher {
    &__dropdown {
      right: auto;
      left: 0;
    }
    
    &__current {
      flex-direction: row-reverse;
    }
  }
  
  .site-header__language-switcher {
    margin-left: 0;
    margin-right: auto;
    
    .language-switcher__dropdown {
      right: auto;
      left: 0;
    }
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .language-switcher {
    &__button {
      border-width: 2px !important;
      font-weight: bold;
    }
    
    &__dropdown {
      border-width: 2px;
    }
    
    &__option-button {
      &:focus,
      &--active {
        background: black !important;
        color: white !important;
      }
    }
  }
}

/* Animation preferences */
@media (prefers-reduced-motion: reduce) {
  .language-switcher {
    &__icon {
      transition: none !important;
    }
    
    &__option-button {
      transition: none !important;
    }
  }
}

/* Print styles */
@media print {
  .language-switcher-container {
    display: none !important;
  }
}
