/* ========================================
   PRODUCT ANIMATIONS - Theme-based, Lightweight
   ======================================== */

.anim-stage {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 16px;
    background: radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.03),
        transparent 70%
    );
}

.anim-stage * {
    box-sizing: border-box;
}

/* ============ ESB: Central Hub + Orbiting Nodes ============ */
.anim-esb .esb-hub {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        var(--p-color, #3b82f6),
        transparent 75%
    );
    box-shadow: 0 0 40px var(--p-color, #3b82f6);
    animation: pulseScale 2.5s ease-in-out infinite;
}
.anim-esb .esb-orbit {
    position: absolute;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: spin 12s linear infinite;
}
.anim-esb .esb-orbit-1 {
    width: 160px;
    height: 160px;
}
.anim-esb .esb-orbit-2 {
    width: 240px;
    height: 240px;
    animation-duration: 18s;
    animation-direction: reverse;
}
.anim-esb .esb-node {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    top: -11px;
    left: calc(50% - 11px);
    box-shadow: 0 0 15px currentColor;
}
.anim-esb .esb-node-1 {
    background: #10b981;
    color: #10b981;
}
.anim-esb .esb-node-2 {
    background: #f59e0b;
    color: #f59e0b;
    top: auto;
    bottom: -11px;
}
.anim-esb .esb-node-3 {
    background: #ec4899;
    color: #ec4899;
}
.anim-esb .esb-node-4 {
    background: #8b5cf6;
    color: #8b5cf6;
    top: auto;
    bottom: -11px;
}

/* ============ CAS: Shield + Lock ============ */
.anim-cas .cas-shield {
    position: relative;
    width: 140px;
    height: 160px;
    background: linear-gradient(135deg, var(--p-color, #10b981), transparent);
    clip-path: polygon(50% 0%, 100% 20%, 100% 60%, 50% 100%, 0% 60%, 0% 20%);
    animation: pulseScale 3s ease-in-out infinite;
    box-shadow: 0 0 40px var(--p-color, #10b981);
    display: flex;
    align-items: center;
    justify-content: center;
}
.anim-cas .cas-lock {
    width: 50px;
    height: 40px;
    background: #0f172a;
    border-radius: 6px;
    position: relative;
    margin-top: 20px;
}
.anim-cas .cas-lock::before {
    content: "";
    position: absolute;
    top: -22px;
    left: 10px;
    width: 30px;
    height: 30px;
    border: 6px solid #0f172a;
    border-bottom: none;
    border-radius: 50% 50% 0 0;
}
.anim-cas .cas-lock::after {
    content: "";
    position: absolute;
    top: 12px;
    left: 21px;
    width: 8px;
    height: 8px;
    background: var(--p-color, #10b981);
    border-radius: 50%;
    animation: blink 1.5s ease-in-out infinite;
}
.anim-cas .cas-scan {
    position: absolute;
    width: 140px;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--p-color, #10b981),
        transparent
    );
    animation: scanDown 2.5s ease-in-out infinite;
    box-shadow: 0 0 10px var(--p-color, #10b981);
}

/* ============ BPMS: Flowchart nodes ============ */
.anim-bpms .bp-flow {
    position: relative;
    width: 260px;
    height: 200px;
}
.anim-bpms .bp-node {
    position: absolute;
    width: 60px;
    height: 42px;
    border-radius: 8px;
    opacity: 0;
    animation: popIn 0.6s ease-out forwards;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}
.anim-bpms .bp-node-1 {
    top: 0;
    left: 0;
    background: var(--p-color, #f59e0b);
    animation-delay: 0.1s;
}
.anim-bpms .bp-node-2 {
    top: 0;
    left: 100px;
    background: #10b981;
    animation-delay: 0.4s;
}
.anim-bpms .bp-node-3 {
    top: 0;
    right: 0;
    background: #8b5cf6;
    animation-delay: 0.7s;
}
.anim-bpms .bp-node-4 {
    top: 80px;
    left: 50px;
    background: #3b82f6;
    animation-delay: 1s;
}
.anim-bpms .bp-node-5 {
    top: 80px;
    right: 20px;
    background: #ec4899;
    animation-delay: 1.3s;
}
.anim-bpms .bp-node-6 {
    top: 160px;
    left: 100px;
    background: #14b8a6;
    animation-delay: 1.6s;
}
.anim-bpms .bp-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 10px #fff;
    animation: bpFlowMove 3s linear infinite;
    animation-delay: 2s;
}

/* ============ BI: Bar chart + Pie ============ */
.anim-bi .bi-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 160px;
}
.anim-bi .bi-bar {
    width: 24px;
    border-radius: 6px 6px 0 0;
    animation: barGrow 2.5s ease-in-out infinite;
    box-shadow: 0 0 15px currentColor;
}
.anim-bi .bi-bar-1 {
    background: #3b82f6;
    color: #3b82f6;
    height: 60%;
    animation-delay: 0s;
}
.anim-bi .bi-bar-2 {
    background: #10b981;
    color: #10b981;
    height: 90%;
    animation-delay: 0.2s;
}
.anim-bi .bi-bar-3 {
    background: #f59e0b;
    color: #f59e0b;
    height: 75%;
    animation-delay: 0.4s;
}
.anim-bi .bi-bar-4 {
    background: var(--p-color, #8b5cf6);
    color: var(--p-color, #8b5cf6);
    height: 100%;
    animation-delay: 0.6s;
}
.anim-bi .bi-bar-5 {
    background: #ec4899;
    color: #ec4899;
    height: 50%;
    animation-delay: 0.8s;
}
.anim-bi .bi-pie {
    position: absolute;
    top: 20px;
    right: 30px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: conic-gradient(
        #3b82f6 0deg 120deg,
        #10b981 120deg 220deg,
        #f59e0b 220deg 360deg
    );
    animation: spin 6s linear infinite;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.4);
}

/* ============ LMS: Book + Play ============ */
.anim-lms .lms-book {
    position: relative;
    width: 180px;
    height: 130px;
    display: flex;
}
.anim-lms .lms-page-left,
.anim-lms .lms-page-right {
    width: 90px;
    height: 130px;
    background: var(--p-color, #06b6d4);
}
.anim-lms .lms-page-left {
    border-radius: 8px 0 0 8px;
    opacity: 0.9;
}
.anim-lms .lms-page-right {
    border-radius: 0 8px 8px 0;
    background: #e0f7fa;
    transform-origin: left center;
    animation: pageFlip 3s ease-in-out infinite;
}
.anim-lms .lms-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(6, 182, 212, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulseScale 2s ease-in-out infinite;
    box-shadow: 0 0 30px var(--p-color, #06b6d4);
}
.anim-lms .lms-play::after {
    content: "";
    border-style: solid;
    border-width: 9px 0 9px 15px;
    border-color: transparent transparent transparent white;
    margin-left: 4px;
}
.anim-lms .lms-spark {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fcd34d;
    animation: floatUp 3s ease-in-out infinite;
}

/* ============ Portal: Gateway ring ============ */
.anim-portal .portal-ring {
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--p-color, #6366f1);
    border-right-color: var(--p-color, #6366f1);
    animation: spin 4s linear infinite;
}
.anim-portal .portal-ring-1 {
    width: 200px;
    height: 200px;
}
.anim-portal .portal-ring-2 {
    width: 150px;
    height: 150px;
    animation-duration: 3s;
    animation-direction: reverse;
    opacity: 0.7;
}
.anim-portal .portal-core {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        var(--p-color, #6366f1),
        transparent 75%
    );
    box-shadow: 0 0 50px var(--p-color, #6366f1);
    animation: pulseScale 2s ease-in-out infinite;
}
.anim-portal .portal-icon {
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    opacity: 0;
    animation: enterPortal 3s ease-in infinite;
}
.anim-portal .portal-icon-1 {
    background: #3b82f6;
    top: 30%;
    left: 10%;
    animation-delay: 0s;
}
.anim-portal .portal-icon-2 {
    background: #10b981;
    top: 60%;
    left: 15%;
    animation-delay: 1s;
}
.anim-portal .portal-icon-3 {
    background: #f59e0b;
    top: 20%;
    right: 12%;
    animation-delay: 2s;
}

/* ============ SuperApp: Phone with apps ============ */
.anim-superapp .app-phone {
    position: relative;
    width: 130px;
    height: 240px;
    background: #1e293b;
    border-radius: 20px;
    border: 3px solid var(--p-color, #ec4899);
    padding: 14px 10px;
    box-shadow: 0 0 40px rgba(236, 72, 153, 0.3);
}
.anim-superapp .app-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.anim-superapp .app-icon {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    opacity: 0;
    animation: popIn 0.4s ease-out forwards infinite;
    animation-duration: 0.4s, 0s;
}
.anim-superapp .app-icon {
    animation: appPopLoop 4s ease-in-out infinite;
}
.anim-superapp .app-icon:nth-child(1) {
    background: #3b82f6;
    animation-delay: 0s;
}
.anim-superapp .app-icon:nth-child(2) {
    background: #10b981;
    animation-delay: 0.1s;
}
.anim-superapp .app-icon:nth-child(3) {
    background: #f59e0b;
    animation-delay: 0.2s;
}
.anim-superapp .app-icon:nth-child(4) {
    background: #8b5cf6;
    animation-delay: 0.3s;
}
.anim-superapp .app-icon:nth-child(5) {
    background: var(--p-color, #ec4899);
    animation-delay: 0.4s;
}
.anim-superapp .app-icon:nth-child(6) {
    background: #06b6d4;
    animation-delay: 0.5s;
}
.anim-superapp .app-notif {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    animation: blink 1.2s ease-in-out infinite;
}

/* ============ NovaMeet: Video grid ============ */
.anim-novameet .nova-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 260px;
}
.anim-novameet .nova-cell {
    aspect-ratio: 4/3;
    border-radius: 10px;
    background: #1e293b;
    border: 2px solid;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: speakPulse 2s ease-in-out infinite;
}
.anim-novameet .nova-cell-1 {
    border-color: var(--p-color, #f43f5e);
    animation-delay: 0s;
}
.anim-novameet .nova-cell-2 {
    border-color: #10b981;
    animation-delay: 0.5s;
}
.anim-novameet .nova-cell-3 {
    border-color: #3b82f6;
    animation-delay: 1s;
}
.anim-novameet .nova-cell-4 {
    border-color: #f59e0b;
    animation-delay: 1.5s;
}
.anim-novameet .nova-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}
.anim-novameet .nova-wave {
    position: absolute;
    bottom: 6px;
    left: 6px;
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 12px;
}
.anim-novameet .nova-wave span {
    width: 3px;
    background: #10b981;
    animation: waveBar 1s ease-in-out infinite;
}
.anim-novameet .nova-wave span:nth-child(1) {
    animation-delay: 0s;
}
.anim-novameet .nova-wave span:nth-child(2) {
    animation-delay: 0.2s;
}
.anim-novameet .nova-wave span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ============ API Operator: network nodes ============ */
.anim-api-operator .api-center {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 16px;
    background: var(--p-color, #14b8a6);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px var(--p-color, #14b8a6);
    animation: pulseScale 2.5s ease-in-out infinite;
}
.anim-api-operator .api-node {
    position: absolute;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #1e293b;
    border: 2px solid var(--p-color, #14b8a6);
    display: flex;
    align-items: center;
    justify-content: center;
}
.anim-api-operator .api-node-1 {
    top: 10%;
    left: 10%;
}
.anim-api-operator .api-node-2 {
    top: 10%;
    right: 10%;
}
.anim-api-operator .api-node-3 {
    bottom: 10%;
    left: 10%;
}
.anim-api-operator .api-node-4 {
    bottom: 10%;
    right: 10%;
}
.anim-api-operator .api-line {
    position: absolute;
    background: linear-gradient(
        90deg,
        transparent,
        var(--p-color, #14b8a6),
        transparent
    );
    height: 2px;
    animation: apiPulseLine 2s linear infinite;
}

/* ============ Cloudino: Cloud upload ============ */
.anim-cloudino .cloud-shape {
    position: relative;
    width: 200px;
    height: 110px;
}
.cloud-shape::before,
.cloud-shape::after,
.cloud-shape .cloud-main {
    content: "";
    position: absolute;
    background: var(--p-color, #f97316);
    border-radius: 50%;
}
.anim-cloudino .cloud-main {
    width: 200px;
    height: 90px;
    border-radius: 50px;
    bottom: 0;
    box-shadow: 0 0 40px rgba(249, 115, 22, 0.4);
    animation: floatCloud 4s ease-in-out infinite;
}
.anim-cloudino .cloud-shape::before {
    width: 90px;
    height: 90px;
    left: 15px;
    bottom: 25px;
    animation: floatCloud 4s ease-in-out infinite;
}
.anim-cloudino .cloud-shape::after {
    width: 110px;
    height: 110px;
    right: 10px;
    bottom: 15px;
    animation: floatCloud 4s ease-in-out infinite;
}
.anim-cloudino .cloud-arrow {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 40px;
    background: white;
    animation: uploadArrow 2s ease-in-out infinite;
}
.anim-cloudino .cloud-arrow::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -8px;
    border-style: solid;
    border-width: 0 10px 14px 10px;
    border-color: transparent transparent white transparent;
}

/* ============ Shared keyframes ============ */
@keyframes pulseScale {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.12);
    }
}
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}
@keyframes scanDown {
    0% {
        transform: translateY(-70px);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(70px);
        opacity: 0;
    }
}
@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
@keyframes bpFlowMove {
    0% {
        top: 21px;
        left: 30px;
    }
    16% {
        top: 21px;
        left: 130px;
    }
    33% {
        top: 21px;
        left: 230px;
    }
    50% {
        top: 101px;
        left: 180px;
    }
    66% {
        top: 101px;
        left: 90px;
    }
    83% {
        top: 181px;
        left: 130px;
    }
    100% {
        top: 21px;
        left: 30px;
    }
}
@keyframes barGrow {
    0%,
    100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(0.7);
    }
}
@keyframes pageFlip {
    0%,
    100% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(-140deg);
    }
}
@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(-60px);
        opacity: 0;
    }
}
@keyframes enterPortal {
    0% {
        opacity: 0;
        transform: scale(1) translateX(0);
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
        transform: scale(0.3) translateX(120px);
    }
    100% {
        opacity: 0;
        transform: scale(0.1) translateX(150px);
    }
}
@keyframes appPopLoop {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.92);
    }
}
@keyframes speakPulse {
    0%,
    100% {
        box-shadow: 0 0 0 rgba(255, 255, 255, 0);
    }
    50% {
        box-shadow: 0 0 20px currentColor;
    }
}
@keyframes waveBar {
    0%,
    100% {
        height: 4px;
    }
    50% {
        height: 12px;
    }
}
@keyframes apiPulseLine {
    0% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}
@keyframes floatCloud {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}
@keyframes uploadArrow {
    0% {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(-10px);
        opacity: 0;
    }
}

/* Card thumbnail scale - animations smaller inside product cards */
.card-image-wrapper {
    background: var(--bg-dark);
}

.card-image-wrapper .anim-stage {
    min-height: 100%;
    height: 100%;
    transform: scale(0.62);
    opacity: 0.75;
    transition: all 0.5s ease;
}

.tilt-card:hover .card-image-wrapper .anim-stage {
    opacity: 1;
    transform: scale(0.7);
}

/* Hero slider animation scaling */
.slide .anim-stage {
    min-height: 100%;
    height: 100%;
    transform: scale(0.85);
}

@media (max-width: 768px) {
    .anim-stage {
        min-height: 220px;
    }
    .anim-bpms .bp-flow,
    .anim-novameet .nova-grid {
        transform: scale(0.8);
    }
}
