/**
* Language Switcher Component
* Version: 1.0.0
* Description: نظام تبديل اللغة بين العربية والإنجليزية
*/

.language-switcher {
  position: relative;
  margin: 0 1rem;
  z-index: 1000;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(102, 126, 234, 0.2);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'El Messiri', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-dark);
}

.lang-btn:hover {
  border-color: var(--color-primary);
  background: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

.lang-btn i:first-child {
  font-size: 1.2rem;
  color: var(--color-primary);
}

.lang-btn i:last-child {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.lang-btn.active i:last-child {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 180px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  z-index: 9999;
}

.lang-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  color: var(--color-dark);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
}

.lang-option:hover {
  background: rgba(102, 126, 234, 0.05);
}

.lang-option.active {
  background: rgba(102, 126, 234, 0.1);
  color: var(--color-primary);
  font-weight: 600;
}

.lang-option .lang-flag {
  font-size: 1.3rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-option i.bi-check-lg {
  margin-right: auto;
  color: var(--color-success);
  font-size: 1rem;
  display: none;
}

.lang-option.active i.bi-check-lg {
  display: block;
}

/* RTL Support */
[dir="rtl"] .lang-dropdown {
  left: auto;
  right: 0;
}

[dir="rtl"] .lang-option i.bi-check-lg {
  margin-right: 0;
  margin-left: auto;
}

/* Mobile Responsive */
@media (max-width: 991px) {
  .language-switcher {
    margin: 0 0.5rem;
  }
  
  .lang-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
  }
  
  .lang-btn .current-lang {
    display: none;
  }
}

/* Animation */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-dropdown.show {
  animation: slideDown 0.3s ease;
}

/* Accessibility */
.lang-btn:focus {
  outline: 3px solid rgba(102, 126, 234, 0.5);
  outline-offset: 3px;
}

.lang-btn:focus:not(:focus-visible) {
  outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .lang-btn {
    border: 2px solid currentColor;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .lang-btn,
  .lang-dropdown,
  .lang-option {
    animation: none !important;
    transition: none !important;
  }
}
