/* ==========================================================================
   M&M Equipment — Modern Mobile-First International Phone Input (intl-tel-input v24)
   Enhances Gravity Forms phone inputs (#input_{2,3,4,6,7,8,9}_3) in-place with
   country flag, separate dial code, searchable country picker, and mobile sheet
   without altering field IDs or historical entry data.
   ========================================================================== */

body .gform_wrapper .iti,
body #myModalForm .iti,
body .mm-ct-formcard .iti,
body .mm-sell .iti,
body .mm-apr .iti,
body .dforms .iti {
  width: 100% !important;
  display: block !important;
  position: relative !important;
}

/* Country flag + dial code trigger button inside left side of input */
body .gform_wrapper .iti__country-container {
  top: 1px !important;
  bottom: 1px !important;
  left: 1px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
}

body .gform_wrapper .iti__selected-country {
  height: 100% !important;
  padding: 0 8px 0 10px !important;
  background: #f8fafc !important;
  border-right: 1px solid #e2e8f0 !important;
  border-radius: 7px 0 0 7px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  transition: background-color .15s ease !important;
}

body .gform_wrapper .iti__selected-country:hover,
body .gform_wrapper .iti__selected-country:focus {
  background: #f1f5f9 !important;
}

body .gform_wrapper .iti__selected-dial-code {
  margin-left: 3px !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  font-variant-numeric: tabular-nums !important;
}

body .gform_wrapper .iti__arrow {
  margin-left: 4px !important;
  border-top-color: #64748b !important;
}

body .gform_wrapper .iti__arrow--up {
  border-bottom-color: #263878 !important;
}

/* Phone text input — >=16px on mobile prevents iOS auto-zoom; JS sets exact padding-left !important */
body .gform_wrapper .iti input.iti__tel-input,
body #myModalForm #gform_9 .iti input.iti__tel-input,
body .mm-ct-formcard .iti input.iti__tel-input,
body .mm-sell #gform_4 .iti input.iti__tel-input,
body .mm-apr #gform_6 .iti input.iti__tel-input,
body .dforms .gform_wrapper .iti input.iti__tel-input {
  width: 100% !important;
  min-height: 46px !important;
  padding-top: 11px !important;
  padding-right: 13px !important;
  padding-bottom: 11px !important;
  font-size: 15.5px !important;
  line-height: 1.4 !important;
  color: #0f172a !important;
  background-color: #ffffff !important;
  border-radius: 8px !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

@media (max-width: 767.98px) {
  body .gform_wrapper .iti input.iti__tel-input,
  body #myModalForm #gform_9 .iti input.iti__tel-input {
    font-size: 16px !important;
    min-height: 48px !important;
  }
}

/* Dropdown & Mobile Fullscreen Popup — MUST sit above #myModalForm (z-index: 9999999) */
.iti__dropdown-content,
body .iti--container {
  z-index: 10000050 !important;
  font-family: "Nunito Sans", -apple-system, BlinkMacSystemFont, sans-serif !important;
}

.iti__dropdown-content {
  border-radius: 12px !important;
  border: 1px solid #dbe3ef !important;
  box-shadow: 0 18px 44px rgba(11, 37, 75, 0.22) !important;
  overflow: hidden !important;
  background: #ffffff !important;
}

/* Country search input inside dropdown */
.iti__search-input {
  width: 100% !important;
  padding: 11px 14px 11px 36px !important;
  margin: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-radius: 0 !important;
  font-size: 15px !important;
  color: #0f172a !important;
  background-color: #f8fafc !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%2364748b%27 stroke-width=%272.2%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Ccircle cx=%2711%27 cy=%2711%27 r=%277%27/%3E%3Cpath d=%27m21 21-4.3-4.3%27/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: 12px center !important;
  background-size: 16px !important;
  outline: none !important;
  box-shadow: none !important;
}

.iti__search-input:focus {
  background-color: #ffffff !important;
  border-bottom-color: #F05123 !important;
}

.iti__country-list {
  max-height: 250px !important;
  margin: 0 !important;
  padding: 4px 0 !important;
  list-style: none !important;
  scrollbar-width: thin;
}

.iti__country {
  padding: 9px 14px !important;
  font-size: 14px !important;
  color: #1e293b !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.iti__country.iti__highlight,
.iti__country:hover {
  background-color: #fff4ef !important;
}

.iti__country-name {
  color: #0f172a !important;
  font-weight: 600 !important;
}

.iti__dial-code {
  color: #64748b !important;
  font-weight: 700 !important;
  margin-left: auto !important;
}

/* Mobile bottom-sheet / fullscreen popup polish */
.iti--fullscreen-popup.iti--container {
  background-color: rgba(11, 37, 75, 0.58) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  backdrop-filter: blur(4px) !important;
  padding: 16px !important;
  display: flex !important;
  align-items: flex-end !important;
  justify-content: center !important;
}

.iti--fullscreen-popup .iti__dropdown-content {
  width: 100% !important;
  max-width: 480px !important;
  max-height: 78vh !important;
  border-radius: 16px !important;
  display: flex !important;
  flex-direction: column !important;
}

.iti--fullscreen-popup .iti__country-list {
  max-height: none !important;
  flex: 1 1 auto !important;
  overflow-y: auto !important;
}

/* Error border propagation onto phone input */
body .gform_wrapper .gfield_error .iti input.iti__tel-input,
body .gform_wrapper .iti input.iti__tel-input.error {
  border-color: #e23b1e !important;
}
