/* ====== DEBE Forms — Design System Integration ====== */
/* Markup lives in debe-core/includes/forms; this file only styles it. */

/* ── Layout ──────────────────────────────────────────────── */
.debe-form__fields {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Field wrapper ───────────────────────────────────────── */
.debe-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

/* ── Labels ──────────────────────────────────────────────── */
.debe-form__label {
  font-family: "Poppins", sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgb(var(--label-text));
}
.debe-form__req {
  color: rgb(var(--brand));
}

/* ── Inputs & textarea ───────────────────────────────────── */
.debe-form__input,
.debe-form__textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: "Poppins", sans-serif;
  font-size: 0.875rem;
  font-weight: 300;
  color: rgb(var(--input-text));
  background: rgb(var(--input-bg));
  border: 1px solid rgb(var(--input-border));
  border-radius: 0.5rem;
  outline: none;
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}
.debe-form__input::placeholder,
.debe-form__textarea::placeholder {
  color: rgb(var(--input-placeholder));
  font-weight: 300;
}
.debe-form__input:focus,
.debe-form__textarea:focus {
  border-color: rgb(var(--input-border-focus));
  box-shadow: 0 0 0 3px rgba(var(--input-ring-focus), 0.1);
}
.debe-form__textarea {
  min-height: 160px;
  resize: vertical;
}

/* ── Validation state ────────────────────────────────────── */
.debe-form__field--invalid .debe-form__input,
.debe-form__field--invalid .debe-form__textarea {
  border-color: rgb(var(--state-error));
  box-shadow: 0 0 0 3px rgba(var(--state-error), 0.08);
}
.debe-form__error {
  font-family: "Poppins", sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: rgb(var(--state-error));
}

/* ── Acceptance (DSGVO) checkbox ─────────────────────────── */
.debe-form__field--acceptance {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgb(var(--divider));
}
/* Error wraps onto its own full-width line below the checkbox + label. */
.debe-form__field--acceptance .debe-form__error {
  flex-basis: 100%;
  margin-top: 0.25rem;
}
.debe-form__field--acceptance input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0;
  border: 1.5px solid rgb(var(--input-border));
  border-radius: 0.3125rem;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  transition:
    border-color 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.debe-form__field--acceptance input[type="checkbox"]:hover {
  border-color: rgb(var(--input-placeholder));
  box-shadow: 0 0 0 3px rgba(var(--brand), 0.08);
}
.debe-form__field--acceptance input[type="checkbox"]:focus-visible {
  outline: 2px solid rgb(var(--brand));
  outline-offset: 2px;
}
.debe-form__field--acceptance input[type="checkbox"]:checked {
  background: rgb(var(--brand));
  border-color: rgb(var(--brand));
}
.debe-form__field--acceptance input[type="checkbox"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E");
  background-size: 75%;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity 0.2s ease,
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.debe-form__field--acceptance input[type="checkbox"]:checked::after {
  opacity: 1;
  transform: scale(1);
}
.debe-form__acceptance-label {
  flex: 1 1 0;
  min-width: 0;
  font-family: "Poppins", sans-serif;
  font-size: 0.8125rem;
  font-weight: 300;
  line-height: 1.6;
  color: rgb(var(--text));
  cursor: pointer;
}
.debe-form__acceptance-label a {
  color: rgb(var(--brand));
  text-decoration: underline;
}
.debe-form__acceptance-label a:hover {
  color: rgb(var(--brand-text));
}

/* ── Section heading (html content block) ────────────────── */
.debe-form__section {
  font-family: "Quicksand", sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: rgb(var(--heading));
  margin: 1rem 0 0.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgb(var(--divider));
}
.debe-form__fields > .debe-form__block:first-child .debe-form__section {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* ── Checkbox group ──────────────────────────────────────── */
.debe-form__field--checkbox {
  margin: 0;
  padding: 0;
  border: 0;
}
.debe-form__field--checkbox > .debe-form__label {
  margin-bottom: 0.625rem;
}
.debe-form__checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem 1.25rem;
}
@media (min-width: 640px) {
  .debe-form__checkbox-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (min-width: 1024px) {
  .debe-form__checkbox-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
.debe-form__checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Poppins", sans-serif;
  font-size: 0.8125rem;
  font-weight: 300;
  color: rgb(var(--text));
  cursor: pointer;
}
.debe-form__checkbox-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  margin: 0;
  border: 1.5px solid rgb(var(--input-border));
  border-radius: 0.25rem;
  background: #fff;
  position: relative;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}
.debe-form__checkbox-item input[type="checkbox"]:hover {
  border-color: rgb(var(--input-placeholder));
}
.debe-form__checkbox-item input[type="checkbox"]:checked {
  background: rgb(var(--brand));
  border-color: rgb(var(--brand));
}
.debe-form__checkbox-item input[type="checkbox"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E");
  background-size: 72%;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.debe-form__checkbox-item input[type="checkbox"]:checked::after {
  opacity: 1;
}
.debe-form__field--checkbox.debe-form__field--invalid > .debe-form__label {
  color: rgb(var(--state-error));
}

/* ── Checkbox category groups (collapsible on mobile) ────── */
.debe-form__matgroup {
  border-top: 1px solid rgb(var(--divider));
  margin-top: 1rem;
  padding-top: 1rem;
}
.debe-form__field--checkbox .debe-form__matgroup:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.debe-form__matgroup-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-family: "Quicksand", sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  color: rgb(var(--heading));
  cursor: pointer;
  list-style: none;
}
.debe-form__matgroup-title::-webkit-details-marker {
  display: none;
}
.debe-form__matgroup-title::after {
  content: "+";
  font-size: 1.25rem;
  line-height: 1;
  color: rgb(var(--brand));
}
.debe-form__matgroup[open] > .debe-form__matgroup-title::after {
  content: "−";
}
/* Show the grid only when the group is open (default open on desktop, JS
   collapses on mobile). Column template comes from .debe-form__checkbox-grid. */
.debe-form__matgroup > .debe-form__checkbox-grid {
  display: none;
}
.debe-form__matgroup[open] > .debe-form__checkbox-grid {
  display: grid;
}

/* ── File upload ─────────────────────────────────────────── */
.debe-form__file {
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
}
.debe-form__file::file-selector-button {
  padding: 0.5rem 1rem;
  font-family: "Poppins", sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgb(var(--brand));
  background: rgba(var(--brand), 0.06);
  border: 1px solid rgb(var(--input-border));
  border-radius: 0.375rem;
  cursor: pointer;
  margin-right: 0.75rem;
  transition: all 0.2s ease;
}
.debe-form__file::file-selector-button:hover {
  background: rgba(var(--brand), 0.12);
  border-color: rgb(var(--brand));
}

/* ── Captcha ─────────────────────────────────────────────── */
.debe-form__captcha {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.625rem;
}
.debe-form__captcha-image {
  display: block;
  width: 150px;
  height: 50px;
  border: 1px solid rgb(var(--input-border));
  border-radius: 0.5rem;
  background: #f5f5f5;
}
.debe-form__captcha-reload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.125rem;
  line-height: 1;
  color: rgb(var(--brand));
  background: rgba(var(--brand), 0.06);
  border: 1px solid rgb(var(--input-border));
  border-radius: 0.5rem;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.4s ease;
}
.debe-form__captcha-reload:hover {
  background: rgba(var(--brand), 0.12);
  border-color: rgb(var(--brand));
}
.debe-form__captcha-reload:active {
  transform: rotate(180deg);
}
.debe-form__captcha-input {
  flex: 1 1 8rem;
  min-width: 8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ── Honeypot — visually & semantically removed ──────────── */
.debe-form__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── Submit button ───────────────────────────────────────── */
.debe-form__footer {
  margin-top: 1.5rem;
}
.debe-form__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.875rem 2.5rem;
  font-family: "Quicksand", sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #fff;
  background: rgb(var(--brand));
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition:
    background 0.25s ease,
    transform 0.2s ease,
    box-shadow 0.25s ease;
}
.debe-form__submit:hover {
  background: rgb(var(--brand-hover));
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--brand), 0.25);
}
.debe-form__submit:active {
  transform: translateY(0);
}
.debe-form__submit[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Spinner ─────────────────────────────────────────────── */
.debe-form__spinner {
  display: none;
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: debe-form-spin 0.7s linear infinite;
}
.debe-form.is-submitting .debe-form__spinner {
  display: inline-block;
}
@keyframes debe-form-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Response message ────────────────────────────────────── */
.debe-form__response {
  font-family: "Poppins", sans-serif;
  font-size: 0.8125rem;
  font-weight: 400;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin-top: 1.5rem;
}
.debe-form__response--success {
  background: rgba(var(--state-success-strong), 0.1);
  border: 1px solid rgb(var(--state-success-strong));
  color: rgb(var(--state-success-strong));
  font-weight: 500;
}
.debe-form__response--error {
  background: rgba(var(--state-error), 0.08);
  border: 1px solid rgb(var(--state-error));
  color: rgb(var(--state-error));
}

@media (prefers-reduced-motion: reduce) {
  .debe-form__spinner {
    animation-duration: 1.4s;
  }
  .debe-form__captcha-reload:active {
    transform: none;
  }
}
