/**
 * Conversion-Pop-up · Delta-Web-Solution
 * 2-Step-Flow mit Brand-Gradients + Plugin-Bonus
 * Mobile-optimiert (Tap-Targets ≥ 48px, iOS no-zoom Inputs)
 */

/* ─── Animations ─── */
@keyframes dws-popup-slideIn { from { transform: translate(40px, 40px); opacity: 0; } to { transform: translate(0, 0); opacity: 1; } }
@keyframes dws-popup-fadeStep { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes dws-popup-shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes dws-popup-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 246, 49, .4); } 50% { box-shadow: 0 0 0 6px rgba(239, 246, 49, 0); } }

/* ─── Container ─── */
.dws-popup {
    /* Initial versteckt — wird per JS sichtbar gemacht */
    display: none;
    position: fixed; right: 40px; bottom: 40px;
    width: 420px; max-width: calc(100vw - 48px);
    background: linear-gradient(180deg, #FAFBFD 0%, #F0F5FA 100%);
    border-radius: 22px;
    box-shadow: 0 28px 72px rgba(0, 35, 64, .32), 0 0 0 1px rgba(0, 55, 91, .06);
    overflow: hidden;
    z-index: 9999;
    flex-direction: column;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #0A1620;
    line-height: 1.5;
}
.dws-popup.is-open { display: flex; animation: dws-popup-slideIn .55s cubic-bezier(.16,1,.3,1); }

/* Brand-Akzent-Leiste oben */
.dws-popup::before {
    content: ""; display: block; height: 4px;
    background: linear-gradient(90deg, #00375B 0%, #0080C0 35%, #EFF631 65%, #0080C0 100%);
    background-size: 200% 100%;
    animation: dws-popup-shimmer 5s linear infinite;
}

/* Close-Button */
.dws-popup__close {
    position: absolute; top: 14px; right: 14px;
    width: 32px; height: 32px; border-radius: 50%;
    background: #fff;
    border: 1px solid #E5E9F2; color: #4A5A6B; font-size: 13px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
    z-index: 10;
    padding: 0; line-height: 1;
}
.dws-popup__close:hover { background: #002340; color: #fff; border-color: #002340; }

/* Step-Indikator */
.dws-popup__steps {
    position: absolute; top: 22px; left: 30px;
    display: flex; gap: 5px; z-index: 5;
}
.dws-popup__step-dot {
    width: 22px; height: 4px;
    border-radius: 99px;
    background: #E5E9F2;
    transition: background .25s, width .25s;
}
.dws-popup__step-dot.is-active { background: linear-gradient(90deg, #00375B, #0080C0); width: 32px; }
.dws-popup__step-dot.is-done { background: #EFF631; }

/* Body */
.dws-popup__body { padding: 50px 30px 26px; position: relative; }

/* Step-Container */
.dws-popup__step { display: none; animation: dws-popup-fadeStep .35s cubic-bezier(.16,1,.3,1); }
.dws-popup__step.is-active { display: block; }

.dws-popup__eyebrow {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 10.5px; letter-spacing: .14em;
    color: #00375B; font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.dws-popup__headline {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 900; font-size: 20px;
    letter-spacing: -.02em; line-height: 1.25;
    color: #00375B;
    margin: 0 0 8px;
}
.dws-popup__sub {
    font-size: 13.5px; color: #4A5A6B;
    line-height: 1.55;
    margin: 0 0 20px;
}

/* Bedarfs-Buttons */
.dws-popup__needs-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px; letter-spacing: .12em;
    color: #7C8B98; font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.dws-popup__needs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.dws-popup__need-btn {
    padding: 13px 14px;
    border: 1.5px solid #E5E9F2;
    background: #fff;
    border-radius: 10px;
    font-size: 13px; font-weight: 700;
    color: #0A1620;
    cursor: pointer;
    transition: all .18s;
    font-family: inherit;
    display: flex; align-items: center; gap: 6px;
    text-align: left;
    min-height: 48px;
}
.dws-popup__need-btn:hover {
    border-color: #00375B;
    background: linear-gradient(135deg, rgba(0, 55, 91, .04) 0%, rgba(0, 128, 192, .04) 100%);
    color: #00375B;
}
.dws-popup__need-btn.is-active {
    background: linear-gradient(135deg, #00375B 0%, #0080C0 100%);
    color: #fff; border-color: #002340;
    box-shadow: 0 4px 12px rgba(0, 55, 91, .25);
}

/* CTA-Button */
.dws-popup__cta {
    width: 100%; padding: 16px 22px;
    background: linear-gradient(135deg, #00375B 0%, #0080C0 100%);
    color: #fff; border: 0;
    border-radius: 10px;
    font-weight: 800; font-size: 14.5px;
    cursor: pointer; font-family: inherit;
    transition: all .25s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 4px;
    position: relative; overflow: hidden;
    min-height: 52px;
    box-shadow: 0 6px 16px rgba(0, 55, 91, .3);
}
.dws-popup__cta::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(239,246,49,.35), transparent);
    transform: translateX(-100%);
    transition: transform .55s;
}
.dws-popup__cta:hover {
    background: linear-gradient(135deg, #002340 0%, #00375B 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 35, 64, .35);
}
.dws-popup__cta:hover::before { transform: translateX(100%); }
.dws-popup__cta:disabled { opacity: .6; cursor: wait; transform: none; }

/* Zurück */
.dws-popup__back {
    background: none; border: 0;
    color: #7C8B98; font-size: 12px;
    font-family: inherit; font-weight: 700;
    cursor: pointer; padding: 0; margin: 0 0 10px;
    display: inline-flex; align-items: center; gap: 4px;
    transition: color .15s;
}
.dws-popup__back:hover { color: #00375B; }

/* Summary-Tag in Step 2 */
.dws-popup__summary {
    background: linear-gradient(135deg, rgba(0, 55, 91, .04) 0%, rgba(0, 128, 192, .06) 100%);
    border: 1px solid #EEF1F7;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 12px; color: #4A5A6B;
    display: flex; align-items: center; gap: 10px;
}
.dws-popup__summary-tag {
    background: linear-gradient(135deg, #00375B 0%, #0080C0 100%);
    color: #fff; padding: 4px 10px;
    border-radius: 99px;
    font-size: 10.5px; font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: .05em;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 55, 91, .2);
}

/* Trust-Box vor Form */
.dws-popup__trust-box {
    background: linear-gradient(135deg, rgba(239, 246, 49, .12) 0%, rgba(239, 246, 49, .06) 100%);
    border: 1px solid rgba(239, 246, 49, .35);
    border-radius: 10px;
    padding: 10px 14px; margin-bottom: 14px;
    font-size: 11.5px; color: #00375B;
    display: flex; align-items: center; gap: 10px;
    line-height: 1.4;
}
.dws-popup__trust-box-icon { font-size: 18px; flex-shrink: 0; }

/* Form */
.dws-popup__form { display: flex; flex-direction: column; gap: 10px; }
.dws-popup__field { position: relative; }
.dws-popup__field-label {
    position: absolute; top: -7px; left: 12px;
    background: #FAFBFD; padding: 0 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px; color: #00375B;
    letter-spacing: .08em; font-weight: 700;
    z-index: 2;
}
.dws-popup__field-label .opt { color: #7C8B98; font-weight: 500; }

.dws-popup__input {
    width: 100%; padding: 15px 16px;
    border: 1.5px solid #E5E9F2;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit; color: #0A1620;
    transition: all .15s;
    background: #fff;
    min-height: 48px;
}
.dws-popup__input:focus {
    outline: 0; border-color: #00375B;
    box-shadow: 0 0 0 3px rgba(0, 55, 91, .12);
}
.dws-popup__input.has-error { border-color: #DC2626; }
.dws-popup__input::placeholder { color: #7C8B98; }

/* Honeypot — versteckt */
.dws-popup__honeypot { position: absolute; left: -9999px; top: -9999px; opacity: 0; pointer-events: none; }

.dws-popup__microtrust {
    text-align: center;
    font-size: 11px; color: #7C8B98;
    margin-top: 14px; line-height: 1.5;
}
.dws-popup__microtrust strong { color: #10B981; font-weight: 700; }

/* Error-Message */
.dws-popup__error {
    background: #FEE2E2;
    color: #991B1B;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    margin-top: 10px;
    text-align: center;
    display: none;
}
.dws-popup__error.is-visible { display: block; }

/* Plugin-Sektion */
.dws-popup__plugin-wrap {
    text-decoration: none; color: inherit; display: block;
    position: relative; z-index: 2; isolation: isolate;
}
.dws-popup__plugin-badge {
    position: absolute; top: -10px; left: 22px; z-index: 20;
    background: #EFF631; color: #002340;
    padding: 5px 11px; border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px; font-weight: 800;
    letter-spacing: .1em; text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(0, 35, 64, .3);
    white-space: nowrap; line-height: 1.2;
}
.dws-popup__plugin {
    background: linear-gradient(135deg, #00375B 0%, #0080C0 100%);
    padding: 22px 22px 18px;
    display: flex; align-items: center; gap: 14px;
    cursor: pointer; transition: all .25s;
    color: #fff;
    position: relative; overflow: hidden;
}
.dws-popup__plugin::before {
    content: ""; position: absolute;
    top: -30px; right: -30px;
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(239, 246, 49, .15) 0%, transparent 60%);
    pointer-events: none;
}
.dws-popup__plugin-wrap:hover .dws-popup__plugin {
    background: linear-gradient(135deg, #002340 0%, #00375B 100%);
}
.dws-popup__plugin-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, #EFF631 0%, #B8C124 100%);
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0; color: #002340;
    position: relative; z-index: 2;
}
.dws-popup__plugin-body { flex: 1; min-width: 0; line-height: 1.4; position: relative; z-index: 2; }
.dws-popup__plugin-eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9.5px; color: #EFF631;
    letter-spacing: .1em; font-weight: 700; text-transform: uppercase;
}
.dws-popup__plugin-name { font-size: 14px; font-weight: 800; color: #fff; margin-top: 2px; }
.dws-popup__plugin-desc { font-size: 11.5px; color: rgba(255, 255, 255, .65); margin-top: 2px; }
.dws-popup__plugin-dl {
    background: #EFF631; color: #002340;
    padding: 10px 16px; border-radius: 99px;
    font-weight: 800; font-size: 11px;
    text-decoration: none; white-space: nowrap;
    transition: all .2s;
    border: 0; cursor: pointer; font-family: inherit;
    flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 4px;
    min-height: 36px;
    position: relative; z-index: 2;
    box-shadow: 0 4px 12px rgba(239, 246, 49, .35);
}
.dws-popup__plugin-dl:hover { background: #fff; color: #00375B; transform: scale(1.05); }

/* Success-State */
.dws-popup__success { display: none; text-align: center; padding: 20px 0; animation: dws-popup-fadeStep .35s cubic-bezier(.16,1,.3,1); }
.dws-popup__success.is-active { display: block; }
.dws-popup__success-emoji {
    font-size: 56px; margin-bottom: 12px;
    animation: dws-popup-glow 2s infinite;
    display: inline-block; padding: 12px; border-radius: 50%;
    background: linear-gradient(135deg, rgba(239, 246, 49, .15) 0%, rgba(0, 128, 192, .1) 100%);
}
.dws-popup__success-title { font-size: 22px; font-weight: 900; color: #00375B; letter-spacing: -.02em; margin: 0 0 8px; }
.dws-popup__success-text { font-size: 13.5px; color: #4A5A6B; line-height: 1.6; margin: 0 0 14px; }
.dws-popup__success-detail {
    background: linear-gradient(135deg, rgba(0, 55, 91, .04) 0%, rgba(0, 128, 192, .04) 100%);
    border: 1px solid #EEF1F7;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 12px; color: #4A5A6B; line-height: 1.6;
}
.dws-popup__success-detail strong { color: #00375B; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 900px) {
    .dws-popup { right: 24px; bottom: 24px; left: 24px; width: auto; max-width: 460px; margin-left: auto; }
}
@media (max-width: 540px) {
    .dws-popup { right: 12px; bottom: 12px; left: 12px; width: auto; max-width: none; border-radius: 18px; }
    .dws-popup__body { padding: 48px 22px 22px; }
    .dws-popup__headline { font-size: 18px; line-height: 1.3; }
    .dws-popup__sub { font-size: 13px; margin-bottom: 18px; }
    .dws-popup__needs { grid-template-columns: 1fr 1fr; gap: 7px; }
    .dws-popup__need-btn { padding: 14px 12px; font-size: 12.5px; min-height: 52px; flex-direction: column; align-items: flex-start; gap: 4px; }
    .dws-popup__cta { font-size: 14px; min-height: 54px; padding: 16px 20px; }
    .dws-popup__input { font-size: 16px; padding: 16px; min-height: 52px; } /* iOS: keine Auto-Zoom */
    .dws-popup__plugin { padding: 22px 18px 16px; gap: 12px; }
    .dws-popup__plugin-icon { width: 40px; height: 40px; font-size: 18px; }
    .dws-popup__plugin-name { font-size: 13px; }
    .dws-popup__plugin-desc { font-size: 11px; }
    .dws-popup__plugin-dl { padding: 9px 14px; font-size: 10.5px; }
    .dws-popup__steps { top: 18px; left: 22px; }
    .dws-popup__close { top: 12px; right: 12px; width: 30px; height: 30px; }
    /* Plugin in Step 2 ausblenden — Pop-up wird sonst zu groß */
    .dws-popup.on-step-2 .dws-popup__plugin-wrap { display: none; }
}
@media (max-width: 360px) {
    .dws-popup__needs { grid-template-columns: 1fr; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .dws-popup, .dws-popup__step, .dws-popup__success { animation: none !important; }
    .dws-popup::before, .dws-popup__cta::before, .dws-popup__success-emoji { animation: none !important; }
}
