/**
 * Language Switcher Stylesheet
 * Poli International Tattoo Tools Suite
 * 
 * Provides responsive styling, theme support, and accessibility parity
 * for the header language selector.
 * Zero external dependencies or remote links.
 */

:root {
  --lang-switcher-font-size: 0.875rem;
  --lang-switcher-height: 44px;
  --lang-switcher-radius: 8px;
  --lang-switcher-border-width: 1px;
  --lang-switcher-bg: var(--bg-secondary, #f8fafc);
  --lang-switcher-text: var(--text-primary, #0f172a);
  --lang-switcher-border: var(--border-secondary, #cbd5e1);
  --lang-switcher-focus: var(--artist-purple, #6d28d9);
  --lang-switcher-option-bg: var(--bg-elevated, #ffffff);
  --lang-switcher-option-text: var(--text-primary, #0f172a);
  --lang-switcher-header-bg: rgba(255, 255, 255, 0.1);
  --lang-switcher-header-bg-hover: rgba(255, 255, 255, 0.18);
  --lang-switcher-header-text: #ffffff;
  --lang-switcher-header-border: rgba(255, 255, 255, 0.3);
  --lang-switcher-header-focus: #38bdf8;
  --lang-switcher-header-option-bg: #1a1a1a;
  --lang-switcher-header-option-text: #f8fafc;
}

[data-theme="dark"] {
  --lang-switcher-bg: var(--dark-bg-secondary, #111827);
  --lang-switcher-text: var(--dark-text-primary, #f9fafb);
  --lang-switcher-border: var(--dark-border-primary, #374151);
  --lang-switcher-option-bg: var(--dark-bg-elevated, #1f2937);
  --lang-switcher-option-text: var(--dark-text-primary, #f9fafb);
}

/* Base Language Switcher Wrapper */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  position: relative;
  gap: 0.5rem;
  margin: 0;
  vertical-align: middle;
}

/* Decorative Icon (hidden from screen readers) */
.lang-switcher__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  opacity: 0.9;
}

/* Language Selection Dropdown Input */
.lang-switcher__select {
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  display: inline-block;
  height: var(--lang-switcher-height);
  min-height: var(--lang-switcher-height);
  min-width: 140px;
  padding: 0 0.85rem;
  font-size: var(--lang-switcher-font-size);
  font-weight: 600;
  font-family: inherit;
  line-height: var(--lang-switcher-height);
  color: var(--lang-switcher-text);
  background-color: var(--lang-switcher-bg);
  border: var(--lang-switcher-border-width) solid var(--lang-switcher-border);
  border-radius: var(--lang-switcher-radius);
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.lang-switcher__select:hover {
  border-color: var(--lang-switcher-focus);
}

.lang-switcher__select:focus-visible {
  outline: 2px solid var(--lang-switcher-focus);
  outline-offset: 2px;
}

.lang-switcher__select option {
  background-color: var(--lang-switcher-option-bg);
  color: var(--lang-switcher-option-text);
  font-weight: 500;
  padding: 0.4rem 0.5rem;
}

/* Top Dark Site Header Integration */
.site-header .lang-switcher {
  margin-left: auto;
}

.site-header .lang-switcher__select {
  background-color: var(--lang-switcher-header-bg);
  color: var(--lang-switcher-header-text);
  border-color: var(--lang-switcher-header-border);
}

.site-header .lang-switcher__select:hover {
  background-color: var(--lang-switcher-header-bg-hover);
  border-color: var(--lang-switcher-header-focus);
}

.site-header .lang-switcher__select:focus-visible {
  outline: 2px solid var(--lang-switcher-header-focus);
  outline-offset: 2px;
}

.site-header .lang-switcher__select option {
  background-color: var(--lang-switcher-header-option-bg);
  color: var(--lang-switcher-header-option-text);
}

/* Tool Header Action Buttons Integration */
.ink-mixer__header-buttons .lang-switcher {
  margin-right: 0.25rem;
}

.ink-mixer__header-buttons .lang-switcher__select {
  background-color: var(--bg-primary, #ffffff);
  color: var(--text-primary, #1f2937);
  border: 1.5px solid var(--border-primary, #e5e7eb);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.ink-mixer__header-buttons .lang-switcher__select:hover {
  border-color: var(--artist-purple, #6d28d9);
}

/* Mobile & Small Screen Adaptations */
@media (max-width: 768px) {
  .site-header .lang-switcher {
    margin: 0.5rem auto 0;
    width: 100%;
    justify-content: center;
  }

  .ink-mixer__header-buttons .lang-switcher {
    width: 100%;
    justify-content: center;
    margin: 0.25rem 0;
  }

  .lang-switcher__select {
    width: 100%;
    max-width: 280px;
    font-size: 0.95rem;
  }
}

/* The site header stays dark in both themes: its drawn globe icon is white like the links */
.site-header .lang-switcher__icon {
  color: #fff;
}
