/**
 * Baranda Latam — Language Switcher (Country Picker style)
 * Tokens aligned with DESIGN.md
 */

/* ─── Container ─── */
.country-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #F7F4EE;
  cursor: pointer;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.country-picker:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ─── Trigger ─── */
.country-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  appearance: none;
}

.country-picker-trigger:focus-visible {
  outline: 2px solid #F0C9A0;
  outline-offset: 2px;
  border-radius: 2px;
}

.cp-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.cp-flag img {
  width: 18px;
  height: auto;
  display: block;
  border-radius: 2px;
}

.cp-label {
  white-space: nowrap;
}

.cp-arrow {
  display: inline-block;
  font-size: 10px;
  line-height: 1;
  opacity: 0.7;
  transition: transform 0.2s ease;
  margin-left: 2px;
}

.country-picker.open .cp-arrow {
  transform: rotate(180deg);
}

/* ─── Dropdown ─── */
.cp-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #F7F4EE;
  color: #1A1A2E;
  min-width: 220px;
  border-radius: 2px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  padding: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.country-picker.open .cp-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ─── Option / Language item ─── */
.cp-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 2px;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 13px;
  font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #1A1A2E;
  text-decoration: none;
  line-height: 1.4;
  transition: background 0.15s ease, color 0.15s ease;
}

.cp-option:hover,
.cp-option:focus-visible {
  background: #EFE9DD;
  color: #1A1A2E;
  outline: none;
}

.cp-option.active {
  color: #4B4FC4;
  font-weight: 600;
}

.cp-option.active:hover {
  color: #383BA8;
}

/* Flag inside option */
.cp-option-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.cp-option-flag img {
  width: 20px;
  height: auto;
  display: block;
  border-radius: 2px;
}

.cp-option-name {
  flex: 1 1 auto;
}

.cp-option-code {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  opacity: 0.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .country-picker {
    font-size: 11px;
    padding: 5px 10px;
    gap: 6px;
  }

  .cp-dropdown {
    min-width: 180px;
    right: 0;
    left: auto;
  }

  .cp-option {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  .country-picker,
  .cp-dropdown,
  .cp-arrow,
  .cp-option {
    transition: none;
  }

  .country-picker.open .cp-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }
}
