/* ===== JELLYFISH POPUP ===== */

/* Overlay backdrop */
.jellyfish-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

/* Popup container */
.jellyfish-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    padding: 2rem 2.5rem 2.5rem;
    border-radius: 24px;
    background: linear-gradient(135deg, #0d1b2a 0%, #1b2838 50%, #0a1628 100%);
    border: 1px solid rgba(0, 217, 213, 0.2);
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(0, 217, 213, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 420px;
    width: 90vw;
}

.jellyfish-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Close button */
.jellyfish-popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.jellyfish-popup-close:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1);
}

.jellyfish-popup-close svg {
    width: 16px;
    height: 16px;
    stroke: rgba(255, 255, 255, 0.6);
    stroke-width: 2;
}

/* Jellyfish character container */
.jellyfish-popup-character {
    width: 180px;
    height: 220px;
    flex-shrink: 0;
}

.jellyfish-popup-character .jellyfish-svg {
    width: 100%;
    height: 100%;
    animation: jellyfishPopupFloat 4s ease-in-out infinite;
}

@keyframes jellyfishPopupFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Breathing animation for body */
.jellyfish-popup-character .jf-body-group {
    animation: jfBreathe 3s ease-in-out infinite;
    transform-origin: 210px 160px;
}

@keyframes jfBreathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* Tentacle swaying */
.jellyfish-popup-character .jf-tentacle {
    transform-origin: top center;
}

.jellyfish-popup-character .jf-tentacle:nth-child(1) { animation: jfSway1 3s ease-in-out infinite 0s; }
.jellyfish-popup-character .jf-tentacle:nth-child(2) { animation: jfSway2 3.5s ease-in-out infinite 0.2s; }
.jellyfish-popup-character .jf-tentacle:nth-child(3) { animation: jfSway1 3.2s ease-in-out infinite 0.4s; }
.jellyfish-popup-character .jf-tentacle:nth-child(4) { animation: jfSway2 3.8s ease-in-out infinite 0.6s; }

@keyframes jfSway1 {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(5deg); }
}

@keyframes jfSway2 {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-5deg); }
}

/* Eye blink */
.jellyfish-popup-character .jf-eye {
    animation: jfBlink 4s ease-in-out infinite;
    transform-origin: center center;
}

.jellyfish-popup-character .jf-eye:nth-child(2) {
    animation-delay: 0.1s;
}

@keyframes jfBlink {
    0%, 42%, 44%, 100% { transform: scaleY(1); }
    43% { transform: scaleY(0.1); }
}

/* Highlight shimmer */
.jellyfish-popup-character .jf-highlight {
    animation: jfShimmer 2.5s ease-in-out infinite;
}

@keyframes jfShimmer {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
}

/* Star twinkle */
.jellyfish-popup-character .jf-star {
    animation: jfTwinkle 2s ease-in-out infinite;
    transform-origin: center center;
}

@keyframes jfTwinkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
    50% { transform: scale(1.1) rotate(10deg); opacity: 0.8; }
}

/* Popup text content */
.jellyfish-popup-text {
    text-align: center;
}

.jellyfish-popup-text h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.jellyfish-popup-text h3 span {
    background: linear-gradient(135deg, #00d9d5, #00b8b5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.jellyfish-popup-text p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.5;
    margin: 0;
}

/* CTA Button - same style as hero "Instant Live Demo" */
.jellyfish-popup .popup-cta-btn {
    --round: 0.75rem;
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.25s ease;
    background: radial-gradient(65.28% 65.28% at 50% 100%,
            rgba(0, 217, 213, 0.8) 0%,
            rgba(0, 217, 213, 0) 100%),
        linear-gradient(0deg, #00d9d5, #00d9d5);
    border-radius: var(--round);
    border: none;
    outline: none;
    padding: 1rem 2.5rem;
    min-width: 220px;
    margin-top: 0.5rem;
}

.jellyfish-popup .popup-cta-btn::before,
.jellyfish-popup .popup-cta-btn::after {
    content: "";
    position: absolute;
    inset: var(--space);
    transition: all 0.5s ease-in-out;
    border-radius: calc(var(--round) - var(--space));
    z-index: 0;
}

.jellyfish-popup .popup-cta-btn::before {
    --space: 1px;
    background: linear-gradient(177.95deg,
            rgba(255, 255, 255, 0.19) 0%,
            rgba(255, 255, 255, 0) 100%);
}

.jellyfish-popup .popup-cta-btn::after {
    --space: 2px;
    background: radial-gradient(65.28% 65.28% at 50% 100%,
            rgba(14, 206, 65, 0.8) 0%,
            rgba(0, 217, 213, 0) 100%),
        linear-gradient(0deg, #050f0e, #00d9d5);
}

.jellyfish-popup .popup-cta-btn:active {
    transform: scale(0.95);
}

.jellyfish-popup .popup-cta-btn:hover {
    background: radial-gradient(65.28% 65.28% at 50% 100%,
            rgba(0, 217, 213, 0.9) 0%,
            rgba(0, 217, 213, 0) 100%),
        linear-gradient(0deg, #00b8b5, #00b8b5);
}

.jellyfish-popup .popup-cta-btn .fold {
    z-index: 1;
    position: absolute;
    top: 0;
    right: 0;
    height: 1rem;
    width: 1rem;
    display: inline-block;
    transition: all 0.5s ease-in-out;
    background: radial-gradient(100% 75% at 55%,
            rgba(0, 217, 213, 0.8) 0%,
            rgba(0, 217, 213, 0) 100%);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    border-bottom-left-radius: 0.5rem;
    border-top-right-radius: var(--round);
}

.jellyfish-popup .popup-cta-btn .fold::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 150%;
    height: 150%;
    transform: rotate(45deg) translateX(0%) translateY(-18px);
    background-color: #e8e8e8;
    pointer-events: none;
}

.jellyfish-popup .popup-cta-btn:hover .fold {
    margin-top: -1rem;
    margin-right: -1rem;
}

.jellyfish-popup .popup-cta-btn .points_wrapper {
    overflow: hidden;
    width: 100%;
    height: 100%;
    pointer-events: none;
    position: absolute;
    z-index: 1;
}

.jellyfish-popup .popup-cta-btn .points_wrapper .point {
    bottom: -10px;
    position: absolute;
    animation: popup-floating-points infinite ease-in-out;
    pointer-events: none;
    width: 2px;
    height: 2px;
    background-color: #fff;
    border-radius: 9999px;
}

@keyframes popup-floating-points {
    0% { transform: translateY(0); }
    85% { opacity: 0; }
    100% { transform: translateY(-55px); opacity: 0; }
}

.jellyfish-popup .popup-cta-btn .points_wrapper .point:nth-child(1) { left: 10%; opacity: 1; animation-duration: 2.35s; animation-delay: 0.2s; }
.jellyfish-popup .popup-cta-btn .points_wrapper .point:nth-child(2) { left: 30%; opacity: 0.7; animation-duration: 2.5s; animation-delay: 0.5s; }
.jellyfish-popup .popup-cta-btn .points_wrapper .point:nth-child(3) { left: 50%; opacity: 0.8; animation-duration: 2.2s; animation-delay: 0.1s; }
.jellyfish-popup .popup-cta-btn .points_wrapper .point:nth-child(4) { left: 70%; opacity: 0.6; animation-duration: 2.05s; }
.jellyfish-popup .popup-cta-btn .points_wrapper .point:nth-child(5) { left: 90%; opacity: 1; animation-duration: 1.9s; }

.jellyfish-popup .popup-cta-btn .inner {
    z-index: 2;
    gap: 6px;
    position: relative;
    width: 100%;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    transition: color 0.2s ease-in-out;
}

.jellyfish-popup .popup-cta-btn .inner svg.icon {
    width: 18px;
    height: 18px;
    transition: fill 0.1s linear;
}

.jellyfish-popup .popup-cta-btn:hover svg.icon {
    fill: transparent;
    animation:
        popup-dasharray 1s linear forwards,
        popup-filled 0.1s linear forwards 0.95s;
}

@keyframes popup-dasharray {
    from { stroke-dasharray: 0 0 0 0; }
    to { stroke-dasharray: 68 68 0 0; }
}

@keyframes popup-filled {
    to { fill: white; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .jellyfish-popup {
        padding: 1.5rem 1.5rem 2rem;
        gap: 0.8rem;
    }

    .jellyfish-popup-character {
        width: 140px;
        height: 175px;
    }

    .jellyfish-popup-text h3 {
        font-size: 1.15rem;
    }

    .jellyfish-popup-text p {
        font-size: 0.85rem;
    }

    .jellyfish-popup .popup-cta-btn {
        padding: 0.85rem 2rem;
        min-width: 190px;
    }

    .jellyfish-popup .popup-cta-btn .inner {
        font-size: 0.9rem;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .jellyfish-popup-character .jellyfish-svg,
    .jellyfish-popup-character .jf-body-group,
    .jellyfish-popup-character .jf-tentacle,
    .jellyfish-popup-character .jf-eye,
    .jellyfish-popup-character .jf-highlight,
    .jellyfish-popup-character .jf-star {
        animation: none !important;
    }
}
