/*
 * Responsive Fixes - Mobile Optimization
 * Melhorias específicas para visualização mobile
 */

/* Reset e Base Mobile */
@media (max-width: 768px) {
    /* Prevenir zoom em inputs no iOS */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }
    
    /* Melhorar legibilidade */
    body {
        -webkit-text-size-adjust: 100%;
        text-rendering: optimizeLegibility;
    }
    
    /* Prevenir overflow horizontal */
    html,
    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    /* Melhorar espaçamento de seções */
    section {
        padding-left: 15px;
        padding-right: 15px;
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Títulos responsivos */
    h1 {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
        line-height: 1.2;
        word-wrap: break-word;
        hyphens: auto;
    }
    
    h2 {
        font-size: clamp(1.5rem, 4vw, 2rem);
        line-height: 1.3;
        word-wrap: break-word;
    }
    
    h3 {
        font-size: clamp(1.2rem, 3.5vw, 1.5rem);
        line-height: 1.3;
    }
    
    /* Parágrafos */
    p {
        font-size: clamp(0.95rem, 2.5vw, 1.1rem);
        line-height: 1.6;
        word-wrap: break-word;
    }
    
    /* Imagens responsivas */
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }
    
    /* Cards e containers */
    .service-card,
    .mvv-card,
    .feature-card,
    .benefit-card,
    .contact-info-card {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }
    
    /* Formulários */
    form {
        width: 100%;
        max-width: 100%;
    }
    
    input,
    textarea,
    select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Botões */
    button:not(.indicator):not(.carousel-prev):not(.carousel-next),
    .btn,
    a[class*="btn"] {
        width: 100%;
        max-width: 280px;
        margin-left: auto;
        margin-right: auto;
        display: block;
        box-sizing: border-box;
    }
    
    /* Carousel indicators - force horizontal */
    .carousel-indicators {
        display: none !important;
    }
    
    .indicator {
        display: none !important;
    }
    
    /* Grid responsivo */
    .services-grid,
    .about-grid,
    .contact-grid,
    .footer-content {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }
    
    /* Espaçamento consistente */
    section + section {
        margin-top: 0;
    }
    
    /* Melhorar toque em links */
    a {
        -webkit-tap-highlight-color: rgba(44, 85, 48, 0.2);
    }
}

/* Ajustes para telas muito pequenas */
@media (max-width: 360px) {
    .container {
        padding: 0 12px;
    }
    
    section {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    p {
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 0.85rem;
    }
}

/* Melhorias para tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 0 30px;
        max-width: 900px;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .about-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
}

/* Otimizações de performance */
@media (max-width: 768px) {
    /* Simplificar sombras */
    .service-card,
    .mvv-card,
    .contact-info-card {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Otimizar gradientes */
    .hero,
    .cta-section {
        background-attachment: scroll !important;
    }
}

/* Acessibilidade Mobile */
@media (max-width: 768px) {
    /* Aumentar contraste */
    .hero h1,
    .hero p {
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    }
    
    /* Melhorar foco em elementos interativos */
    button:focus,
    a:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: 3px solid #2c5530;
        outline-offset: 2px;
    }
    
    /* Área de toque mínima (44x44px) */
    button,
    a,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Fix para Safari iOS */
@supports (-webkit-touch-callout: none) {
    /* Corrigir altura do viewport no iOS */
    .hero {
        min-height: -webkit-fill-available;
    }
}

/* Dark Mode Support (opcional) */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    /* Ajustar cores para dark mode se necessário */
    body {
        background-color: #1a1a1a;
        color: #f0f0f0;
    }
}

/* Print Styles Mobile */
@media print {
    .whatsapp-float,
    .mobile-menu-toggle,
    button,
    .btn {
        display: none !important;
    }
    
    * {
        background: white !important;
        color: black !important;
    }
}


/* Mobile Menu Fix - Garantir funcionamento */
@media (max-width: 768px) {
    /* Botão do menu mobile */
    .mobile-menu-toggle {
        display: block !important;
        position: relative;
        z-index: 10000;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 10px;
        font-size: 1.8rem;
        color: #2c5530;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    .mobile-menu-toggle:active {
        background: rgba(44, 85, 48, 0.1);
        border-radius: 8px;
    }
    
    /* Menu mobile */
    .main-nav {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        z-index: 9998;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    /* Menu aberto */
    .main-nav.menu-open {
        transform: translateX(0);
    }
    
    /* Lista do menu */
    .main-nav ul,
    .main-nav .nav-menu {
        display: flex !important;
        flex-direction: column !important;
        list-style: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    
    /* Itens do menu */
    .main-nav li {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    }
    
    /* Links do menu */
    .main-nav a {
        display: block !important;
        padding: 1.2rem 2rem !important;
        color: #333 !important;
        text-decoration: none !important;
        font-size: 1rem !important;
        font-weight: 500 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        border-radius: 0 !important;
        transition: background 0.2s ease !important;
    }
    
    .main-nav a:hover,
    .main-nav a:active {
        background: rgba(44, 85, 48, 0.1) !important;
        color: #2c5530 !important;
    }
    
    /* Submenu mobile */
    .main-nav .sub-menu {
        position: static !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none !important;
        background: rgba(0, 0, 0, 0.02) !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .main-nav .menu-item-has-children.active .sub-menu,
    .main-nav .menu-item-has-children:hover .sub-menu {
        max-height: 500px;
    }
    
    .main-nav .sub-menu a {
        padding-left: 3rem !important;
        font-size: 0.95rem !important;
    }
    
    /* Overlay quando menu está aberto */
    body.menu-open {
        overflow: hidden;
    }
    
    /* Header fixo */
    .site-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9999;
    }
    
    /* Garantir que header e menu fiquem acima do hero */
    .site-header,
    .site-header * {
        z-index: inherit;
    }
    
    .header-content {
        position: relative;
        z-index: 10000;
    }
}

/* Garantir que o menu desktop funcione */
@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }
    
    .main-nav {
        display: block !important;
        position: static !important;
        transform: none !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
    }
    
    .main-nav ul {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.5rem !important;
    }
}


/* Overlay do menu mobile */
@media (max-width: 768px) {
    /* Overlay escuro quando menu está aberto */
    .menu-overlay {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9997;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* WhatsApp button deve ficar abaixo do menu */
    .whatsapp-float {
        z-index: 998 !important;
    }
    
    /* Quando menu está aberto, esconder WhatsApp */
    body.menu-open .whatsapp-float {
        opacity: 0;
        pointer-events: none;
    }
}

/* Z-index hierarchy */
/*
10000 - Mobile menu toggle button
9999  - Site header
9998  - Mobile menu nav
9997  - Menu overlay
998   - WhatsApp button
100   - Services section
10    - Hero content
2     - Hero overlay
1     - Hero video
*/
