/* Scope */
.hbform { --pm-gap: 1rem; }

/* 2-Spalten oben */
.hbform .hb-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.hbform .hb-col > .powermail_fieldwrap + .powermail_fieldwrap { margin-top: 1rem; }

/* 4-Spalten "Aufteilung" */
.hbform .hb-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

/* Zweier-Reihen (Straße/Nr.) */
.hbform .hb-row { display: grid; gap: var(--pm-gap); }
.hbform .hb-row-2 { grid-template-columns: 1fr 160px; }

/* Radios "Vorhaben" */
.hbform .hb-radios { display: flex; gap: 1.5rem; align-items: center; }
.hbform .hb-radio  { display: inline-flex; gap: .5rem; align-items: center; }

/* Selects wie Inputs */
.hbform .powermail_select,
.hbform .powermail_input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: "Josefin Sans", sans-serif;
  font-size: 1rem;
  background-color: #fff;
  min-height: 44px;                /* feste Feldhöhe für sauberes Zentrieren */
}
.hbform .powermail_select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #888 50%),
                    linear-gradient(135deg, #888 50%, transparent 50%),
                    linear-gradient(to right, #ccc, #ccc);
  background-position: calc(100% - 18px) calc(50% + 1px),
                       calc(100% - 12px) calc(50% + 1px),
                       calc(100% - 2.2rem) 50%;
  background-size: 6px 6px, 6px 6px, 1px 60%;
  background-repeat: no-repeat;
}
.hbform .powermail_select:focus,
.hbform .powermail_input:focus {
  border-color: var(--color-beige);
  outline: none;
  box-shadow: 0 0 0 2px rgba(216,186,154,.3);
}

/* Vorhaben-Layout (Radios links, Zusatz rechts) */
.hbform .hb-purpose-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:1.2rem 2rem;
  align-items:start;
}

/* ---- Fehlermeldungen im Powermail-Stil ---- */
.hbform .is-invalid .powermail_input,
.hbform .is-invalid .powermail_select {
  border-color: #d32f2f;
  box-shadow: 0 0 0 2px rgba(211,47,47,.08);
}

.hbform .pm-errors { margin-top: .45rem; }

.hbform .pm-error {
  display: block;
  color: #d32f2f;
  font-size: .95rem;
  line-height: 1.35;
}

/* kleine Abstände bei Radio-Gruppen */
.hbform [data-field="purposeSell"] .pm-errors,
.hbform [data-field="purposeBuy"]  .pm-errors {
  margin-top: .55rem;
}

/* Segmented Radio-Gruppen */
.hb-fieldset { margin-top:1.2rem; }
.hb-legend { font-weight:600; color:var(--color-gray-dark); margin:0 0 .6rem 0; }

.hb-segmented {
  display:flex; border:1px solid var(--color-border); border-radius:8px;
  background:#fff; overflow:hidden;
}
.hb-segmented label {
  flex:1; display:flex; align-items:center; gap:.55rem;
  padding:.85rem 1.1rem; cursor:pointer; user-select:none; margin:0;
}
.hb-segmented label + label { border-left:1px solid rgba(0,0,0,.12); }

.hb-segmented input[type="radio"] {
  appearance:none; width:18px; height:18px; border:2px solid #c5c5c5;
  border-radius:50%; position:relative; background:#fff;
}
.hb-segmented input[type="radio"]:focus-visible {
  outline:2px solid var(--color-beige); outline-offset:2px;
}
.hb-segmented input[type="radio"]:checked { border-color:var(--color-beige); }
.hb-segmented input[type="radio"]:checked::after {
  content:""; position:absolute; inset:4px; background:var(--color-beige); border-radius:50%;
}

/* Fehlerzustand wie im Formular (rote Umrandung + Hint) */
.hb-segmented.is-invalid { border-color:#d32f2f; }
.hb-error { color:#d32f2f; font-size:.95rem; margin:.45rem 0 0 .2rem; }

/* 1) Echte Labels ausblenden u. Abstände */
.hb-immo-form-wrapper .powermail_label { display: none; }
.hb-immo-form-wrapper .powermail_fieldwrap { margin-bottom: 1rem; }
.hb-immo-form-wrapper .powermail_field { width: 100%; }

/* 2) Inputs: Placeholder dezenter */
.hb-immo-form-wrapper input::placeholder { opacity: .65; }

/* 3) Select-Platzhalter */
.hb-immo-form-wrapper select:required:invalid { color: rgba(0,0,0,.55); }
@supports(selector(:has(*))) {
  .hb-immo-form-wrapper select:has(option[disabled]:checked) { color: rgba(0,0,0,.55); }
}
.hb-immo-form-wrapper select option { color: #000; }
.hb-immo-form-wrapper select.is-placeholder { color: rgba(0,0,0,.55); }
.hb-immo-form-wrapper select.is-placeholder option[disabled][hidden] { color: rgba(0,0,0,.55); }

/* Radio-Gruppen-Box Fallback */
.hb-radios.hb-choice {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: .8rem 1rem;
}
.hb-radio { display: inline-flex; align-items: center; gap: .5rem; }
.hb-radio input[type="radio"] { transform: translateY(-1px); }

/* Datenschutz-Checkbox */
.hb-consent {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: .8rem 1rem;
  line-height: 1.5;
  background: #fff;
}
.hb-consent input[type="checkbox"] { margin-top: .2rem; }

.hb-error {
  display: none;
  color: #c62828;
  font-size: .9rem;
  margin-top: .45rem;
}

/* Fehlerzustand anzeigen (CSS-only mit :has) */
.powermail_fieldwrap:has(input[required]:not(:checked)) .hb-error { display: block; }
.powermail_fieldwrap:has(input[required]:not(:checked)) .hb-consent {
  border-color: #c62828;
  box-shadow: 0 0 0 2px rgba(198, 40, 40, .08);
}

.powermail_fieldwrap[data-field="privacy"]{display:block!important;visibility:visible!important}

@media(max-width:800px){
  .hbform .hb-purpose-grid{ grid-template-columns:1fr; }
}

/* ------------------------------------------
   FIX: Icon bleibt auch mit Fehlern mittig
-------------------------------------------*/
.hb-immo-form-wrapper{
  --field-h: 44px;      /* Höhe der Inputs/Selects */
  --icon-h: 26px;       /* Button-Icon-Höhe */
  --err-line: 1.35rem;  /* Höhe je Fehlerzeile */
}

/* Oberkanten ausrichten */
.hb-immo-form-wrapper .hb-grid-4.hb-grid-split{ align-items:start; }

/* Help-Icon an Feldhöhe ausrichten, nicht an Zeilenhöhe */
.hb-immo-form-wrapper .hb-help-col{
  align-self:start;
}
.hb-immo-form-wrapper .hb-tip-standalone{
  margin-top: calc((var(--field-h) - var(--icon-h)) / 2);
}

/* Reserve unter jedem Feld – 2 Fehlerzeilen */
.hb-immo-form-wrapper .hb-grid-4.hb-grid-split .pm-errors{
  margin-top:.35rem;
  min-height: calc(var(--err-line) * 2);
}

/* ------------------------------------------
   RESPONSIVE: Aufteilung = 2 Felder pro Zeile (< 910px)
   Wichtig: !important um Inline-Styles/Template-Styles zu schlagen
-------------------------------------------*/
@media (max-width: 910px) {
  .hb-immo-form-wrapper .hb-grid-4.hb-grid-split{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1rem !important;
  }

  /* verhindert Überlaufen in Grid-Zellen */
  .hb-immo-form-wrapper .hb-grid-4.hb-grid-split > *{
    min-width: 0;
  }

  /* Help-Icon unter die Felder, rechtsbündig */
  .hb-immo-form-wrapper .hb-grid-4.hb-grid-split .hb-help-col{
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-bottom: 0;
  }

  .hb-immo-form-wrapper .hb-grid-4.hb-grid-split .hb-tip-standalone{
    margin-top: 0;
  }
}

/* optional: ganz klein lieber 1 Spalte */
@media (max-width: 520px) {
  .hb-immo-form-wrapper .hb-grid-4.hb-grid-split{
    grid-template-columns: 1fr !important;
  }
  .hb-immo-form-wrapper .hb-grid-4.hb-grid-split .hb-help-col{
    justify-content: flex-start;
  }
}

/* Mobile Allgemein */
@media (max-width: 600px) {
  .hbform .hb-grid-2 { grid-template-columns: 1fr; }
  .hbform .hb-row-2  { grid-template-columns: 1fr; }
}

/* Success / Danke-Box (nach erfolgreichem Versand) */
.hbform .hb-success {
  border: 2px solid rgba(46, 125, 50, 0.45);
  background: rgba(46, 125, 50, 0.08);
  padding: 1.6rem;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

.hbform .hb-success-title {
  margin: 0 0 0.75rem 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.hbform .hb-success-text {
  margin: 0.35rem 0;
}

.hbform .hb-success-steps {
  margin: 0.9rem 0 0.75rem 0;
  padding-left: 1.15rem;
}

.hbform .hb-success-steps li {
  margin: 0.25rem 0;
}

.hbform .hb-success-hint {
  margin: 0.6rem 0 0 0;
  font-size: 0.95rem;
  opacity: 0.9;
}
.hbform .hb-success {
  margin-bottom: 2rem;
}
