/* ==================== RESPONSIVE DESIGN ==================== */

/* Large Screens (TVs) */
@media (min-width: 1600px) {
    html {
        font-size: 18px;
        /* Scale up everything slightly */
    }

    .hero-container {
        max-width: 1600px;
    }
}

/* Tablet & Smaller Laptops (1024px and down) */
@media (max-width: 1024px) {
    html {
        font-size: 15px;
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        padding-top: 6rem;
    }

    .hero-content {
        margin: 0 auto;
        align-items: center;
        max-width: 80%;
    }

    .canvas-container {
        height: 400px;
        /* Reduced height for 3D element */
        margin-top: 2rem;
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on tablet */
        gap: 1.5rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
    }

    .about-text {
        order: 1;
    }

    #canvas-container-2 {
        order: 2;
        height: 350px;
        margin: 0 auto;
        width: 100%;
        max-width: 500px;
    }

    .contact-container {
        grid-template-columns: 1fr;
        padding: 3rem;
    }

    .contact-left {
        justify-content: flex-start;
        align-items: center;
        text-align: center;
        gap: 2rem;
    }

    .steps-container {
        gap: 2rem;
    }

    .step-body {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .step-header {
        justify-content: center;
    }
}

/* Mobile Devices (768px and down) */
@media (max-width: 768px) {
    * {
        box-sizing: border-box;
        /* Enforce box-sizing */
    }

    html,
    body {
        overflow-x: hidden !important;
        width: 100%;
        max-width: 100%;
        position: relative;
        margin: 0;
        padding: 0;
    }

    html {
        font-size: 14px;
    }

    /* Navigation */
    .navbar {
        padding: 0.8rem 1rem;
        width: 100%;
        max-width: 100vw;
        display: flex;
        justify-content: space-between;
        align-items: center;
        /* Ensure vertical centering */
    }

    .logo-container {
        font-size: 1.2rem;
        z-index: 1002;
        gap: 0.5rem;
        display: flex;
        align-items: center;
        /* Center logo elements */
    }

    .logo-img {
        height: 32px;
    }

    /* Adjust the "Fale Conosco" button in navbar for mobile */
    .navbar .btn-primary {
        padding: 0.5rem 0.8rem !important;
        font-size: 0.75rem !important;
        margin-right: 0.5rem;
        white-space: nowrap;
        /* Prevent text wrapping */
    }

    .mobile-menu-btn {
        align-self: center;
        /* Ensure hamburger is vertically centered */
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        /* Changed from 100vw to avoid scrollbar overlap */
        height: 100%;
        /* Changed from 100vh */
        background: rgba(2, 6, 23, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 2rem;
        gap: 2.5rem;
        z-index: 1000;
        margin: 0;
    }

    .nav-links.active {
        display: flex;
    }

    .logo-container {
        z-index: 1002;
        position: relative;
    }

    .logo {
        font-size: 1.5rem;
    }

    /* Hero */
    .hero {
        /* Correct class name */
        padding: 5rem 0 3rem;
        /* Remove side padding */
        min-height: auto;
        overflow: hidden;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }

    .hero-content {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        padding: 0 1.5rem;
        /* Internal padding */
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        box-sizing: border-box;
    }

    .hero-features {
        /* Correct class name for badges container */
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
        margin-bottom: 1rem;
    }

    .feature-pill {
        /* Correct class name for badge */
        font-size: 0.75rem;
        white-space: normal;
        text-align: center;
        padding: 0.4rem 0.8rem;
        max-width: 100%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .hero-title {
        font-size: 1.8rem !important;
        line-height: 1.2;
        margin: 1rem auto;
        word-wrap: break-word;
        width: 100%;
        max-width: 320px;
        text-align: center;
        padding: 0;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        padding: 0;
        width: 100%;
        max-width: 320px;
        margin: 0 auto 2rem;
        text-align: center;
        line-height: 1.5;
        border: none;
        /* Remove border if present */
    }

    .hero-graphic {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 1rem;
    }

    #canvas-container {
        width: 100% !important;
        height: 350px !important;
    }

    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    /* About */
    .about-section {
        padding: 4rem 1.5rem;
        /* Safer padding */
        overflow: hidden;
    }

    .about-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 3rem;
    }

    .about-text h2 {
        font-size: 2rem;
        line-height: 1.3;
    }

    .stats-grid {
        display: grid;
        /* Ensure grid */
        grid-template-columns: 1fr;
        gap: 1.5rem;
        width: 100%;
    }

    .values-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.5rem;
        width: 100%;
    }

    /* Contact */
    .contact-section {
        padding: 4rem 1rem;
        /* Reduced padding */
    }

    .contact-container {
        padding: 2rem 1rem;
        margin: 0;
        /* Remove margin */
        width: 100%;
        display: flex;
        /* Switch to flex column */
        flex-direction: column;
        gap: 3rem;
    }

    .contact-title {
        font-size: 2rem;
        word-break: break-word;
    }

    .steps-container {
        padding: 0;
        gap: 3rem;
    }

    .step-icon-large {
        min-width: 50px;
        width: 50px;
        height: 50px;
    }

    .step-icon-large svg {
        width: 24px;
        height: 24px;
    }

    .step-content-large h3 {
        font-size: 1.3rem;
    }

    .step-content-large p {
        font-size: 0.9rem;
    }

    /* Testimonials */
    .testimonials-grid {
        grid-template-columns: 1fr;
    }
}

/* Small Mobile (480px and down) */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .cta-button {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}