/* =========================================
   LEOCONS ANIMATION ENGINE
   System: Motion / 3D / Transitions
   ========================================= */

/* =========================================
   GLOBAL ENTRANCE ANIMATIONS
   ========================================= */

/* Fade In Up (Standard content reveal) */
.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered delays for grids */
.features-grid > div:nth-child(1) { animation-delay: 0.1s; }
.features-grid > div:nth-child(2) { animation-delay: 0.2s; }
.features-grid > div:nth-child(3) { animation-delay: 0.3s; }

/* =========================================
   PAGE LOADER SYSTEM
   ========================================= */

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    width: 300px;
    text-align: center;
}

.loader-title {
    font-size: 3rem;
    color: white;
    margin-bottom: 20px;
    opacity: 0;
    animation: flickerIn 1s infinite alternate;
}

.loader-bar-container {
    width: 100%;
    height: 4px;
    background: #222;
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.loader-bar {
    width: 0%;
    height: 100%;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
    transition: width 0.2s linear;
}

.loader-text {
    margin-top: 10px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    color: #666;
    letter-spacing: 2px;
}

/* Fast Fade Loader (for internal navigation) */
.fast-fade {
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes flickerIn {
    0% { opacity: 0.8; text-shadow: 0 0 5px white; }
    100% { opacity: 1; text-shadow: 0 0 20px white, 0 0 10px var(--accent-primary); }
}

/* =========================================
   3D CUBE ANIMATION (HERO VISUAL)
   ========================================= */

.cube-wrapper {
    width: 200px;
    height: 200px;
    perspective: 800px;
}

.cube {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(-20deg) rotateY(-20deg);
    animation: rotateCube 15s infinite linear;
}

/* Hover pauses the rotation */
.cube-wrapper:hover .cube {
    animation-play-state: paused;
}

.face {
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.2) inset;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    font-family: 'Anton', sans-serif;
    color: white;
    backface-visibility: visible; /* Show inside */
    opacity: 0.9;
}

/* Positioning Faces */
.face.front  { transform: translateZ(100px); }
.face.back   { transform: rotateY(180deg) translateZ(100px); }
.face.right  { transform: rotateY(90deg) translateZ(100px); }
.face.left   { transform: rotateY(-90deg) translateZ(100px); }
.face.top    { transform: rotateX(90deg) translateZ(100px); background: rgba(0, 255, 157, 0.1); }
.face.bottom { transform: rotateX(-90deg) translateZ(100px); background: rgba(0, 255, 157, 0.1); }

@keyframes rotateCube {
    0% { transform: rotateX(-20deg) rotateY(0deg); }
    100% { transform: rotateX(-20deg) rotateY(360deg); }
}

/* =========================================
   INTERACTIVE HOVER EFFECTS
   ========================================= */

/* Glitch Hover for Buttons */
.glitch-hover {
    position: relative;
    overflow: hidden;
}

.glitch-hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transform: skewX(-20deg);
    transition: 0s;
}

.glitch-hover:hover::after {
    animation: shine-sweep 0.5s;
}

@keyframes shine-sweep {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Neon Pulse (for 'Active' states) */
.neon-pulse {
    animation: neonPulse 2s infinite;
}

@keyframes neonPulse {
    0% { box-shadow: 0 0 5px var(--accent-primary); }
    50% { box-shadow: 0 0 20px var(--accent-primary), 0 0 10px var(--accent-secondary); }
    100% { box-shadow: 0 0 5px var(--accent-primary); }
}

/* =========================================
   MODAL & PANEL TRANSITIONS
   ========================================= */

/* Modal Entry (Scale Up) */
.modal-backdrop.active .modal-content {
    animation: modalPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Slide in from Right (Sidebar) */
.slide-in-right {
    animation: slideRight 0.3s ease-out forwards;
}

@keyframes slideRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* =========================================
   EDITOR SPECIFIC ANIMATIONS
   ========================================= */

/* Canvas Resize Animation */
.canvas-frame {
    transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.4s ease;
}

/* Drag & Drop Visuals */
.draggable-item {
    transition: transform 0.2s, background 0.2s;
    cursor: grab;
}

.draggable-item:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.drop-target-active {
    border: 2px dashed var(--accent-primary) !important;
    background: rgba(0, 255, 157, 0.05);
}
