/* Animações de Controle de Acesso - VERSÃO 3D MELHORADA */

/* Animação de Scan Facial */
@keyframes facial-scan {
    0%, 100% { 
        transform: translateY(0);
        opacity: 0.3;
    }
    50% { 
        transform: translateY(100%);
        opacity: 1;
    }
}

@keyframes pulse-green {
    0%, 100% { 
        box-shadow: 
            0 0 0 0 rgba(0, 230, 118, 0.7),
            0 0 20px rgba(0, 230, 118, 0.3),
            inset 0 0 20px rgba(0, 230, 118, 0.1);
    }
    50% { 
        box-shadow: 
            0 0 0 20px rgba(0, 230, 118, 0),
            0 0 40px rgba(0, 230, 118, 0.6),
            inset 0 0 30px rgba(0, 230, 118, 0.2);
    }
}

@keyframes scan-line {
    0% { 
        top: 0;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% { 
        top: 100%;
        opacity: 0;
    }
}

@keyframes check-approved {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.3) rotate(-45deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(-45deg);
        opacity: 1;
    }
}

/* Animação de Cancela */
@keyframes barrier-open {
    0% { 
        transform: rotate(0deg);
    }
    100% { 
        transform: rotate(-90deg);
    }
}

@keyframes car-enter {
    0% {
        transform: translateX(-150%);
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        transform: translateX(150%);
    }
}

/* Animação de Catraca */
@keyframes turnstile-rotate {
    0% { 
        transform: rotate(0deg);
    }
    100% { 
        transform: rotate(120deg);
    }
}

@keyframes person-walk {
    0% {
        transform: translateX(-100px);
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        transform: translateX(100px);
    }
}

/* Animação de Desktop */
@keyframes screen-glow {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(0, 230, 118, 0.3),
            inset 0 0 30px rgba(0, 230, 118, 0.1);
    }
    50% {
        box-shadow: 
            0 0 40px rgba(0, 230, 118, 0.6),
            inset 0 0 50px rgba(0, 230, 118, 0.2);
    }
}

@keyframes data-flow {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(20px);
        opacity: 0;
    }
}

/* Animação de Smartphone */
@keyframes notification-pop {
    0% {
        transform: translateY(-20px) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateY(0) scale(1.05);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes phone-vibrate {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-2px) rotate(-1deg); }
    75% { transform: translateX(2px) rotate(1deg); }
}

/* Efeito de Hologram */
@keyframes hologram {
    0%, 100% {
        opacity: 0.6;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-5px) scale(1.02);
    }
}

/* Glow pulsante */
@keyframes glow-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(0, 230, 118, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 25px rgba(0, 230, 118, 1));
    }
}

/* Seção de Demonstração Interativa */
.demo-section {
    padding: 6rem 0;
    background: linear-gradient(180deg, var(--color-dark) 0%, var(--color-dark-secondary) 50%, var(--color-dark) 100%);
    position: relative;
    overflow: hidden;
}

.demo-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(26, 115, 232, 0.03) 2px,
            rgba(26, 115, 232, 0.03) 4px
        );
    pointer-events: none;
}

.demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 3rem;
    margin-top: 3rem;
}

/* Card de Demonstração */
.demo-card {
    background: linear-gradient(145deg, var(--color-gray), var(--color-gray-light));
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    transition: var(--transition);
    overflow: hidden;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        0 1px 3px rgba(255, 255, 255, 0.1);
}

.demo-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 230, 118, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: var(--transition);
}

.demo-card:hover::before {
    opacity: 1;
}

.demo-card:hover {
    transform: translateY(-15px) scale(1.02);
    border-color: var(--color-secondary);
    box-shadow: 
        0 25px 70px rgba(0, 230, 118, 0.4),
        0 15px 40px rgba(26, 115, 232, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.demo-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-secondary);
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 230, 118, 0.3);
}

/* Animação de Leitura Facial 3D */
.facial-recognition {
    width: 220px;
    height: 220px;
    margin: 2rem auto;
    position: relative;
    perspective: 1000px;
}

.face-frame {
    width: 100%;
    height: 100%;
    border: 4px solid var(--color-primary);
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(26, 115, 232, 0.1), rgba(0, 230, 118, 0.05));
    box-shadow: 
        0 10px 40px rgba(26, 115, 232, 0.3),
        inset 0 5px 15px rgba(0, 230, 118, 0.1);
    transform-style: preserve-3d;
}

.face-icon {
    width: 60%;
    height: 60%;
    margin: 20% auto;
    display: block;
    fill: var(--color-text-secondary);
    transition: var(--transition);
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.5));
}

.scan-effect {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, 
        transparent,
        rgba(0, 230, 118, 0.5),
        var(--color-secondary),
        rgba(0, 230, 118, 0.5),
        transparent
    );
    box-shadow: 
        0 0 20px rgba(0, 230, 118, 1),
        0 0 40px rgba(0, 230, 118, 0.5);
    opacity: 0;
}

.demo-card:hover .scan-effect {
    animation: scan-line 2s ease-in-out infinite;
}

.demo-card:hover .face-frame {
    border-color: var(--color-secondary);
    animation: pulse-green 2s ease-in-out infinite;
}

.demo-card:hover .face-icon {
    fill: var(--color-secondary);
    filter: drop-shadow(0 0 20px rgba(0, 230, 118, 0.8));
}

.check-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 70px;
    margin: -35px 0 0 -35px;
    opacity: 0;
    pointer-events: none;
    background: rgba(0, 230, 118, 0.2);
    border-radius: 50%;
    backdrop-filter: blur(5px);
}

.demo-card:hover .check-mark {
    animation: check-approved 0.6s ease-out 1.5s forwards;
}

.check-mark::before {
    content: '';
    position: absolute;
    width: 40px;
    height: 20px;
    border-left: 5px solid var(--color-secondary);
    border-bottom: 5px solid var(--color-secondary);
    transform: rotate(-45deg);
    top: 20px;
    left: 15px;
    filter: drop-shadow(0 0 10px rgba(0, 230, 118, 1));
}

/* Animação de Cancela 3D */
.barrier-demo {
    width: 100%;
    height: 220px;
    position: relative;
    margin: 2rem auto;
    perspective: 1200px;
}

.barrier-container {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}

.barrier-base {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 35px;
    height: 90px;
    background: linear-gradient(145deg, #3a3a3a, #1a1a1a);
    border-radius: 8px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.7),
        inset 2px 0 5px rgba(255, 255, 255, 0.1),
        inset -2px 0 5px rgba(0, 0, 0, 0.5);
}

.barrier-base::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--color-secondary);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.8);
}

.barrier-arm {
    position: absolute;
    bottom: 90px;
    left: 50%;
    width: 190px;
    height: 12px;
    background: repeating-linear-gradient(
        90deg,
        #ff0000 0px,
        #ff0000 20px,
        #ffffff 20px,
        #ffffff 40px
    );
    transform-origin: left center;
    border-radius: 6px;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 8px 20px rgba(255, 0, 0, 0.4),
        0 2px 5px rgba(0, 0, 0, 0.5),
        inset 0 2px 3px rgba(255, 255, 255, 0.3),
        inset 0 -2px 3px rgba(0, 0, 0, 0.3);
}

.barrier-arm::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: linear-gradient(145deg, #ff0000, #cc0000);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
}

.demo-card:hover .barrier-arm {
    animation: barrier-open 0.8s ease-in-out forwards;
}

.car-icon {
    position: absolute;
    bottom: 35px;
    left: 0;
    width: 90px;
    height: 50px;
    opacity: 0;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

.demo-card:hover .car-icon {
    animation: car-enter 3s ease-in-out 0.8s forwards;
}

/* Animação de Catraca 3D */
.turnstile-demo {
    width: 220px;
    height: 220px;
    margin: 2rem auto;
    position: relative;
    perspective: 1000px;
}

.turnstile-base {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 130px;
    background: linear-gradient(145deg, #3a3a3a, #1a1a1a);
    border-radius: 10px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.7),
        inset 2px 0 8px rgba(255, 255, 255, 0.1),
        inset -2px 0 8px rgba(0, 0, 0, 0.5);
}

.turnstile-base::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(26, 115, 232, 0.8);
}

.turnstile-arms {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140px;
    height: 140px;
    transform-style: preserve-3d;
}

.turnstile-arm {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 12px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    transform-origin: left center;
    border-radius: 6px;
    box-shadow: 
        0 5px 15px rgba(0, 230, 118, 0.5),
        inset 0 2px 3px rgba(255, 255, 255, 0.3),
        inset 0 -2px 3px rgba(0, 0, 0, 0.3);
}

.turnstile-arm::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: linear-gradient(145deg, var(--color-secondary), var(--color-primary));
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.6);
}

.turnstile-arm:nth-child(1) {
    transform: translate(-50%, -50%) rotate(0deg);
}

.turnstile-arm:nth-child(2) {
    transform: translate(-50%, -50%) rotate(120deg);
}

.turnstile-arm:nth-child(3) {
    transform: translate(-50%, -50%) rotate(240deg);
}

.demo-card:hover .turnstile-arms {
    animation: turnstile-rotate 1s ease-in-out forwards;
}

.person-icon {
    position: absolute;
    bottom: 25px;
    left: 0;
    width: 45px;
    height: 70px;
    opacity: 0;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.5));
}

.demo-card:hover .person-icon {
    animation: person-walk 2s ease-in-out 0.5s forwards;
}

/* Desktop 3D */
.desktop-demo {
    width: 100%;
    height: 240px;
    margin: 2rem auto 3rem;
    position: relative;
    perspective: 1500px;
    padding-bottom: 50px;
}

.monitor {
    position: relative;
    width: 200px;
    height: 130px;
    margin: 0 auto;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border-radius: 12px;
    border: 4px solid #0a0a0a;
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.7),
        inset 0 2px 5px rgba(255, 255, 255, 0.05),
        0 0 30px rgba(0, 230, 118, 0.1);
    transform-style: preserve-3d;
    overflow: hidden;
}

.monitor::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    background: linear-gradient(145deg, rgba(26, 115, 232, 0.1), rgba(0, 230, 118, 0.05));
    border-radius: 8px;
    transition: var(--transition);
}

.demo-card:hover .monitor::before {
    animation: screen-glow 2s ease-in-out infinite;
}

.screen-content {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    z-index: 1;
}

.screen-header {
    height: 20px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    box-shadow: 0 2px 10px rgba(0, 230, 118, 0.3);
}

.screen-header::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--color-secondary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 230, 118, 1);
    animation: glow-pulse 2s ease-in-out infinite;
}

.screen-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.data-row {
    height: 8px;
    background: linear-gradient(90deg, rgba(0, 230, 118, 0.3), transparent);
    border-radius: 2px;
    opacity: 0;
}

.demo-card:hover .data-row:nth-child(1) {
    animation: data-flow 2s ease-in-out 0.2s infinite;
}

.demo-card:hover .data-row:nth-child(2) {
    animation: data-flow 2s ease-in-out 0.4s infinite;
}

.demo-card:hover .data-row:nth-child(3) {
    animation: data-flow 2s ease-in-out 0.6s infinite;
}

.demo-card:hover .data-row:nth-child(4) {
    animation: data-flow 2s ease-in-out 0.8s infinite;
}

.monitor-stand {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 30px;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border-radius: 8px 8px 0 0;
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.5),
        inset 0 2px 3px rgba(255, 255, 255, 0.05);
}

.monitor-base {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 10px;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border-radius: 10px;
    box-shadow: 
        0 5px 20px rgba(0, 0, 0, 0.7),
        inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

/* Smartphone 3D */
.smartphone-demo {
    width: 140px;
    height: 240px;
    margin: 1rem auto;
    position: relative;
    perspective: 1000px;
}

.phone-device {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #2a2a2a, #0a0a0a);
    border-radius: 25px;
    border: 3px solid #0a0a0a;
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.8),
        inset 0 1px 3px rgba(255, 255, 255, 0.1),
        0 0 30px rgba(26, 115, 232, 0.2);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 20px;
    background: #0a0a0a;
    border-radius: 0 0 15px 15px;
    z-index: 10;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
}

.phone-screen {
    position: absolute;
    top: 25px;
    left: 10px;
    right: 10px;
    bottom: 15px;
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.95), rgba(26, 26, 26, 0.95));
    border-radius: 15px;
    padding: 10px;
    overflow: hidden;
}

.app-header {
    height: 30px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    font-size: 10px;
    font-weight: bold;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.4);
}

.notification {
    background: linear-gradient(145deg, rgba(0, 230, 118, 0.15), rgba(26, 115, 232, 0.15));
    border-left: 3px solid var(--color-secondary);
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 8px;
    color: var(--color-text);
    opacity: 0;
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.2);
}

.notification-icon {
    width: 12px;
    height: 12px;
    background: var(--color-secondary);
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.8);
}

.demo-card:hover .phone-device {
    animation: phone-vibrate 0.3s ease-in-out 3;
}

.demo-card:hover .notification:nth-child(1) {
    animation: notification-pop 0.5s ease-out 0.5s forwards;
}

.demo-card:hover .notification:nth-child(2) {
    animation: notification-pop 0.5s ease-out 1s forwards;
}

.demo-card:hover .notification:nth-child(3) {
    animation: notification-pop 0.5s ease-out 1.5s forwards;
}

/* Status Indicator */
.status-indicator {
    text-align: center;
    margin-top: 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    transition: var(--transition);
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.demo-card:hover .status-indicator {
    color: var(--color-secondary);
    text-shadow: 0 0 20px rgba(0, 230, 118, 0.6);
}

.status-indicator::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-text-secondary);
    margin-right: 0.5rem;
    transition: var(--transition);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.demo-card:hover .status-indicator::before {
    background: var(--color-secondary);
    animation: pulse-green 1s ease-in-out infinite;
}

/* Tech Grid Background */
.tech-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(26, 115, 232, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 115, 232, 0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.3;
    pointer-events: none;
}

/* Efeitos nos Feature Cards */
.feature-card {
    position: relative;
    overflow: hidden;
}

.feature-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(0, 230, 118, 0.1) 50%,
        transparent 70%
    );
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.feature-card:hover::after {
    transform: translateX(100%);
}

/* Floating Animation para ícones */
@keyframes float-icon {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.feature-icon {
    animation: float-icon 3s ease-in-out infinite;
}

.feature-card:hover .feature-icon {
    animation: float-icon 1s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .demo-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .facial-recognition {
        width: 180px;
        height: 180px;
    }
    
    .barrier-demo,
    .turnstile-demo,
    .desktop-demo {
        height: 180px;
    }

    .smartphone-demo {
        width: 120px;
        height: 200px;
    }
}
