/* ==========================================================================
   Behavioral Popups — KLAR.Raum
   Dark Glassmorphism with Background Images
   ========================================================================== */

/* ---------- Overlay ---------- */
.bp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    padding: var(--space-m, 16px);
}

.bp-overlay.active {
    display: flex;
    animation: bpFadeIn 0.3s ease;
}

/* ---------- Modal Box ---------- */
.bp-box {
    position: relative;
    overflow: hidden;
    max-width: 480px;
    width: 100%;
    border-radius: 16px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.06);
    animation: bpSlideUp 0.4s ease;
}

/* ---------- Background Image Layer ---------- */
.bp-bg-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(2px) brightness(0.35);
    z-index: 0;
    transform: scale(1.05); /* prevent blur edge artifacts */
}

/* Fallback when no image loaded */
.bp-box.bp-no-image .bp-bg-image {
    display: none;
}

.bp-box.bp-no-image .bp-content {
    background: rgba(20, 20, 25, 0.95);
}

/* ---------- Content Layer (Glassmorphism) ---------- */
.bp-content {
    position: relative;
    z-index: 1;
    padding: 48px 32px 36px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

/* ---------- Close Button ---------- */
.bp-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.3s ease;
    z-index: 2;
}

.bp-close:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: rotate(90deg);
}

.bp-close svg {
    width: 18px;
    height: 18px;
    stroke: rgba(255, 255, 255, 0.7);
    stroke-width: 2;
}

/* ---------- Icon ---------- */
.bp-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-m, 16px);
    background: linear-gradient(135deg, #00d2d3, #00b4d8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 210, 211, 0.3);
}

.bp-icon svg {
    width: 30px;
    height: 30px;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
}

/* ---------- Content Text ---------- */
.bp-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: var(--space-s, 8px);
    line-height: 1.3;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.bp-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: var(--space-l, 24px);
    line-height: 1.5;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ---------- CTA Button ---------- */
.bp-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #00d2d3, #00b4d8);
    color: #000;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    position: relative;
}

.bp-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 210, 211, 0.4);
}

.bp-cta:active {
    transform: translateY(0);
}

.bp-cta svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

/* Pulse Dot on CTA */
.bp-cta-pulse {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: bpPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes bpPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.5); }
}

/* ---------- Secondary CTA (Phone/WhatsApp row) ---------- */
.bp-actions {
    display: flex;
    gap: var(--space-s, 8px);
    margin-top: var(--space-s, 8px);
}

.bp-actions a {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-md, 8px);
    text-decoration: none;
    transition: background 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.bp-actions a:hover {
    background: rgba(255, 255, 255, 0.18);
}

.bp-actions svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* ---------- Social Proof Badge ---------- */
.bp-social-proof {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: var(--space-m, 16px);
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.bp-stars {
    display: flex;
    gap: 2px;
}

.bp-stars svg {
    width: 14px;
    height: 14px;
    fill: #facc15;
}

.bp-social-proof img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ---------- Animations ---------- */
@keyframes bpFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bpSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes bpSlideInBottom {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Mobile: Bottom Sheet ---------- */
@media (max-width: 640px) {
    .bp-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .bp-box {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        animation: bpSlideInBottom 0.35s ease;
    }

    .bp-content {
        padding: 32px 24px 40px;
    }

    /* Drag handle indicator */
    .bp-content::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.25);
        border-radius: 2px;
        margin: 0 auto var(--space-m, 16px);
    }

    .bp-close {
        top: 16px;
        right: 16px;
    }

    .bp-title {
        font-size: 1.2rem;
    }

    .bp-actions {
        flex-direction: column;
    }

    .bp-box {
        max-height: calc(100vh - env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
    }

    /* Mobile: image as top strip */
    .bp-bg-image {
        position: relative;
        height: 120px;
        filter: brightness(0.5);
        transform: none;
    }

    .bp-box.bp-no-image .bp-bg-image {
        display: none;
    }
}

/* ---------- Fallback: No backdrop-filter ---------- */
@supports not (backdrop-filter: blur(8px)) {
    .bp-overlay {
        background: rgba(10, 10, 10, 0.95);
    }

    .bp-content {
        background: rgba(20, 20, 25, 0.95);
    }
}
