/**
 * Effects.css - Estilos para efectos visuales avanzados
 *
 * @package iAudita\Portal
 * @version 1.0.0
 */

/* ========================================
   CANVAS DE PARTÍCULAS
   ======================================== */

#particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: auto;
}

.hero-section {
    position: relative;
}

.hero-section .container {
    position: relative;
    z-index: 2;
}

/* ========================================
   ANIMACIONES DE SCROLL
   ======================================== */

/* Estado inicial para elementos animados */
.scroll-animate-init {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.scroll-animate-init.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animaciones específicas */
.animate-fade-up {
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-down {
    animation: fadeDown 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-left {
    animation: fadeLeft 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-right {
    animation: fadeRight 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-scale-up {
    animation: scaleUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-rotate-in {
    animation: rotateIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeLeft {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeRight {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-10deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* ========================================
   PARALLAX LAYERS
   ======================================== */

[data-parallax] {
    will-change: transform;
}

/* ========================================
   FLOATING ELEMENTS (ANTIGRAVITY)
   ======================================== */

[data-float] {
    will-change: transform;
}

/* Floating shapes decorativos */
.floating-shape {
    position: absolute;
    pointer-events: none;
    opacity: 0.1;
    z-index: 0;
}

.floating-shape--circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
}

.floating-shape--square {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-primary) 100%);
    transform: rotate(45deg);
}

.floating-shape--triangle {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 86px solid var(--color-accent);
    opacity: 0.08;
}

/* ========================================
   TILT EFFECT
   ======================================== */

[data-tilt] {
    will-change: transform;
    transform-style: preserve-3d;
}

[data-tilt] > * {
    transform: translateZ(20px);
}

/* ========================================
   CURSOR GLOW
   ======================================== */

.cursor-glow {
    mix-blend-mode: screen;
}

/* ========================================
   TEXT REVEAL
   ======================================== */

[data-text-reveal] {
    overflow: hidden;
}

[data-text-reveal] .word {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
}

[data-text-reveal] .char {
    display: inline-block;
    will-change: transform, opacity;
}

/* ========================================
   GRADIENT TEXT ANIMATION
   ======================================== */

.gradient-text-animated {
    background: linear-gradient(
        90deg,
        var(--color-primary) 0%,
        var(--color-accent) 25%,
        var(--color-secondary) 50%,
        var(--color-accent) 75%,
        var(--color-primary) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientFlow 3s linear infinite;
}

@keyframes gradientFlow {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

/* ========================================
   PULSE EFFECT
   ======================================== */

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* ========================================
   GLOW RING (GOOGLE ANTIGRAVITY STYLE)
   ======================================== */

.glow-ring {
    position: relative;
}

.glow-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent,
        var(--color-primary),
        transparent,
        var(--color-accent),
        transparent
    );
    opacity: 0.3;
    animation: rotateGlow 8s linear infinite;
    z-index: -1;
    filter: blur(20px);
}

@keyframes rotateGlow {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ========================================
   SHIMMER EFFECT (LOADING)
   ======================================== */

.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* ========================================
   STAGGER ANIMATIONS
   ======================================== */

[data-stagger] > * {
    opacity: 0;
    transform: translateY(20px);
}

[data-stagger].is-visible > *:nth-child(1) { animation: staggerIn 0.5s 0.1s forwards; }
[data-stagger].is-visible > *:nth-child(2) { animation: staggerIn 0.5s 0.2s forwards; }
[data-stagger].is-visible > *:nth-child(3) { animation: staggerIn 0.5s 0.3s forwards; }
[data-stagger].is-visible > *:nth-child(4) { animation: staggerIn 0.5s 0.4s forwards; }
[data-stagger].is-visible > *:nth-child(5) { animation: staggerIn 0.5s 0.5s forwards; }
[data-stagger].is-visible > *:nth-child(6) { animation: staggerIn 0.5s 0.6s forwards; }
[data-stagger].is-visible > *:nth-child(7) { animation: staggerIn 0.5s 0.7s forwards; }
[data-stagger].is-visible > *:nth-child(8) { animation: staggerIn 0.5s 0.8s forwards; }

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

/* ========================================
   BORDER GRADIENT ANIMATION
   ======================================== */

.border-gradient-animated {
    position: relative;
    background: var(--color-white);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.border-gradient-animated::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        45deg,
        var(--color-primary),
        var(--color-accent),
        var(--color-secondary),
        var(--color-primary)
    );
    background-size: 400% 400%;
    z-index: -1;
    border-radius: inherit;
    animation: borderGradient 5s ease infinite;
}

@keyframes borderGradient {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* ========================================
   HOVER LIFT EFFECT
   ======================================== */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* ========================================
   MAGNETIC BUTTON EFFECT
   ======================================== */

.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========================================
   BLUR BACKGROUND ON SCROLL
   ======================================== */

.blur-on-scroll {
    transition: filter 0.3s ease;
}

.blur-on-scroll.is-blurred {
    filter: blur(5px);
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    /* Reducir partículas en mobile para performance */
    #particles-canvas {
        opacity: 0.5;
    }

    /* Deshabilitar tilt en mobile */
    [data-tilt] {
        transform: none !important;
    }

    /* Reducir animaciones */
    .scroll-animate-init {
        transform: translateY(20px);
    }

    /* Ocultar shapes decorativos */
    .floating-shape {
        display: none;
    }
}

/* Preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    #particles-canvas {
        display: none;
    }

    [data-parallax] {
        transform: none !important;
    }

    [data-float] {
        animation: none !important;
    }

    [data-parallax-bg] {
        transform: none !important;
    }
}

/* ========================================
   TOUR SISTEMA - GALERÍA CON TABS
   ======================================== */

/* Screenshot Frame (estilo macOS) */
.screenshot-frame {
    background: #1e1e1e;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.screenshot-frame:hover {
    transform: translateY(-5px);
    box-shadow: 0 35px 60px -15px rgba(0, 0, 0, 0.3);
}

.screenshot-header {
    background: linear-gradient(180deg, #3d3d3d 0%, #2d2d2d 100%);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.screenshot-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.screenshot-dot.red {
    background: #ff5f57;
}

.screenshot-dot.yellow {
    background: #ffbd2e;
}

.screenshot-dot.green {
    background: #28c940;
}

.screenshot-title {
    color: #999;
    font-size: 13px;
    margin-left: 12px;
    font-weight: 500;
}

/* Contenedor scrolleable para imágenes largas */
.screenshot-body {
    max-height: 450px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scrollbar personalizado estilo macOS */
.screenshot-body::-webkit-scrollbar {
    width: 8px;
}

.screenshot-body::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.screenshot-body::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.screenshot-body::-webkit-scrollbar-thumb:hover {
    background: #777;
}

.screenshot-frame img {
    width: 100%;
    height: auto;
    display: block;
}

/* Tour Tabs */
.tour-tab {
    background: transparent !important;
    border: 2px solid #e5e7eb !important;
    color: #6b7280 !important;
    padding: 10px 20px !important;
    border-radius: 50px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
}

.tour-tab:hover {
    border-color: var(--color-primary, #22c55e) !important;
    color: var(--color-primary, #22c55e) !important;
    background: rgba(34, 197, 94, 0.05) !important;
}

.tour-tab.active {
    background: var(--color-primary, #22c55e) !important;
    border-color: var(--color-primary, #22c55e) !important;
    color: white !important;
}

/* Tab content transition */
.tab-pane {
    animation: fadeInTab 0.4s ease;
}

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

/* Responsive tabs */
@media (max-width: 768px) {
    .tour-tab {
        padding: 8px 14px !important;
        font-size: 12px !important;
    }

    .tour-tab i {
        display: none;
    }

    .screenshot-frame {
        border-radius: 8px;
    }

    .screenshot-header {
        padding: 8px 12px;
    }

    .screenshot-dot {
        width: 8px;
        height: 8px;
    }

    .screenshot-title {
        font-size: 11px;
    }
}

/* ========================================
   DASHBOARD PARALLAX SECTION (Fixed Background)
   ======================================== */

.dashboard-parallax-section {
    position: relative;
    overflow: hidden;
}

/* Responsive: Ajustar en mobile */
@media (max-width: 768px) {
    .dashboard-parallax-section {
        height: 400px !important;
        /* En móviles, background-attachment: fixed no funciona bien en iOS */
        background-attachment: scroll !important;
        background-size: cover !important;
        background-position: center center !important;
    }
}
