/**
 * Law LTQ Stats Widget - Frontend Styles - CORRIGIDO
 * 
 * @package Law_LTQ_Stats
 * @since 1.0.0
 */

/* Estilos base do widget */
.law-ltq-stats-widget {
    /* Estilos específicos do widget podem ser adicionados aqui */
}

/* CORRIGIDO: Estilos aprimorados para efeitos hover dos cards */
.stat-card {
    position: relative;
    cursor: default;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center center;
    will-change: transform, box-shadow;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Efeito Grow (Crescer) para cards */
.stat-card.hover-grow:hover,
.questoes-stats-container[data-card-hover="grow"] .stat-card:hover {
    transform: scale(1.05) !important;
    z-index: 2;
}

/* Efeito Lift (Elevar) para cards */
.stat-card.hover-lift:hover,
.questoes-stats-container[data-card-hover="lift"] .stat-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3) !important;
    z-index: 2;
}

/* Efeitos hover para botões */
.period-btn,
.reset-btn {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    z-index: 1;
    transform-origin: center center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Efeito de ondulação para todos os botões */
.period-btn::before,
.reset-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.6s ease, height 0.6s ease, top 0.6s ease, left 0.6s ease, opacity 0.6s ease;
    transform: translate(-50%, -50%);
    z-index: -1;
    opacity: 0;
    pointer-events: none;
}

.period-btn:active::before,
.reset-btn:active::before {
    width: 300px;
    height: 300px;
    opacity: 1;
}

/* Efeitos hover personalizáveis para botões */
.period-btn.hover-grow:hover,
.reset-btn.hover-grow:hover,
.questoes-stats-container[data-btn-hover="grow"] .period-btn:hover,
.questoes-stats-container[data-btn-hover="grow"] .reset-btn:hover {
    transform: scale(1.05);
}

.period-btn.hover-lift:hover,
.reset-btn.hover-lift:hover,
.questoes-stats-container[data-btn-hover="lift"] .period-btn:hover,
.questoes-stats-container[data-btn-hover="lift"] .reset-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Estados de transição suaves */
.period-btn:focus,
.reset-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.3);
    outline-offset: 2px;
}

/* Melhorias para acessibilidade */
.period-btn:disabled,
.reset-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.period-btn:disabled:hover,
.reset-btn:disabled:hover {
    transform: none !important;
}

/* Animações customizadas */
@keyframes statsCountUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    animation: statsCountUp 0.6s ease-out forwards;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.4s;
}

.stat-card:nth-child(5) {
    animation-delay: 0.5s;
}

/* Efeitos de loading para gráfico */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #ccc;
    font-size: 14px;
}

.chart-loading::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* CORRIGIDO: Melhorias específicas para efeitos hover responsivos */
@media (hover: hover) and (pointer: fine) {
    /* Aplicar efeitos hover apenas em dispositivos que suportam hover */
    .stat-card:hover {
        transition-duration: 0.2s;
    }
    
    .period-btn:hover,
    .reset-btn:hover {
        transition-duration: 0.2s;
    }
}

@media (hover: none) and (pointer: coarse) {
    /* Desabilitar efeitos hover em dispositivos touch */
    .stat-card:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    
    .period-btn:hover,
    .reset-btn:hover {
        transform: none !important;
        box-shadow: none !important;
    }
}

/* Melhorias para responsividade dos botões */
@media (max-width: 768px) {
    .period-btn,
    .reset-btn {
        min-height: 44px; /* Melhora acessibilidade em touch */
        font-size: 14px;
    }
    
    .period-buttons {
        justify-content: center;
        width: 100%;
    }
    
    .period-btn {
        flex: 1;
        min-width: 80px;
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .period-btn,
    .reset-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .period-buttons {
        gap: 4px;
    }
    
    .stats-header {
        gap: 10px;
    }
}

/* Estados de hover específicos para diferentes tipos de botão */
.period-btn.active {
    position: relative;
}

.period-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    opacity: 0.8;
}

/* Transições suaves para mudanças de estado */
.period-btn,
.reset-btn {
    transition: 
        background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        transform 0.3s ease,
        box-shadow 0.3s ease,
        opacity 0.3s ease;
}

/* Melhorias para contraste e acessibilidade */
.period-btn:focus-visible,
.reset-btn:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.25);
}

/* Estados de carregamento */
.period-btn.loading,
.reset-btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.period-btn.loading::after,
.reset-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    color: inherit;
}

/* CORRIGIDO: Força aplicação dos efeitos hover através de classes específicas */
.questoes-stats-container .stat-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Classes auxiliares para aplicação via JavaScript */
.card-hover-grow .stat-card:hover {
    transform: scale(1.05) !important;
}

.card-hover-lift .stat-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3) !important;
}

.btn-hover-grow .period-btn:hover,
.btn-hover-grow .reset-btn:hover {
    transform: scale(1.05) !important;
}

.btn-hover-lift .period-btn:hover,
.btn-hover-lift .reset-btn:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
}

/* Fallback para garantir que os efeitos funcionem */
.elementor-widget-law_ltq_questoes_stats .stat-card:hover {
    transition: all 0.3s ease !important;
}

/* Melhorias na performance de animação */
.stat-card,
.period-btn,
.reset-btn {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Suporte para reduced motion */
@media (prefers-reduced-motion: reduce) {
    .stat-card,
    .period-btn,
    .reset-btn {
        transition: none !important;
        animation: none !important;
    }
    
    .stat-card:hover,
    .period-btn:hover,
    .reset-btn:hover {
        transform: none !important;
    }
}