/* ══════════════════════════════════════════════════════
   WUP Language Switcher Styles
   Designed to integrate with the existing dark navbar.
   Theming via CSS custom properties.
   ══════════════════════════════════════════════════════ */

   :root {
    --ls-accent:       #9B7FFF;
    --ls-bg:           rgba(255, 255, 255, 0.06);
    --ls-bg-hover:     rgba(255, 255, 255, 0.10);
    --ls-bg-dropdown:  #1e1a38;
    --ls-border:       rgba(255, 255, 255, 0.12);
    --ls-text:         #e8e3ff;
    --ls-text-muted:   rgba(232, 227, 255, 0.6);
    --ls-shadow:       0 16px 48px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    --ls-radius:       12px;
    --ls-radius-sm:    8px;
    --ls-transition:   0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  /* ── Wrapper ───────────────────────────────────────────── */
  .ls-wrapper {
    position: relative;
    display: inline-block;
    font-family: 'Inter', 'Geologica', system-ui, sans-serif;
  }
  
  /* ── Trigger button ────────────────────────────────────── */
  .ls-trigger {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px 7px 10px;
    border-radius: var(--ls-radius-sm);
    border: 1.5px solid var(--ls-border);
    background: var(--ls-bg);
    color: var(--ls-text);
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: pointer;
    white-space: nowrap;
    transition:
      background var(--ls-transition),
      border-color var(--ls-transition),
      box-shadow var(--ls-transition);
    -webkit-user-select: none;
    user-select: none;
    outline: none;
  }
  
  .ls-trigger:hover,
  .ls-wrapper.is-open .ls-trigger {
    background: var(--ls-bg-hover);
    border-color: var(--ls-accent);
    box-shadow: 0 0 0 3px rgba(155, 127, 255, 0.18);
  }
  
  .ls-trigger:focus-visible {
    border-color: var(--ls-accent);
    box-shadow: 0 0 0 3px rgba(155, 127, 255, 0.28);
  }
  
  /* Flag emoji */
  .ls-trigger .ls-flag {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
  }
  
  /* Label text */
  .ls-trigger .ls-label {
    min-width: 68px;
  }
  
  /* Caret */
  .ls-caret {
    color: var(--ls-text-muted);
    display: flex;
    align-items: center;
    transition: transform var(--ls-transition), color var(--ls-transition);
  }
  
  .ls-wrapper.is-open .ls-caret {
    transform: rotate(180deg);
    color: var(--ls-accent);
  }
  
  /* ── Dropdown list ─────────────────────────────────────── */
  .ls-dropdown {
    list-style: none;
    margin: 0;
    padding: 6px;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 170px;
    background: var(--ls-bg-dropdown);
    border: 1.5px solid var(--ls-border);
    border-radius: var(--ls-radius);
    box-shadow: var(--ls-shadow);
    z-index: 9999;
  
    /* Hidden state */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px) scale(0.97);
    transform-origin: top right;
    transition:
      opacity var(--ls-transition),
      transform var(--ls-transition);
  }
  
  .ls-dropdown.open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
  }
  
  /* ── Individual option ─────────────────────────────────── */
  .ls-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--ls-radius-sm);
    color: var(--ls-text-muted);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--ls-transition), color var(--ls-transition);
    outline: none;
    -webkit-user-select: none;
    user-select: none;
  }
  
  .ls-option:hover,
  .ls-option:focus-visible {
    background: rgba(155, 127, 255, 0.12);
    color: var(--ls-text);
  }
  
  .ls-option.active {
    color: var(--ls-accent);
    background: rgba(155, 127, 255, 0.1);
  }
  
  .ls-option.active .ls-lang-label::after {
    content: ' ✓';
    opacity: 0.7;
    font-size: 11px;
  }
  
  .ls-option .ls-flag {
    font-size: 18px;
    line-height: 1;
  }
  
  .ls-option .ls-lang-label {
    flex: 1;
  }
  
  /* ── Divider between options (optional, add class .ls-divided) ── */
  .ls-option + .ls-option.ls-divided {
    border-top: 1px solid var(--ls-border);
    margin-top: 4px;
    padding-top: 12px;
  }
  
  /* ── Light mode override (if body has .light-mode) ────── */
  body.light-mode {
    --ls-bg:          rgba(0, 0, 0, 0.05);
    --ls-bg-hover:    rgba(0, 0, 0, 0.08);
    --ls-bg-dropdown: #ffffff;
    --ls-border:      rgba(0, 0, 0, 0.10);
    --ls-text:        #1A1530;
    --ls-text-muted:  rgba(26, 21, 48, 0.55);
    --ls-shadow:      0 16px 48px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  }
  
  /* ── Responsive ────────────────────────────────────────── */
  @media (max-width: 640px) {
    /* On mobile, hide the text label — show flag + caret only */
    .ls-trigger .ls-label {
      display: none;
    }
  
    .ls-trigger {
      padding: 7px 10px;
      gap: 5px;
    }
  
    /* Dropdown opens to the left edge instead */
    .ls-dropdown {
      right: auto;
      left: 0;
      transform-origin: top left;
    }
  }