/* =========================================
   DIJEXA - Language Switcher CSS
   Çoklu Dil Değiştirici Stil
   ========================================= */

/* ---- Çince Font Desteği ---- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

/* Çince sayfalar için font */
html[lang="zh"] body {
  font-family: 'Noto Sans SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Rusça ve Almanca uzun kelimeler için word-break */
html[lang="ru"],
html[lang="de"] {
  word-break: break-word;
  hyphens: auto;
}

/* RTL hazırlığı (gelecekte Arapça için) */
html[dir="rtl"] {
  direction: rtl;
}

html[dir="rtl"] .navbar,
html[dir="rtl"] .container {
  direction: rtl;
}

/* ---- Dil Değiştirici ---- */
.lang-switcher {
  position: relative;
  z-index: 100;
}

.lang-switcher-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s var(--ease-out);
  cursor: pointer;
  height: 38px;
}

.lang-switcher-btn:hover {
  background: var(--bg-hover);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.lang-flag {
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.lang-code {
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-light);
}

.lang-arrow {
  transition: transform 0.3s var(--ease-out);
  opacity: 0.7;
}

.lang-switcher.open .lang-arrow {
  transform: rotate(180deg);
}

/* ---- Dropdown ---- */
.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2),
              0 2px 8px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s var(--ease-out);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

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

.lang-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-light);
  font-size: 0.875rem;
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
}

.lang-item:last-child {
  border-bottom: none;
}

.lang-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  padding-left: 18px;
}

.lang-item.active {
  background: linear-gradient(135deg, rgba(200, 16, 46, 0.1), rgba(255, 23, 68, 0.05));
  color: var(--color-primary);
  font-weight: 600;
}

.lang-item .lang-flag {
  font-size: 1.3rem;
}

.lang-name {
  flex: 1;
  font-weight: 500;
}

.lang-code-small {
  font-size: 0.75rem;
  opacity: 0.6;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ---- Mobile Dil Değiştirici ---- */
.lang-switcher-mobile {
  margin-top: 16px;
  margin-right: 0;
}

.lang-switcher-mobile .lang-switcher-btn {
  padding: 10px 18px;
  font-size: 0.9rem;
  height: 44px;
  min-width: 120px;
  justify-content: center;
}

.lang-switcher-mobile .lang-dropdown {
  right: auto;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  min-width: 200px;
}

.lang-switcher-mobile.open .lang-dropdown {
  transform: translateX(-50%) translateY(0);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .lang-switcher:not(.lang-switcher-mobile) {
    display: none;
  }

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

  .lang-item {
    font-size: 0.8rem;
    padding: 9px 12px;
  }
}

@media (min-width: 769px) {
  .lang-switcher-mobile {
    display: none;
  }
}

/* ---- Desktop Nav Actions Düzenlemesi ---- */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---- Animation ---- */
@keyframes langFadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-switcher.open .lang-item {
  animation: langFadeIn 0.3s var(--ease-out) backwards;
}

.lang-switcher.open .lang-item:nth-child(1) { animation-delay: 0.05s; }
.lang-switcher.open .lang-item:nth-child(2) { animation-delay: 0.1s; }
.lang-switcher.open .lang-item:nth-child(3) { animation-delay: 0.15s; }
.lang-switcher.open .lang-item:nth-child(4) { animation-delay: 0.2s; }
.lang-switcher.open .lang-item:nth-child(5) { animation-delay: 0.25s; }
.lang-switcher.open .lang-item:nth-child(6) { animation-delay: 0.3s; }

/* ---- Dark/Light Theme Uyumu ---- */
[data-theme="light"] .lang-switcher-btn {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .lang-switcher-btn:hover {
  background: #f8f9fa;
  border-color: var(--color-primary);
}

[data-theme="light"] .lang-dropdown {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08),
              0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .lang-item {
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .lang-item:hover {
  background: #f8f9fa;
}

/* ---- Accessibility ---- */
.lang-switcher-btn:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.lang-item:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* Klavye navigasyonu */
.lang-item:focus-visible {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ---- Print ---- */
@media print {
  .lang-switcher {
    display: none;
  }
}
