/* Unified Stack Visualization */
.unified-stack {
    position: relative;
    width: 100%;
    height: 200px;
    background: rgba(29, 12, 70, 0.05);
    border-radius: 8px;
    padding: 0.8rem;
    overflow: hidden;
    perspective: 1000px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.stack-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Data Pane Styles */
.data-pane {
    position: absolute;
    width: 80px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
}

/* Off-chain Data Panes (Purple) */
.pane-offchain {
    background: linear-gradient(135deg, rgba(29, 12, 70, 0.2), rgba(29, 12, 70, 0.1));
    border-color: rgba(29, 12, 70, 0.3);
}

.pane-offchain::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%231d0c46"><path d="M3 3h18v2H3V3zm0 4h18v2H3V7zm0 4h18v2H3v-2zm0 4h18v2H3v-2z"/></svg>') no-repeat center;
    background-size: contain;
    opacity: 0.6;
}

/* On-chain Data Panes (Gold) */
.pane-onchain {
    background: linear-gradient(135deg, rgba(202, 169, 104, 0.2), rgba(202, 169, 104, 0.1));
    border-color: rgba(202, 169, 104, 0.3);
}

.pane-onchain::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23CAA968"><path d="M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"/></svg>') no-repeat center;
    background-size: contain;
    opacity: 0.6;
}

/* Initial Scattered Positions */
.pane-1 {
    top: 20%;
    left: 10%;
    transform: rotateX(15deg) rotateY(-20deg) rotateZ(5deg) translateZ(0);
    animation: scatterToStack 1.5s ease-out 2s forwards, stackToScatter 1s ease-out 5s forwards;
}

.pane-2 {
    top: 60%;
    left: 15%;
    transform: rotateX(-10deg) rotateY(25deg) rotateZ(-8deg) translateZ(0);
    animation: scatterToStack 1.5s ease-out 2.2s forwards, stackToScatter 1s ease-out 5s forwards;
}

.pane-3 {
    top: 30%;
    right: 20%;
    transform: rotateX(20deg) rotateY(15deg) rotateZ(-12deg) translateZ(0);
    animation: scatterToStack 1.5s ease-out 2.4s forwards, stackToScatter 1s ease-out 5s forwards;
}

.pane-4 {
    bottom: 25%;
    right: 10%;
    transform: rotateX(-15deg) rotateY(-30deg) rotateZ(10deg) translateZ(0);
    animation: scatterToStack 1.5s ease-out 2.6s forwards, stackToScatter 1s ease-out 5s forwards;
}

.pane-5 {
    top: 10%;
    left: 50%;
    transform: rotateX(25deg) rotateY(-10deg) rotateZ(-15deg) translateZ(0);
    animation: scatterToStack 1.5s ease-out 2.8s forwards, stackToScatter 1s ease-out 5s forwards;
}

/* Stacked Positions */
.pane-1.stacked {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(0px) !important;
}

.pane-2.stacked {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(-10px) !important;
}

.pane-3.stacked {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(-20px) !important;
}

.pane-4.stacked {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(-30px) !important;
}

.pane-5.stacked {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(-40px) !important;
}

/* Cryptique Logo Card */
.cryptique-card {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 60px;
    background: linear-gradient(135deg, rgba(202, 169, 104, 0.2), rgba(202, 169, 104, 0.1));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(202, 169, 104, 0.3);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%) translateZ(10px);
    opacity: 0;
    box-shadow: 0 8px 32px rgba(202, 169, 104, 0.1);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.cryptique-card.active {
    opacity: 1;
    animation: logoAppear 0.8s ease-out 4s forwards, logoDisappear 0.5s ease-out 5s forwards;
}

.cryptique-logo {
    width: 30px;
    height: 30px;
    object-fit: contain;
    filter: brightness(1.2);
}

/* Animation Keyframes */
@keyframes scatterToStack {
    0% {
        transform: var(--initial-transform);
    }
    100% {
        transform: translate(-50%, -50%) translateZ(var(--stack-depth)) !important;
    }
}

@keyframes stackToScatter {
    0% {
        transform: translate(-50%, -50%) translateZ(var(--stack-depth));
    }
    100% {
        transform: var(--initial-transform);
    }
}

@keyframes logoAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) translateZ(10px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) translateZ(10px) scale(1);
    }
}

@keyframes logoDisappear {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) translateZ(10px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateZ(10px) scale(0.8);
    }
}

/* Floating Animation for Scattered State */
@keyframes float {
    0%, 100% {
        transform: var(--initial-transform) translateY(0px);
    }
    50% {
        transform: var(--initial-transform) translateY(-5px);
    }
}

.pane-1, .pane-2, .pane-3, .pane-4, .pane-5 {
    animation: float 3s ease-in-out infinite, scatterToStack 1.5s ease-out 2s forwards, stackToScatter 1s ease-out 5s forwards;
}

.pane-1 { animation-delay: 0s, 2s, 5s; }
.pane-2 { animation-delay: 0.2s, 2.2s, 5s; }
.pane-3 { animation-delay: 0.4s, 2.4s, 5s; }
.pane-4 { animation-delay: 0.6s, 2.6s, 5s; }
.pane-5 { animation-delay: 0.8s, 2.8s, 5s; }

/* Mobile Responsive */
@media (max-width: 768px) {
    .unified-stack {
        height: 160px;
        padding: 0.6rem;
        margin-bottom: 0.8rem;
    }
    
    .data-pane {
        width: 60px;
        height: 45px;
    }
    
    .cryptique-card {
        width: 60px;
        height: 45px;
        background: linear-gradient(135deg, rgba(202, 169, 104, 0.2), rgba(202, 169, 104, 0.1));
        border: 1px solid rgba(202, 169, 104, 0.3);
        box-shadow: 0 6px 24px rgba(202, 169, 104, 0.1);
    }
    
    .cryptique-logo {
        width: 25px;
        height: 25px;
    }
    
    .pane-offchain::before,
    .pane-onchain::before {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 480px) {
    .unified-stack {
        height: 140px;
        padding: 0.5rem;
        margin-bottom: 0.6rem;
    }
    
    .data-pane {
        width: 50px;
        height: 40px;
    }
    
    .cryptique-card {
        width: 50px;
        height: 40px;
        background: linear-gradient(135deg, rgba(202, 169, 104, 0.2), rgba(202, 169, 104, 0.1));
        border: 1px solid rgba(202, 169, 104, 0.3);
        box-shadow: 0 5px 20px rgba(202, 169, 104, 0.1);
    }
    
    .cryptique-logo {
        width: 20px;
        height: 20px;
    }
    
    .pane-offchain::before,
    .pane-onchain::before {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 360px) {
    .unified-stack {
        height: 120px;
        padding: 0.4rem;
        margin-bottom: 0.5rem;
    }
    
    .data-pane {
        width: 45px;
        height: 35px;
    }
    
    .cryptique-card {
        width: 45px;
        height: 35px;
        background: linear-gradient(135deg, rgba(202, 169, 104, 0.2), rgba(202, 169, 104, 0.1));
        border: 1px solid rgba(202, 169, 104, 0.3);
        box-shadow: 0 4px 16px rgba(202, 169, 104, 0.1);
    }
    
    .cryptique-logo {
        width: 18px;
        height: 18px;
    }
    
    .pane-offchain::before,
    .pane-onchain::before {
        width: 8px;
        height: 8px;
    }
}
