:root {
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  input[type="password"],
  input[type="search"],
  textarea,
  .input-text {
    width: 100%;
    height: 72px;
    padding: 24px;
    background-color: #fff;
    color: var(--color-black);
    border: 1px solid var(--color-light);
    border-radius: 4px;
    -webkit-appearance: none;
    box-sizing: border-box;
    box-shadow: unset;
    font-size: var(--fs-caption);
    font-family: var(--secondary-font-family);
    font-weight: 300;
    transition: all 0.3s ease;

    &::placeholder {
      opacity: 1 !important;
      color: var(--color-light) !important;
    }

    &:hover,
    &:focus {
      background-color: #fff;
      outline: none;
      border-color: var(--color-dim);
    }
  }
}

/* Form */
.wpcf7-form {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 40px;
  margin: 0 auto;

  p {
    transition: 0.6s ease-in-out;
    margin: 0;
  }

  .loader-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    z-index: 9;
    transition: 0.6s ease-in-out;
  }

  /* Submitting */
  &.submitting {
    p {
      opacity: 0;
      pointer-events: none;
    }
    .loader-container {
      opacity: 1;
    }
  }
  /* After sent */
  &.response {
    p {
      opacity: 0;
      animation: showFields 0.6s 5.5s forwards ease-out;
    }
    .loader-container {
      opacity: 0;
    }

    .wpcf7-response-output {
      display: flex !important;
      opacity: 0;
      animation: showResponse 0.6s 0.5s forwards ease-out,
        hideResponse 0.6s 5.5s forwards ease-out;
    }
  }

  /* Response output */
  .wpcf7-response-output {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    max-width: 100%;
    width: 100%;
    min-width: 319px !important;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 23px;
    text-align: center;
    font-family: var(--secondary-font-family);
    font-size: var(--fs-h3);
    line-height: var(--lh-h3);
    opacity: 0.8;
    color: var(--color-dark);
    font-weight: 300;
    transform: translate(-50%, -50%);

    @media (--min-md) {
      font-size: var(--fs-h2-desktop);
    }
  }

  &.failed .wpcf7-response-output {
    color: var(--black);
  }

  /* Contact form 7 */
  .wpcf7-not-valid-tip {
    display: none !important;
  }

  /* Error */
  .error-message {
    position: absolute;
    display: block;
    width: 100%;
    margin-top: 8px;
    color: var(--color-red);
    pointer-events: none;
    font-size: 13.5px;
    line-height: 120%;
    font-family: var(--secondary-font-family);
    font-weight: 400;
    letter-spacing: 0%;
  }
}

/* Consents */
.acceptances-wrap {
  position: relative;

  .newsletter-input {
    display: flex;
    justify-content: flex-start;
    gap: 5px;

    .wpcf7-form-control-wrap {
      position: static;
    }

    .wpcf7-list-item {
      margin: 0;

      label {
        display: flex;
        align-items: center;
        gap: 12px;
        cursor: pointer;

        .wpcf7-list-item-label {
          line-height: var(--lh-caption);
          font-size: var(--fs-caption);
          font-family: var(--secondary-font-family);
          font-weight: 300;
        }
      }

      @media (hover: hover) {
        &:hover input[type="checkbox"] {
          border-color: var(--color-black);
        }
      }
    }

    .newsletter-link {
      cursor: pointer;
      color: inherit;
      text-underline-offset: 2px;
      word-spacing: 0.1em;
      font-size: var(--fs-caption);
      font-family: var(--secondary-font-family);
      font-weight: 300;
      line-height: var(--lh-caption);
      text-decoration: underline;
      transition: all 0.3s ease;

      &:focus {
        outline: none;
        opacity: 0.5;
      }

      &:hover {
        text-decoration: none;
        opacity: 0.5;
      }
    }
  }

  input[type="checkbox"] {
    all: unset;
    grid-column: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 23px;
    height: 23px;
    width: 23px;
    margin: 0;
    background-color: #fff;
    border: 1px solid var(--color-light);
    border-radius: 3px;
    transition: background-color 0.2s ease, border-color 0.2s ease;

    &:before {
      background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTIiIHZpZXdCb3g9IjAgMCAxNiAxMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTUuMDg0NzEgOS40Njc1NkwxLjI5MTY0IDUuNzM2MDJMMCA2Ljk5Nzc2TDUuMDg0NzEgMTJMMTYgMS4yNjE3NEwxNC43MTc1IDBMNS4wODQ3MSA5LjQ2NzU2WiIgZmlsbD0iI0ZCRkJGQiIvPgo8L3N2Zz4K);
      background-position: 50%;
      background-repeat: no-repeat;
      background-size: cover;
      content: "";
      display: block;
      height: 12px;
      scale: 0.7;
      width: 16px;

      transition: scale 0.2s ease;
    }

    &:checked {
      border-color: var(--color-black);
      background-color: var(--color-black);

      &:before {
        scale: 1;
      }
    }
  }

  .error-message {
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 7px;
  }
}

/* Submit */
button[type="submit"] {
  position: absolute;
  top: calc((72px - 48px) / 2);
  right: calc((72px - 48px) / 2);
  height: 48px;
  padding: 0;
  background: transparent;

  rect {
    fill: #7f8f801f;
    transition: fill 0.3s ease;
  }

  &:hover {
    background-color: unset;
    border-color: unset;
    color: unset;

    rect {
      fill: var(--color-light);
    }
  }

  &:focus {
    outline: unset;
    box-shadow: unset;
  }
}

/* Dodajemy keyframes dla lepszej kontroli */
@keyframes showFields {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes showResponse {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes hideResponse {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Loader */
@keyframes loader {
  0% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(180deg);
  }
  50% {
    transform: rotate(180deg);
  }
  75% {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(360deg);
  }
}
@keyframes loader-inner {
  0% {
    height: 0%;
  }
  25% {
    height: 0%;
  }
  50% {
    height: 100%;
  }
  75% {
    height: 100%;
  }
  to {
    height: 0%;
  }
}

.loader-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.loader.modal-loader {
  margin: 60px auto;
}

.loader {
  --cal-brand-color: white;
  display: block;
  width: 30px;
  height: 30px;
  position: relative;
  border-width: 4px;
  border-style: solid;
  border-color: var(--color-dim);
  animation: loader 2s infinite ease;

  p,
  .loader-inner {
    vertical-align: top;
    display: inline-block;
    width: 100%;
    background-color: var(--color-dim);
    opacity: 0.9 !important;
    animation: loader-inner 2s infinite ease-in !important;
  }
}
