/* Arquivo complementar de performance e otimizações adicionais */

/* Otimizações críticas de performance */
.hero-background,
.hero-shape {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Loading states e skeleton screens */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Estados de erro e sucesso para formulários */
.form-success {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.form-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Melhorias para acessibilidade */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible melhorado */
.btn:focus-visible,
.nav-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(212, 165, 116, 0.2);
}

/* Estados de hover melhorados para touch devices */
@media (hover: hover) {
    .benefit-card:hover {
        transform: translateY(-10px);
    }
    
    .feature-category:hover {
        transform: translateY(-5px);
    }
    
    .pricing-card:hover {
        transform: translateY(-5px);
    }
}

/* Otimizações para high DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-mockup {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Melhorias para modo escuro (se o sistema suportar) */
@media (prefers-color-scheme: dark) {
    :root {
        --white: #1a1a1a;
        --gray-light: #2d2d2d;
        --dark: #ffffff;
    }
    
    .mockup-screen {
        background: var(--dark-light);
        color: var(--white);
    }
    
    .mockup-header {
        background: var(--dark);
        border-bottom-color: #444;
    }
    
    .mini-stat {
        background: var(--dark);
    }
    
    .calendar-day {
        background: var(--dark);
        border-left-color: #444;
    }
    
    .calendar-day.active {
        background: rgba(212, 165, 116, 0.2);
    }
}

/* Melhorias para motion reduzido */
@media (prefers-reduced-motion: reduce) {
    .hero-shape {
        animation: none;
    }
    
    .float {
        animation: none;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Otimizações para telas pequenas */
@media (max-width: 375px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        min-width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 16px;
    }
    
    .contact-methods {
        gap: 24px;
    }
    
    .contact-method {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
}

/* Melhorias para tablets em landscape */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .hero-container {
        padding: 80px 20px 40px;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .mockup-screen {
        width: 350px;
        height: 450px;
    }
}

/* Otimizações para impressão */
@media print {
    .hero-background,
    .hero-shape,
    .back-to-top,
    .nav-toggle,
    .social-links,
    .btn,
    .contact-form {
        display: none !important;
    }
    
    .hero {
        background: white !important;
        color: black !important;
        min-height: auto;
        padding: 20px 0;
    }
    
    .hero-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }
    
    .section-title,
    .hero-title {
        color: black !important;
        page-break-after: avoid;
    }
    
    .feature-category,
    .benefit-card,
    .pricing-card {
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
}

/* Estados de carregamento para imagens */
img {
    transition: opacity 0.3s ease;
}

img[data-src] {
    opacity: 0;
}

img[data-src].loaded {
    opacity: 1;
}

/* Melhorias de performance para animações */
.hero-mockup,
.benefit-icon,
.feature-category,
.pricing-card {
    will-change: auto;
}

.hero-mockup:hover,
.benefit-card:hover,
.feature-category:hover,
.pricing-card:hover {
    will-change: transform;
}

/* Otimizações para conexões lentas */
@media (prefers-reduced-data: reduce) {
    .hero-background,
    .hero-shape {
        display: none;
    }
    
    .benefit-icon {
        background: var(--primary-color);
    }
    
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Melhorias para teclado de navegação */
.nav-link:focus,
.btn:focus {
    z-index: 10;
}

/* Skip links para acessibilidade */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* Indicadores de carregamento */
.loading-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Melhorias para contraste */
@media (prefers-contrast: high) {
    .btn-secondary {
        border-width: 3px;
    }
    
    .nav-link::after {
        height: 3px;
    }
    
    .feature-item i,
    .benefit-icon,
    .nav-logo i {
        filter: contrast(1.2);
    }
}

/* Otimizações finais de GPU */
.hero-image,
.mockup-screen,
.benefit-icon,
.pricing-badge {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Estados de conexão offline */
.offline-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #dc3545;
    color: white;
    padding: 12px 24px;
    border-radius: 20px;
    z-index: 10000;
    font-size: 0.9rem;
    display: none;
}

.offline-indicator.visible {
    display: block;
    animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}