/* ========== INTERNATIONALIZATION STYLES ========== */

/* Language Switcher */
.language-switcher {
  position: relative;
  display: inline-block;
  margin-left: 1rem;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.375rem;
  color: white;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.lang-current {
  font-weight: 500;
}

.lang-chevron {
  transition: transform 0.2s ease;
}

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

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  min-width: 200px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

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

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: #374151;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid #f3f4f6;
}

.lang-option:last-child {
  border-bottom: none;
  border-radius: 0 0 0.5rem 0.5rem;
}

.lang-option:first-child {
  border-radius: 0.5rem 0.5rem 0 0;
}

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

.lang-code {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  min-width: 2.5rem;
}

.lang-name {
  font-size: 0.875rem;
  font-weight: 500;
}

/* Mobile Language Switcher */
@media (max-width: 768px) {
  .language-switcher {
    margin: 1rem 0;
    width: 100%;
  }

  .lang-toggle {
    width: 100%;
    justify-content: space-between;
    background: rgba(67, 97, 238, 0.1);
    border-color: rgba(67, 97, 238, 0.2);
    color: #4361ee;
  }

  .lang-dropdown {
    right: 0;
    left: 0;
    width: 100%;
  }
}

/* RTL Support */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .language-switcher {
  margin-left: 0;
  margin-right: 1rem;
}

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

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

[dir="rtl"] .lang-code {
  margin-left: 0.5rem;
  margin-right: 0;
}

/* RTL Layout Adjustments */
.rtl .nav-links {
  flex-direction: row-reverse;
}

.rtl .nav-link,
.rtl .mobile-link {
  text-align: right;
}

.rtl .site-nav .nav-inner {
  flex-direction: row-reverse;
}

.rtl .footer-inner {
  flex-direction: row-reverse;
}

.rtl .footer-col {
  text-align: right;
}

.rtl .footer-connect-icons {
  justify-content: flex-end;
}

.rtl .story-card {
  text-align: right;
}

.rtl .blog-layout {
  flex-direction: row-reverse;
}

.rtl .callout {
  text-align: right;
}

.rtl .socials {
  justify-content: flex-end;
}

/* Win98 Desktop RTL Support */
.rtl #win98-icons {
  right: 20px;
  left: auto;
}

.rtl #win98-taskbar {
  flex-direction: row-reverse;
}

.rtl .win98-icon span {
  text-align: right;
}

/* Arabic Font Optimization */
.rtl {
  font-family: 'Noto Sans Arabic', 'Arial', sans-serif;
}

.rtl h1,
.rtl h2,
.rtl h3,
.rtl h4,
.rtl h5,
.rtl h6 {
  font-weight: 600;
}

/* High contrast mode for Arabic */
@media (prefers-contrast: high) {
  .rtl {
    --text-primary: #000;
    --text-secondary: #333;
  }
}

/* Language-specific typography */
.lang-zh,
.lang-zh-tw {
  font-family: 'Noto Sans CJK SC', 'PingFang SC', 'Source Han Sans CN', 'Microsoft YaHei', sans-serif;
}

.lang-zh-tw {
  font-family: 'Noto Sans CJK TC', 'PingFang TC', 'Source Han Sans TW', 'Microsoft JhengHei', sans-serif;
}

.lang-ar {
  font-family: 'Noto Sans Arabic', 'Cairo', 'Amiri', 'Arial', sans-serif;
}

.lang-fr {
  font-family: 'Inter', 'Roboto', 'Helvetica Neue', sans-serif;
}

.lang-es {
  font-family: 'Inter', 'Roboto', 'Helvetica Neue', sans-serif;
}

/* Enhanced mobile experience for non-Latin scripts */
@media (max-width: 768px) {
  .lang-ar,
  .lang-zh,
  .lang-zh-tw {
    font-size: 1.05em;
    line-height: 1.6;
  }
}

/* Navigation adjustments for longer language names */
@media (max-width: 1024px) {
  .site-nav .nav-links {
    gap: 1rem;
  }

  .lang-toggle {
    padding: 0.375rem 0.5rem;
    font-size: 0.8rem;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  .lang-dropdown,
  .lang-chevron {
    transition: none;
  }
}

/* Focus states */
.lang-toggle:focus-visible {
  outline: 2px solid #4361ee;
  outline-offset: 2px;
}

.lang-option:focus-visible {
  background: #eff6ff;
  outline: 2px solid #4361ee;
  outline-offset: -2px;
}
/* ===== Win98 taskbar-tray variant (docked bottom-right) ===== */
.language-switcher.lang-in-tray { margin: 0; display: flex; align-items: center; }
.language-switcher.lang-in-tray .lang-toggle {
  padding: 1px 6px; background: transparent; border: none; box-shadow: none;
  font-family: "MS Sans Serif", Tahoma, sans-serif; font-size: 11px; color: #000;
  gap: 4px; border-radius: 0;
}
.language-switcher.lang-in-tray .lang-toggle:hover { background: rgba(0,0,0,0.08); }
.language-switcher.lang-in-tray .lang-chevron { width: 9px; height: 9px; }
/* Open upward — the tray sits at the screen bottom */
.language-switcher.lang-in-tray .lang-dropdown {
  top: auto; bottom: 100%; right: 0; margin: 0 0 6px 0;
  min-width: 150px; border: 1px solid #000; border-radius: 0;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.4); transform: translateY(10px);
}
.language-switcher.lang-in-tray.open .lang-dropdown { transform: translateY(0); }
.language-switcher.lang-in-tray .lang-option { padding: 6px 10px; border-bottom: 1px solid #e5e5e5; }
.language-switcher.lang-in-tray .lang-option:first-child,
.language-switcher.lang-in-tray .lang-option:last-child { border-radius: 0; }
.language-switcher.lang-in-tray .lang-code { font-size: 10px; min-width: 2rem; }
.language-switcher.lang-in-tray .lang-name { font-size: 11px; }
