/* Language Switcher Styles */
.language-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.language-switcher-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.language-switcher-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
}

.language-flag-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 18px;
  flex-shrink: 0;
}

.language-flag-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
}

.language-name {
  font-weight: 500;
  white-space: nowrap;
}

.language-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

/* Desktop Dropdown */
.language-dropdown-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
}

.language-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 180px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  z-index: 50;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Dropdown button styles */
.language-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  color: #374151;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  text-align: left;
}

.language-dropdown-item:hover {
  background: #f9fafb;
  color: #374151;
}

.language-dropdown-item.selected {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 500;
}

.language-dropdown-flag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 18px;
  flex-shrink: 0;
}

.language-dropdown-name {
  flex: 1;
  text-align: left;
}

.language-checkmark {
  margin-left: auto;
  color: #2563eb;
  font-weight: 600;
  flex-shrink: 0;
}

.language-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 16px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid white;
}

/* Mobile Language Switcher */
.language-switcher-mobile {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
  margin-top: 20px;
}

.language-selector-mobile {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
}

.language-dropdown-mobile {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.language-option-mobile {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: white;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  transition: background-color 0.2s;
}

.language-option-mobile:hover {
  background: rgba(255, 255, 255, 0.1);
}

.language-option-mobile.active {
  background: rgba(255, 255, 255, 0.15);
  font-weight: 600;
}

.language-mobile-flag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 15px;
  flex-shrink: 0;
}

.language-mobile-name {
  flex: 1;
  text-align: left;
}

.language-mobile-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-left: auto;
  transition: transform 0.2s ease;
}

/* RTL Support for Arabic */
[dir="rtl"] .language-option-mobile,
[dir="rtl"] .language-selector-mobile,
[dir="rtl"] .language-switcher-button,
[dir="rtl"] .language-dropdown-item {
  direction: rtl;
}

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

[dir="rtl"] .language-dropdown::before {
  right: auto;
  left: 16px;
}

[dir="rtl"] .language-dropdown-name,
[dir="rtl"] .language-mobile-name {
  text-align: right;
}

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

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

/* Header layout adjustments */
.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-right .language-switcher {
  order: -1; /* Language switcher appears first */
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .language-switcher button span {
    display: none;
  }

  .header-right {
    gap: 0.75rem;
  }
}

/* Ensure dropdown appears above header elements */
.header-sticky .language-dropdown {
  z-index: 1000;
}
