/**
 * Country Selector
 * Scoped entirely under .jc-country-selector — safe to enqueue
 * site-wide with no risk of leaking into other components.
 */

.jc-country-selector {
  --jc-country-selector-toggle-padding: 0px 12px;

  --jc-country-select-globe-color: var(--brand-color-black-500);
  --jc-country-select-globe-hover-color: var(--brand-color-primary);
  --jc-country-select-globe-size: 20px;

  --jc-country-select-text-color: var(--brand-color-black);
  --jc-country-select-text-color-hover: var(--brand-color-black);
  --jc-country-select-text-code-display: block;
  --jc-country-select-text-label-display: none;

  --jc-country-select-chevron-color: var(--brand-color-black-500);
  --jc-country-select-chevron-color-hover: var(--brand-color-black-500);
  --jc-country-select-chevron-size: 16px;

  --jc-country-select-dropdown-bg-color: var(--brand-color-white);
  --jc-country-select-dropdown-border: 1px solid rgba(var(--brand-color-black-rgb), 0.05);
  --jc-country-select-dropdown-border-radius: 8px;
  --jc-country-select-dropdown-padding: 8px 0;

  --jc-country-select-dropdown-item-text: var(--brand-color-black);
  --jc-country-select-dropdown-item-text-hover: var(--brand-color-white);
  --jc-country-select-dropdown-item-text-current: var(--brand-color-black);
  --jc-country-select-dropdown-item-bg-color: var(--brand-color-white);
  --jc-country-select-dropdown-item-bg-color-hover: var(--brand-color-primary);
  --jc-country-select-dropdown-item-bg-padding: 8px 16px;

  position: relative;
  display: block;
  font-family: inherit;
}

.header.header--overlay:not(.header--open) .jc-country-selector {
  --jc-country-select-globe-color: rgba(var(--brand-color-white-rgb), 0.6);
  --jc-country-select-text-color: var(--brand-color-white);
  --jc-country-select-text-color-hover: var(--brand-color-white);
  --jc-country-select-chevron-color: rgba(var(--brand-color-white-rgb), 0.75);
  --jc-country-select-chevron-color-hover: rgba(var(--brand-color-white-rgb), 0.75);
}

.footer .jc-country-selector {
  --jc-country-selector-toggle-padding: 0px 0px 0px 12px;
  --jc-country-select-globe-color: var(--brand-color-black-600);
  --jc-country-select-chevron-color: var(--brand-color-black-600);
  --jc-country-select-text-color: var(--brand-color-black-200);
  --jc-country-select-text-color-hover: var(--brand-color-black-200);
  --jc-country-select-text-code-display: none;
  --jc-country-select-text-label-display: block;
}

.jc-country-selector__toggle {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: row;
  gap: 6px;
  box-sizing: border-box;
  justify-content: center;
  align-items: center;
  height: auto;
  padding: var(--jc-country-selector-toggle-padding);
  cursor: pointer;
  color: var(--jc-country-select-text-color);
}

.jc-country-selector__toggle:hover,
.jc-country-selector__toggle:focus-visible,
.jc-country-selector.is-open .jc-country-selector__toggle {
  color: var(--jc-country-select-text-color-hover);
}

.jc-country-selector__code,
.jc-country-selector__label {
  line-height: 1;
}
.jc-country-selector__label { display: var(--jc-country-select-text-label-display); }
.jc-country-selector__code { display: var(--jc-country-select-text-code-display); }

.jc-country-selector__icon--globe {
  color: var(--jc-country-select-globe-color);
  margin-right: -2px; /* Brings the globe icon a little closer */
}

.jc-country-selector__icon--globe svg {
  width: var(--jc-country-select-globe-size);
  height: var(--jc-country-select-globe-size);
  stroke: currentColor;
  transition: color 0.3s ease;
  display: block;
}

.jc-country-selector__toggle:hover .jc-country-selector__icon--globe,
.jc-country-selector__toggle:focus-visible .jc-country-selector__icon--globe,
.jc-country-selector.is-open .jc-country-selector__toggle .jc-country-selector__icon--globe {
  color: var(--jc-country-select-globe-hover-color);
}

.jc-country-selector__icon--chevron {
  color: var(--jc-country-select-chevron-color);
}

.jc-country-selector__icon--chevron svg {
  width: var(--jc-country-select-chevron-size);
  height: var(--jc-country-select-chevron-size);
  display: block;
}

.jc-country-selector__toggle:hover .jc-country-selector__icon--chevron,
.jc-country-selector__toggle:focus-visible .jc-country-selector__icon--chevron,
.jc-country-selector.is-open .jc-country-selector__toggle .jc-country-selector__icon--chevron {
  color: var(--jc-country-select-chevron-color-hover);
}

.jc-country-selector__menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  min-width: 160px;
  background: var(--jc-country-select-dropdown-bg-color);
  border-radius: var(--jc-country-select-dropdown-border-radius);
  border: var(--jc-country-select-dropdown-border);
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  padding: var(--jc-country-select-dropdown-padding);
}

.footer .jc-country-selector__menu {
  left: auto;
  right: 0;
}

.header__menu-mobile-footer-actions .jc-country-selector__menu {
  left: auto;
  right: 0;
  top: auto;
  bottom: 100%;
}

.jc-country-selector__menu[hidden] {
  display: none;
}

.jc-country-selector__item {
  display: block;
  padding: var(--jc-country-select-dropdown-item-bg-padding);
  text-decoration: none;
  background-color: var(--jc-country-select-dropdown-item-bg-color);
  color: var(--jc-country-select-dropdown-item-text);
  font-size: 13px;
  transition: color 0.3s ease, background-color 0.3s ease;
}

a.jc-country-selector__item:hover,
a.jc-country-selector__item:focus-visible {
  background-color: var(--jc-country-select-dropdown-item-bg-color-hover);
  color: var(--jc-country-select-dropdown-item-text-hover);
  outline: none;
}

.jc-country-selector__item--current {
  color: var(--jc-country-select-dropdown-item-text-current);
  cursor: default;
}