/* 
 * Professional Language Switcher Styles
 * EMATECHNOAPP - Professional CRM Solutions
 */

/* Language Switcher Component */
.language-switcher {
  position: relative;
}

.language-switcher .dropdown-toggle {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  background-color: rgba(78, 115, 223, 0.05);
  color: var(--text-dark, #5a5c69);
  text-decoration: none;
  min-width: 85px;
  justify-content: center;
}

.language-switcher .dropdown-toggle:hover {
  background-color: rgba(78, 115, 223, 0.1);
  border-color: rgba(78, 115, 223, 0.2);
  color: var(--primary-color, #4e73df);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.language-switcher .dropdown-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(78, 115, 223, 0.25);
}

.language-switcher .dropdown-toggle::after {
  display: none; /* Hide Bootstrap default arrow */
}

.language-switcher .fa-chevron-down {
  font-size: 0.7rem;
  transition: transform 0.3s ease;
  color: var(--primary-color, #4e73df);
}

.language-switcher .dropdown-toggle[aria-expanded="true"] .fa-chevron-down {
  transform: rotate(180deg);
}

/* Flag Icons */
.language-switcher .flag-icon {
  border-radius: 2px;
  margin-right: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.language-switcher .dropdown-toggle:hover .flag-icon {
  transform: scale(1.05);
}

/* Language Text */
.language-switcher .lang-text {
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

/* Dropdown Menu */
.language-dropdown {
  min-width: 160px;
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  animation: languageDropdownFadeIn 0.2s ease-out;
}

@keyframes languageDropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.language-dropdown::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 20px;
  width: 12px;
  height: 12px;
  background: white;
  border-left: 1px solid rgba(0, 0, 0, 0.1);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  transform: rotate(45deg);
  border-radius: 2px;
}

/* Language Options */
.language-option {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  color: var(--text-dark, #5a5c69);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  border: none;
  background: none;
}

.language-option:hover {
  background-color: rgba(78, 115, 223, 0.08);
  color: var(--primary-color, #4e73df);
  transform: translateX(2px);
}

.language-option:focus {
  outline: none;
  background-color: rgba(78, 115, 223, 0.08);
  color: var(--primary-color, #4e73df);
}

.language-option.active {
  background-color: rgba(78, 115, 223, 0.1);
  color: var(--primary-color, #4e73df);
  font-weight: 600;
}

.language-option .flag-icon {
  margin-right: 0.75rem;
}

.language-option .lang-name {
  flex-grow: 1;
  font-size: 0.9rem;
}

.language-option .fa-check {
  font-size: 0.8rem;
  margin-left: auto;
}

/* Language Notification */
.language-notification {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

.language-notification .alert {
  border-radius: 0;
  border: none;
  border-bottom: 3px solid var(--primary-color, #4e73df);
  font-size: 0.9rem;
}

.language-notification .alert-link {
  font-weight: 600;
  text-decoration: underline;
  color: var(--primary-color, #4e73df);
}

.language-notification .alert-link:hover {
  color: var(--secondary-color, #1cc88a);
}

/* Responsive Design */
@media (max-width: 991.98px) {
  .language-switcher .dropdown-toggle {
    padding: 0.4rem 0.8rem;
    min-width: 75px;
  }
  
  .language-switcher .lang-text {
    font-size: 0.8rem;
  }
  
  .language-switcher .flag-icon {
    width: 18px;
    height: 14px;
  }
  
  .language-dropdown {
    min-width: 140px;
  }
  
  .language-option {
    padding: 0.6rem 1rem;
  }
  
  .language-option .lang-name {
    font-size: 0.85rem;
  }
}

@media (max-width: 576px) {
  .language-switcher {
    margin-top: 0.5rem;
  }
  
  .language-switcher .dropdown-toggle {
    width: 100%;
    justify-content: space-between;
  }
  
  .language-dropdown {
    width: 100%;
    margin-top: 0.25rem;
  }
  
  .language-notification .alert {
    font-size: 0.85rem;
    padding: 0.75rem;
  }
}

/* Loading State */
.language-switcher .dropdown-toggle[aria-expanded="false"]:has(.fa-spinner) {
  opacity: 0.6;
  pointer-events: none;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .language-switcher .dropdown-toggle {
    border-color: currentColor;
  }
  
  .language-dropdown {
    border: 2px solid currentColor;
  }
  
  .language-option:hover {
    background-color: currentColor;
    color: white;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .language-switcher .dropdown-toggle {
    background-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
  }
  
  .language-switcher .dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
  }
  
  .language-dropdown {
    background-color: #2d3748;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .language-dropdown::before {
    background-color: #2d3748;
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .language-option {
    color: rgba(255, 255, 255, 0.8);
  }
  
  .language-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
  }
  
  .language-option.active {
    background-color: rgba(78, 115, 223, 0.2);
    color: #4e73df;
  }
}

/* Print Styles */
@media print {
  .language-switcher {
    display: none;
  }
}

/* Animation for smooth transitions */
.language-switcher * {
  transition: all 0.2s ease;
}

/* Focus management for accessibility */
.language-switcher .dropdown-toggle:focus-visible {
  outline: 2px solid var(--primary-color, #4e73df);
  outline-offset: 2px;
}

.language-option:focus-visible {
  outline: 2px solid var(--primary-color, #4e73df);
  outline-offset: -2px;
}