/* Digits-inspired country code picker — unified phone row + local flag images */

.le-field:has(.le-phone) {
  position: relative;
}

.le-phone {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  position: relative;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  z-index: 1;
}

.le-phone.is-open {
  z-index: 20;
}

.le-phone:focus-within,
.le-phone.is-open {
  border-color: var(--le-btn, var(--le-accent, #ff5c35));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--le-btn, var(--le-accent, #ff5c35)) 18%, transparent);
}

.le-cc__trigger,
.le-auth button.le-cc__trigger,
.le-auth .le-cc__trigger {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 76px !important;
  max-width: 120px !important;
  height: 46px !important;
  min-height: 46px !important;
  margin: 0 !important;
  padding: 0 10px 0 12px !important;
  border: 0 !important;
  border-right: 1px solid #e5e7eb !important;
  border-radius: 10px 0 0 10px !important;
  background: #f9fafb !important;
  background-color: #f9fafb !important;
  color: #111827 !important;
  font-family: inherit !important;
  font-size: 0.92rem !important;
  font-weight: 650 !important;
  line-height: 1 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  box-shadow: none !important;
  cursor: pointer !important;
  direction: ltr !important;
  white-space: nowrap !important;
}

.le-phone.is-open .le-cc__trigger,
.le-auth .le-phone.is-open .le-cc__trigger {
  background: #f3f4f6 !important;
  background-color: #f3f4f6 !important;
}

.le-cc__flag,
.le-cc__option-flag {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 16px;
  flex: 0 0 24px;
  overflow: hidden;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
  background: #e5e7eb;
  line-height: 0;
}

.le-cc__flag[hidden],
.le-cc__option-flag[hidden] {
  display: none !important;
}

.le-cc__flag img,
.le-cc__option-flag img,
.le-auth .le-cc__flag img,
.le-auth .le-cc__option-flag img {
  display: block !important;
  width: 24px !important;
  height: 16px !important;
  max-width: 24px !important;
  max-height: 16px !important;
  object-fit: cover !important;
  border: 0 !important;
  border-radius: 3px;
}

.le-cc__dial {
  font-variant-numeric: tabular-nums;
}

.le-cc__chevron {
  width: 0;
  height: 0;
  margin-left: 1px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #9ca3af;
  transition: transform 0.15s ease;
}

.le-phone.is-open .le-cc__chevron {
  transform: rotate(180deg);
}

.le-phone > input[type='tel'],
.le-auth .le-phone > input[type='tel'] {
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 46px !important;
  min-height: 46px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-radius: 0 10px 10px 0 !important;
  background: #fff !important;
  background-color: #fff !important;
  box-shadow: none !important;
  font-size: 1rem !important;
  direction: ltr !important;
  text-align: left !important;
}

.le-phone > input[type='tel']:focus,
.le-auth .le-phone > input[type='tel']:focus {
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

.le-cc__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  width: 100%;
  min-width: 0;
  max-width: none;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.16);
  overflow: hidden;
  z-index: 60;
  box-sizing: border-box;
}

.le-cc__panel[hidden] {
  display: none !important;
}

/* Backdrop lives outside .le-phone flex — never a visible fake button */
.le-cc__backdrop,
.le-cc__backdrop[hidden] {
  display: none !important;
  position: fixed !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: rgba(17, 24, 39, 0.45) !important;
  z-index: 10040 !important;
  cursor: pointer !important;
  pointer-events: none !important;
}

.le-cc__search-wrap {
  padding: 8px;
  border-bottom: 1px solid #f3f4f6;
  box-sizing: border-box;
}

.le-cc__search,
.le-auth .le-field .le-cc__search,
.le-auth .le-cc__search {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 38px !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 0 12px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  background: #f9fafb !important;
  background-color: #f9fafb !important;
  color: #111827 !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  line-height: 38px !important;
  direction: ltr !important;
  text-align: left !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
}

.le-cc__search:focus,
.le-auth .le-field .le-cc__search:focus {
  border-color: var(--le-btn, var(--le-accent, #ff5c35)) !important;
  background: #fff !important;
  box-shadow: none !important;
  outline: none !important;
}

.le-cc__list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 220px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.le-cc__option {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  margin: 0;
  cursor: pointer;
  direction: ltr;
  text-align: left;
  box-sizing: border-box;
}

.le-cc__option:hover,
.le-cc__option.is-active {
  background: #f9fafb;
}

.le-cc__option.is-selected {
  background: color-mix(in srgb, var(--le-btn, var(--le-accent, #ff5c35)) 12%, #fff);
}

.le-cc__option[hidden] {
  display: none !important;
}

.le-cc__option-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.le-cc__option-dial {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.le-cc__empty {
  padding: 14px 12px;
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
}

.le-auth.le-cc-open .le-auth__shell {
  overflow: visible;
}

.le-auth.le-cc-open .le-auth__card,
.le-auth.le-cc-open .le-panel.is-active,
.le-auth.le-cc-open .le-field {
  overflow: visible;
}

body.le-cc-sheet-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .le-field:has(.le-phone.is-open) > .le-cc__backdrop:not([hidden]) {
    display: block !important;
    pointer-events: auto !important;
  }

  .le-cc__panel {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    top: auto;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: min(72vh, 480px);
    display: flex;
    flex-direction: column;
    z-index: 10050;
    border-radius: 16px;
    box-shadow: 0 20px 48px rgba(17, 24, 39, 0.28);
  }

  .le-cc__panel[hidden] {
    display: none !important;
  }

  .le-cc__list {
    max-height: none;
    flex: 1 1 auto;
  }

  .le-cc__trigger,
  .le-auth button.le-cc__trigger,
  .le-auth .le-cc__trigger {
    min-width: 72px !important;
    padding: 0 8px 0 10px !important;
  }

  .le-phone > input[type='tel'],
  .le-auth .le-phone > input[type='tel'] {
    padding: 0 12px !important;
    font-size: 0.95rem !important;
  }
}

.le-phone__error {
  margin: 6px 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: #dc2626;
  line-height: 1.35;
}

.le-phone__error[hidden] {
  display: none !important;
}

.le-phone.is-invalid {
  border-color: #dc2626;
}

.le-phone.is-invalid:focus-within {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}
