/**
 * Skeleton Loader Styles
 * Loading placeholders que imitam a estrutura dos cards de imóveis
 */

/* Skeleton Loader Base */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

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

/* Skeleton Card - Imita estrutura do imovel-card */
.skeleton-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.skeleton-image {
    width: 100%;
    height: 250px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.skeleton-content {
    padding: 1.5rem;
}

.skeleton-title {
    height: 24px;
    width: 80%;
    margin-bottom: 1rem;
}

.skeleton-location {
    height: 16px;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.skeleton-info-item {
    height: 16px;
    width: 60px;
}

.skeleton-price {
    height: 28px;
    width: 50%;
    margin-top: 1rem;
}

/* Grid de Skeleton Cards */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

/* Responsivo */
@media (max-width: 768px) {
    .skeleton-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .skeleton-image {
        height: 200px;
    }
}

/* ==========================================
   SKELETON PARA PÁGINA DE DETALHES
   ========================================== */

#imovelSkeleton {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Galeria Principal Skeleton */
.skeleton-gallery-main {
    width: 100%;
    height: 400px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Thumbnails Skeleton */
.skeleton-gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.skeleton-thumb {
    width: 100%;
    height: 80px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* Header Skeleton (Título, badges) */
.skeleton-header {
    margin-bottom: 1.5rem;
}

.skeleton-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.skeleton-badge {
    width: 80px;
    height: 28px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 20px;
}

.skeleton-title-main {
    width: 70%;
    height: 32px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.skeleton-location-text {
    width: 40%;
    height: 20px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* Price Skeleton */
.skeleton-price {
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.skeleton-price-label {
    width: 60px;
    height: 16px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.skeleton-price-value {
    width: 50%;
    height: 36px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* Features Skeleton */
.skeleton-features {
    margin-bottom: 1.5rem;
}

.skeleton-features-title {
    width: 150px;
    height: 24px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.skeleton-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.skeleton-feature-item {
    height: 60px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* Description Skeleton */
.skeleton-description {
    margin-bottom: 1.5rem;
}

.skeleton-description-title {
    width: 120px;
    height: 24px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.skeleton-description-text {
    width: 100%;
    height: 16px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.skeleton-description-text:last-child {
    width: 80%;
}

/* Container do Skeleton (Grid Principal) */
.skeleton-info-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
}

/* Sidebar Skeleton (Contato) */
.skeleton-sidebar {
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
}

.skeleton-sidebar-title {
    width: 120px;
    height: 24px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.skeleton-button {
    width: 100%;
    height: 48px;
    background: linear-gradient(
        90deg,
        #e0e0e0 0%,
        #f0f0f0 20%,
        #e0e0e0 40%,
        #e0e0e0 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

/* Transição suave quando conteúdo real aparecer */
.content-fade-in {
    animation: contentFadeIn 0.5s ease-in;
}

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

/* Responsivo para Skeleton de Detalhes - Tablet */
@media (max-width: 1024px) {
    .skeleton-info-container {
        grid-template-columns: 1fr;
    }
}

/* Responsivo para Skeleton de Detalhes - Mobile */
@media (max-width: 768px) {
    .skeleton-gallery-main {
        height: 250px;
        border-radius: 0;
    }
    
    .skeleton-gallery-thumbs {
        display: flex;
        overflow-x: auto;
        grid-template-columns: none;
    }
    
    .skeleton-thumb {
        flex: 0 0 80px;
        height: 80px;
    }
    
    .skeleton-features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Layout mobile: uma coluna */
    .skeleton-info-container {
        grid-template-columns: 1fr;
        gap: var(--espacamento-sm, 1rem);
    }
}

@media (max-width: 480px) {
    .skeleton-gallery-main {
        height: 220px;
    }
    
    .skeleton-thumb {
        flex: 0 0 70px;
        height: 70px;
    }
    
    .skeleton-title-main {
        width: 90%;
    }
    
    .skeleton-location-text {
        width: 60%;
    }
}

/* ==========================================
   IMG LOADING SKELETON — shimmer em imagens individuais
   ========================================== */

/* Wrapper mostra shimmer enquanto imagem carrega */
.img-loading {
    background: linear-gradient(90deg, #ececec 25%, #e0e0e0 50%, #ececec 75%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* Imagem invisível enquanto wrapper mostra skeleton */
.img-loading img {
    opacity: 0;
    transition: opacity 0.35s ease;
}

/* Fade-in suave quando imagem termina de carregar */
img.img-loaded {
    opacity: 1 !important;
    transition: opacity 0.35s ease;
}

/* Wrapper do card de imóvel na tela inicial */
.imovel-card-imagem-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    /* Sem height fixo: herda da .imovel-card-imagem, que é responsiva */
}

/* Garantir que botão WhatsApp não seja afetado pelo skeleton */
#imovelSkeleton ~ .whatsapp-float,
.whatsapp-float {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    max-width: 60px !important;
    max-height: 60px !important;
    flex-shrink: 0 !important;
}

@media (max-width: 768px) {
    #imovelSkeleton ~ .whatsapp-float,
    .whatsapp-float {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        min-height: 56px !important;
        max-width: 56px !important;
        max-height: 56px !important;
    }
}

