/* Correções de Overflow e Responsividade Final - Projeto Constelar */

/* ============================================
   CORREÇÃO PRINCIPAL: Overflow Horizontal
   ============================================ */

/* Prevenir scroll horizontal em todos os dispositivos */
html {
    overflow-x: hidden;
    max-width: 100%;
    position: relative;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
}

/* ============================================
   CORREÇÃO: Elementos Decorativos
   ============================================ */

/* Garantir que elementos de fundo não causem overflow */
.hero-background {
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    position: absolute;
    left: 0;
    right: 0;
}

.stars,
.constellation {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Conter elementos flutuantes dentro da viewport */
.floating-elements {
    max-width: 100%;
    overflow: visible;
    position: relative;
}

.element-1,
.element-2,
.element-3 {
    max-width: calc(100vw - 60px);
}

/* ============================================
   CORREÇÃO: Containers e Seções
   ============================================ */

/* Garantir que todas as seções respeitem a largura da viewport */
.hero,
.services,
.about,
.marcos,
.contact,
.footer {
    max-width: 100vw;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    overflow-x: hidden;
}

/* ============================================
   CORREÇÃO: Navegação Mobile
   ============================================ */

@media (max-width: 768px) {
    .nav-container {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .nav-menu {
        max-width: 100vw;
    }
    
    .nav-menu.active {
        width: 100%;
        max-width: 100vw;
    }
}

/* ============================================
   CORREÇÃO: Hero Section Mobile
   ============================================ */

@media (max-width: 768px) {
    .hero {
        padding-left: 0;
        padding-right: 0;
    }
    
    .hero-content {
        max-width: 100%;
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .hero-title img {
        max-width: calc(100vw - 40px);
        height: auto;
    }
    
    .hero-description-container {
        max-width: 100%;
    }
    
    .hero-description {
        max-width: 100%;
        word-wrap: break-word;
    }
}

/* ============================================
   CORREÇÃO: Grid de Serviços
   ============================================ */

@media (max-width: 768px) {
    .services-grid {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .service-card {
        max-width: 100%;
        width: 100%;
    }
    
    .service-icon img {
        max-width: 100%;
        height: auto;
    }
}

/* ============================================
   CORREÇÃO: Imagens e Mídia
   ============================================ */

img {
    max-width: 100%;
    height: auto;
}


.logo {
    max-width: 100%;
    height: auto;
}

/* ============================================
   CORREÇÃO: Botões e Links
   ============================================ */

@media (max-width: 480px) {
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-purchase {
        max-width: 100%;
        white-space: normal;
        word-wrap: break-word;
    }
    
    .service-footer {
        max-width: 100%;
        flex-wrap: wrap;
    }
}

/* ============================================
   CORREÇÃO: Seção de Contato
   ============================================ */

@media (max-width: 768px) {
    .contact-content {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .social-grid {
        max-width: 100%;
        width: 100%;
    }
    
    .social-link {
        max-width: 100%;
        word-wrap: break-word;
    }
}

/* ============================================
   CORREÇÃO: Textos e Tipografia
   ============================================ */

h1, h2, h3, h4, h5, h6, p, span, a {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================
   CORREÇÃO: Animações em Mobile
   ============================================ */

@media (max-width: 768px) {
    /* Reduzir animações que possam causar overflow */
    .floating-elements .element-1,
    .floating-elements .element-2,
    .floating-elements .element-3 {
        animation: none;
    }
    
    /* Manter elementos decorativos contidos */
    .hero-background .stars,
    .hero-background .constellation {
        transform: none;
    }
}

/* ============================================
   CORREÇÃO: WhatsApp Widget
   ============================================ */

.whatsapp-widget,
.whatsapp-button {
    max-width: 60px;
    right: 15px;
    bottom: 15px;
}

@media (max-width: 480px) {
    .whatsapp-widget {
        right: 10px;
        bottom: 10px;
    }
}

/* ============================================
   CORREÇÃO: Footer
   ============================================ */

.footer {
    max-width: 100vw;
    overflow-x: hidden;
}

.footer-content {
    max-width: 100%;
    padding: 0 20px;
}

@media (max-width: 768px) {
    .footer-content {
        padding: 0 15px;
    }
}

/* ============================================
   CORREÇÃO: Tabelas e Listas
   ============================================ */

table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

ul, ol {
    max-width: 100%;
    padding-left: 20px;
}

/* ============================================
   CORREÇÃO: Formulários
   ============================================ */

input, textarea, select {
    max-width: 100%;
    box-sizing: border-box;
}

/* ============================================
   CORREÇÃO GLOBAL: Box Sizing
   ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ============================================
   CORREÇÃO: Elementos com Posição Absoluta
   ============================================ */

[style*="position: absolute"] {
    max-width: 100vw;
}

/* ============================================
   TESTE: Identificar elementos problemáticos
   ============================================ */

/* Descomente para debug */
/*
* {
    outline: 1px solid rgba(255, 0, 0, 0.1);
}

*:hover {
    outline: 2px solid rgba(255, 0, 0, 0.5);
}
*/

/* ============================================
   CORREÇÃO ESPECÍFICA: Larguras Fixas
   ============================================ */

/* Substituir larguras fixas por responsivas */
@media (max-width: 768px) {
    [style*="width: 100%"] {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ============================================
   MELHORIAS ADICIONAIS
   ============================================ */

/* Smooth scroll para navegação */
html {
    scroll-behavior: smooth;
}

/* Melhorar performance de animações */
.hero-background,
.floating-elements,
.element-1,
.element-2,
.element-3 {
    will-change: auto;
    transform: translateZ(0);
}

/* Garantir que imagens não quebrem o layout */
img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Correção para vídeos e iframes */
iframe,
video {
    max-width: 100%;
    height: auto;
}

/* ============================================
   FIM DAS CORREÇÕES
   ============================================ */
