.country-select {
  position: relative;
  width: 100%;
  min-height: 44px;
}

.country-select-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: color-mix(in oklch, var(--fg) 82%, black);
  background: var(--surface);
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.country-select-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--accent) 16%, transparent);
}

.country-selected-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-select-chevron {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-left: 3px;
  border-right: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 150ms ease;
}

.country-select-trigger[aria-expanded="true"] .country-select-chevron {
  transform: translateY(2px) rotate(225deg);
}

.country-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: 158px;
  max-width: calc(100vw - 42px);
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px color-mix(in oklch, var(--fg) 20%, transparent);
}

.country-options[hidden] {
  display: none;
}

.country-option {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  color: color-mix(in oklch, var(--fg) 86%, black);
  background: transparent;
  font-size: 11px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.country-option:hover,
.country-option:focus-visible,
.country-option[aria-selected="true"] {
  color: var(--fg);
  background: color-mix(in oklch, var(--accent) 10%, var(--surface));
}

.country-native-select {
  display: none;
}

.country-flag {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 18px;
  height: 12px;
  margin-right: 5px;
  overflow: hidden;
  border: 1px solid color-mix(in oklch, var(--muted) 32%, transparent);
  border-radius: 2px;
  box-shadow: 0 1px 2px color-mix(in oklch, var(--fg) 12%, transparent);
}

.country-flag--india {
  background: linear-gradient(to bottom, oklch(73% 0.18 55) 0 33.333%, white 33.333% 66.666%, oklch(56% 0.18 146) 66.666% 100%);
}

.country-flag--india::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  border: 1px solid oklch(45% 0.16 260);
  border-radius: 50%;
  content: "";
  transform: translate(-50%, -50%);
}

.country-flag--indonesia {
  background: linear-gradient(to bottom, oklch(55% 0.22 29) 0 50%, white 50% 100%);
}

.country-flag--bengal {
  background: oklch(47% 0.13 164);
}

.country-flag--bengal::after {
  position: absolute;
  top: 50%;
  left: 45%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: oklch(58% 0.2 25);
  content: "";
  transform: translate(-50%, -50%);
}

.country-flag--pakistan {
  background: linear-gradient(to right, white 0 24%, oklch(39% 0.11 161) 24% 100%);
}

.country-flag--pakistan::before {
  position: absolute;
  top: 2px;
  left: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  box-shadow: 2px 0 0 white;
  content: "";
}

.country-flag--pakistan::after {
  position: absolute;
  top: 3px;
  right: 2px;
  width: 3px;
  height: 3px;
  background: white;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 2% 35%, 39% 35%);
  content: "";
}

.lang-urd .country-options {
  right: 0;
  left: auto;
}

.lang-urd .country-selected-label,
.lang-urd .country-option {
  text-align: right;
}
