/**
 * CarCoding Language Switcher Styles
 * Dropdown with RTL support
 */

/* Language Switcher Container */
.language-switcher-container {
  position: relative;
}

.language-selector {
  position: relative;
  display: inline-block;
}

/* Language Button */
.lang-button {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #FFFFFF;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.lang-button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(220, 38, 38, 0.5);
}

.lang-button.active {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.6);
}

.lang-chevron {
  font-size: 10px;
  transition: transform 0.2s;
}

.lang-button.active .lang-chevron {
  transform: rotate(180deg);
}

/* Language Menu */
.lang-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1001;
  min-width: 220px;
  background: #121212;
  border: 1px solid #27272A;
  border-radius: 12px;
  margin-top: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  animation: slideDown 0.2s ease;
}

html[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-menu-inner {
  display: flex;
  flex-direction: column;
  max-height: 400px;
  overflow-y: auto;
}

/* Language Option Items */
.lang-option {
  background: none;
  border: none;
  color: #A1A1AA;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

html[dir="rtl"] .lang-option {
  text-align: right;
  flex-direction: row-reverse;
}

.lang-option:hover {
  background: #1C1C1E;
  color: #FFFFFF;
}

.lang-option.active {
  background: rgba(220, 38, 38, 0.15);
  color: #DC2626;
  font-weight: 700;
}

.lang-option.active::after {
  content: '✓';
  margin-left: auto;
  font-weight: bold;
}

html[dir="rtl"] .lang-option.active::after {
  margin-left: 0;
  margin-right: auto;
}

/* Scrollbar styling for language menu */
.lang-menu-inner::-webkit-scrollbar {
  width: 4px;
}

.lang-menu-inner::-webkit-scrollbar-track {
  background: #1C1C1E;
}

.lang-menu-inner::-webkit-scrollbar-thumb {
  background: #3F3F46;
  border-radius: 2px;
}

.lang-menu-inner::-webkit-scrollbar-thumb:hover {
  background: #52525B;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .language-switcher-container {
    margin-left: auto;
  }

  .lang-button {
    padding: 6px 12px;
    font-size: 12px;
  }

  .lang-menu {
    min-width: 180px;
  }

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

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

html[dir="rtl"] .lang-button {
  flex-direction: row-reverse;
}
