/* Overlay inside the phone input — same spot as the original KSA flag */
.phone-with-code {
  position: relative;
  overflow: visible;
  z-index: 3;
}

.phone-with-code:has(.country-code-picker.is-open) {
  z-index: 30;
}

.phone-with-code .form-control {
  padding-inline-end: 108px;
}

.country-code-picker {
  position: relative;
  display: inline-block;
}

.country-code-picker--overlay {
  position: absolute;
  top: 10px;
  inset-inline-end: 12px;
  inset-inline-start: auto;
  z-index: 6;
}

.country-code-picker-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: auto;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #1e1e1e;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  direction: ltr;
}

.country-code-picker-toggle:focus {
  outline: none;
}

.country-code-picker-flag {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.country-code-picker-code {
  font-size: 14px;
  font-weight: 600;
}

.country-code-picker-caret {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  opacity: 0.7;
}

.country-code-picker-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  width: 280px;
  max-height: 320px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d9e0ea;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.14);
  z-index: 50;
}

.country-code-picker.is-open .country-code-picker-menu {
  display: flex;
  flex-direction: column;
}

.country-code-picker-search {
  width: 100%;
  border: none;
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}

.country-code-picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  max-height: 260px;
}

.country-code-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  text-align: start;
  cursor: pointer;
  font-size: 13px;
  color: #1e1e1e;
}

.country-code-picker-item:hover,
.country-code-picker-item.is-active {
  background: #f3f6fb;
}

.country-code-picker-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-code-picker-item-code {
  color: #667085;
  font-weight: 600;
}

.country-code-picker--inline {
  width: 100%;
}

.country-code-picker--inline .country-code-picker-toggle {
  width: 100%;
  min-width: 110px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #d9e0ea;
  border-radius: 8px;
  background: #fff;
}

.input-group .country-code-picker {
  overflow: visible;
  z-index: 5;
  flex: 0 0 auto;
}
