/* Language selector dropdown & Mobile language section */
.lang-selector {
  position: relative;
  display: inline-flex;
}

.lang-toggle {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-warm);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.5px;
  transition: background-color 0.22s var(--ease), border-color 0.22s var(--ease), transform 0.22s var(--ease);
}

.lang-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.lang-globe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  color: var(--ink);
}

.lang-current {
  letter-spacing: 0.5px;
}

.lang-arrow {
  font-size: 8px;
  opacity: 0.6;
  transition: transform 0.2s ease;
  margin-left: 1px;
}

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

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 215px;
  background: var(--surface-glass, rgba(14, 16, 26, 0.96));
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 120;
  animation: langDropdownIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes langDropdownIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

[data-theme="light"] .lang-dropdown {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.lang-selector.is-open .lang-dropdown {
  display: flex;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 450;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  font-family: inherit;
}

.lang-option-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--line);
  color: var(--ink);
  letter-spacing: 0.5px;
}

.lang-option:hover {
  background: var(--surface-hover, rgba(255, 255, 255, 0.06));
}

[data-theme="light"] .lang-option:hover {
  background: rgba(0, 0, 0, 0.05);
}

.lang-option.is-selected {
  font-weight: 600;
  color: var(--ink);
  background: rgba(254, 205, 26, 0.12);
}

.lang-check {
  font-size: 13px;
  color: var(--yellow, #fecd1a);
  opacity: 0;
  font-weight: 700;
}

.lang-option.is-selected .lang-check {
  opacity: 1;
}

/* Header layout adjustment for language selector */
@media (min-width: 1200px) {
  .site-header {
    grid-template-columns: 148px 1fr auto auto auto !important;
    width: min(950px, calc(100% - 40px)) !important;
    gap: 10px;
  }
}

@media (max-width: 1199px) {
  .site-header {
    grid-template-columns: 1fr auto auto auto !important;
    width: min(720px, calc(100% - 40px)) !important;
    gap: 8px;
  }
  .desktop-nav, .nav-cta {
    display: none !important;
  }
  .lang-selector {
    display: inline-flex;
  }
}

@media (max-width: 809px) {
  .site-header {
    grid-template-columns: minmax(0, 1fr) auto auto auto !important;
    width: calc(100% - 32px) !important;
    gap: 6px;
    padding: 8px 10px 8px 14px !important;
  }
  .lang-toggle {
    min-height: 38px;
    padding: 4px 8px;
    font-size: 11px;
    gap: 4px;
  }
  .lang-dropdown {
    right: -20px;
    min-width: 195px;
  }
}

/* Mobile drawer language section */
.mobile-lang-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.mobile-lang-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-muted, rgba(255, 255, 255, 0.5));
  margin-bottom: 12px;
}

.mobile-lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.mobile-lang-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-warm);
  color: var(--ink);
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.mobile-lang-btn span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-lang-btn.is-selected {
  border-color: var(--yellow, #fecd1a);
  background: rgba(254, 205, 26, 0.12);
  font-weight: 600;
}

.mobile-lang-btn.is-selected .lang-check {
  opacity: 1;
}
