/* International Telephone Input - Fix v3.0 */

/* Main wrapper */
.intl-tel-input {
  display: block !important;
  width: 100% !important;
  position: relative !important;
}

/* KEEP the theme phone icon */
div.wpcf7 .form-style-1 .style-line.icon-phone:before,
div.wpcf7 .form-style-3 .style-line.icon-phone:before,
div.wpcf7 .form-style-7 .style-line.icon-phone:before {
  display: block !important;
  z-index: 12 !important;
  pointer-events: none !important;
}

/* Shift flag container to the right of the theme icon */
div.wpcf7 .style-line.icon-phone .intl-tel-input .flag-container {
  left: 32px !important;
}

div.wpcf7 .style-line.icon-phone .intl-tel-input input[type="tel"],
div.wpcf7 .style-line.icon-phone .intl-tel-input input.wpcf7-intl-tel {
  padding-left: 86px !important;
}

/* Also shift the click overlay when phone icon exists */
div.wpcf7 .style-line.icon-phone .intl-tel-input .itl-click-overlay {
  left: 32px !important;
}

/* Flag container */
.intl-tel-input .flag-container {
  position: absolute !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  right: auto !important;
  padding: 0 !important;
  z-index: 10 !important;
  width: 50px !important;
}

/* Selected flag button */
.intl-tel-input .selected-flag {
  z-index: 11 !important;
  position: relative !important;
  width: 50px !important;
  height: 100% !important;
  padding: 0 0 0 8px !important;
  display: flex !important;
  align-items: center !important;
  cursor: pointer !important;
  background: transparent !important;
}

.intl-tel-input .selected-flag .iti-flag {
  display: inline-block !important;
  position: relative !important;
  top: auto !important;
  bottom: auto !important;
  margin: 0 !important;
}

.intl-tel-input .selected-flag .iti-arrow {
  position: relative !important;
  display: inline-block !important;
  margin-left: 6px !important;
  margin-top: 0 !important;
  top: auto !important;
  right: auto !important;
  width: 0 !important;
  height: 0 !important;
  border-left: 3px solid transparent !important;
  border-right: 3px solid transparent !important;
  border-top: 4px solid #555 !important;
  border-bottom: none !important;
}

.intl-tel-input .selected-flag .iti-arrow.up {
  border-top: none !important;
  border-bottom: 4px solid #555 !important;
}

/* Phone input - make room for flag */
.intl-tel-input input[type="tel"],
.intl-tel-input input.wpcf7-intl-tel {
  padding-left: 58px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* ============================================
   TRANSPARENT CLICK OVERLAY on flag area
   Sits on top of everything to capture touches
   ============================================ */
.itl-click-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 55px !important;
  height: 100% !important;
  z-index: 999 !important;
  cursor: pointer !important;
  background: transparent !important;
  -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}

/* ============================================
   HIDE ALL original plugin dropdowns
   Both inside wrapper AND when moved to body
   ============================================ */
.intl-tel-input .country-list,
.iti-container,
.iti-container .country-list {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* ============================================
   OUR floating dropdown (appended to body)
   ============================================ */
.itl-dropdown-fixed {
  display: none;
  position: absolute;
  z-index: 9999999;
  background: #ffffff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  width: 320px;
  max-height: 350px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Search box */
.itl-search-box {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-bottom: 2px solid #eee;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
  background: #fafafa;
  color: #333;
  border-radius: 8px 8px 0 0;
  -webkit-appearance: none;
  appearance: none;
}

.itl-search-box:focus {
  background: #fff;
  border-bottom-color: #ccc;
}

.itl-search-box::placeholder {
  color: #999;
}

/* Scrollable country list */
.itl-country-list-custom {
  max-height: 290px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Country row */
.itl-row {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  background: #fff;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.15s;
}

.itl-row:last-child {
  border-bottom: none;
}

.itl-row:hover,
.itl-row:active {
  background: #f0f4ff;
}

/* Country name */
.itl-name {
  flex: 1;
  color: #222;
  font-size: 14px;
  font-weight: 400;
  margin-right: 8px;
}

/* Dial code */
.itl-dial {
  color: #888;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

/* Theme overrides - prevent clipping for flag area */
div.wpcf7 .style-line,
div.wpcf7 .wpcf7-form-control-wrap {
  overflow: visible !important;
}

div.wpcf7 .form-style-1 .style-line,
div.wpcf7 .form-style-2 .style-line,
div.wpcf7 .form-style-3 .style-line,
div.wpcf7 .form-style-7 .style-line {
  overflow: visible !important;
}

div.wpcf7 .columns_wrap {
  overflow: visible !important;
}

/* ============================================
   Mobile adjustments
   ============================================ */
@media (max-width: 767px) {
  .itl-dropdown-fixed {
    max-height: 320px;
    border-radius: 6px;
  }

  .itl-row {
    padding: 12px 14px;
    min-height: 44px;
  }

  .itl-click-overlay {
    min-height: 44px !important;
  }
}
