/*
 * Contact Form 7 (avalonnordic.se's forms) in the look of the theme's Gravity Forms (avalon-nordic
 * assets/css/forms.css): blue labels above full-width fields, light borders, the navy button.
 */

.wpcf7 {
  max-width: 720px;
  margin: 24px 0;
}

.wpcf7-form p {
  margin: 0 0 20px;
}

/* labels: CF7's wpautop puts the fields of one paragraph between <br>s; each label is a row of its own */
.wpcf7-form label {
  display: block;
  margin: 0 0 20px;
  color: #012b55;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.wpcf7-form label > br,
.wpcf7-form label + br,
.wpcf7-form p > br:has(+ label) {
  display: none;
}

.wpcf7-form-control-wrap {
  display: block;
  margin-top: 8px;
}

.wpcf7-form input[type="text"],
.wpcf7-form input[type="email"],
.wpcf7-form input[type="tel"],
.wpcf7-form input[type="number"],
.wpcf7-form input[type="date"],
.wpcf7-form input[type="url"],
.wpcf7-form textarea,
.wpcf7-form select {
  box-sizing: border-box;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 0;
  background-color: #fff;
  color: #282828;
  font-family: inherit;
  font-size: 16px; /* 16px: phones do not zoom into the field */
  font-weight: 400;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.wpcf7-form textarea {
  height: 160px;
  resize: vertical;
}

.wpcf7-form select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23012b55' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.wpcf7-form input:focus,
.wpcf7-form textarea:focus,
.wpcf7-form select:focus {
  outline: none;
  border-color: #012b55;
  box-shadow: 0 0 0 2px rgba(1, 43, 85, 0.1);
}

.wpcf7-form input[type="file"] {
  max-width: 100%;
  font-size: 14px;
}

/* radio buttons and checkboxes */
.wpcf7-form .wpcf7-list-item {
  display: inline-block;
  margin: 8px 24px 0 0;
}

.wpcf7-form .wpcf7-list-item label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #282828;
  font-weight: 400;
  cursor: pointer;
}

.wpcf7-form input[type="radio"],
.wpcf7-form input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #012b55;
  cursor: pointer;
}

/* the button: the theme's navy button */
.wpcf7-form .wpcf7-submit {
  padding: 12px 32px;
  border: 1px solid var(--wp--preset--color--navy, #012b55);
  border-radius: 0;
  background-color: var(--wp--preset--color--navy, #012b55);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.wpcf7-form .wpcf7-submit:hover,
.wpcf7-form .wpcf7-submit:focus-visible {
  background-color: #00436b;
}

.wpcf7-form .wpcf7-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.wpcf7-spinner {
  vertical-align: middle;
}

/* messages */
.wpcf7-not-valid-tip {
  margin-top: 6px;
  color: #b42318;
  font-size: 13px;
  font-weight: 400;
}

.wpcf7 form .wpcf7-response-output {
  margin: 20px 0 0;
  padding: 12px 16px;
  border: 1px solid #012b55;
  font-size: 14px;
}

.wpcf7 form.sent .wpcf7-response-output {
  border-color: #2e7d32;
}

.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.aborted .wpcf7-response-output,
.wpcf7 form.spam .wpcf7-response-output {
  border-color: #b42318;
}

.wpcf7-form input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 16px;
  border: 1px solid #012b55;
  border-radius: 0;
  background: #fff;
  color: #012b55;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

/* a long list of checkboxes (the warranty form's products): in columns, one per row on phones */
.wpcf7-form .wpcf7-checkbox {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 24px;
  margin-top: 8px;
}

.wpcf7-form .wpcf7-checkbox .wpcf7-list-item {
  margin: 0;
}

/* the newsletter form in the navy site footer: no extra margins, the field and the button in one row, the accent
   (light blue) button so it shows on the navy background */
.an-site-footer .wpcf7 {
  max-width: 420px;
  margin: 12px 0 0;
}

.an-site-footer .wpcf7-form p,
.an-site-footer .wpcf7-form .newsletter-input {
  display: flex;
  gap: 8px;
  margin: 0;
}

.an-site-footer .wpcf7-form .wpcf7-form-control-wrap {
  flex: 1 1 auto;
}

.an-site-footer .wpcf7-form .wpcf7-submit {
  border-color: var(--wp--preset--color--accent, #01a6e6);
  background-color: var(--wp--preset--color--accent, #01a6e6);
  color: #fff;
}

.an-site-footer .wpcf7-form .wpcf7-submit:hover,
.an-site-footer .wpcf7-form .wpcf7-submit:focus-visible {
  background-color: #fff;
  color: var(--wp--preset--color--navy, #012b55);
}

.an-site-footer .wpcf7-response-output {
  color: #fff;
}
