/**
 * ============================================================================
 * PULSAR STATE CARDS ENHANCED - Vida e Energia nos Cards de Estados
 * ============================================================================
 * 
 * Efeitos futurísticos avançados para dar vida aos 27 cards de estados
 * Mantém o tamanho original mas adiciona MUITA interatividade e animações
 * 
 * ============================================================================
 */

/* ========== ANIMAÇÃO DE ENTRADA ========== */
.state-card {
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    animation: cardEntrance 0.8s ease-out backwards;
}

@keyframes cardEntrance {
    from {
        opacity: 0;
        transform: translateY(40px) rotateX(-15deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0) scale(1);
    }
}

/* Delays escalonados para os 27 cards */
.state-card:nth-child(1) { animation-delay: 0.05s; }
.state-card:nth-child(2) { animation-delay: 0.1s; }
.state-card:nth-child(3) { animation-delay: 0.15s; }
.state-card:nth-child(4) { animation-delay: 0.2s; }
.state-card:nth-child(5) { animation-delay: 0.25s; }
.state-card:nth-child(6) { animation-delay: 0.3s; }
.state-card:nth-child(7) { animation-delay: 0.35s; }
.state-card:nth-child(8) { animation-delay: 0.4s; }
.state-card:nth-child(9) { animation-delay: 0.45s; }
.state-card:nth-child(10) { animation-delay: 0.5s; }
.state-card:nth-child(11) { animation-delay: 0.55s; }
.state-card:nth-child(12) { animation-delay: 0.6s; }
.state-card:nth-child(13) { animation-delay: 0.65s; }
.state-card:nth-child(14) { animation-delay: 0.7s; }
.state-card:nth-child(15) { animation-delay: 0.75s; }
.state-card:nth-child(16) { animation-delay: 0.8s; }
.state-card:nth-child(17) { animation-delay: 0.85s; }
.state-card:nth-child(18) { animation-delay: 0.9s; }
.state-card:nth-child(19) { animation-delay: 0.95s; }
.state-card:nth-child(20) { animation-delay: 1s; }
.state-card:nth-child(21) { animation-delay: 1.05s; }
.state-card:nth-child(22) { animation-delay: 1.1s; }
.state-card:nth-child(23) { animation-delay: 1.15s; }
.state-card:nth-child(24) { animation-delay: 1.2s; }
.state-card:nth-child(25) { animation-delay: 1.25s; }
.state-card:nth-child(26) { animation-delay: 1.3s; }
.state-card:nth-child(27) { animation-delay: 1.35s; }

/* ========== BORDA NEON ANIMADA ========== */
.state-card::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: linear-gradient(
        135deg,
        rgba(0, 229, 255, 0) 0%,
        rgba(0, 229, 255, 0.8) 25%,
        rgba(142, 45, 226, 0.8) 50%,
        rgba(255, 0, 255, 0.8) 75%,
        rgba(0, 229, 255, 0) 100%
    );
    background-size: 400% 400%;
    border-radius: 18px;
    z-index: -1;
    opacity: 0;
    filter: blur(12px);
    transition: opacity 0.5s ease;
    animation: borderFlow 6s ease infinite;
}

@keyframes borderFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.state-card:hover::before {
    opacity: 1;
    filter: blur(16px);
}

/* ========== PARTÍCULAS DE ENERGIA ========== */
.state-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 15px;
    background-image: 
        radial-gradient(circle 3px at 15% 25%, rgba(0, 229, 255, 1), transparent),
        radial-gradient(circle 2px at 85% 35%, rgba(255, 0, 255, 0.8), transparent),
        radial-gradient(circle 2px at 50% 45%, rgba(142, 45, 226, 1), transparent),
        radial-gradient(circle 3px at 70% 65%, rgba(0, 229, 255, 0.7), transparent),
        radial-gradient(circle 2px at 30% 75%, rgba(255, 255, 255, 1), transparent),
        radial-gradient(circle 2px at 90% 85%, rgba(255, 0, 255, 0.6), transparent),
        radial-gradient(circle 3px at 40% 15%, rgba(0, 229, 255, 0.8), transparent),
        radial-gradient(circle 2px at 60% 90%, rgba(142, 45, 226, 0.7), transparent);
    background-repeat: no-repeat;
    opacity: 0;
    pointer-events: none;
    animation: particlesFloat 4s ease-in-out infinite;
    z-index: 15;
}

@keyframes particlesFloat {
    0%, 100% { 
        opacity: 0;
        transform: translateY(0) scale(0.8);
    }
    50% { 
        opacity: 1;
        transform: translateY(-15px) scale(1.3);
    }
}

.state-card:hover::after {
    animation-duration: 2s;
}

/* ========== SCAN LINE FUTURISTA ========== */
.state-card .state-overlay::before {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(0, 229, 255, 0) 20%,
        rgba(0, 229, 255, 1) 50%,
        rgba(0, 229, 255, 0) 80%,
        transparent 100%
    );
    box-shadow: 
        0 0 20px rgba(0, 229, 255, 1),
        0 0 40px rgba(0, 229, 255, 0.6);
    animation: scanVertical 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
}

@keyframes scanVertical {
    0% { 
        top: -100%;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% { 
        top: 200%;
        opacity: 0;
    }
}

/* ========== HOVER: ELEVAÇÃO 3D COM GLOW ========== */
.state-card:hover {
    transform: translateY(-15px) scale(1.05) rotateX(2deg);
    box-shadow: 
        0 25px 50px rgba(0, 229, 255, 0.4),
        0 15px 30px rgba(142, 45, 226, 0.4),
        0 5px 80px rgba(255, 0, 255, 0.3),
        inset 0 0 30px rgba(0, 229, 255, 0.15);
    z-index: 20;
}

/* ========== BRILHO INTERNO PULSANTE ========== */
.state-card:hover .state-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 229, 255, 0.3) 0%,
        rgba(142, 45, 226, 0.2) 40%,
        transparent 70%
    );
    animation: innerGlow 2s ease-in-out infinite;
    pointer-events: none;
    z-index: 8;
}

@keyframes innerGlow {
    0%, 100% { 
        opacity: 0.4;
        transform: scale(0.95);
    }
    50% { 
        opacity: 1;
        transform: scale(1.1);
    }
}

/* ========== NOME COM GLITCH EFFECT ========== */
.state-card:hover .geo-name {
    animation: textGlitch 0.4s ease 2;
    text-shadow: 
        0 0 10px rgba(0, 229, 255, 1),
        0 0 20px rgba(0, 229, 255, 0.8),
        0 0 30px rgba(0, 229, 255, 0.6),
        2px 2px 0 rgba(255, 0, 255, 0.6),
        -2px -2px 0 rgba(142, 45, 226, 0.4);
    color: #00e5ff;
}

@keyframes textGlitch {
    0%, 100% { 
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
    20% { 
        transform: translate(-3px, 2px);
        filter: hue-rotate(90deg);
    }
    40% { 
        transform: translate(3px, -2px);
        filter: hue-rotate(180deg);
    }
    60% { 
        transform: translate(-2px, -3px);
        filter: hue-rotate(270deg);
    }
    80% { 
        transform: translate(2px, 3px);
        filter: hue-rotate(360deg);
    }
}

/* ========== CONTADOR DE EVENTOS ANIMADO ========== */
.state-card .geo-count {
    position: relative;
    transition: all 0.3s ease;
    display: inline-block;
}

.state-card:hover .geo-count {
    transform: scale(1.15);
    color: #00e5ff;
    text-shadow: 
        0 0 15px rgba(0, 229, 255, 1),
        0 0 25px rgba(0, 229, 255, 0.7),
        0 0 35px rgba(0, 229, 255, 0.5);
    animation: counterPulse 0.6s ease infinite;
}

@keyframes counterPulse {
    0%, 100% { 
        transform: scale(1.15);
    }
    50% { 
        transform: scale(1.25);
    }
}

/* ========== GRID ENERGÉTICO NA IMAGEM ========== */
.state-card .state-image {
    position: relative;
}

.state-card .state-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        repeating-linear-gradient(
            90deg,
            transparent 0,
            rgba(0, 229, 255, 0.1) 1px,
            transparent 2px,
            transparent 25px
        ),
        repeating-linear-gradient(
            0deg,
            transparent 0,
            rgba(142, 45, 226, 0.1) 1px,
            transparent 2px,
            transparent 25px
        );
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    animation: gridScan 3s linear infinite;
    z-index: 5;
}

@keyframes gridScan {
    0% { 
        background-position: 0 0;
        opacity: 0;
    }
    50% {
        opacity: 0.8;
    }
    100% { 
        background-position: 25px 25px;
        opacity: 0;
    }
}

.state-card:hover .state-image::before {
    opacity: 1;
}

/* ========== REFLEXO LUMINOSO DESLIZANTE ========== */
.state-card .state-image::after {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: linear-gradient(
        135deg,
        transparent 0%,
        transparent 45%,
        rgba(255, 255, 255, 0.5) 50%,
        transparent 55%,
        transparent 100%
    );
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 9;
}

.state-card:hover .state-image::after {
    transform: translateX(100%) translateY(100%) rotate(45deg);
}

/* ========== PULSO CONTÍNUO NAS BORDAS ========== */
@keyframes borderPulse {
    0%, 100% {
        box-shadow: 
            0 0 10px rgba(0, 229, 255, 0.2),
            inset 0 0 10px rgba(142, 45, 226, 0.1);
    }
    50% {
        box-shadow: 
            0 0 25px rgba(0, 229, 255, 0.5),
            inset 0 0 20px rgba(142, 45, 226, 0.3);
    }
}

.state-card {
    animation: 
        cardEntrance 0.8s ease-out backwards,
        borderPulse 4s ease-in-out infinite;
}

/* ========== EFEITO DE CLIQUE/ACTIVE ========== */
.state-card:active {
    transform: translateY(-10px) scale(1.03);
    transition: all 0.15s ease;
    box-shadow: 
        0 15px 30px rgba(0, 229, 255, 0.5),
        0 10px 20px rgba(142, 45, 226, 0.5);
}

/* ========== CONTEÚDO ELEVADO NO HOVER ========== */
.state-card .state-content {
    position: relative;
    z-index: 11;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.state-card:hover .state-content {
    transform: translateY(-5px);
}

/* ========== ONDAS DE ENERGIA ALTERNADAS ========== */
.state-card:nth-child(odd)::before {
    animation-direction: reverse;
}

.state-card:nth-child(even) .state-overlay::before {
    animation-direction: reverse;
    animation-delay: 2s;
}

/* ========== RESPONSIVO ========== */
@media (max-width: 1024px) {
    .state-card:hover {
        transform: translateY(-10px) scale(1.03);
    }
}

@media (max-width: 768px) {
    .state-card::before {
        filter: blur(8px);
    }
    
    .state-card:hover {
        transform: translateY(-8px) scale(1.02);
    }
    
    .state-card::after {
        background-image: 
            radial-gradient(circle 2px at 20% 30%, rgba(0, 229, 255, 0.8), transparent),
            radial-gradient(circle 2px at 80% 70%, rgba(255, 0, 255, 0.6), transparent);
    }
    
    @keyframes textGlitch {
        0%, 100% { transform: translate(0); }
        50% { transform: translate(-2px, 2px); }
    }
}

@media (max-width: 480px) {
    .state-card {
        animation: cardEntrance 0.5s ease-out backwards;
    }
    
    .state-card:hover {
        transform: translateY(-5px) scale(1.01);
    }
    
    .state-card::after {
        display: none;
    }
}

/* ========== ACESSIBILIDADE ========== */
@media (prefers-reduced-motion: reduce) {
    .state-card,
    .state-card::before,
    .state-card::after,
    .state-card .state-overlay::before,
    .state-card .geo-name,
    .state-card .geo-count {
        animation: none !important;
        transition: opacity 0.3s ease, transform 0.3s ease !important;
    }
    
    .state-card:hover {
        transform: translateY(-6px) scale(1.02);
    }
}

/* ========== AURORA BOREALIS EFFECT (EXTRA) ========== */
.state-card:hover {
    background: 
        radial-gradient(
            ellipse at top,
            rgba(0, 229, 255, 0.05) 0%,
            transparent 50%
        ),
        radial-gradient(
            ellipse at bottom,
            rgba(255, 0, 255, 0.05) 0%,
            transparent 50%
        );
}
