/**
 * TopApp Image Liquid v2.0
 * Estilos del efecto líquido
 */

/* =============================================
   CONTENEDOR PRINCIPAL
   ============================================= */

.topapp-liquid-box {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    background: #0a0a0a;
    cursor: crosshair;
    -webkit-user-select: none;
    user-select: none;
}

/* =============================================
   CANVAS
   ============================================= */

.topapp-canvas-sim {
    display: none;
}

.topapp-canvas-render {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* =============================================
   FALLBACK (cuando no hay imagen)
   ============================================= */

.topapp-fallback {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: #111;
}

.topapp-fallback img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

/* =============================================
   SPINNER DE CARGA
   ============================================= */

.topapp-liquid-box::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    animation: topapp-spin 0.7s linear infinite;
    z-index: 10;
    pointer-events: none;
}

.topapp-liquid-box.loaded::before {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

@keyframes topapp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* =============================================
   EDITOR DE ELEMENTOR
   ============================================= */

.elementor-editor-active .topapp-liquid-box {
    pointer-events: auto !important;
}

.elementor-editor-active .topapp-liquid-box::after {
    content: '💧 Mueve el cursor para ver el efecto';
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.elementor-editor-active .topapp-liquid-box:hover::after {
    opacity: 1;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
    .topapp-liquid-box {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .topapp-liquid-box {
        height: 350px;
        cursor: default;
    }
    
    .elementor-editor-active .topapp-liquid-box::after {
        content: '💧 Toca para ver el efecto';
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .topapp-liquid-box {
        height: 280px;
    }
}

/* =============================================
   RENDIMIENTO (GPU acceleration)
   ============================================= */

.topapp-liquid-box,
.topapp-canvas-render {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: contents;
}

/* =============================================
   ACCESIBILIDAD
   ============================================= */

@media (prefers-reduced-motion: reduce) {
    .topapp-liquid-box::before {
        animation: none;
    }
    
    .topapp-liquid-box {
        cursor: default;
    }
}

/* =============================================
   IMPRESIÓN
   ============================================= */

@media print {
    .topapp-canvas-render {
        display: none !important;
    }
    
    .topapp-fallback {
        display: flex !important;
        position: relative !important;
    }
}

/* =============================================
   ESTADO SIN IMAGEN
   ============================================= */

.topapp-liquid-box.no-image {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.topapp-liquid-box.no-image::after {
    content: '📷 Selecciona una imagen';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}