/* Modern Minimal Form Styles - Using Site Variables */

/* Remove default styling */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="number"],
textarea,
select {
  /* Reset */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  
  /* Base styling using site variables */
  width: 100%;
  background: transparent;
  color: var(--wp--preset--color--text-body);
  font-size: var(--text-sizes-body);
  font-weight: var(--font-regular);
  line-height: var(--text-sizes-body-line);
  padding: var(--sizes-xs) 0;
  border-bottom: 1px solid var(--wp--preset--color--outline-faint);
  transition: border-color 0.3s ease, color 0.3s ease;
}

/* Placeholder styling */
input::placeholder,
textarea::placeholder {
  color: var(--wp--preset--color--text-body-less);
  opacity: 0.6;
  font-weight: var(--font-light);
}

/* Focus state */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-bottom-color: var(--wp--preset--color--brand-primary, #ff0064);
  color: var(--wp--preset--color--text-heading);
}

/* Hover state */
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="search"]:hover,
input[type="number"]:hover,
textarea:hover,
select:hover {
  border-bottom-color: var(--wp--preset--color--text-body-less);
}

/* Disabled state */
input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Textarea specific */
textarea {
  resize: vertical;
  min-height: 80px;
  line-height: var(--text-sizes-body-line);
}

/* Label styling */
label {
  display: block;
  color: var(--wp--preset--color--text-body-less);
  font-size: var(--text-sizes-body-small);
  font-weight: var(--font-light);
  line-height: var(--text-sizes-body-small-line);
  margin-bottom: var(--sizes-2xs);
  transition: color 0.3s ease;
}

/* Form group spacing */
.form-group {
  margin-bottom: var(--sizes-s);
}

/* Label focus effect (requires :focus-within) */
.form-group:focus-within label {
  color: var(--wp--preset--color--text-body);
}

/* Autofill styling override */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--wp--preset--color--text-body);
  -webkit-box-shadow: 0 0 0px 1000px transparent inset;
  transition: background-color 5000s ease-in-out 0s;
  border-bottom: 1px solid var(--wp--preset--color--outline-faint);
}

/* Select dropdown arrow */
select {
  cursor: pointer;
  padding-right: var(--sizes-l);
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3e%3cpath fill='%23bcbadd' d='M6 8L0 0h12z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right center;
}

select:focus {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3e%3cpath fill='%23fafafa' d='M6 8L0 0h12z'/%3e%3c/svg%3e");
}

/* Toggle Switch (replaces checkbox) */
input[type="checkbox"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 44px;
  height: 24px;
  background: var(--wp--preset--color--neutral-dark);
  border: 1px solid var(--wp--preset--color--outline-faint);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: var(--sizes-s);
  vertical-align: middle;
  flex-shrink: 0;
}

input[type="checkbox"]::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--wp--preset--color--text-body-less);
  top: 2px;
  left: 2px;
  transition: all 0.3s ease;
}

input[type="checkbox"]:hover {
  border-color: var(--wp--preset--color--brand-primary, #ff0064);
}

input[type="checkbox"]:hover::before {
  background: var(--wp--preset--color--brand-primary, #ff0064);
}

input[type="checkbox"]:checked {
  background: var(--wp--preset--color--brand-primary, #ff0064);
  border-color: var(--wp--preset--color--brand-primary, #ff0064);
}

input[type="checkbox"]:checked::before {
  left: 22px;
  background: var(--wp--preset--color--text-heading);
}

input[type="checkbox"]:focus {
  outline: 2px solid var(--wp--preset--color--brand-primary, #ff0064);
  outline-offset: 2px;
}

input[type="checkbox"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Radio buttons - custom styling */
input[type="radio"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--wp--preset--color--outline-faint);
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: var(--sizes-xs);
  vertical-align: middle;
  flex-shrink: 0;
  background: transparent;
}

input[type="radio"]:hover {
  border-color: var(--wp--preset--color--brand-primary, #ff0064);
}

input[type="radio"]:checked {
  border-color: var(--wp--preset--color--brand-primary, #ff0064);
}

input[type="radio"]:checked::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--wp--preset--color--brand-primary, #ff0064);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

input[type="radio"]:focus {
  outline: 2px solid var(--wp--preset--color--brand-primary, #ff0064);
  outline-offset: 2px;
}

input[type="radio"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Label wrapper for checkboxes/radios */
.bf-cc {
  display: flex;
  align-items: center;
  margin-bottom: var(--sizes-m);
  cursor: pointer;
  user-select: none;
  padding: var(--sizes-xs) 0;
  transition: opacity 0.2s ease;
}

.bf-cc:hover {
  opacity: 0.8;
}

.bf-cc label {
  margin: 0;
  cursor: pointer;
  user-select: none;
  flex: 1;
}

/* Legacy support for .form-check */
.form-check {
  display: flex;
  align-items: center;
  margin-bottom: var(--sizes-2xs);
  cursor: pointer;
  user-select: none;
  padding: 0;
  transition: opacity 0.2s ease;
}

.form-check:hover {
  opacity: 0.8;
}

.form-check label {
  margin: 0;
  cursor: pointer;
  user-select: none;
  flex: 1;
}

input[type="submit"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: transparent;
  border: 1px solid var(--wp--preset--color--outline-faint);
  color: var(--wp--preset--color--text-body);
  padding: var(--sizes-s) var(--sizes-xl);
  font-size: var(--text-sizes-body-small);
  font-weight: var(--font-semibold);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: var(--text-sizes-special-label-spacing);
  border-radius: var(--corners-m);
}

input[type="submit"]:hover {
  border-color: var(--wp--preset--color--brand-primary, #ff0064);
  color: var(--wp--preset--color--brand-primary, #ff0064);
}

input[type="submit"]:focus {
  outline: 1px solid var(--wp--preset--color--text-body);
  outline-offset: 2px;
}

input[type="submit"]:active {
  transform: scale(0.98);
}

input[type="submit"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Error state (add .error class to input) */
input.error,
textarea.error,
select.error {
  border-bottom-color: #ff4444;
}

input.error:focus,
textarea.error:focus,
select.error:focus {
  border-bottom-color: #ff6666;
}

/* Success state (add .success class to input) */
input.success,
textarea.success,
select.success {
  border-bottom-color: #44ff44;
}

input.success:focus,
textarea.success:focus,
select.success:focus {
  border-bottom-color: #66ff66;
}

/* Small input variant (add .input-small class) */
input.input-small,
textarea.input-small,
select.input-small {
  font-size: var(--text-sizes-body-small);
  line-height: var(--text-sizes-body-small-line);
  padding: var(--sizes-xs) 0;
}

/* Large input variant (add .input-large class) */
input.input-large,
textarea.input-large,
select.input-large {
  font-size: var(--text-sizes-body-big);
  line-height: var(--text-sizes-body-big-line);
  padding: var(--sizes-m) 0;
}

/* Field wrapper structure */
.btcd-fld-itm {
  margin-bottom: var(--sizes-xs);
}

.bf-fld-wrp {
  width: 100%;
}
.btcd-fld-itm {
  min-height: unset;
}
.bf-lbl-wrp {
  margin-bottom: 0;
}

.bf-lbl {
  display: block;
  color: var(--wp--preset--color--text-body-less);
  font-size: var(--text-sizes-body-small);
  font-weight: var(--font-light);
  line-height: var(--text-sizes-body-small-line);
  transition: color 0.3s ease;
}

.bf-req-smbl {
  color: var(--wp--preset--color--brand-primary, #ff0064);
  margin-left: 2px;
}

.bf-inp-wrp {
  width: 100%;
}

.bf-inp-fld-wrp {
  position: relative;
}

.bf-fld {
  width: 100%;
  background: transparent;
  color: var(--wp--preset--color--text-body);
  font-size: var(--text-sizes-body);
  font-weight: var(--font-regular);
  line-height: var(--text-sizes-body-line);
  padding: var(--sizes-xs) 0;
  border: none;
  border-bottom: 1px solid var(--wp--preset--color--outline-faint);
  transition: border-color 0.3s ease, color 0.3s ease;
  outline: none;
}

.bf-fld:hover {
  border-bottom-color: var(--wp--preset--color--text-body-less);
}

.bf-fld:focus {
  border-bottom-color: var(--wp--preset--color--brand-primary, #ff0064);
  color: var(--wp--preset--color--text-heading);
}

/* Error wrapper and messages */
.bf-err-wrp {
  transition: opacity 0.3s ease, height 0.3s ease;
  overflow: hidden;
}

.bf-err-inner {
  padding-top: 2px;
}

.bf-err-msg {
  color: var(--wp--preset--color--brand-primary, #ff0064);
  font-size: var(--text-sizes-body-small);
  line-height: var(--text-sizes-body-small-line);
  font-weight: var(--font-regular);
}

.bf-err-msg p {
  margin: 0;
}

/* Field error state - when error message is visible */
.bf-err-wrp[style*="opacity: 1"] ~ .bf-inp-fld-wrp .bf-fld,
.bf-inp-wrp:has(.bf-err-wrp[style*="opacity: 1"]) .bf-fld {
  border-bottom-color: var(--wp--preset--color--brand-primary, #ff0064);
  color: var(--wp--preset--color--brand-primary, #ff0064);
}

.bf-err-wrp[style*="opacity: 1"] ~ .bf-inp-fld-wrp .bf-fld:focus,
.bf-inp-wrp:has(.bf-err-wrp[style*="opacity: 1"]) .bf-fld:focus {
  border-bottom-color: var(--wp--preset--color--brand-primary, #ff0064);
  color: var(--wp--preset--color--brand-primary, #ff0064);
}

/* Alternative approach using parent class if you can add a class to the wrapper */
.has-error .bf-fld,
.bf-fld.error {
  border-bottom-color: var(--wp--preset--color--brand-primary, #ff0064) !important;
  color: var(--wp--preset--color--brand-primary, #ff0064) !important;
}

/* Button styles */
.bf-btn {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: transparent;
  border: 1px solid var(--wp--preset--color--outline-faint);
  color: var(--wp--preset--color--text-body);
  padding: var(--sizes-s) var(--sizes-xl);
  font-size: var(--text-sizes-body-small);
  font-weight: var(--font-semibold);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: var(--text-sizes-special-label-spacing);
  border-radius: var(--corners-m);
  position: relative;
}

.bf-btn:hover {
  border-color: var(--wp--preset--color--brand-primary, #ff0064);
  color: var(--wp--preset--color--brand-primary, #ff0064);
}

.bf-btn:focus {
  outline: 1px solid var(--wp--preset--color--brand-primary, #ff0064);
  outline-offset: 2px;
}

.bf-btn:active {
  transform: scale(0.98);
}

.bf-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.bf-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--wp--preset--color--text-body-less);
  border-top-color: var(--wp--preset--color--brand-primary, #ff0064);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: var(--sizes-xs);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Checkbox wrapper - toggle switch */
.bf-cc {
  display: flex;
  align-items: flex-start;
  margin-bottom: var(--sizes-2xs);
  cursor: pointer;
  user-select: none;
  padding: 0;
  transition: opacity 0.2s ease;
}

.bf-cc:hover {
  opacity: 0.8;
}

.bf-cw {
  display: flex;
  align-items: flex-start;
  width: 100%;
}

.bf-ci {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 44px;
  height: 24px;
  min-width: 44px;
  background: var(--wp--preset--color--neutral-dark);
  border: 1px solid var(--wp--preset--color--outline-faint);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: var(--sizes-s);
  flex-shrink: 0;
  margin-top: 2px;
}

.bf-ci::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--wp--preset--color--text-body-less);
  top: 2px;
  left: 2px;
  transition: all 0.3s ease;
}

.bf-cc:hover .bf-ci {
  border-color: var(--wp--preset--color--brand-primary, #ff0064);
}

.bf-cc:hover .bf-ci::before {
  background: var(--wp--preset--color--brand-primary, #ff0064);
}

.bf-ci:checked {
  background: var(--wp--preset--color--brand-primary, #ff0064);
  border-color: var(--wp--preset--color--brand-primary, #ff0064);
}

.bf-ci:checked::before {
  left: 22px;
  background: var(--wp--preset--color--text-heading);
}

.bf-ci:focus {
  outline: 2px solid var(--wp--preset--color--brand-primary, #ff0064);
  outline-offset: 2px;
}

.bf-ci:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bf-cl {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
  width: 100%;
}

/* Hide the old checkbox box and SVG elements */
.bf-bx,
.bf-svgwrp,
.bf-cks {
  display: none !important;
}

.bf-ct {
  flex: 1;
  color: var(--wp--preset--color--text-body-less);
  font-size: var(--text-sizes-body-small);
  line-height: var(--text-sizes-body-small-line);
  font-weight: var(--font-light);
  transition: color 0.2s ease;
  margin-top: 4px;
}

.bf-cc:hover .bf-ct {
  color: var(--wp--preset--color--text-body);
}

.bf-ct p {
  margin: 0;
}

.bf-ct a {
  color: var(--wp--preset--color--brand-primary, #ff0064);
  text-decoration: underline;
  transition: opacity 0.2s ease;
}

.bf-ct a:hover {
  opacity: 0.8;
}