/* =========================================================
   LFQ Educalio – Modal Styles (scoped)
   ========================================================= */

:root {
  --lfq-primary: #f6a623;
  --lfq-accent: #2b6cb0;
  --lfq-bg: #ffffff;
  --lfq-soft: #f4f7fb;
  --lfq-text: #1f2937;
  --lfq-muted: #6b7280;
  --lfq-border: #e5e7eb;
}

/* ===== Modal / Overlay ===== */
.lfq-modal {
  position: fixed;
  inset: 0;
  display: none !important;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(3px);
  z-index: 9999;
}

.lfq-modal[aria-hidden="false"] {
  display: grid !important;
  place-items: center;
}

/* ===== Dialog ===== */
.lfq-modal .lfq-dialog {
  position: relative;
  background: var(--lfq-bg);
  width: min(920px, 92vw);
  max-height: 92vh;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
  color: var(--lfq-text);
}

/* Header */
.lfq-modal #lfq-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--lfq-border);
}

/* Close-Button */
.lfq-modal .lfq-close {
  position: absolute;
  right: 0;
  top: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: var(--lfq-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 0;
}

.lfq-modal .lfq-close:hover,
.lfq-modal .lfq-close:focus {
  background: var(--e-global-color-secondary, var(--lfq-accent));
  color: #fff;
  outline: none;
}

.lfq-modal .lfq-close::before,
.lfq-modal .lfq-close::after {
  content: none !important;
}

/* ===== Form-Bereich ===== */
.lfq-modal #lfq-form {
  padding: 1rem 1.25rem 0;
  max-height: calc(92vh - 64px - 72px);
  overflow: auto;
}

/* Fieldsets */
.lfq-modal fieldset {
  border: 1px solid var(--lfq-border);
  border-radius: 12px;
  padding: .75rem .9rem 1rem;
  margin: .75rem 0 1rem;
  background: #fff;
}

.lfq-modal legend {
  padding: .2rem .6rem;
  border-radius: 8px;
  font-weight: 600;
  color: var(--e-global-color-secondary, var(--lfq-accent));
  background: var(--lfq-soft);
  border: 1px solid var(--lfq-border);
}

/* Grid */
.lfq-modal .lfq-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin: .75rem 0;
}

/* Labels + Inputs */
.lfq-modal label {
  display: block;
  font-size: .95rem;
}

.lfq-modal .lfq-label {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  margin-bottom: .35rem;
}

.lfq-modal .req {
  color: #b91c1c;
}

.lfq-modal input,
.lfq-modal select,
.lfq-modal textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--lfq-border);
  border-radius: 10px;
  background: #fff;
  font-size: 1rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

/* Einheitliche Feldhöhe */
.lfq-modal input,
.lfq-modal select {
  height: 44px;
  line-height: 1.2;
}

.lfq-modal select {
  padding-right: 34px;
}

.lfq-modal select[multiple] {
  min-height: 88px;
}

.lfq-modal input:focus,
.lfq-modal select:focus,
.lfq-modal textarea:focus {
  border-color: var(--e-global-color-secondary, var(--lfq-accent));
  box-shadow: 0 0 0 3px rgba(43, 108, 176, .15);
}

/* Checkbox specific styles */
.lfq-modal .lfq-checkbox-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  /* Align to top of text line if multi-line, or center if single */
  gap: 0.5rem !important;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1.4;
  width: auto !important;
}

.lfq-modal .lfq-checkbox-label input[type="checkbox"] {
  /* Reset global input styles aggressive override */
  width: 1.1em !important;
  height: 1.1em !important;
  min-height: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0.15em 0 0 0 !important;
  /* Slight top margin to align with text baseline */
  box-shadow: none !important;
  border: 1px solid var(--lfq-border) !important;
  border-radius: 4px !important;
  /* Slight rounding for modern look */
  appearance: auto !important;
  /* Ensure native look or fallback */
  flex-shrink: 0 !important;
  /* Prevent shrinking */
  display: inline-block !important;
}

.lfq-modal .lfq-checkbox-label a {
  color: var(--e-global-color-secondary, var(--lfq-accent));
  text-decoration: underline;
}

.lfq-modal .lfq-checkbox-label a:hover {
  color: var(--e-global-color-primary, var(--lfq-primary));
}

/* ===== Actions (Captcha + Button nebeneinander) ===== */
.lfq-modal .lfq-actions {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.25rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 40%);
  border-top: 1px solid var(--lfq-border);
  z-index: 1;
  flex-wrap: wrap;
  /* bei schmalen Screens umbrechen */
}

.lfq-modal .lfq-actions .lfq-captcha {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.lfq-modal .lfq-actions .lfq-submit {
  margin-left: auto;
  /* Button nach rechts schieben */
}

/* Status-Meldung immer in neue Zeile */
.lfq-modal .lfq-actions .lfq-msg {
  flex-basis: 100%;
  margin-top: .25rem;
  font-size: .95rem;
  color: var(--lfq-muted);
}

/* Buttons (nur im Modal) */
.lfq-modal .lfq-btn[data-lfq-open] {
  display: none;
}

.lfq-modal .lfq-actions .lfq-btn.lfq-submit {
  background: var(--e-global-color-primary, var(--lfq-primary));
  color: #fff;
  border: 0;
  border-radius: 0;
  padding: .95rem 1.35rem;
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: .25px;
  line-height: 1.1;
  min-height: 52px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .12);
  cursor: pointer;
}

.lfq-modal .lfq-actions .lfq-btn.lfq-submit:hover {
  background: var(--e-global-color-secondary, var(--lfq-accent));
  color: #fff;
  box-shadow: 0 12px 24px rgba(0, 0, 0, .18);
}

.lfq-modal .lfq-actions .lfq-btn.lfq-submit:active {
  background: var(--e-global-color-secondary, var(--lfq-accent));
  filter: brightness(.9);
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .16);
}

.lfq-modal .lfq-actions .lfq-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  box-shadow: none;
}

/* ===== Seite blur + scroll lock ===== */
body.lfq-modal-open #page,
body.lfq-modal-open main,
body.lfq-modal-open .site-content {
  filter: blur(2px);
}

body.lfq-modal-open {
  overflow: hidden;
}

html.lfq-lock {
  overflow: hidden !important;
  overscroll-behavior: contain;
}

/* Safety: Sende-Button nie ausblenden */
.lfq-modal .lfq-actions .lfq-btn {
  display: inline-flex !important;
}

/* Responsive Finetuning (Mobile) */
@media (max-width: 520px) {
  .lfq-modal .lfq-actions {
    gap: .75rem;
  }

  .lfq-modal .lfq-actions .lfq-submit {
    width: 100%;
    margin-left: 0;
    /* unter Captcha volle Breite */
  }

  .lfq-modal .lfq-actions .lfq-captcha {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ===== Form Success State ===== */
.lfq-modal #lfq-form.lfq-success-state fieldset,
.lfq-modal #lfq-form.lfq-success-state .lfq-row:not(.lfq-actions),
.lfq-modal #lfq-form.lfq-success-state .lfq-submit,
.lfq-modal #lfq-form.lfq-success-state .lfq-captcha {
  display: none !important;
}

.lfq-modal #lfq-form.lfq-success-state .lfq-actions {
  border-top: none;
  background: transparent;
}

.lfq-modal #lfq-form.lfq-success-state .lfq-msg {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--e-global-color-primary, var(--lfq-primary));
  text-align: center;
  padding: 2rem 1rem;
}