/* Estilos principais para Nova Energia Comercializadora S.A. */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--body-font);
    color: var(--dark-color);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--heading-font);
    font-weight: 700;
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* Header/Navbar */
.navbar {
    padding-top: 1rem;
    padding-bottom: 1rem;
    transition: all var(--transition-normal);
}

.navbar.scrolled {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    box-shadow: var(--shadow-md);
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--border-radius);
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(0, 86, 179, 0.1);
    color: var(--primary-color) !important;
}

.logo-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
}

/* Hero Section */
.hero-section {
    padding-top: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-light) 100%);
    opacity: 0.05;
    clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.min-vh-70 {
    min-height: 70vh;
}

.hero-image {
    position: relative;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

.floating-element {
    position: absolute;
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-md);
    animation: float-small 4s ease-in-out infinite;
    z-index: 10;
}

.floating-element-1 {
    top: 10%;
    right: 10%;
    animation-delay: 0s;
    color: var(--secondary-color);
}

.floating-element-2 {
    top: 60%;
    left: 5%;
    animation-delay: 1s;
    color: var(--primary-color);
}

.floating-element-3 {
    bottom: 10%;
    right: 20%;
    animation-delay: 2s;
    color: var(--accent-color);
}

@keyframes float-small {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Section Titles */
.section-title {
    position: relative;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.section-title.text-center::after {
    left: 50%;
    transform: translateX(-50%);
}

/* Service Cards */
.service-card {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    border-radius: var(--border-radius-xl);
    overflow: hidden;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg) !important;
}

.service-icon {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 86, 179, 0.1);
    border-radius: 50%;
    font-size: 2rem;
}

/* Advantage Cards */
.advantage-card {
    background-color: white;
    border-radius: var(--border-radius-lg);
    transition: all var(--transition-normal);
    border: 1px solid var(--gray-light);
}

.advantage-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.advantage-icon {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    font-size: 2rem;
    color: white;
    margin: 0 auto;
}

/* Form Styles */
#contactForm .form-control, #contactForm .form-select {
    padding: 0.75rem 1rem;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
}

#contactForm .form-control:focus, #contactForm .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(0, 86, 179, 0.25);
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--dark-color) 0%, #343a40 100%);
}

footer a:hover {
    color: var(--secondary-color) !important;
}

.social-icons a {
    display: inline-block;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    transition: all var(--transition-fast);
}

.social-icons a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

/* Botão Voltar ao Topo */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

#backToTop.show {
    opacity: 1;
    visibility: visible;
}

/* Cookies Banner */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(33, 37, 41, 0.95);
    color: white;
    padding: 1rem 0;
    z-index: 1050;
    display: none;
}

.cookie-consent.show {
    display: block;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Animações de entrada */
.fade-in {
    animation: fadeIn 1s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsividade */
@media (max-width: 768px) {
    .hero-section {
        padding-top: var(--spacing-lg);
        padding-bottom: var(--spacing-lg);
    }
    
    .display-4 {
        font-size: 2.5rem;
    }
    
    .floating-element {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Acessibilidade */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid white;
    }
    
    .nav-link.active {
        outline: 2px solid var(--primary-color);
    }
}

/* Print Styles */
@media print {
    .navbar, .cookie-consent, #backToTop {
        display: none !important;
    }
    
    a {
        color: black !important;
        text-decoration: underline !important;
    }
    
    .btn {
        border: 1px solid black !important;
        background-color: white !important;
        color: black !important;
    }
}// JavaScript para Nova Energia Comercializadora S.A.

// Inicialização quando o DOM estiver carregado
document.addEventListener('DOMContentLoaded', function() {
    // Botão Voltar ao Topo
    const backToTopButton = document.getElementById('backToTop');
    
    // Exibir/ocultar botão ao rolar
    window.addEventListener('scroll', function() {
        if (window.scrollY > 300) {
            backToTopButton.classList.add('show');
        } else {
            backToTopButton.classList.remove('show');
        }
        
        // Navbar com sombra ao rolar
        const navbar = document.querySelector('.navbar');
        if (window.scrollY > 50) {
            navbar.classList.add('scrolled');
        } else {
            navbar.classList.remove('scrolled');
        }
    });
    
    // Rolar para o topo
    backToTopButton.addEventListener('click', function() {
        window.scrollTo({
            top: 0,
            behavior: 'smooth'
        });
    });
    
    // Cookies Banner
    const cookieConsent = document.getElementById('cookieConsent');
    const acceptCookies = document.getElementById('acceptCookies');
    const rejectCookies = document.getElementById('rejectCookies');
    
    // Verificar se o usuário já aceitou/rejeitou cookies
    const cookiesAccepted = localStorage.getItem('cookiesAccepted');
    
    if (!cookiesAccepted) {
        // Mostrar banner após 1 segundo
        setTimeout(() => {
            cookieConsent.classList.add('show');
        }, 1000);
    }
    
    // Aceitar cookies
    acceptCookies.addEventListener('click', function() {
        localStorage.setItem('cookiesAccepted', 'true');
        cookieConsent.classList.remove('show');
        // Aqui você pode inicializar Google Analytics, Facebook Pixel, etc.
        console.log('Cookies aceitos. Inicializando scripts de terceiros...');
    });
    
    // Rejeitar cookies
    rejectCookies.addEventListener('click', function() {
        localStorage.setItem('cookiesAccepted', 'false');
        cookieConsent.classList.remove('show');
        // Não inicializar scripts de rastreamento
        console.log('Cookies rejeitados.');
    });
    
    // Validação do formulário de contato
    const contactForm = document.getElementById('contactForm');
    const formSuccess = document.getElementById('formSuccess');
    
    if (contactForm) {
        contactForm.addEventListener('submit', function(event) {
            event.preventDefault();
            event.stopPropagation();
            
            if (contactForm.checkValidity()) {
                // Simulação de envio
                setTimeout(() => {
                    formSuccess.classList.remove('d-none');
                    contactForm.reset();
                    
                    // Ocultar mensagem após 5 segundos
                    setTimeout(() => {
                        formSuccess.classList.add('d-none');
                    }, 5000);
                }, 500);
            }
            
            contactForm.classList.add('was-validated');
        }, false);
    }
    
    // Animações de entrada para elementos
    const observerOptions = {
        root: null,
        rootMargin: '0px',
        threshold: 0.1
    };
    
    const observer = new IntersectionObserver(function(entries) {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.classList.add('fade-in');
            }
        });
    }, observerOptions);
    
    // Observar elementos para animação
    const animatedElements = document.querySelectorAll('.service-card, .advantage-card, .section-title');
    animatedElements.forEach(element => {
        observer.observe(element);
    });
    
    // Máscara para telefone
    const phoneInput = document.getElementById('phone');
    if (phoneInput) {
        phoneInput.addEventListener('input', function(e) {
            let value = e.target.value.replace(/\D/g, '');
            
            if (value.length > 10) {
                value = value.replace(/^(\d{2})(\d{5})(\d{4}).*/, '($1) $2-$3');
            } else if (value.length > 6) {
                value = value.replace(/^(\d{2})(\d{4})(\d{0,4}).*/, '($1) $2-$3');
            } else if (value.length > 2) {
                value = value.replace(/^(\d{2})(\d{0,5})/, '($1) $2');
            } else if (value.length > 0) {
                value = value.replace(/^(\d*)/, '($1');
            }
            
            e.target.value = value;
        });
    }
    
    // Atualizar ano no footer
    const currentYear = new Date().getFullYear();
    const yearElements = document.querySelectorAll('.current-year');
    yearElements.forEach(element => {
        element.textContent = currentYear;
    });
});

// Funções utilitárias
function formatPhoneNumber(phone) {
    return phone.replace(/\D/g, '').replace(/^(\d{2})(\d{5})(\d{4})$/, '($1) $2-$3');
}

// SEO Helper - Alterar título dinamicamente com base no scroll
window.addEventListener('scroll', function() {
    // Esta função pode ser expandida para otimização de SEO
    // Por exemplo, atualizar meta tags dinamicamente para diferentes seções
});

// Otimização de performance
window.addEventListener('load', function() {
    // Remover pré-carregamento de imagens críticas já carregadas
    const lazyImages = document.querySelectorAll('img[data-src]');
    lazyImages.forEach(img => {
        img.src = img.getAttribute('data-src');
        img.removeAttribute('data-src');
    });
});