/* --- MELHORIAS DE RESPONSIVIDADE PARA TELAS PEQUENAS --- */

/* --- TYPOGRAPHY & SPACING SYSTEM --- */

/* Base typography improvements */
@media (max-width: 992px) {
    body {
        font-size: 16px;
        line-height: 1.6;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    h1, h2, h3, h4, h5, h6 {
        font-weight: 600;
        letter-spacing: -0.02em;
        margin-bottom: 0.5em;
    }

    h1 { font-size: 2.25rem; line-height: 1.1; }
    h2 { font-size: 1.875rem; line-height: 1.2; }
    h3 { font-size: 1.5rem; line-height: 1.3; }
    h4 { font-size: 1.25rem; line-height: 1.4; }
    h5 { font-size: 1.125rem; line-height: 1.4; }
    h6 { font-size: 1rem; line-height: 1.5; }

    p {
        font-size: 1rem;
        line-height: 1.7;
        margin-bottom: 1rem;
    }

    /* Improved spacing system */
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    section {
        padding: 60px 0;
    }

    .section-title {
        margin-bottom: 40px;
        text-align: center;
    }

    .section-title h2 {
        margin-bottom: 16px;
    }

    .section-title p {
        font-size: 1.1rem;
        max-width: 600px;
        margin: 0 auto;
    }
}

/* --- TOUCH TARGET OPTIMIZATIONS --- */

/* Base touch target improvements for all interactive elements */
@media (hover: none) and (pointer: coarse) {
    /* CTA Buttons - Touch optimized */
    .cta-button {
        min-height: 48px !important;
        min-width: 120px !important;
        padding: 16px 32px !important;
        font-size: 1.0rem !important;
        line-height: 1.2 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative !important;
    }

    .cta-button::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease;
        pointer-events: none;
    }

    .cta-button:active::before {
        width: 100%;
        height: 100%;
    }

    .cta-button--small {
        min-height: 44px !important;
        min-width: 100px !important;
        padding: 12px 24px !important;
        font-size: 0.9rem !important;
    }

    /* WhatsApp Button - Enhanced touch target */
    .ai-whatsapp-button {
        width: 64px !important;
        height: 64px !important;
        position: relative !important;
    }

    .ai-whatsapp-button::after {
        content: '';
        position: absolute;
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
        border-radius: 50%;
        background: transparent;
        transition: background-color 0.2s ease;
        pointer-events: none;
    }

    .ai-whatsapp-button:active::after {
        background: rgba(37, 211, 102, 0.2);
    }

    /* Navigation links - Touch friendly */
    .nav-links a {
        min-height: 48px !important;
        padding: 16px 20px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Form elements - Touch optimized */
    .form-control {
        min-height: 48px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px 16px !important;
        border-width: 2px !important;
    }

    /* Modal close button */
    .modal-close {
        width: 48px !important;
        height: 48px !important;
        font-size: 24px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Footer links */
    .footer-links ul a {
        min-height: 44px !important;
        padding: 12px 8px !important;
        display: flex !important;
        align-items: center !important;
    }

    /* Service card links */
    .service-card .cta-button {
        width: 100% !important;
        margin-top: 20px !important;
    }
}

/* Tablets (768px - 992px) */

/* Tablets (768px - 992px) */
@media (max-width: 992px) and (min-width: 769px) {
    .hero {
        padding-top: calc(var(--header-height) + 60px);
    }

    .hero-content {
        gap: 40px;
    }

    .hero-text h1 {
        font-size: 2.2rem;
        line-height: 1.3;
        margin-bottom: 20px;
    }

    .hero-text p {
        font-size: 1.15rem;
        margin-bottom: 25px;
    }

    .hero-img {
        max-width: 420px;
    }

    /* Touch targets for tablets */
    .cta-button {
        min-height: 48px;
        padding: 14px 28px;
        font-size: 0.95rem;
    }

    .cta-button--small {
        min-height: 44px;
        padding: 12px 24px;
    }

    .ai-whatsapp-button {
        width: 62px;
        height: 62px;
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }

    .service-card {
        padding: 35px;
    }

    .about-content {
        gap: 40px;
    }
}

/* Mobile Grande (481px - 768px) */
@media (max-width: 768px) and (min-width: 481px) {
    .hero {
        padding-top: calc(var(--header-height) + 50px);
    }

    .hero-content {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }

    .hero-text {
        order: 1;
    }

    .hero-image {
        order: 2;
    }

    .hero-text h1 {
        font-size: 1.9rem;
        line-height: 1.25;
        margin-bottom: 18px;
        letter-spacing: -0.5px;
    }

    .hero-text p {
        font-size: 1.1rem;
        margin-bottom: 25px;
        line-height: 1.5;
    }

    .hero-img {
        max-width: 100%;
        width: 100%;
        max-width: 350px;
    }

    /* Touch targets for large mobile */
    .cta-button {
        min-height: 52px;
        padding: 16px 32px;
        font-size: 1.0rem;
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }

    .cta-button--small {
        min-height: 48px;
        padding: 14px 28px;
        font-size: 0.95rem;
    }

    .ai-whatsapp-button {
        width: 64px;
        height: 64px;
        font-size: 1.9rem;
    }

    .section-title h2 {
        font-size: 2.0rem;
    }

    section {
        padding: 50px 0;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .service-card {
        padding: 30px;
        text-align: center;
    }

    .contact-container {
        gap: 35px;
        padding: 35px;
    }

    .footer-content {
        gap: 25px;
    }
}

/* Mobile Pequeno (até 480px) */
@media (max-width: 480px) {
    :root {
        --header-height: 65px;
    }

    .container {
        padding: 0 15px;
    }

    section {
        padding: 40px 0;
    }

    /* --- HERO SECTION MOBILE OPTIMIZATIONS --- */
    .hero {
        padding-top: calc(var(--header-height) + 50px);
        background: linear-gradient(135deg, var(--gray-color) 0%, #f8f9fa 100%);
        min-height: auto;
        padding-bottom: 40px;
    }

    .hero-content {
        flex-direction: column;
        text-align: center;
        gap: 25px;
        align-items: center;
    }

    .hero-text {
        flex: none;
        width: 100%;
        max-width: 100%;
    }

    .hero-text h1 {
        font-size: 1.5rem;
        line-height: 1.2;
        letter-spacing: -0.3px;
        margin-bottom: 15px;
        font-weight: 700;
        color: var(--secondary-color);
        text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }

    .hero-text .highlight {
        background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        font-weight: 800;
    }

    .hero-text p {
        font-size: 1.0rem;
        line-height: 1.5;
        margin-bottom: 20px;
        color: var(--text-color);
        opacity: 0.9;
        max-width: 100%;
    }

    .hero-image {
        flex: none;
        width: 100%;
        max-width: 280px;
        order: -1; /* Imagem aparece primeiro em mobile */
    }

    .hero-img {
        width: 100%;
        max-width: 280px;
        height: auto;
        border-radius: 12px;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        transition: transform 0.3s ease;
    }

    .hero-img:hover {
        transform: translateY(-2px);
    }

    /* CTA Button Mobile Optimization */
    .hero .cta-button {
        width: 100%;
        max-width: 280px;
        padding: 16px 24px;
        font-size: 1.0rem;
        font-weight: 600;
        margin: 0 auto;
        display: block;
        box-shadow: 0 6px 20px rgba(0, 159, 253, 0.4);
    }

    .hero .cta-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(0, 159, 253, 0.6);
    }

    /* --- END HERO SECTION MOBILE OPTIMIZATIONS --- */

    .section-title {
        margin-bottom: 50px;
    }

    .section-title h2 {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }

    .section-title p {
        font-size: 1.0rem;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .service-card {
        padding: 25px 20px;
        text-align: center;
    }

    .service-icon {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }

    .service-card h3 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }

    .about-content {
        gap: 30px;
    }

    .contact-container {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 25px;
    }

    .contact-info h2 {
        font-size: 1.6rem;
    }

    .contact-detail {
        margin-bottom: 20px;
    }

    .form-control {
        font-size: 16px; /* Previne zoom no iOS */
        padding: 14px;
    }

    .cta-button {
        padding: 14px 30px;
        min-height: 48px; /* Touch target mínimo */
        font-size: 0.95rem;
    }

    .cta-button--small {
        padding: 12px 25px;
        min-height: 44px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }

    .footer-links h3 {
        margin-bottom: 15px;
    }

    .footer-links ul li {
        margin-bottom: 12px;
        justify-content: center;
    }

    .whatsapp-container {
        bottom: 20px;
        right: 20px;
    }

    .ai-whatsapp-button {
        width: 56px;
        height: 56px;
        font-size: 1.8rem;
    }

    .whatsapp-text {
        font-size: 0.85rem;
        padding: 6px 10px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
        margin: 20px auto;
    }

    .modal-gallery {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .modal-gallery img {
        height: 150px;
    }
}

/* Orientação Landscape para Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding-top: calc(var(--header-height) + 30px);
        padding-bottom: 30px;
        min-height: 100vh;
        display: flex;
        align-items: center;
    }

    .hero-content {
        flex-direction: row;
        align-items: center;
        gap: 20px;
        max-width: 100%;
    }

    .hero-text {
        flex: 1.2;
        text-align: left;
    }

    .hero-text h1 {
        font-size: 1.4rem;
        line-height: 1.2;
        margin-bottom: 12px;
    }

    .hero-text p {
        font-size: 0.95rem;
        margin-bottom: 15px;
        line-height: 1.4;
    }

    .hero-image {
        flex: 1;
        max-width: 200px;
    }

    .hero-img {
        max-width: 180px;
        height: auto;
    }

    .hero .cta-button {
        width: auto;
        max-width: 200px;
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    /* Touch targets for landscape */
    .cta-button {
        min-height: 48px;
        padding: 14px 24px;
    }

    .ai-whatsapp-button {
        width: 58px;
        height: 58px;
        font-size: 1.7rem;
    }

    section {
        padding: 30px 0;
    }

    .section-title h2 {
        font-size: 1.6rem;
    }

    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
    }

    .service-card {
        padding: 20px;
    }

    .whatsapp-container {
        bottom: 15px;
        right: 15px;
    }

    .hero .cta-button {
        width: auto;
        max-width: 200px;
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    /* Touch targets for landscape */
    .cta-button {
        min-height: 48px;
        padding: 14px 24px;
    }

    .ai-whatsapp-button {
        width: 58px;
        height: 58px;
        font-size: 1.7rem;
    }

    section {
        padding: 30px 0;
    }

    .section-title h2 {
        font-size: 1.6rem;
    }

    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
    }

    .service-card {
        padding: 20px;
    }

    .whatsapp-container {
        bottom: 15px;
        right: 15px;
    }

    .ai-whatsapp-button {
        width: 50px;
        height: 50px;
        font-size: 1.6rem;
    }
}

/* --- TOUCH TARGET ENHANCED STYLES --- */

/* Enhanced touch feedback for all interactive elements */
@media (hover: none) and (pointer: coarse) {
    /* General link improvements */
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 8px 4px;
        position: relative;
    }

    /* Enhanced button feedback */
    button,
    .cta-button,
    .ai-whatsapp-button,
    .modal-close {
        position: relative;
        overflow: hidden;
    }

    button:active,
    .cta-button:active,
    .ai-whatsapp-button:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    /* Ripple effect for buttons */
    .cta-button::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.4);
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease;
        pointer-events: none;
        z-index: 0;
    }

    .cta-button:active::before {
        width: 120%;
        height: 120%;
    }

    .cta-button span,
    .cta-button i {
        position: relative;
        z-index: 1;
    }

    /* Form submit button specific */
    input[type="submit"],
    button[type="submit"] {
        min-height: 48px !important;
        font-size: 16px !important;
        padding: 12px 24px !important;
    }

    /* Select and input improvements */
    select,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea {
        min-height: 48px !important;
        font-size: 16px !important;
        padding: 12px 16px !important;
        border-radius: 8px !important;
    }

    /* Checkbox and radio improvements */
    input[type="checkbox"],
    input[type="radio"] {
        width: 24px !important;
        height: 24px !important;
        margin-right: 12px !important;
    }

    /* Label associations for better touch */
    label {
        min-height: 44px;
        display: flex;
        align-items: center;
        cursor: pointer;
        padding: 8px 0;
    }
}

/* --- END TOUCH TARGET ENHANCED STYLES --- */

/* --- ADVANCED TYPOGRAPHY & SPACING IMPROVEMENTS --- */

/* Improved readability for all screen sizes */
@media (max-width: 1200px) {
    /* Better text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }

    /* Consistent heading hierarchy */
    h1, h2, h3, h4, h5, h6 {
        font-feature-settings: "kern" 1, "liga" 1;
        text-rendering: optimizeLegibility;
    }

    /* Improved paragraph spacing */
    p + p {
        margin-top: 0.5rem;
    }

    /* Better list spacing */
    ul, ol {
        padding-left: 1.2rem;
    }

    li {
        margin-bottom: 0.5rem;
    }

    /* Consistent link spacing */
    a {
        text-decoration-thickness: 1px;
        text-underline-offset: 2px;
    }
}

/* Enhanced spacing for better visual hierarchy */
@media (max-width: 768px) {
    /* Micro-spacing improvements */
    .section-title + * {
        margin-top: 2rem;
    }

    .service-card + .service-card {
        margin-top: 1.5rem;
    }

    /* Better content flow */
    .hero + section {
        padding-top: 3rem;
    }

    section + section {
        padding-top: 4rem;
    }

    /* Improved form spacing */
    .form-group + .form-group {
        margin-top: 1.25rem;
    }

    /* Better button spacing */
    .cta-button + .cta-button {
        margin-top: 1rem;
    }
}

/* Fine-tuned spacing for small screens */
@media (max-width: 480px) {
    /* Compact but readable spacing */
    .section-title + * {
        margin-top: 1.5rem;
    }

    .service-card + .service-card {
        margin-top: 1.25rem;
    }

    section + section {
        padding-top: 3rem;
    }

    /* Optimized form spacing */
    .form-group + .form-group {
        margin-top: 1rem;
    }

    /* Better mobile navigation spacing */
    .nav-links a {
        margin-bottom: 0.75rem;
    }

    /* Improved footer spacing */
    .footer-links + .footer-links {
        margin-top: 2rem;
    }
}

/* --- CONTEXT-AWARE TYPOGRAPHY --- */

/* Better typography for different content types */
@media (max-width: 768px) {
    /* Hero section specific typography */
    .hero-text h1 {
        font-weight: 700;
        letter-spacing: -0.02em;
    }

    .hero-text p {
        font-weight: 400;
        letter-spacing: 0.01em;
    }

    /* Service cards typography */
    .service-card h3 {
        font-weight: 600;
        letter-spacing: -0.01em;
    }

    .service-card p {
        font-weight: 400;
        letter-spacing: 0.005em;
    }

    /* Form typography */
    .form-control {
        font-weight: 400;
        letter-spacing: 0.01em;
    }

    label {
        font-weight: 500;
        letter-spacing: 0.005em;
    }

    /* Footer typography */
    .footer-about p {
        font-weight: 400;
        letter-spacing: 0.01em;
    }

    .footer-links a {
        font-weight: 400;
        letter-spacing: 0.005em;
    }
}

/* Enhanced readability in low-light conditions */
@media (prefers-color-scheme: dark) {
    /* Note: This would need dark mode implementation */
    /* For now, ensuring good contrast in light mode */
}

/* Improved typography for users who prefer larger text */
@media (prefers-reduced-motion: no-preference) {
    /* Smooth font transitions */
    h1, h2, h3, h4, h5, h6, p {
        transition: font-size 0.3s ease, line-height 0.3s ease;
    }
}

/* Better spacing for CJK languages (if needed) */
:lang(ja), :lang(ko), :lang(zh) {
    /* Specific adjustments for CJK typography */
    h1, h2, h3 {
        line-height: 1.4;
    }

    p {
        line-height: 1.8;
    }
}

/* --- HERO SECTION ENHANCED MOBILE STYLES --- */

/* Extra small mobile optimization (320px - 480px) */
@media (max-width: 480px) and (min-width: 320px) {
    .hero {
        position: relative;
        overflow: hidden;
    }

    .hero::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: radial-gradient(circle at 30% 20%, rgba(0, 159, 253, 0.05) 0%, transparent 50%),
                    radial-gradient(circle at 70% 80%, rgba(42, 42, 114, 0.05) 0%, transparent 50%);
        pointer-events: none;
    }

    .hero-content {
        position: relative;
        z-index: 1;
    }

    .hero-text h1 {
        animation: fadeInUp 0.8s ease-out;
    }

    .hero-text p {
        animation: fadeInUp 0.8s ease-out 0.2s both;
    }

    .hero-img {
        animation: fadeInScale 0.8s ease-out 0.4s both;
    }

    .hero .cta-button {
        animation: fadeInUp 0.8s ease-out 0.6s both;
    }
}

/* Animation keyframes for mobile hero */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Touch-friendly interactions for mobile */
@media (hover: none) and (pointer: coarse) {
    .hero-img {
        transition: transform 0.2s ease;
    }

    .hero-img:active {
        transform: scale(0.98);
    }

    .hero .cta-button:active {
        transform: scale(0.98);
        box-shadow: 0 4px 15px rgba(0, 159, 253, 0.5);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hero {
        background-color: var(--white-color);
        border-bottom: 2px solid var(--secondary-color);
    }

    .hero-text h1 {
        color: var(--dark-color);
    }

    .hero-text .highlight {
        color: var(--dark-color);
        font-weight: 900;
        text-decoration: underline;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .hero-text h1,
    .hero-text p,
    .hero-img,
    .hero .cta-button {
        animation: none;
    }

    .hero-img,
    .hero .cta-button {
        transition: none;
    }
}