/* ==========================================================================
   Opt-in Popup - überarbeitete Version
   Verbesserungen gegenüber dem Original:
   - Dark Brand-Look statt weißer Box, Modal bricht nicht mehr aus der Seite
   - Split-Layout: linke Seite verkauft, rechte Seite konvertiert
   - Floating Labels, Inline-Validierung, echte Checkbox statt Radio-Kreis
   - Loading- und Success-State, Fokus-Trap, ESC/Backdrop-Close
   - Mobile: Bottom-Sheet statt abgeschnittener Desktop-Box
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  visibility: hidden;
  pointer-events: none;
}

.modal.open {
  visibility: visible;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 5, 0.78);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.modal.open .modal-backdrop {
  opacity: 1;
}

.modal-dialog {
  position: relative;
  width: min(100%, 940px);
  max-width: 100%;
  min-width: 0;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #131313;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 22px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.65);
  display: grid;
  grid-template-columns: 340px 1fr;
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.modal.open .modal-dialog {
  opacity: 1;
  transform: none;
}

/* ------------------------------------------------------- Linke Spalte */

.modal-aside {
  min-width: 0;
  background: linear-gradient(165deg, #1c1710, #121212 55%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 34px 30px;
  border-radius: 22px 0 0 22px;
  display: flex;
  flex-direction: column;
}

.modal-aside .logo {
  margin-bottom: 26px;
}

.modal-aside h3 {
  font-size: 19px;
  line-height: 1.35;
  margin-bottom: 22px;
}

.modal-benefits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 15px;
}

.modal-benefits li {
  display: flex;
  gap: 12px;
  font-size: 14px;
  color: #cfcfcf;
  line-height: 1.45;
}

.modal-benefits svg {
  flex: none;
  margin-top: 2px;
  color: var(--gold);
}

.modal-proof {
  margin-top: auto;
  padding-top: 26px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-proof .faces {
  display: flex;
  flex: none;
}

.modal-proof .faces img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #131313;
  margin-left: -10px;
}

.modal-proof .faces img:first-child {
  margin-left: 0;
}

.modal-proof p {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.4;
}

.modal-proof strong {
  color: #dcdcdc;
}

/* ------------------------------------------------------ Rechte Spalte */

.modal-main {
  padding: 34px 36px 30px;
  position: relative;
  min-width: 0;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #b6b6b6;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: rotate(90deg);
}

.modal-channel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(187, 154, 101, 0.12);
  border: 1px solid rgba(187, 154, 101, 0.32);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: 999px;
}

.modal-main h2 {
  font-size: clamp(21px, 2.6vw, 27px);
  margin: 16px 0 8px;
  max-width: 24ch;
}

.modal-main h2 .channel {
  color: var(--gold);
}

.modal-lead {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ------------------------------------------------------------ Formular */

.field {
  position: relative;
  margin-bottom: 14px;
  min-width: 0;
}

.field input {
  width: 100%;
  min-width: 0;
  background: #1b1b1b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 22px 14px 8px;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.field input::placeholder {
  color: transparent;
}

.field label {
  position: absolute;
  left: 15px;
  top: 15px;
  font-size: 15px;
  color: var(--text-dim);
  pointer-events: none;
  transition: transform 0.16s ease, font-size 0.16s ease, color 0.16s ease;
  transform-origin: left top;
}

.field input:focus {
  outline: none;
  border-color: var(--gold);
  background: #1f1c16;
  box-shadow: 0 0 0 3px rgba(187, 154, 101, 0.14);
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  transform: translateY(-9px) scale(0.75);
  color: var(--gold);
}

.field .hint {
  display: block;
  font-size: 12.5px;
  color: #ff8080;
  margin-top: 6px;
  min-height: 0;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, max-height 0.2s ease;
}

.field.invalid input,
.field-phone.invalid select {
  border-color: rgba(255, 100, 100, 0.65);
  background-color: #201616;
}

.field.invalid label {
  color: #ff8080;
}

.field.invalid .hint {
  opacity: 1;
  max-height: 40px;
}

.field.valid input {
  border-color: rgba(37, 211, 102, 0.45);
}

.field.valid::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -12px;
  background: no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2325d366' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* Telefonfeld mit integrierter Vorwahl */

.field-phone {
  display: grid;
  grid-template-columns: 116px 1fr;
}

.field-phone select {
  appearance: none;
  background: #1b1b1b
    no-repeat right 12px center /
    11px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='3' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-right: 0;
  border-radius: 11px 0 0 11px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 0 30px 0 14px;
  cursor: pointer;
  z-index: 2;
}

.field-phone select:focus {
  outline: none;
  border-color: var(--gold);
}

.field-phone input {
  border-radius: 0 11px 11px 0;
}

.field-phone .hint {
  grid-column: 1 / -1;
}

.field-phone label {
  left: 131px;
}

.field-phone.valid::after {
  margin-top: -20px;
}

/* Checkbox */

/* Statt Checkbox nur noch ein Hinweis unter dem Button. Weniger Reibung an der
   Conversion-Stelle, dafür kein dokumentiertes Opt-in für spätere Werbe-SMS. */
.form-consent {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin: 14px auto 0;
  max-width: 420px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-dim);
  text-align: left;
}

.form-consent svg {
  flex: none;
  margin-top: 2px;
  color: var(--gold);
  opacity: 0.75;
}

.form-consent a {
  color: var(--gold);
}

/* Submit */

.btn-submit {
  width: 100%;
  padding: 19px 24px;
  font-size: 16.5px;
  position: relative;
}

.btn-submit[data-loading="true"] {
  pointer-events: none;
  color: transparent;
}

.btn-submit[data-loading="true"]::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.form-trust {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--text-dim);
}

.form-trust span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.form-trust svg {
  color: #4f4f4f;
}

/* ------------------------------------------------------- Success-State */

.modal-success {
  display: none;
  text-align: center;
  padding: 34px 10px 20px;
}

.modal-dialog[data-state="success"] .modal-form,
.modal-dialog[data-state="success"] .modal-channel,
.modal-dialog[data-state="success"] .modal-main > h2,
.modal-dialog[data-state="success"] .modal-lead {
  display: none;
}

.modal-dialog[data-state="success"] .modal-success {
  display: block;
}

.success-icon {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: rgba(37, 211, 102, 0.13);
  border: 1px solid rgba(37, 211, 102, 0.35);
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  color: var(--green);
}

.modal-success h2 {
  font-size: 25px;
  margin-bottom: 12px;
}

.modal-success p {
  color: var(--text-muted);
  font-size: 14.5px;
  max-width: 34ch;
  margin: 0 auto;
}

.modal-success .btn {
  margin-top: 26px;
}

/* --------------------------------------------------------------- Mobile */

@media (max-width: 860px) {
  .modal {
    padding: 0;
    place-items: end center;
  }

  .modal-dialog {
    grid-template-columns: 1fr;
    width: 100%;
    max-height: 94dvh;
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
  }

  .modal-aside {
    order: 2;
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    padding: 24px 22px 28px;
  }

  .modal-aside .logo,
  .modal-aside h3 {
    display: none;
  }

  .modal-main {
    order: 1;
    padding: 26px 22px 22px;
  }

  .modal-main::before {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.16);
    margin: -8px auto 18px;
  }

  .modal-proof {
    margin-top: 0;
    padding-top: 0;
  }

  .field-phone {
    grid-template-columns: 108px 1fr;
  }

  .field-phone label {
    left: 123px;
  }
}

/* Honeypot. Kein display:none und kein hidden-Attribut, das erkennen die
   besseren Bots. Stattdessen aus dem sichtbaren Bereich geschoben. */
.gotcha {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
