/**
 * WooCommerce Back In Stock Notifications – "Bevaka"-formuläret på produktsidan.
 *
 * Pluginets egna markup (#wc_bis_product_form) stylas här så att det matchar
 * produktsidan: vit ruta med ljus ram, fet rubrik med klock-ikon, fält och
 * röd pill-knapp på samma rad på desktop och staplade i full bredd på mobil.
 * Notiserna (lyckad/fel) skrivs ut av WooCommerce och stylas redan av
 * assets/css/woocommerce-notices.css.
 *
 * Laddas bara på produktsidor via assets/php/back-in-stock-sv.php.
 */

#wc_bis_product_form {
  --bis-red: var(--primary, #c61618);
  --bis-border: #e3dcdc;
  --bis-text: #111111;
  --bis-muted: rgba(17, 17, 17, 0.62);

  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
  margin: 1.25rem 0 1.5rem;
  padding: 1.25rem 1.25rem 1.35rem;
  background: #ffffff;
  border: 1px solid var(--bis-border);
  border-radius: var(--border-radius-lg, 8px);
  box-sizing: border-box;
  line-height: 1.5;
}

#wc_bis_product_form > * {
  box-sizing: border-box;
}

/* Rubrik: "Vill du få ett mejl när produkten finns i lager igen?" */
#wc_bis_product_form .wc_bis_form_title {
  position: relative;
  flex: 0 0 100%;
  margin: 0 0 2px;
  padding-left: 30px;
  font-family: var(--font-heading, inherit);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--bis-text);
}

#wc_bis_product_form .wc_bis_form_title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  background-color: var(--bis-red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/%3E%3Cpath d='M10.3 21a1.94 1.94 0 0 0 3.4 0'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/%3E%3Cpath d='M10.3 21a1.94 1.94 0 0 0 3.4 0'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* E-postfält */
#wc_bis_product_form #wc_bis_email {
  flex: 1 1 220px;
  min-width: 0;
  height: 48px;
  margin: 0;
  padding: 0 18px;
  font-family: var(--font-body, inherit);
  font-size: 15px;
  color: var(--bis-text);
  background: #ffffff;
  border: 1px solid var(--bis-border);
  border-radius: 32px;
  box-shadow: none;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

#wc_bis_product_form #wc_bis_email::placeholder {
  color: rgba(17, 17, 17, 0.5);
  opacity: 1;
}

#wc_bis_product_form #wc_bis_email:hover {
  border-color: #cfc6c6;
}

#wc_bis_product_form #wc_bis_email:focus {
  border-color: var(--bis-red);
  box-shadow: 0 0 0 3px rgba(198, 22, 24, 0.12);
}

/* Knapp: samma röda pill som "Lägg till i varukorg" */
#wc_bis_product_form #wc_bis_send_form {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  min-width: 150px;
  margin: 0;
  padding: 0 28px;
  font-family: var(--font-heading, inherit);
  font-size: 15px;
  font-weight: 600;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  color: #ffffff;
  background: var(--bis-red);
  border: 0;
  border-radius: 32px;
  box-shadow: none;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    transform 0.1s ease;
}

#wc_bis_product_form #wc_bis_send_form:hover {
  background: #a51214;
  color: #ffffff;
}

#wc_bis_product_form #wc_bis_send_form:active {
  transform: translateY(1px);
}

#wc_bis_product_form #wc_bis_send_form:focus-visible {
  outline: 2px solid var(--bis-red);
  outline-offset: 3px;
}

/* Samtycke för konto (visas om pluginet kräver det) */
#wc_bis_product_form .wc_bis_opt_in {
  display: flex;
  flex: 0 0 100%;
  align-items: flex-start;
  gap: 8px;
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--bis-muted);
  cursor: pointer;
}

#wc_bis_product_form .wc_bis_opt_in input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--bis-red);
}

#wc_bis_product_form .wc_bis_opt_in span {
  margin: 0;
}

/* "X kunder bevakar produkten" */
#wc_bis_product_form .wc_bis_registrations_count {
  flex: 0 0 100%;
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--bis-muted);
}

/* "Du bevakar redan produkten" (inloggad kund) */
#wc_bis_already_registered {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 1.25rem;
  font-size: 14px;
  line-height: 1.5;
  color: #111111;
  background: #ffffff;
  border: 1px solid #e3dcdc;
  border-radius: var(--border-radius-lg, 8px);
}

#wc_bis_already_registered a {
  color: var(--primary, #c61618);
  font-weight: 600;
  text-decoration: underline;
}

/* Mobil: fält och knapp staplade i full bredd */
@media (max-width: 768px) {
  #wc_bis_product_form {
    flex-direction: column;
    gap: 10px;
    padding: 1rem;
  }

  #wc_bis_product_form .wc_bis_form_title {
    font-size: 14px;
  }

  #wc_bis_product_form #wc_bis_email,
  #wc_bis_product_form #wc_bis_send_form {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  /* 16px förhindrar att iOS Safari zoomar in vid fokus */
  #wc_bis_product_form #wc_bis_email {
    font-size: 16px;
  }
}
