/**
 * Language Switcher Component Styles
 * Modern, accessible, and responsive design
 */

/* Language Switcher Container */
.language-switcher {
  position: relative;
  display: inline-block;
}

/* Language Switcher Button */
.lang-switcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.lang-switcher-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.lang-switcher-btn:focus {
  outline: none;
  border-color: #444FB6;
  box-shadow: 0 0 0 3px rgba(68, 79, 182, 0.1);
}

/* Language Flag */
.lang-flag {
  font-size: 18px;
  line-height: 1;
}

/* Language Name */
.lang-name {
  font-size: 14px;
  font-weight: 500;
}

/* Chevron Icon */
.lang-chevron {
  transition: transform 0.2s ease;
  color: #64748b;
}

.lang-switcher-btn:hover .lang-chevron {
  color: #334155;
}

.lang-dropdown.show + .lang-switcher-btn .lang-chevron {
  transform: rotate(180deg);
}

/* Language Dropdown */
.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
  overflow: hidden;
}

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

/* Language Option */
.lang-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #334155;
  transition: background 0.2s ease;
  position: relative;
}

.lang-option:hover {
  background: #f8fafc;
}

.lang-option:focus {
  outline: none;
  background: #f1f5f9;
}

.lang-option .lang-flag {
  font-size: 18px;
}

.lang-option .lang-name {
  flex: 1;
  text-align: left;
}

/* Check Mark for Selected Language */
.lang-check {
  color: #444FB6;
  font-weight: bold;
  font-size: 16px;
}

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

html[dir="rtl"] .lang-option .lang-name {
  text-align: right;
}

/* Loading State */
body.lang-switching {
  cursor: wait;
}

body.lang-switching * {
  pointer-events: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .lang-switcher-btn {
    padding: 6px 12px;
    font-size: 13px;
  }

  .lang-name {
    display: none;
  }

  .lang-dropdown {
    min-width: 160px;
  }

  .lang-option {
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* Navbar Integration Styles */
.nav-buttons .lang-switcher {
  position: relative;
}

.nav-buttons .lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-buttons .lang-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.nav-buttons .lang-btn i {
  font-size: 16px;
}

.nav-buttons .lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

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

.nav-buttons .lang-dropdown li {
  margin: 0;
}

.nav-buttons .lang-dropdown a {
  display: block;
  padding: 10px 16px;
  color: #334155;
  text-decoration: none;
  transition: background 0.2s ease;
  font-size: 14px;
}

.nav-buttons .lang-dropdown a:hover {
  background: #f8fafc;
  color: #444FB6;
}

/* Smooth Transitions for Language Change */
[data-i18n] {
  transition: opacity 0.15s ease;
}

body.lang-switching [data-i18n] {
  opacity: 0.6;
}

/* Animation for language switch */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-switched [data-i18n] {
  animation: fadeIn 0.3s ease forwards;
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
  .lang-switcher-btn {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
  }

  .lang-switcher-btn:hover {
    background: #334155;
    border-color: #475569;
  }

  .lang-dropdown {
    background: #1e293b;
    border-color: #334155;
  }

  .lang-option {
    color: #f1f5f9;
  }

  .lang-option:hover {
    background: #334155;
  }

  .lang-option:focus {
    background: #475569;
  }
}

/* Accessibility Improvements */
.lang-switcher-btn:focus-visible {
  outline: 2px solid #444FB6;
  outline-offset: 2px;
}

.lang-option:focus-visible {
  outline: 2px solid #444FB6;
  outline-offset: -2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .lang-switcher-btn {
    border-width: 2px;
  }

  .lang-dropdown {
    border-width: 2px;
  }

  .lang-option:hover,
  .lang-option:focus {
    outline: 2px solid currentColor;
  }
}

