/* Enhanced Language Switcher Styles */
.language-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 25px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.3);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.language-switcher:hover {
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.2);
}

.language-switcher__btn {
  min-width: 44px;
  height: 32px;
  padding: 6px 12px;
  border-radius: 20px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: #94a3b8;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.language-switcher__btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.6s ease;
}

.language-switcher__btn:hover::before {
  left: 100%;
}

.language-switcher__btn:hover {
  color: #e2e8f0;
  transform: translateY(-1px);
}

.language-switcher__btn--active {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  font-weight: 700;
}

.language-switcher__btn--active:hover {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

/* Modern Dropdown Language Switcher */
.language-switcher--modern {
  position: relative;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.language-switcher--modern:hover {
  border: none;
  box-shadow: none;
}

.language-switcher__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 25px;
  border: 1px solid rgba(66, 153, 225, 0.3);
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 13px;
  font-weight: 600;
  min-width: 80px;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.language-switcher__trigger:hover {
  border-color: rgba(66, 153, 225, 0.6);
  background: rgba(30, 41, 59, 1);
  box-shadow: 0 4px 12px rgba(66, 153, 225, 0.25);
  transform: translateY(-1px);
}

.language-switcher__trigger[aria-expanded="true"] {
  border-color: rgba(66, 153, 225, 0.8);
  background: rgba(30, 41, 59, 1);
  box-shadow: 0 4px 16px rgba(66, 153, 225, 0.3);
}

.language-switcher__trigger[aria-expanded="true"] .language-switcher__icon {
  transform: rotate(180deg);
}

.language-switcher__current {
  display: flex;
  align-items: center;
  gap: 6px;
}

.language-switcher__flag {
  font-size: 18px;
  line-height: 1;
  display: inline-block;
}

.language-switcher__code {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.language-switcher__icon {
  font-size: 10px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #94a3b8;
  margin-left: 4px;
}

.language-switcher__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 160px;
  background: rgba(30, 41, 59, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(66, 153, 225, 0.3);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  overflow: hidden;
  padding: 4px;
}

.language-switcher__dropdown[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.language-switcher__option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #e2e8f0;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 13px;
  text-align: right;
  font-family: inherit;
}

.language-switcher__option:hover {
  background: rgba(66, 153, 225, 0.15);
  transform: translateX(-2px);
}

.language-switcher__option[data-lang="fa"] {
  direction: rtl;
}

.language-switcher__option[data-lang="en"] {
  direction: ltr;
}

.language-switcher__option .language-switcher__flag {
  font-size: 20px;
  flex-shrink: 0;
}

.language-switcher__option .language-switcher__label {
  flex: 1;
  font-weight: 500;
}

.language-switcher__option .language-switcher__code {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  background: rgba(66, 153, 225, 0.1);
  border-radius: 4px;
}

/* Mobile Language Switcher */
@media (max-width: 768px) {
  .language-switcher {
    gap: 4px;
    padding: 4px;
    margin: 8px 0;
  }
  
  .language-switcher__btn {
    min-width: 38px;
    height: 28px;
    padding: 4px 8px;
    font-size: 11px;
  }

  .language-switcher__trigger {
    padding: 6px 10px;
    min-width: 70px;
    font-size: 12px;
  }

  .language-switcher__flag {
    font-size: 16px;
  }

  .language-switcher__code {
    font-size: 11px;
  }

  .language-switcher__dropdown {
    min-width: 140px;
    right: 0;
    left: auto;
  }

  .language-switcher__option {
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* Header Integration */
.header .language-switcher {
  margin-left: 12px;
}

/* Mobile Menu Language Switcher */
.modern-mobile-menu .language-switcher {
  margin: 16px auto;
  justify-content: center;
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(59, 130, 246, 0.2);
  width: fit-content;
}

/* Footer Language Switcher */
.footer .language-switcher {
  background: rgba(15, 23, 42, 0.7);
  margin-top: 16px;
}

/* Admin Panel Language Switcher */
.admin-panel .language-switcher {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.admin-panel .language-switcher__btn {
  color: #cbd5e1;
}

.admin-panel .language-switcher__btn--active {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

/* Animation for language change */
@keyframes languageSwitch {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.language-switcher__btn--active {
  animation: languageSwitch 0.3s ease;
}

/* RTL Support */
[dir="rtl"] .language-switcher {
  direction: ltr;
}

[dir="rtl"] .language-switcher__btn::before {
  left: auto;
  right: -100%;
}

[dir="rtl"] .language-switcher__btn:hover::before {
  right: 100%;
}

[dir="rtl"] .language-switcher--modern {
  direction: ltr;
}

[dir="rtl"] .language-switcher__dropdown {
  left: auto;
  right: 0;
}

[dir="rtl"] .language-switcher__option:hover {
  transform: translateX(2px);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .language-switcher {
    border-width: 2px;
  }
  
  .language-switcher__btn--active {
    border: 2px solid #ffffff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .language-switcher,
  .language-switcher__btn,
  .language-switcher__btn::before {
    transition: none;
  }
  
  .language-switcher__btn--active {
    animation: none;
  }
}