/* Otimizações específicas para dispositivos móveis e performance */

/* Otimizações de performance */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input, textarea, select {
    -webkit-user-select: text;
    -khtml-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Otimização de imagens */
img {
    max-width: 100%;
    height: auto;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
    -ms-interpolation-mode: bicubic;
}

/* Lazy loading placeholder */
.img-placeholder {
    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; }
}

/* Melhorias específicas para mobile */
@media (max-width: 768px) {
    /* Aumentar área de toque para elementos interativos */
    .btn, .nav-link, .social-link {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Otimizar formulários para mobile */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Previne zoom no iOS */
        padding: 15px;
        border-radius: 8px;
    }

    /* Melhorar legibilidade */
    body {
        font-size: 16px;
        line-height: 1.6;
    }

    h1 { font-size: 2.2rem; }
    h2 { font-size: 1.8rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.3rem; }

    /* Otimizar espaçamentos */
    .section {
        padding: 50px 0;
    }

    .container {
        padding: 0 20px;
    }

    /* Menu mobile otimizado */
    .nav-menu {
        padding: 30px 0;
        gap: 0;
    }

    .nav-menu li {
        border-bottom: 1px solid var(--border-color);
        width: 100%;
    }

    .nav-menu li:last-child {
        border-bottom: none;
    }

    .nav-link {
        padding: 15px 20px;
        width: 100%;
        text-align: left;
        border-radius: 0;
    }

    /* Hero section mobile */
    .hero {
        height: 70vh;
        min-height: 500px;
    }

    .hero-content {
        padding: 0 30px;
    }

    /* Cards responsivos */
    .apartamento-card {
        margin-bottom: 20px;
        transform: none !important;
    }

    .apartamento-card:hover {
        transform: translateY(-5px) !important;
    }

    /* Tabela responsiva */
    .precos-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .precos-table {
        min-width: 600px;
    }

    /* Modal mobile */
    .modal-content {
        margin: 20px;
        max-height: 90vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Galeria de imagens otimizada */
    .lazer-grid {
        gap: 15px;
    }

    .lazer-item {
        height: 250px;
    }

    /* Formulário de contato mobile */
    .contato-content {
        gap: 30px;
    }

    .form-group {
        margin-bottom: 25px;
    }

    /* Footer mobile */
    .footer-content {
        text-align: center;
        gap: 30px;
    }

    .footer-links {
        flex-direction: column;
        gap: 15px;
    }

    /* Notificações mobile */
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
        top: 80px;
    }
}

/* Otimizações para tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 0 30px;
    }

    .apartamentos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .empreendimento-content,
    .localizacao-content,
    .contato-content {
        gap: 40px;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Otimizações para telas pequenas (smartphones pequenos) */
@media (max-width: 480px) {
    .hero-title {
        font-size: 1.8rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        width: 100%;
        max-width: 280px;
    }

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

    .section-subtitle {
        font-size: 1rem;
    }

    .apartamento-card .card-content {
        padding: 20px 15px;
    }

    .price {
        font-size: 1.1rem;
    }

    .features-list {
        font-size: 0.9rem;
    }

    .modal-content {
        margin: 10px;
        padding: 20px 15px;
    }

    .modal-apartment-info {
        gap: 20px;
    }

    .precos-table th,
    .precos-table td {
        padding: 8px 6px;
        font-size: 0.75rem;
    }

    .info-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .ponto-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding: 20px 15px;
    }
}

/* Otimizações para landscape em mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        height: 100vh;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .section {
        padding: 40px 0;
    }
}

/* Otimizações de performance para animações */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Melhorias de acessibilidade */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #2d4a08;
        --text-light: #444444;
        --border-color: #cccccc;
    }

    .btn-primary {
        border: 2px solid var(--primary-color);
    }

    .apartamento-card {
        border: 1px solid var(--border-color);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --white: #1a1a1a;
        --light-gray: #2d2d2d;
        --text-dark: #ffffff;
        --text-light: #cccccc;
        --border-color: #444444;
        --accent-color: #3a3a3a;
    }

    .header {
        background: rgba(26, 26, 26, 0.95);
    }

    .apartamento-card,
    .feature-item,
    .ponto-item {
        background: var(--light-gray);
        border: 1px solid var(--border-color);
    }

    .precos-table {
        background: var(--light-gray);
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        background: var(--light-gray);
        color: var(--text-dark);
        border-color: var(--border-color);
    }
}

/* Otimizações para impressão */
@media print {
    .header,
    .nav-toggle,
    .btn,
    .modal,
    .notification {
        display: none !important;
    }

    .hero {
        height: auto;
        page-break-after: always;
    }

    .section {
        page-break-inside: avoid;
        padding: 20px 0;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
        color: black;
        background: white;
    }

    .apartamento-card,
    .feature-item {
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .precos-table {
        font-size: 10pt;
    }
}

/* Otimizações de loading */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--border-radius);
}

.loading-skeleton.text {
    height: 1em;
    margin-bottom: 0.5em;
}

.loading-skeleton.title {
    height: 2em;
    width: 60%;
    margin-bottom: 1em;
}

.loading-skeleton.image {
    height: 200px;
    width: 100%;
}

/* Otimizações de scroll */
.smooth-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Melhorias de performance para GPU */
.hero-image,
.apartamento-card,
.lazer-item {
    transform: translateZ(0);
    will-change: transform;
}

/* Otimizações de fonte */
@font-display: swap;

/* Preload crítico */
.critical-resource {
    font-display: swap;
    loading: eager;
}

/* Otimizações de imagem responsiva */
.responsive-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center;
}

@media (max-width: 480px) {
    .responsive-image {
        object-position: center top;
    }
}

/* Melhorias de UX para touch */
.touch-friendly {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.touch-friendly:active {
    transform: scale(0.98);
}

/* Otimizações de performance para CSS Grid */
.grid-container {
    contain: layout style;
}

/* Melhorias de acessibilidade para foco */
.focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Otimizações para conexões lentas */
@media (max-width: 768px) and (prefers-reduced-data: reduce) {
    .hero-image img {
        content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="400" height="300"><rect width="100%" height="100%" fill="%23f0f0f0"/><text x="50%" y="50%" text-anchor="middle" fill="%23999">Imagem</text></svg>');
    }
    
    .lazer-item img {
        display: none;
    }
    
    .amenity-placeholder {
        display: flex;
    }
}
