/* ===== Confetti Container ===== */
#joe-confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100000;
    overflow: hidden;
}

.joe-confetti-piece {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 10px;
    opacity: 0;
    animation: joe-confetti-fall var(--fall-duration, 3s) ease-in forwards;
    animation-delay: var(--fall-delay, 0s);
}

.joe-confetti-piece--square {
    border-radius: 2px;
}

.joe-confetti-piece--ribbon {
    width: 8px;
    height: 24px;
    border-radius: 2px;
}

.joe-confetti-piece--circle {
    border-radius: 50%;
}

@keyframes joe-confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    25% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    75% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.3);
        opacity: 0;
    }
}

/* ===== Firework Particles ===== */
.joe-firework-particle {
    position: absolute;
    pointer-events: none;
    z-index: 99998;
    animation: joe-firework-burst var(--f-duration, 1s) ease-out forwards;
    animation-delay: var(--f-delay, 0s);
}

@keyframes joe-firework-burst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--fx), var(--fy)) scale(0.2);
        opacity: 0;
    }
}

/* ===== Firework Flash ===== */
.joe-firework-flash {
    position: absolute;
    width: 30px;
    height: 30px;
    margin-left: -15px;
    margin-top: -15px;
    background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    animation: joe-flash-fade 0.35s ease-out forwards;
}

@keyframes joe-flash-fade {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

/* ===== Firework Sparkle ===== */
.joe-firework-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    margin-top: -2px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    animation: joe-sparkle-fly 0.5s ease-out forwards;
}

@keyframes joe-sparkle-fly {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    80% { opacity: 0.6; }
    100% { transform: translate(var(--sx), var(--sy)) scale(0); opacity: 0; }
}

/* ===== Rocket Trail ===== */
.joe-rocket-trail {
    position: absolute;
    bottom: 0;
    width: 3px;
    height: 60px;
    margin-left: -1.5px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 99998;
    animation: joe-rocket-up 1.2s ease-in forwards;
    opacity: 0;
}

@keyframes joe-rocket-up {
    0% {
        transform: translateY(0) scaleY(1);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(calc(var(--target-y, 30%) * -1)) scaleY(0.3);
        opacity: 0;
    }
}

/* ===== Popup Overlay ===== */
#joe-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    font-family: 'Tajawal', 'Segoe UI', 'Arial', sans-serif;
    background: transparent !important;
    pointer-events: none;
}

#joe-popup-overlay.joe-active {
    background: transparent !important;
}

#joe-popup-overlay.joe-active #joe-popup-container {
    pointer-events: auto;
}

/* ===== Popup Container ===== */
#joe-popup-container {
    position: relative;
    width: 90%;
    max-width: 520px;
    border-radius: 20px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
    overflow: hidden;
    text-align: center;
    transform: scale(0.5) translateY(50px);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
}

#joe-popup-container.joe-visible {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* ===== Ribbon ===== */
#joe-popup-ribbon {
    position: relative;
    padding: 18px 40px;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    clip-path: polygon(0 0, 100% 0, 96% 100%, 4% 100%);
    margin-bottom: 8px;
}

#joe-popup-ribbon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    pointer-events: none;
}

#joe-popup-ribbon-text {
    display: inline-block;
    animation: joe-ribbon-pulse 2s ease-in-out infinite;
}

@keyframes joe-ribbon-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ===== Ribbon tails ===== */
#joe-popup-ribbon::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 10%;
    width: 20px;
    height: 8px;
    background: inherit;
    filter: brightness(0.7);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* ===== Close Button ===== */
#joe-popup-close {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0,0,0,0.08);
    color: #666;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

#joe-popup-close:hover {
    background: rgba(0,0,0,0.15);
    transform: rotate(90deg);
    color: #333;
}

/* ===== Popup Content ===== */
#joe-popup-content {
    padding: 30px 30px 25px;
}

#joe-popup-icon {
    margin-bottom: 5px;
    animation: joe-gift-bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#joe-popup-icon svg {
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.15));
    animation: joe-gift-float 3s ease-in-out infinite;
    animation-delay: 1s;
}

@keyframes joe-gift-bounce {
    0% { transform: scale(0) rotate(-15deg); opacity: 0; }
    60% { transform: scale(1.1) rotate(3deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes joe-gift-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

#joe-popup-subtitle {
    margin: 10px 0 12px;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.4;
}

#joe-popup-desc {
    margin: 0 0 15px;
    font-size: 17px;
    line-height: 1.6;
    opacity: 0.85;
}

#joe-popup-company {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px dashed;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* ===== Buttons ===== */
#joe-popup-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 18px 0 10px;
    flex-wrap: wrap;
}

.joe-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.joe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.2);
}

.joe-btn:active {
    transform: translateY(0);
}

.joe-btn svg {
    flex-shrink: 0;
}

.joe-btn-whatsapp:hover {
    background: #1da851 !important;
}

.joe-btn-call:hover {
    filter: brightness(1.1);
}

/* ===== Confetti Burst (inner effect) ===== */
.joe-inner-confetti {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    animation: joe-inner-burst 1.5s ease-out forwards;
}

@keyframes joe-inner-burst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--bx), var(--by)) scale(0);
        opacity: 0;
    }
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    #joe-popup-container {
        max-width: 95%;
        border-radius: 15px;
    }

    #joe-popup-ribbon {
        font-size: 18px;
        padding: 14px 30px;
    }

    #joe-popup-content {
        padding: 20px 20px 18px;
    }

    #joe-popup-subtitle {
        font-size: 18px;
    }

    #joe-popup-desc {
        font-size: 15px;
    }

    #joe-popup-company {
        font-size: 13px;
    }

    .joe-firework-particle,
    .joe-firework-sparkle {
        display: none;
    }
}

/* ===== Prevent body scroll when popup is open ===== */
body.joe-popup-open {
    overflow: hidden;
}
