/* Language Switcher Optimized Styles */
.language-switcher-wrapper {
  position: relative;
  z-index: 1000;
}

.language-switcher {
  position: relative;
  display: inline-block;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  transition: all 0.2s ease;
  will-change: background-color, border-color;
}

.lang-toggle:hover {
  background: #f5f5f5;
  border-color: #ccc;
  color: #000000;
}

.lang-toggle:focus {
  background: #f5f5f5;
  border-color: #ccc;
  color: #000000;
}

.lang-arrow {
  transition: transform 0.3s ease;
  will-change: transform;
}

.language-switcher.active .lang-arrow {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 150px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  will-change: opacity, visibility, transform;
}

.language-switcher.active .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
  position: relative;
  will-change: background-color, padding-left;
}

.lang-option:hover {
  background: #f5f5f5;
  color: #333;
  text-decoration: none;
  padding-left: 20px;
}

.lang-option.active {
  background: #e8f4fd;
  color: #0066cc;
  font-weight: 500;
}

.lang-option.active::before {
  content: '✓';
  position: absolute;
  right: 12px;
  font-size: 12px;
}

.lang-flag {
  width: 24px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Loading Overlay - Optimized with GPU acceleration */
.lang-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 16px;
  z-index: 99999;
  backdrop-filter: blur(2px);
  transform: translateZ(0); /* Force GPU acceleration */
}

.lang-loading-overlay.show {
  display: flex !important;
}

.lang-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e0e0;
  border-top-color: #0066cc;
  border-radius: 50%;
  animation: langSpin 0.8s linear infinite;
  transform: translateZ(0); /* Force GPU acceleration */
}

@keyframes langSpin {
  to { 
    transform: translateZ(0) rotate(360deg); 
  }
}

.lang-loading-text {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

/* Mobile optimizations */
@media (max-width: 991px) {
  .lang-dropdown {
    right: auto;
    left: 0;
  }
  
  .lang-toggle {
    padding: 6px 10px;
    font-size: 13px;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .lang-toggle,
  .lang-arrow,
  .lang-dropdown,
  .lang-option {
    transition: none;
  }
  
  .lang-loading-spinner {
    animation: none;
  }
}