.country-select {
  position: relative;
  width: 100%;
}

.country-select__native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.country-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--radius-md);
  background: var(--color-white);
  color: var(--color-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.country-select__trigger:hover,
.country-select__trigger:focus {
  border-color: rgba(124, 58, 237, 0.45);
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.country-select--open .country-select__trigger {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.country-select--disabled .country-select__trigger {
  background: rgba(15, 23, 42, 0.04);
  color: var(--color-muted);
  cursor: not-allowed;
}

.country-select--invalid .country-select__trigger {
  border-color: #dc2626;
}

.country-select--placeholder .country-select__trigger-label {
  color: var(--color-muted);
}

.country-select__trigger-content {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
}

.country-select__flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
}

.country-select__flag-img {
  display: block;
  width: 1.35rem;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.country-select__trigger-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-select__trigger-icon {
  flex-shrink: 0;
  color: var(--color-muted);
  transition: transform var(--transition-fast);
}

.country-select--open .country-select__trigger-icon {
  transform: rotate(180deg);
}

.country-select__dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 18rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--radius-md);
  background: var(--color-white);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.country-select__dropdown--floating {
  position: fixed;
  top: auto;
  left: auto;
  z-index: 2000;
}

.modal .country-select__dropdown--floating {
  z-index: 1065;
}

.country-select__option--hidden {
  display: none !important;
}

.country-select__search {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--color-white);
  font: inherit;
}

.country-select__search:focus {
  outline: none;
}

.country-select__list {
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  overflow-y: auto;
}

.country-select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.country-select__option-main {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.country-select__option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-select__option-code {
  flex-shrink: 0;
  color: var(--color-muted);
  font-size: var(--fs-sm);
}

.country-select__option:hover,
.country-select__option--active {
  background: rgba(124, 58, 237, 0.08);
}

.country-select__option--selected {
  background: rgba(124, 58, 237, 0.12);
  font-weight: var(--fw-semibold);
}

.country-select__empty {
  margin: 0;
  padding: 1rem 0.85rem;
  color: var(--color-muted);
  font-size: var(--fs-sm);
  text-align: center;
}

.country-select--auth .country-select__trigger {
  min-height: 3rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-full);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-white);
}

.country-select--auth .country-select__trigger:hover,
.country-select--auth .country-select__trigger:focus {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: none;
}

.country-select--auth.country-select--open .country-select__trigger {
  border-color: rgba(255, 255, 255, 0.45);
}

.country-select--auth.country-select--placeholder .country-select__trigger-label {
  color: rgba(255, 255, 255, 0.65);
}

.country-select--auth .country-select__trigger-icon {
  color: rgba(255, 255, 255, 0.75);
}

.auth-page__country-wrap .country-select--auth .country-select__trigger {
  padding-left: 1rem;
}

.country-select--auth .country-select__flag-img {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.country-select--business .country-select__trigger,
.country-select--admin .country-select__trigger {
  min-height: auto;
}

@media (max-width: 767.98px) {
  .country-select__dropdown--floating {
    max-width: calc(100vw - 1.5rem);
  }
}
