/* Custom country picker styles — matches the reference pill design
   (intl-tel-input v25 default look: pill on left with flag+name+code+arrow,
   phone number input on right, dropdown with search + scrollable list)
   ------------------------------------------------------------------
   Robustness rules:
   - .cp-pill has flex-shrink:0 so it never collapses below its content
   - .cp-pill-name has no max-width/overflow, so the name is always visible
   - .cp-item-name drops min-width:0 so the country list rows never go blank
   - On narrow screens (< 500px) the pill+input stacks vertically
*/

.cp-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
  font: inherit;
  box-sizing: border-box;
  min-width: 0;
}
.cp-wrap:focus-within,
.cp-wrap.cp-open {
  border-color: #0094a2;
  box-shadow: 0 0 0 3px rgba(0, 148, 162, 0.15);
}

.cp-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-right: 1px solid #e5e7eb;
  border-radius: 6px 0 0 6px;
  cursor: pointer;
  font: inherit;
  color: #1f2937;
  white-space: nowrap;
  min-height: 44px;
  flex-shrink: 0;            /* never collapse the pill */
  min-width: max-content;     /* always show full content */
}
.cp-pill:hover {
  background: rgba(0, 148, 162, 0.04);
}
.cp-pill-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  flex: 0 0 24px;
}
.cp-flag-image {
  display: block;
  width: 22px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.cp-pill-name {
  font-weight: 500;
  font-size: 0.95em;
  color: #1f2937;
  white-space: nowrap;
  flex-shrink: 0;
}
.cp-pill-code {
  color: #4b5563;
  font-size: 0.95em;
  flex-shrink: 0;
}
.cp-pill-arrow {
  color: #6b7280;
  font-size: 0.85em;
  margin-left: 2px;
  transition: transform .15s ease;
  flex-shrink: 0;
}
.cp-open .cp-pill-arrow {
  transform: rotate(180deg);
}

.cp-number {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 8px 12px;
  font: inherit;
  background: transparent;
  min-height: 44px;
}
.cp-number::placeholder {
  color: #9ca3af;
}

.cp-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  z-index: 20;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cp-dropdown[hidden] {
  display: none;
}

.cp-search {
  flex: 0 0 auto;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 0;
  padding: 10px 14px;
  font: inherit;
  font-size: 0.95em;
  outline: 0;
  background: #fafafa;
}
.cp-search:focus {
  background: #fff;
  border-bottom-color: #0094a2;
}

.cp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1 1 auto;
  max-height: 260px;
}

.cp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.95em;
  color: #1f2937;
}
.cp-item:hover,
.cp-item:focus {
  background: rgba(0, 148, 162, 0.06);
  outline: 0;
}
.cp-item.cp-active {
  background: rgba(0, 148, 162, 0.1);
  font-weight: 500;
}
.cp-item-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
}
.cp-item-name {
  flex: 1 1 auto;
  /* intentionally NO min-width: 0 — we want the name to always be readable,
     and the code column on the right is fixed-width below. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cp-item-code {
  color: #4b5563;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
  text-align: right;
  min-width: 3.5em;
}

/* Mobile keeps country and number in one horizontal control. */
@media (max-width: 500px) {
  .cp-pill {
    min-width: 0;
    max-width: 58%;
    padding-inline: 9px;
  }
  .cp-pill-name {
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
  }
  .cp-dropdown {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    max-height: 100%;
    border-radius: 0;
    z-index: 1000;
  }
  .cp-list { max-height: none; }
}
