/* ==========================================
   Conversion Tools - Exit-Intent Popup + Social Proof Toast
   ========================================== */

/* A. Exit-Intent Popup */
.cro-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.cro-overlay.cro-visible {
    display: flex;
    animation: croFadeIn .35s ease;
}
.cro-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    padding: 40px 32px 32px;
    position: relative;
    direction: rtl;
    text-align: center;
    font-family: 'Tajawal', sans-serif;
    box-shadow: 0 24px 64px rgba(0,0,0,.25);
    animation: croSlideUp .4s cubic-bezier(.22,1,.36,1);
}
.cro-modal__close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 32px;
    color: #6b7280;
    transition: background .2s, color .2s;
}
.cro-modal__close:hover { background: #e5e7eb; color: #1f2937; }
.cro-modal__badge {
    display: inline-block;
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    color: #2E7A3E;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 16px;
}
.cro-modal__title {
    font-size: 24px;
    font-weight: 800;
    color: #1f2937;
    margin: 0 0 12px;
    line-height: 1.4;
}
.cro-modal__text {
    font-size: 16px;
    color: #6b7280;
    margin: 0 0 28px;
    line-height: 1.7;
}
.cro-modal__cta {
    display: block;
    width: 100%;
    padding: 14px;
    background: #3E8E50;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s, transform .15s;
    margin-bottom: 12px;
    text-align: center;
}
.cro-modal__cta:hover { background: #2E7A3E; transform: translateY(-1px); color: #fff; }
.cro-modal__wa {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s, transform .15s;
    text-align: center;
}
.cro-modal__wa:hover { background: #1da851; transform: translateY(-1px); color: #fff; }
.cro-modal__wa svg { flex-shrink: 0; }

/* B. Social Proof Notifications */
.cro-toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99990;
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
    pointer-events: none;
}
.cro-toast__card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    padding: 14px 18px 14px 44px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 380px;
    border-right: 4px solid #3E8E50;
    transform: translateY(120%);
    opacity: 0;
    transition: transform .4s cubic-bezier(.22,1,.36,1), opacity .4s ease;
    pointer-events: auto;
    position: relative;
}
.cro-toast__card.cro-toast-in {
    transform: translateY(0);
    opacity: 1;
}
.cro-toast__card.cro-toast-out {
    transform: translateY(120%);
    opacity: 0;
}
.cro-toast__icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}
.cro-toast__body {
    flex: 1;
    min-width: 0;
}
.cro-toast__msg {
    font-size: 14px;
    color: #1f2937;
    font-weight: 500;
    line-height: 1.5;
    margin: 0;
}
.cro-toast__time {
    font-size: 12px;
    color: #9ca3af;
    margin: 2px 0 0;
}
.cro-toast__close {
    position: absolute;
    top: 6px;
    left: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: #9ca3af;
    line-height: 24px;
    padding: 0;
    pointer-events: auto;
}
.cro-toast__close:hover { color: #6b7280; }

/* رفع الـ toast فوق شريط CTA في الصفحات التي فيها الشريط الثابت */
body.single-product .cro-toast,
body.home .cro-toast,
body.page-id-538 .cro-toast {
    bottom: 100px;
}
@media (max-width: 768px) {
    body.single-product .cro-toast,
    body.home .cro-toast,
    body.page-id-538 .cro-toast {
        bottom: 92px;
    }
}

@media (max-width: 768px) {
    .cro-toast {
        left: 12px;
        right: 12px;
        bottom: 16px;
    }
    .cro-toast__card {
        min-width: 0;
        max-width: 100%;
    }
    .cro-modal {
        padding: 32px 20px 24px;
        max-width: 100%;
    }
    .cro-modal__title { font-size: 20px; }
}

@keyframes croFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes croSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
