/* Travel Custom v1.0.2 — country selector and CF7 phone number feedback.
   Scoped to the existing telephone widget; all other form styling is retained. */
.sama-forma .iti.tm-phone-input,
.sama-forma-cont .iti.tm-phone-input,
.wpcf7 .iti.tm-phone-input {
  position: relative;
  max-width: 100%;
  vertical-align: top;
}
.iti.tm-phone-input input[type="tel"] {
  padding-left: 56px !important;
  box-sizing: border-box;
}
.iti.tm-phone-input .iti__flag-container { z-index: 4; }
.iti.tm-phone-input .iti__selected-flag { min-width: 45px; cursor: pointer; }
.iti.tm-phone-input .iti__arrow { border-top-color: #ddd; }
.iti.tm-phone-input .iti__arrow.iti__arrow--up { border-bottom-color: #ddd; }
/* The dropdown is attached to document.body, so clipped parent form
   containers and modal overflow cannot hide the country choices. */
.iti--container { z-index: 2147482000 !important; }
.iti--container .iti__country-list {
  background: #fff !important;
  color: #242424 !important;
  border: 1px solid #ddd;
  border-radius: 6px;
  max-height: min(300px, 55vh);
  overflow-y: auto;
  text-align: left;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0,0,0,.20);
}
.iti--container .iti__country { color: #242424; cursor: pointer; }
.iti--container .iti__dial-code { color: #626262; }
.iti--container .iti__country.iti__highlight { background: #f1edf9; }
.tm-phone-error { display: none; clear: both; width: 100%; color: #ffe7a9; font: 500 12px/1.35 Gilroy, Arial, sans-serif; margin-top: 5px; text-align: left; }
.tm-phone-error.tm-visible { display: block; }
.sama-forma-cont .tm-phone-error { color: #bb2626; }
.iti.tm-phone-input.tm-phone-invalid input[type="tel"] { border-color: #ffca76 !important; }
/* Use the same compact responsive widths as the site's existing form fields. */
@media (max-width: 768px) {
  .sama-forma .iti.tm-phone-input,
  .sama-forma-cont .iti.tm-phone-input,
  .wpcf7 .iti.tm-phone-input { max-width: 100%; }
  .iti--container .iti__country-list { max-width: calc(100vw - 22px); white-space: normal; }
}

/* Ship the existing matching flag sprite in the child theme as a fallback for
   relative-path issues in caches/CDNs. The parent theme is not changed. */
.iti__flag { background-image: url("../img/flags.png") !important; }
@media (min-resolution: 2dppx) {
  .iti__flag { background-image: url("../img/flags@2x.png") !important; }
}

/* v1.0.3 — Prevent dynamic phone errors from shifting the desktop form row.
   The phone field itself remains 44px high and aligned with name/email;
   its message is anchored immediately below. Does not affect Send/CF7.
*/
@media (min-width: 993px) {
  section.forma .sama-forma .wpcf7-form-control-wrap.tm-phone-field {
    position: relative !important;
  }
  section.forma .sama-forma .wpcf7-form-control-wrap.tm-phone-field > .tm-phone-error {
    position: absolute !important;
    top: calc(100% + 5px) !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    pointer-events: none;
    z-index: 3;
    overflow-wrap: anywhere;
  }
}
/* On small screens the fields are stacked. The message remains in normal
   flow so it pushes the next field/button down instead of overlapping it. */
@media (max-width: 992px) {
  section.forma .sama-forma .wpcf7-form-control-wrap.tm-phone-field > .tm-phone-error {
    position: static !important;
    display: none;
    width: 100% !important;
    margin: 5px 0 0 !important;
    box-sizing: border-box !important;
    overflow-wrap: anywhere;
  }
  section.forma .sama-forma .wpcf7-form-control-wrap.tm-phone-field > .tm-phone-error.tm-visible {
    display: block;
  }
}
