/* Telas grandes: 2560px+ */
@media (min-width: 2560px) {
    .container {
        max-width: 1440px;
    }
}

/* Tablets: 768px–1280px */
@media (max-width: 1280px) and (min-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    .hero-banner {
        min-height: 70vh;
    }
    
    .sobre-content {
        flex-direction: column;
    }
    
    .sobre-text {
        margin-bottom: 30px;
    }
    
    /* Footer Responsivo para Tablets */
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    
    .footer-section:first-child {
        grid-column: 1 / -1;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    /* Ajustes para botões flutuantes em tablets */
    .whatsapp-float {
        bottom: 100px;
        right: 30px;
    }
    
    .back-to-top {
        bottom: 170px;
        right: 30px;
    }
}

/* Mobile: até 768px */
@media (max-width: 768px) {
    .container {
        width: 95%;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    /* Header Mobile - CORRIGIDO */
    #header {
        z-index: 1000;
        position: fixed;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        flex-direction: column;
        background-color: var(--white);
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        z-index: 999;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-link {
        padding: 15px;
        display: block;
        border-bottom: 1px solid var(--gray-light);
    }
    
    .hamburger {
        display: flex;
    }
    
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    .btn-cta {
        display: none;
    }
    
    /* Hero Banner Mobile */
    .hero {
        margin-top: 70px;
    }
    
    .hero-banner {
        min-height: 80vh;
        text-align: center;
        padding: 40px 0;
    }
    
    .hero-content {
        max-width: 100%;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    /* Serviços Mobile */
    .servicos-grid {
        grid-template-columns: 1fr;
    }
    
    /* Portfólio Mobile */
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    
    /* Importância Mobile */
    .importancia-grid {
        grid-template-columns: 1fr;
    }
    
    /* FAQ Mobile */
    .faq-question h3 {
        font-size: 1.1rem;
        margin-right: 15px;
    }
    
    /* Sobre Mobile */
    .sobre-content {
        flex-direction: column;
    }
    
    .sobre-text {
        margin-bottom: 30px;
    }
    
    /* CORREÇÃO: Modal do Portfólio em Mobile */
    .modal-content {
        width: 95%;
        margin: 5% auto;
        height: auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-body {
        flex-direction: column;
    }
    
    .modal-body img {
        height: auto;
        max-height: 50vh;
        object-fit: contain;
        border-radius: 10px 10px 0 0;
    }
    
    .modal-text {
        padding: 20px;
    }
    
    .close-modal {
        top: 10px;
        right: 15px;
        font-size: 1.5rem;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 100;
    }
    
    /* CORREÇÃO: Problema do select no formulário em mobile */
    .form-group select {
        font-size: 16px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 15px center;
        background-size: 16px;
        padding-right: 45px;
    }
    
    .form-group select:focus {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231e40af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    }
    
    /* FOOTER MOBILE COM ACCORDION */
    .footer {
        padding: 40px 0 0;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .footer-section {
        border-bottom: 1px solid #334155;
        padding: 20px 0;
        position: relative;
    }
    
    .footer-section:last-child {
        border-bottom: none;
    }
    
    /* Accordion Styles para Mobile */
    .footer-accordion-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        background: none;
        border: none;
        color: var(--white);
        font-family: 'Playfair Display', serif;
        font-size: 1.2rem;
        font-weight: 600;
        cursor: pointer;
        padding: 15px 0;
        text-align: left;
    }
    
    .footer-accordion-toggle i {
        font-size: 0.9rem;
        transition: transform 0.3s ease;
    }
    
    .footer-accordion-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .footer-section.active .footer-accordion-content {
        max-height: 500px;
    }
    
    .footer-section.active .footer-accordion-toggle i {
        transform: rotate(180deg);
    }
    
    /* Esconder os títulos h3 no mobile e mostrar accordion */
    .footer-section:not(:first-child) h3 {
        display: none;
    }
    
    .footer-section:first-child .footer-accordion-toggle {
        display: none;
    }
    
    /* Isolar o accordion para não interferir em outros elementos */
    .footer-accordion-content {
        z-index: 1;
        position: relative;
    }
    
    .footer-social {
        justify-content: center;
        margin-top: 15px;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .footer-legal {
        justify-content: center;
        flex-direction: column;
        gap: 10px;
    }
    
    /* Botões flutuantes em mobile */
    .whatsapp-float {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
        bottom: 100px;
        right: 20px;
    }
    
    .back-to-top {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
        bottom: 160px;
        right: 20px;
    }

    /* Prevenir flash de conteúdo antes do JS carregar */
    .footer-section:not(:first-child) .footer-links,
    .footer-section:not(:first-child) .contact-info {
        display: none;
    }
    
    .footer-section.active .footer-links,
    .footer-section.active .contact-info {
        display: block;
    }
}

/* Desktop: acima de 768px - Esconder accordion */
@media (min-width: 769px) {
    .footer-accordion-toggle {
        display: none !important;
    }
    
    .footer-section h3 {
        display: block !important;
    }
    
    .footer-accordion-content {
        max-height: none !important;
        overflow: visible !important;
        display: block !important;
    }
    
    /* Restaurar display para desktop */
    .footer-section .footer-links,
    .footer-section .contact-info {
        display: block !important;
    }
}

/* Mobile pequeno: 360px–430px */
@media (max-width: 430px) and (min-width: 360px) {
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.6rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .servico-card, .importancia-item {
        padding: 20px;
    }
    
    /* CORREÇÃO: Modal em telas pequenas */
    .modal-content {
        width: 98%;
        margin: 2% auto;
    }
    
    .modal-body img {
        max-height: 40vh;
    }
    
    .modal-text h3 {
        font-size: 1.3rem;
    }
    
    .modal-text p {
        font-size: 0.9rem;
    }
    
    /* Footer Mobile Pequeno */
    .footer {
        padding: 30px 0 0;
    }
    
    .footer-content {
        gap: 0;
    }
    
    .footer-section {
        padding: 15px 0;
    }
    
    .footer-section h3 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }
    
    .footer-logo h2 {
        font-size: 1.8rem;
    }
    
    .footer-logo p {
        font-size: 0.9rem;
    }
    
    .footer-social {
        gap: 10px;
    }
    
    .social-link {
        width: 35px;
        height: 35px;
    }
    
    .footer-links li {
        margin-bottom: 8px;
    }
    
    .contact-info {
        gap: 12px;
    }
    
    .contact-item {
        font-size: 0.9rem;
    }
    
    .footer-bottom {
        padding: 20px 0;
    }
    
    .footer-bottom-content {
        font-size: 0.8rem;
    }
    
    /* Botões flutuantes em mobile pequeno */
    .whatsapp-float {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
        bottom: 90px;
        right: 15px;
    }
    
    .back-to-top {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        bottom: 145px;
        right: 15px;
    }
}

/* Ajustes específicos para orientação landscape em mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-banner {
        min-height: 100vh;
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    .footer-section:first-child {
        grid-column: 1 / -1;
    }
    
    /* CORREÇÃO: Modal em landscape */
    .modal-body img {
        max-height: 40vh;
    }
}

/* Ajustes para telas muito pequenas (menos de 360px) */
@media (max-width: 359px) {
    .footer {
        padding: 25px 0 0;
    }
    
    .footer-content {
        gap: 0;
    }
    
    .footer-section {
        padding: 12px 0;
    }
    
    .footer-section h3 {
        font-size: 1rem;
    }
    
    .footer-logo h2 {
        font-size: 1.6rem;
    }
    
    .social-link {
        width: 32px;
        height: 32px;
    }
    
    .footer-links a {
        font-size: 0.9rem;
    }
    
    .contact-item {
        font-size: 0.85rem;
    }
    
    /* CORREÇÃO: Modal em telas muito pequenas */
    .modal-content {
        width: 99%;
        margin: 1% auto;
    }
    
    .modal-body img {
        max-height: 35vh;
    }
    
    .modal-text {
        padding: 15px;
    }
    
    /* Botões flutuantes em telas muito pequenas */
    .whatsapp-float {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
        bottom: 80px;
        right: 10px;
    }
    
    .back-to-top {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
        bottom: 130px;
        right: 10px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animações para o accordion */
.footer-section.active .footer-accordion-content {
    animation: slideDown 0.4s ease-out;
}

.fade-in {
    animation: fadeIn 0.6s ease-in-out;
}

.slide-down {
    animation: slideDown 0.5s ease-out;
}