/* ================================================
   Contact Us Popup
   ================================================ */

.contact-us-trigger {
  cursor: pointer;
  color: var(--color-foreground);
  display: flex;
  align-items: center;
  white-space: nowrap;
  padding: 10px 40px;
  border-radius: 10px;
  background: white;

  &:hover {
    color: var(--color-foreground);
    opacity: var(--opacity-subdued-text);
    background: #f0f0f0;
  }

  &__label {
    font-size: var(--header-actions-font-size, 0.875rem);
    font-family: var(--header-actions-font-family, inherit);
    font-weight: var(--header-actions-font-weight, inherit);
    text-transform: var(--header-actions-text-case, none);
    line-height: 1;
  }
  @media screen and (max-width: 749px) {
    padding: 8px 16px;
    &__label {
        font-size: 12px;
    }
  }
}

/* ================================================
   Dialog / Popup
   ================================================ */

.contact-popup {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(520px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: var(--style-border-popover, 1px solid var(--color-border));
  border-radius: var(--style-border-radius-popover, 8px);
  background-color: var(--color-background);
  box-shadow: var(--shadow-popover);
  overflow: hidden;

  /* Enter/exit animation */
  opacity: 0;
  translate: 0 16px;
  transition:
    opacity 0.3s var(--ease-out-cubic, ease),
    translate 0.3s var(--ease-out-cubic, ease),
    display 0.3s allow-discrete,
    overlay 0.3s allow-discrete;

  &[open] {
    opacity: 1;
    translate: 0 0;
  }

  /* Backdrop overlay */
  &::backdrop {
    background-color: rgb(0 0 0 / 0);
    transition:
      background-color 0.3s ease,
      display 0.3s allow-discrete,
      overlay 0.3s allow-discrete;
  }

  &[open]::backdrop {
    background-color: rgb(0 0 0 / 0.45);
  }
}

/* Starting state for enter animation */
@starting-style {
  .contact-popup[open] {
    opacity: 0;
    translate: 0 16px;
  }

  .contact-popup[open]::backdrop {
    background-color: rgb(0 0 0 / 0);
  }
}

/* ================================================
   Popup inner layout
   ================================================ */

.contact-popup__inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}

.contact-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--padding-lg, 1.5rem) var(--padding-xl, 2rem);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background-color: var(--color-background);
  z-index: 1;
}

.contact-popup__title {
  margin: 0;
  font-size: var(--font-size--md, 1.125rem);
  font-family: var(--font-heading--family);
  font-weight: var(--font-heading--weight);
  color: var(--color-foreground);
}

.contact-popup__close {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-foreground);
  cursor: pointer;
  padding: var(--padding-2xs, 0.25rem);
  border-radius: var(--style-border-radius-buttons-primary, 4px);
  transition: opacity var(--animation-speed, 0.2s) var(--animation-easing, ease);

  &:hover {
    opacity: var(--opacity-subdued-text, 0.6);
  }

  .svg-wrapper {
    width: 20px;
    height: 20px;

    svg {
      width: 20px;
      height: 20px;
    }
  }
}

/* ================================================
   Form body
   ================================================ */

.contact-popup__body {
  padding: var(--padding-xl, 2rem);
}

.contact-popup__success {
  padding: var(--padding-md, 1rem);
  margin-bottom: var(--margin-md, 1rem);
  background-color: rgb(var(--color-foreground-rgb) / 0.05);
  border-radius: var(--style-border-radius-buttons-primary, 4px);
  color: var(--color-foreground);
}

.contact-popup__field {
  display: flex;
  flex-direction: column;
  gap: var(--gap-2xs, 0.375rem);
  margin-bottom: var(--margin-md, 1rem);

  &:last-of-type {
    margin-bottom: var(--margin-lg, 1.5rem);
  }
}

.contact-popup__label {
  font-size: var(--font-size--sm, 0.875rem);
  font-family: var(--font-body--family);
  font-weight: var(--font-body--weight);
  color: var(--color-foreground);
}

.contact-popup__input,
.contact-popup__textarea {
  width: 100%;
  padding: var(--padding-xs, 0.5rem) var(--padding-sm, 0.75rem);
  border: 1px solid var(--color-input-border, var(--color-border));
  border-radius: var(--style-border-radius-buttons-primary, 4px);
  background-color: var(--color-input-background, var(--color-background));
  color: var(--color-input-text, var(--color-foreground));
  font-size: var(--font-size--sm, 0.875rem);
  font-family: var(--font-body--family);
  transition: border-color var(--animation-speed, 0.2s) var(--animation-easing, ease);
  box-sizing: border-box;

  &:focus {
    outline: none;
    border-color: var(--color-input-text, var(--color-foreground));
  }

  &::placeholder {
    color: rgb(var(--color-input-text-rgb, var(--color-foreground-rgb)) / 0.4);
  }
}

.contact-popup__textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-popup__submit {
  width: 100%;
  justify-content: center;
}
