/**
 * @file
 * Custom Language Switcher CSS styles - Dropdown design.
 * WCAG 2.1 AAA compliant.
 */

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

/* Toggle button */
.language-switcher-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #333;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  transition: all 0.2s ease;
  min-width: 60px;
}

.language-switcher-toggle:hover {
  background: #f5f5f5;
  border-color: #000;
}

.language-switcher-toggle:focus {
  outline: 3px solid #007cba;
  outline-offset: 2px;
  border-color: #007cba;
}

.language-switcher-toggle:active {
  background: #e8e8e8;
}

.language-switcher-toggle[aria-expanded="true"] {
  background: #f5f5f5;
  border-color: #007cba;
}

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

/* Current language label */
.language-switcher-current {
  font-weight: 600;
}

/* Dropdown icon */
.language-switcher-icon {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

/* Dropdown menu */
.language-switcher-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  background: #fff;
  border: 1px solid #333;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.language-switcher-dropdown[hidden] {
  display: none;
}

/* Dropdown items */
.language-switcher-item {
  margin: 0;
  padding: 0;
}

.language-link {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
  color: #333;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.language-link:hover {
  background-color: #f5f5f5;
  color: #000;
  text-decoration: none;
}

.language-link:focus {
  outline: 3px solid #007cba;
  outline-offset: -3px;
  background-color: #e8f4f8;
  color: #000;
  text-decoration: none;
}

.language-link:active {
  background-color: #d0e8f0;
}

/* Active language indicator */
.language-switcher-item.is-active .language-link {
  background-color: #007cba;
  color: #fff;
  font-weight: 600;
}

.language-switcher-item.is-active .language-link:hover {
  background-color: #005a87;
  color: #fff;
}

.language-switcher-item.is-active .language-link:focus {
  outline-color: #fff;
  background-color: #005a87;
  color: #fff;
}

/* Visually hidden utility for screen readers */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .language-switcher-toggle,
  .language-switcher-dropdown {
    border-width: 2px;
  }
  
  .language-link:focus {
    outline-width: 4px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .language-switcher-toggle,
  .language-switcher-icon,
  .language-link {
    transition: none;
  }
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .language-switcher-toggle {
    padding: 6px 10px;
    font-size: 13px;
  }
  
  .language-link {
    padding: 8px 14px;
    font-size: 14px;
  }
}
