/*
 * Contact form — the phone field and the outcome banners.
 *
 * shareek.css carries the frame's own classes (sk-contact-page, sk-form,
 * sk-contact-card-lg). What is here is this site's functionality that the frame
 * has no markup for: the real phone input that intl-tel-input binds, and the
 * success / error banners the form has always reported itself with.
 *
 * Loaded after style.css, which the site fetches through an async loader, so
 * ordering buys nothing — selectors out-specify the legacy rules rather than
 * merely follow them.
 */

/* --- Phone field ------------------------------------------------------ */

/*
 * A dga-text-input cannot be used here: intlTelInputInit() binds
 * .phone-number-input and needs a real input to wrap, and its country selector
 * is what puts the dial code in the submitted number. So the field is built by
 * hand to match the DGA inputs beside it — .input in core.css is a 40px box,
 * 1px border, radius-sm.
 */
.sk-contact-page .sk-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.sk-contact-page .sk-field__label {
  color: var(--text-default, #1f2a37);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

.sk-contact-page .sk-field__control {
  box-sizing: border-box;
  width: 100%;
  height: 40px;
  padding: 0 8px;
  border: 1px solid var(--form-field-border-default, #d0d5dd);
  border-radius: var(--radius-sm, 4px);
  background: var(--form-field-background-default, #fff);
  color: var(--text-default, #1f2a37);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  /* The number reads left-to-right in both locales, as the frame's does. */
  direction: ltr;
}

.sk-contact-page .sk-field__control:focus {
  outline: 2px solid var(--border-brand-primary, #1b8354);
  outline-offset: -1px;
}

.sk-contact-page .sk-field__control.is-invalid {
  border-color: var(--border-error-primary, #d92d20);
}

.sk-contact-page .sk-field__error {
  color: var(--text-error-primary, #d92d20);
  font-size: 12px;
  line-height: 18px;
}

.sk-contact-page .sk-field__error[hidden] {
  display: none;
}

/*
 * intl-tel-input's own stylesheet is not on this page: style.css is not loaded
 * here and the page's CriticalCSS does not carry the .iti rules, so the country
 * list rendered as a 2400px column of every country in the document flow. That
 * predates the rebrand -- the legacy form had it too -- but the markup is this
 * file's now, so the plugin's layout is set out here, matched to the frame's
 * country selector: a 79px block on the field's leading edge.
 */
.sk-contact-page .sk-field-phone .iti {
  display: block;
  position: relative;
  width: 100%;
}

/* The number clears the selector rather than running under it. */
.sk-contact-page .sk-field-phone .sk-field__control {
  padding-inline-start: 88px;
}

.sk-contact-page .iti__country-container {
  position: absolute;
  inset-inline-start: 1px;
  top: 1px;
  bottom: 1px;
  display: flex;
  align-items: stretch;
}

.sk-contact-page .iti__selected-country {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm, 4px) 0 0 var(--radius-sm, 4px);
  background: var(--background-neutral-100, #f3f4f6);
  color: inherit;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.sk-contact-page .iti__selected-country-primary {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Closed state. Without this the whole list sits in the flow. */
.sk-contact-page .iti__hide {
  display: none;
}

.sk-contact-page .iti__dropdown-content {
  position: absolute;
  z-index: 30;
  inset-inline-start: 0;
  top: calc(100% + 4px);
  width: 320px;
  max-width: 90vw;
  border: 1px solid var(--border-neutral-primary, #e5e7eb);
  border-radius: 8px;
  background: var(--background-white, #fff);
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.12);
  overflow: hidden;
}

.sk-contact-page .iti__search-input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border-neutral-primary, #e5e7eb);
  font: inherit;
  font-size: 14px;
}

.sk-contact-page .iti__country-list {
  max-height: 200px;
  margin: 0;
  padding: 4px;
  list-style: none;
  overflow-y: auto;
}

.sk-contact-page .iti__country {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
  cursor: pointer;
}

.sk-contact-page .iti__country:hover,
.sk-contact-page .iti__country.iti__highlight {
  background: var(--background-neutral-50, #f2f4f7);
}

.sk-contact-page .iti__a11y-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* --- Outcome banners -------------------------------------------------- */

.sk-contact-page .sk-form__message {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--border-neutral-primary, #e5e7eb);
  border-radius: 8px;
  background: var(--background-white, #fff);
  color: var(--text-default, #1f2a37);
  font-size: 16px;
  line-height: 24px;
}

.sk-contact-page .sk-form__message[hidden] {
  display: none;
}

.sk-contact-page .sk-form__message--ok {
  border-color: var(--border-brand-primary, #1b8354);
  color: var(--text-brand-primary, #1b8354);
}

.sk-contact-page .sk-form__message--error {
  border-color: var(--border-error-primary, #d92d20);
  color: var(--text-error-primary, #d92d20);
}

/* Pushed to the far edge, so the text keeps the rest of the row. */
.sk-contact-page .sk-form__message-close {
  margin-inline-start: auto;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  line-height: 0;
  cursor: pointer;
}

/* dga-button gets a busy state while the request is in flight. */
.sk-contact-page dga-button.loading {
  pointer-events: none;
  opacity: 0.7;
}

@media (max-width: 767px) {
  .sk-contact-page .sk-form__row {
    grid-template-columns: 1fr;
  }
}
