/* ═══════════════════════════════════════════════════════
   Smart Exit-Intent Popup Styles
   ═══════════════════════════════════════════════════════ */

.exit-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    padding: 1.5rem;
}

.exit-overlay.active {
    opacity: 1;
    visibility: visible;
}

.exit-popup {
    position: relative;
    max-width: 480px;
    width: 100%;
    background: rgba(30, 30, 40, 0.85);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: none;
    border-radius: 1.5rem;
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    transform: translateY(-30px) scale(0.95);
    transition: transform 0.4s cubic-bezier(.23, 1, .32, 1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

/* Animated gradient border */
.exit-popup::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    padding: 2px;
    background: conic-gradient(from var(--exit-border-angle, 0deg),
            var(--brand-primary, #cf5b2e), var(--accent-cyan, #22d3ee), var(--brand-primary, #cf5b2e));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: exitBorderSpin 3s linear infinite;
    z-index: -1;
}

@keyframes exitBorderSpin {
    to {
        --exit-border-angle: 360deg;
    }
}

@property --exit-border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.exit-overlay.active .exit-popup {
    transform: translateY(0) scale(1);
}

.exit-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    z-index: 2;
}

.exit-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.exit-emoji {
    font-size: 2.8rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0;
    transform: scale(0.3) translateY(20px);
    transition: none;
}

.exit-overlay.active .exit-emoji {
    animation: emojiBounceIn 0.6s cubic-bezier(.34, 1.56, .64, 1) 0.15s forwards;
}

@keyframes emojiBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(20px);
    }

    60% {
        opacity: 1;
        transform: scale(1.15) translateY(-4px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.exit-popup h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--brand-primary, #cf5b2e), var(--accent-cyan, #22d3ee));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transform: translateY(10px);
    transition: none;
}

.exit-overlay.active .exit-popup h3 {
    animation: exitContentIn 0.5s ease 0.3s forwards;
}

.exit-popup p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: none;
}

.exit-overlay.active .exit-popup p {
    animation: exitContentIn 0.5s ease 0.45s forwards;
}

@keyframes exitContentIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.exit-popup .btn {
    width: 100%;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
    justify-content: center;
    opacity: 0;
    transform: translateY(10px);
}

.exit-overlay.active .exit-popup .btn {
    animation: exitContentIn 0.4s ease 0.55s forwards,
        exitCtaPulse 2s ease-in-out 1.2s infinite;
}

@keyframes exitCtaPulse {

    0%,
    100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 4px 20px rgba(109, 40, 217, 0.3);
    }

    50% {
        transform: translateY(-2px) scale(1.03);
        box-shadow: 0 8px 30px rgba(109, 40, 217, 0.5);
    }
}

.exit-popup .exit-dismiss {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    background: none;
    border: none;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0;
}

.exit-overlay.active .exit-dismiss {
    animation: exitContentIn 0.4s ease 0.65s forwards;
}

.exit-popup .exit-dismiss:hover {
    color: rgba(255, 255, 255, 0.6);
}

/* Light mode overrides */
[data-theme="light"] .exit-popup {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .exit-popup p {
    color: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .exit-popup .exit-dismiss {
    color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .exit-popup .exit-dismiss:hover {
    color: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .exit-close {
    border-color: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .exit-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.7);
}